HelenOS sources
This source file includes following definitions.
- PCUT_TEST
- PCUT_TEST
- test_write_data_16
- test_read_data_16
- test_write_cmd_8
- test_read_cmd_8
- test_write_ctl_8
- test_read_ctl_8
- test_irq_enable
- test_irq_disable
- test_dma_chan_setup
- test_dma_chan_teardown
- test_add_device
- test_remove_device
- test_msg_note
- test_msg_error
- test_msg_warn
- test_msg_debug
#include <ata/ata.h>
#include <errno.h>
#include <pcut/pcut.h>
PCUT_INIT;
PCUT_TEST_SUITE(ata);
static void test_write_data_16(void *, uint16_t *, size_t);
static void test_read_data_16(void *, uint16_t *, size_t);
static void test_write_cmd_8(void *, uint16_t, uint8_t);
static uint8_t test_read_cmd_8(void *, uint16_t);
static void test_write_ctl_8(void *, uint16_t, uint8_t);
static uint8_t test_read_ctl_8(void *, uint16_t);
static errno_t test_irq_enable(void *);
static errno_t test_irq_disable(void *);
static void test_dma_chan_setup(void *, void *, size_t, ata_dma_dir_t);
static void test_dma_chan_teardown(void *);
static errno_t test_add_device(void *, unsigned, void *);
static errno_t test_remove_device(void *, unsigned);
static void test_msg_note(void *, char *);
static void test_msg_error(void *, char *);
static void test_msg_warn(void *, char *);
static void test_msg_debug(void *, char *);
PCUT_TEST(channel_create_destroy)
{
ata_params_t params;
ata_channel_t *chan;
errno_t rc;
memset(¶ms, 0, sizeof(params));
params.write_data_16 = test_write_data_16;
params.read_data_16 = test_read_data_16;
params.write_cmd_8 = test_write_cmd_8;
params.read_cmd_8 = test_read_cmd_8;
params.write_ctl_8 = test_write_ctl_8;
params.read_ctl_8 = test_read_ctl_8;
params.irq_enable = test_irq_enable;
params.irq_disable = test_irq_disable;
params.dma_chan_setup = test_dma_chan_setup;
params.dma_chan_teardown = test_dma_chan_teardown;
params.add_device = test_add_device;
params.remove_device = test_remove_device;
params.msg_note = test_msg_note;
params.msg_error = test_msg_error;
params.msg_warn = test_msg_warn;
params.msg_debug = test_msg_debug;
chan = NULL;
rc = ata_channel_create(¶ms, &chan);
PCUT_ASSERT_ERRNO_VAL(EOK, rc);
ata_channel_destroy(chan);
}
PCUT_TEST(channel_initialize)
{
ata_params_t params;
ata_channel_t *chan;
errno_t rc;
memset(¶ms, 0, sizeof(params));
params.write_data_16 = test_write_data_16;
params.read_data_16 = test_read_data_16;
params.write_cmd_8 = test_write_cmd_8;
params.read_cmd_8 = test_read_cmd_8;
params.write_ctl_8 = test_write_ctl_8;
params.read_ctl_8 = test_read_ctl_8;
params.irq_enable = test_irq_enable;
params.irq_disable = test_irq_disable;
params.dma_chan_setup = test_dma_chan_setup;
params.dma_chan_teardown = test_dma_chan_teardown;
params.add_device = test_add_device;
params.remove_device = test_remove_device;
params.msg_note = test_msg_note;
params.msg_error = test_msg_error;
params.msg_warn = test_msg_warn;
params.msg_debug = test_msg_debug;
chan = NULL;
rc = ata_channel_create(¶ms, &chan);
PCUT_ASSERT_ERRNO_VAL(EOK, rc);
rc = ata_channel_initialize(chan);
PCUT_ASSERT_ERRNO_VAL(EOK, rc);
ata_channel_destroy(chan);
}
static void test_write_data_16(void *arg, uint16_t *data, size_t nwords)
{
(void)arg;
(void)data;
(void)nwords;
}
static void test_read_data_16(void *arg, uint16_t *buf, size_t nwords)
{
(void)arg;
(void)buf;
(void)nwords;
}
static void test_write_cmd_8(void *arg, uint16_t off, uint8_t value)
{
(void)arg;
(void)off;
(void)value;
}
static uint8_t test_read_cmd_8(void *arg, uint16_t off)
{
(void)arg;
if (off == REG_STATUS) {
return SR_DRQ;
}
return 0;
}
static void test_write_ctl_8(void *arg, uint16_t off, uint8_t value)
{
(void)arg;
(void)off;
(void)value;
}
static uint8_t test_read_ctl_8(void *arg, uint16_t off)
{
(void)arg;
(void)off;
return 0;
}
static errno_t test_irq_enable(void *arg)
{
(void)arg;
return EOK;
}
static errno_t test_irq_disable(void *arg)
{
(void)arg;
return EOK;
}
static void test_dma_chan_setup(void *arg, void *buf, size_t buf_size,
ata_dma_dir_t dir)
{
(void)arg;
(void)buf;
(void)buf_size;
(void)dir;
}
static void test_dma_chan_teardown(void *arg)
{
(void)arg;
}
static errno_t test_add_device(void *arg, unsigned idx, void *charg)
{
(void)arg;
(void)idx;
(void)charg;
return EOK;
}
static errno_t test_remove_device(void *arg, unsigned idx)
{
(void)arg;
(void)idx;
return EOK;
}
static void test_msg_note(void *arg, char *msg)
{
(void)arg;
(void)msg;
}
static void test_msg_error(void *arg, char *msg)
{
(void)arg;
(void)msg;
}
static void test_msg_warn(void *arg, char *msg)
{
(void)arg;
(void)msg;
}
static void test_msg_debug(void *arg, char *msg)
{
(void)arg;
(void)msg;
}
PCUT_EXPORT(ata);
HelenOS homepage, sources at GitHub