[ECOS] problem with layered drivers

Bernard Fouché bernard.fouche@kuantic.com
Mon Nov 6 19:46:00 GMT 2006


Hi.

If you have enough room in your target, can you use open/select. It 
seems that the usual design is to have a thread doing a blocking read on 
one or more uarts (if more than one, select() is needed), then send the 
serial data to the destination threads according to the data content or 
the uart that gave the data.

So your actual data reading threads become message consumer threads, fed 
by a thread that read the uart for everybody.

 Bernard

Michele Paselli wrote:
> Hi all,
> I'm writing a driver for a PSoC, it is connected to the 
> microcontroller through the serial port so I'm building the serial 
> driver on top of the AT91 serial driver. The PSoC has two functions: it 
> receives from the serial port a byte, sets an analog output with a DAC, 
> and send the value back to the serial port (a sort of acknowledgment 
> for the microcontroller). In the meanwhile it always monitors an analog 
> input and send an error message (1 byte) through the serial port if the 
> input is below a threshold. The error message has a unique value, so it 
> can't be confused with an "ack" value.
> The 2 different functions belong to 2 different drivers, which are 
> built on top of the PSoC driver, let's call A the driver for the DAC 
> and B the driver that want to be notified by the error message.
> The A driver will call the cyg_io_write() function of the PSoC driver 
> which will call the cyg_io_write() function of the serial driver and 
> check the value back with the cyg_io_read() function of the serial 
> driver. The B driver will call the cyg_io_read ()function of the PSoC 
> which will call the cyg_io_read() function of the serial driver. The 
> problem is that in the PSoC driver I would like to implement a sort of 
> DSR that choses to which driver (A or B) belongs the value read from 
> the serial port and that resumes the thread (for the driver A or B) 
> that has been blocked. So my question is if I can have a callback 
> coming from the serial driver to the PSoC driver, or any other sort of 
> software interrupt which I can use to see that a character is arrived 
> on the serial port.
> I hope to have been clear enough, thanks a lot.
>
> Michele
>
>
> 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



More information about the Ecos-discuss mailing list