Hi, one more question, where should I start the demux thread? Is it allowed to start a thread in the driver of the PSoC? In the the device driver API function (cyg_drv_xxx) there aren't functions like create_thread or resume_thread, am I allowed to use them anyway? Thanks
Michele ----Messaggio originale---- Da: [EMAIL PROTECTED] Data: 07/11/2006 11.35 A: "Michele Paselli"<[EMAIL PROTECTED]> Cc: <[email protected]> Ogg: Re: [ECOS] problem with layered drivers On Tue, Nov 07, 2006 at 11:16:34AM +0100, Michele Paselli wrote: > Hi Bernard, > could you please be more precise? Where can I find the open function > and how can I use that? > Thanks He means the normal open(2) function. You can fd = open("/dev/ser0",O_RDWR); and then do normal read(2) and write(2) on the file descriptor. What Barnard is suggesting, is that you have a thread doing the demultiplexing. So you have something like void demux(void) { fd = open("/dev/ser0",O_RDWR); for (;;) { read(fd, c, 1); switch(c) { case 0x01: case 0x02: case 0x03: // Bytes for thread A cyg_mbox_put(&thread_A_mbox, c); break; case 0x10: case 0x11: // Bytes for thread B cyg_mbox_put(&thread_B_mbox, c); break; default: // Hardware has gone crazy!! HAL_PLATFORM_RESET(); } } } Naviga e telefona senza limiti con Tiscali Scopri le promozioni Tiscali adsl: navighi e telefoni senza canone Telecom http://abbonati.tiscali.it/adsl/ -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
