This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
Re: problem with layered drivers
- From: Michele Paselli <miguelon at tiscali dot it>
- To: <andrew at lunn dot ch>
- Cc: <ecos-discuss at ecos dot sourceware dot org>
- Date: Tue, 7 Nov 2006 12:46:22 +0100 (CET)
- Subject: Re: [ECOS] problem with layered drivers
- Reply-to: Michele Paselli <miguelon at tiscali dot it>
- Xoriginalsenderip: 194.171.252.108
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: andrew@lunn.ch
Data: 07/11/2006 11.35
A: "Michele Paselli"<miguelon@tiscali.it>
Cc: <ecos-discuss@ecos.sourceware.org>
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