src/C/devices.c
uint8_t dev_register_gpios(e_device_id dev_id, e_task_id task_id)
{
    uint8_t     ret;

    if (device_tab[dev_id].status == DEV_STATE_REGISTERED) {
        KERNLOG(DBG_ERR, "dev_register_gpios(): status already set as DEV_STATE_REGISTERED\n");
        return 1;
    }

    for (int i = 0; i < device_tab[dev_id].udev.gpio_num; ++i) {
        /* Then we register the GPIO itself */
        ret = gpio_register_gpio
                (task_id, dev_id, &device_tab[dev_id].udev.gpios[i]);
        if (ret) {
            KERNLOG(DBG_ERR, "device GPIO registering failed!\n");
            return ret;
        }

        /* To finish we register possible associated EXTI line */
        ret = exti_register_exti(&device_tab[dev_id].udev.gpios[i]);
        if (ret) {
            KERNLOG(DBG_ERR, "device GPIO-EXTI registering failed!\n");
            return ret;
        }

        KERNLOG(DBG_INFO,
            "registered GPIO port %x, pin %x for device %s\n",
            device_tab[dev_id].udev.gpios[i].kref.port,
            device_tab[dev_id].udev.gpios[i].kref.pin,
            device_tab[dev_id].udev.name);
    }

    return 0;
}
/*
 * This function simply register the GPIO and return a reference handle.
 */
This function simply register the GPIO and return a reference handle.
This function simply register the GPIO and return a reference handle .
uint8_t dev_register_gpios(e_device_id dev_id, e_task_id task_id)
{
    uint8_t     ret;
    if (device_tab[dev_id].status == DEV_STATE_REGISTERED) {
        KERNLOG(DBG_ERR, "dev_register_gpios(): status already set as DEV_STATE_REGISTERED\n");
        return 1;
    }
    for (int i = 0; i < device_tab[dev_id].udev.gpio_num; ++i) {
        ret = gpio_register_gpio
                (task_id, dev_id, &device_tab[dev_id].udev.gpios[i]);
        if (ret) {
            KERNLOG(DBG_ERR, "device GPIO registering failed!\n");
            return ret;
        }
        ret = exti_register_exti(&device_tab[dev_id].udev.gpios[i]);
        if (ret) {
            KERNLOG(DBG_ERR, "device GPIO-EXTI registering failed!\n");
            return ret;
        }
        KERNLOG(DBG_INFO,
            "registered GPIO port %x, pin %x for device %s\n",
            device_tab[dev_id].udev.gpios[i].kref.port,
            device_tab[dev_id].udev.gpios[i].kref.pin,
            device_tab[dev_id].udev.name);
    }
    return 0;
}
uint8_t dev_register_gpios ( e_device_id dev_id , e_task_id task_id ) { uint8_t ret ; if ( device_tab [ dev_id ] . status == DEV_STATE_REGISTERED ) { KERNLOG ( DBG_ERR , " \n " ) ; return 1 ; } for ( int i = 0 ; i < device_tab [ dev_id ] . udev . gpio_num ; ++ i ) { ret = gpio_register_gpio ( task_id , dev_id , & device_tab [ dev_id ] . udev . gpios [ i ] ) ; if ( ret ) { KERNLOG ( DBG_ERR , " \n " ) ; return ret ; } ret = exti_register_exti ( & device_tab [ dev_id ] . udev . gpios [ i ] ) ; if ( ret ) { KERNLOG ( DBG_ERR , " \n " ) ; return ret ; } KERNLOG ( DBG_INFO , " \n " , device_tab [ dev_id ] . udev . gpios [ i ] . kref . port , device_tab [ dev_id ] . udev . gpios [ i ] . kref . pin , device_tab [ dev_id ] . udev . name ) ; } return 0 ; }
This function simply register the GPIO and return a reference handle.
This function simply register the GPIO and return a reference handle .
/* Then we register the GPIO itself */ /* To finish we register possible associated EXTI line */