static void root_task(void *p) { kprintf(" Root task started...\n"); clock_init(INT_SYSTICK); systick_init(); kprintf(" Clock subsystem inited.\n"); console_init(); kprintf(" Console subsystem inited.\n"); kservice_init(); kprintf(" tkservice started.\n"); // command_init(); // kprintf(" Shell subsystem inited.\n"); samv_agent_init(); kprintf(" Samv agent inited.\n"); #ifdef INCLUDE_GDB_STUB // gdb_stub_init(); // kprintf(" gdb stub inited.\n"); #endif /* INCLUDE_GDB_STUB */ /* a temp wrapper */ // net_task_init(); // lwip_sys_init(); // kprintf(" LWIP inited.\n"); udelay_init(); user_app_init(); kprintf(" Root task ended.\n"); }
int drv_generic_i2c_open(const char *section, const char *driver) { int dev; char *bus, *device; udelay_init(); Section = (char *) section; Driver = (char *) driver; bus = cfg_get(Section, "Port", NULL); device = cfg_get(Section, "Device", NULL); dev = atoi(device); info("%s: initializing I2C bus %s", Driver, bus); if ((i2c_device = open(bus, O_WRONLY)) < 0) { error("%s: I2C bus %s open failed !\n", Driver, bus); goto exit_error; } info("%s: selecting slave device 0x%x", Driver, dev); if (ioctl(i2c_device, I2C_SLAVE, dev) < 0) { error("%s: error selecting slave device 0x%x\n", Driver, dev); goto exit_error; } info("%s: initializing I2C slave device 0x%x", Driver, dev); if (i2c_smbus_write_quick(i2c_device, I2C_SMBUS_WRITE) < 0) { error("%s: error initializing device 0x%x\n", Driver, dev); close(i2c_device); } return 0; exit_error: free(bus); free(device); close(i2c_device); return -1; }
int drv_generic_parport_open(const char *section, const char *driver) { char *s, *e; Section = (char *) section; Driver = (char *) driver; udelay_init(); #ifndef WITH_PPDEV error("The files include/linux/parport.h and/or include/linux/ppdev.h"); error("were missing at compile time. Even if your system supports"); error("ppdev, it will not be used."); error("You *really* should install these files and recompile LCD4linux!"); #endif s = cfg_get(Section, "Port", NULL); if (s == NULL || *s == '\0') { error("%s: no '%s.Port' entry from %s", Driver, Section, cfg_source()); return -1; } PPdev = NULL; if ((Port = strtol(s, &e, 0)) == 0 || *e != '\0') { #ifdef WITH_PPDEV Port = 0; PPdev = s; #else error("%s: bad %s.Port '%s' from %s", Driver, Section, s, cfg_source()); free(s); return -1; #endif } #ifdef WITH_PPDEV if (PPdev) { info("%s: using ppdev %s", Driver, PPdev); PPfd = open(PPdev, O_RDWR); if (PPfd == -1) { error("%s: open(%s) failed: %s", Driver, PPdev, strerror(errno)); return -1; } #if 0 /* PPEXCL fails if someone else uses the port (e.g. lp.ko) */ if (ioctl(PPfd, PPEXCL)) { info("%s: ioctl(%s, PPEXCL) failed: %s", PPdev, Driver, strerror(errno)); info("%s: could not get exclusive access to %s.", Driver, PPdev); } else { info("%s: got exclusive access to %s.", Driver, PPdev); } #endif if (ioctl(PPfd, PPCLAIM)) { error("%s: ioctl(%s, PPCLAIM) failed: %d %s", Driver, PPdev, errno, strerror(errno)); return -1; } } #endif #ifdef WITH_OUTB if (Port) { error("using raw port 0x%x (deprecated!)", Port); error("You *really* should change your setup and use ppdev!"); if ((Port + 3) <= 0x3ff) { if (ioperm(Port, 3, 1) != 0) { error("%s: ioperm(0x%x) failed: %s", Driver, Port, strerror(errno)); return -1; } } else { if (iopl(3) != 0) { error("%s: iopl(1) failed: %s", Driver, strerror(errno)); return -1; } } } #endif return 0; }