hw/drivers/io_expander/tca9535/src/tca9535.c
int
tca9535_io_expander_dev_init(struct os_dev *odev, void *arg)
{
    int i;
    struct tca9535_io_expander_dev_cfg *cfg;
    struct io_expander_dev *dev;
    struct io_expander_driver_funcs *iof;

    cfg = (struct tca9535_io_expander_dev_cfg *) arg;

    assert(cfg != NULL);

    dev = (struct io_expander_dev *)odev;
    dev->number_of_pins = 16;

    log_register(odev->od_name, &_log, &log_console_handler, NULL, LOG_SYSLEVEL);

    iof = &dev->iof_funcs;

    iof->iof_init_in = tca9535_init_in;
    iof->iof_init_out = tca9535_init_out;
    iof->iof_pin_dir = tca9535_pin_dir;
    iof->iof_write = tca9535_write_out;
    iof->iof_read = tca9535_read;

    iof->iof_irq_init = tca9535_irq_init;
    iof->iof_irq_release = tca9535_irq_release;
    iof->iof_irq_enable = tca9535_irq_enable;
    iof->iof_irq_disable = tca9535_irq_disable;

    /* Clear interrupt structure */
    for (i=0;i<IO_EXPANDER_MAX_IRQ;i++)
    {
        dev->ioexp_irqs[i].trig = HAL_GPIO_TRIG_NONE;
        dev->ioexp_irqs[i].enabled = 0;
        dev->ioexp_irqs[i].func = 0;
        dev->ioexp_irqs[i].arg = 0;
    }

    return (OS_OK);
}
/**
 * Callback to initialize an io_expander_dev structure from the os device
 * initialization callback.  This sets up a tca9525_io_expander_device(), so
 * that subsequent lookups to this device allow us to manipulate it.
 *
 * @param1 os device ptr
 * @param2 tca9535 io expander device cfg ptr
 * @return OS_OK on success
 */
Callback to initialize an io_expander_dev structure from the os device
initialization callback.  This sets up a tca9525_io_expander_device(), so
that subsequent lookups to this device allow us to manipulate it.

@param1 os device ptr
@param2 tca9535 io expander device cfg ptr
@return OS_OK on success
Callback to initialize an io_expander_dev structure from the os device initialization callback . This sets up a tca9525_io_expander_device () so that subsequent lookups to this device allow us to manipulate it . @param1 os device ptr @param2 tca9535 io expander device cfg ptr @return OS_OK on success
int
tca9535_io_expander_dev_init(struct os_dev *odev, void *arg)
{
    int i;
    struct tca9535_io_expander_dev_cfg *cfg;
    struct io_expander_dev *dev;
    struct io_expander_driver_funcs *iof;
    cfg = (struct tca9535_io_expander_dev_cfg *) arg;
    assert(cfg != NULL);
    dev = (struct io_expander_dev *)odev;
    dev->number_of_pins = 16;
    log_register(odev->od_name, &_log, &log_console_handler, NULL, LOG_SYSLEVEL);
    iof = &dev->iof_funcs;
    iof->iof_init_in = tca9535_init_in;
    iof->iof_init_out = tca9535_init_out;
    iof->iof_pin_dir = tca9535_pin_dir;
    iof->iof_write = tca9535_write_out;
    iof->iof_read = tca9535_read;
    iof->iof_irq_init = tca9535_irq_init;
    iof->iof_irq_release = tca9535_irq_release;
    iof->iof_irq_enable = tca9535_irq_enable;
    iof->iof_irq_disable = tca9535_irq_disable;
    for (i=0;i<IO_EXPANDER_MAX_IRQ;i++)
    {
        dev->ioexp_irqs[i].trig = HAL_GPIO_TRIG_NONE;
        dev->ioexp_irqs[i].enabled = 0;
        dev->ioexp_irqs[i].func = 0;
        dev->ioexp_irqs[i].arg = 0;
    }
    return (OS_OK);
}
int tca9535_io_expander_dev_init ( struct os_dev * odev , void * arg ) { int i ; struct tca9535_io_expander_dev_cfg * cfg ; struct io_expander_dev * dev ; struct io_expander_driver_funcs * iof ; cfg = ( struct tca9535_io_expander_dev_cfg * ) arg ; assert ( cfg != NULL ) ; dev = ( struct io_expander_dev * ) odev ; dev -> number_of_pins = 16 ; log_register ( odev -> od_name , & _log , & log_console_handler , NULL , LOG_SYSLEVEL ) ; iof = & dev -> iof_funcs ; iof -> iof_init_in = tca9535_init_in ; iof -> iof_init_out = tca9535_init_out ; iof -> iof_pin_dir = tca9535_pin_dir ; iof -> iof_write = tca9535_write_out ; iof -> iof_read = tca9535_read ; iof -> iof_irq_init = tca9535_irq_init ; iof -> iof_irq_release = tca9535_irq_release ; iof -> iof_irq_enable = tca9535_irq_enable ; iof -> iof_irq_disable = tca9535_irq_disable ; for ( i = 0 ; i < IO_EXPANDER_MAX_IRQ ; i ++ ) { dev -> ioexp_irqs [ i ] . trig = HAL_GPIO_TRIG_NONE ; dev -> ioexp_irqs [ i ] . enabled = 0 ; dev -> ioexp_irqs [ i ] . func = 0 ; dev -> ioexp_irqs [ i ] . arg = 0 ; } return ( OS_OK ) ; }
Callback to initialize an io_expander_dev structure from the os device
 initialization callback.
Callback to initialize an io_expander_dev structure from the os device initialization callback .
/* Clear interrupt structure */