src/C/devices.c
uint8_t dev_register_device(e_device_id dev_id, device_t *udev)
{
    struct device_soc_infos  *devinfo = NULL;

    if (udev->size != 0) {
        devinfo = soc_devmap_find_device(udev->address, udev->size);
        if (devinfo == NULL) {
            KERNLOG(DBG_WARN, "can't find device %s (addr: %x, size: %x)\n",
                udev->name, udev->address, udev->size);
            return 1;
        }

        memcpy(&device_tab[dev_id].udev, udev, sizeof(device_t));
        device_tab[dev_id].devinfo = devinfo;
        device_tab[dev_id].is_mapped = false;
    }

    device_tab[dev_id].status = DEV_STATE_REGISTERED;

    KERNLOG(DBG_INFO, "registered device %s (%x)\n", udev->name, udev->address);
    return 0;
}
/*
 * Registering a new device.
 * NOTE: If the task configures only some GPIOs without any "real" device
 * behind 'devinfo' field will be set as NULL.
 */
Registering a new device.
NOTE: If the task configures only some GPIOs without any "real" device
behind 'devinfo' field will be set as NULL.
Registering a new device . NOTE : If the task configures only some GPIOs without any " real " device behind ' devinfo ' field will be set as NULL .
uint8_t dev_register_device(e_device_id dev_id, device_t *udev)
{
    struct device_soc_infos  *devinfo = NULL;
    if (udev->size != 0) {
        devinfo = soc_devmap_find_device(udev->address, udev->size);
        if (devinfo == NULL) {
            KERNLOG(DBG_WARN, "can't find device %s (addr: %x, size: %x)\n",
                udev->name, udev->address, udev->size);
            return 1;
        }
        memcpy(&device_tab[dev_id].udev, udev, sizeof(device_t));
        device_tab[dev_id].devinfo = devinfo;
        device_tab[dev_id].is_mapped = false;
    }
    device_tab[dev_id].status = DEV_STATE_REGISTERED;
    KERNLOG(DBG_INFO, "registered device %s (%x)\n", udev->name, udev->address);
    return 0;
}
uint8_t dev_register_device ( e_device_id dev_id , device_t * udev ) { struct device_soc_infos * devinfo = NULL ; if ( udev -> size != 0 ) { devinfo = soc_devmap_find_device ( udev -> address , udev -> size ) ; if ( devinfo == NULL ) { KERNLOG ( DBG_WARN , " \n " , udev -> name , udev -> address , udev -> size ) ; return 1 ; } memcpy ( & device_tab [ dev_id ] . udev , udev , sizeof ( device_t ) ) ; device_tab [ dev_id ] . devinfo = devinfo ; device_tab [ dev_id ] . is_mapped = false ; } device_tab [ dev_id ] . status = DEV_STATE_REGISTERED ; KERNLOG ( DBG_INFO , " \n " , udev -> name , udev -> address ) ; return 0 ; }
Registering a new device.
Registering a new device .