/******************************************************************************* * hwidev_add_uart * * See sys/hwinfo.h for interface description * * Returns: the offset in the hwinfo section of the added device or HWI_NULL_OFF * on error */ unsigned hwidev_add_uart(const char *device_name, hwiattr_uart_t *attr, unsigned bus_hwi_off) { /* we use the (unused) 'device.pnpid' as the device class identifier */ unsigned hwi_off = hwidev_add(device_name, hwi_devclass_UART, bus_hwi_off); if ((hwi_off != HWI_NULL_OFF) && (attr != NULL)) { unsigned i; hwitag_add_common(hwi_off, &attr->common); for (i=0; i<attr->num_clks; i++) hwitag_add_inputclk(hwi_off, 0, 1); // make divisor 1, just in case ;) } return hwi_off; }
/******************************************************************************* * hwibus_add_i2c * * See sys/hwinfo.h for interface description * * Returns: the offset in the hwinfo section of the added bus or HWI_NULL_OFF * on error */ unsigned hwibus_add_i2c(unsigned parent_hwi_off, hwiattr_i2c_t *attr) { unsigned hwi_off = hwibus_add(HWI_ITEM_BUS_I2C, parent_hwi_off); if ((hwi_off != HWI_NULL_OFF) && (attr != NULL)) { unsigned i; hwitag_add_common(hwi_off, &attr->common); for (i=0; i<attr->num_clks; i++) hwitag_add_inputclk(hwi_off, 0, 1); // make divisor 1, just in case ;) for (i=0; i<attr->num_busattr; i++) hwitag_add_busattr(hwi_off, NULL); // create empty busattr tags } return hwi_off; }