1 May 2009 01:43
Re: Disk I/O -> scheduling problems]
Szentirmai Gergely <reg <at> t-online.hu>
2009-04-30 23:43:05 GMT
2009-04-30 23:43:05 GMT
Paul D. DeRocco írta:
>> From: Szentirmai Gergely
>>
>> I have an SD card with FAT filesystem, handled throught an MCI
>> interface. eCos did not have support for this interface (target
>> AT91SAM7A3), and I have written an extension - based on Atmel's library
>> - for the MMC driver to support it.
>> I have a sensor connected with SPI, and this sensor has an interrupt,
>> which is handled this way isr -> dsr (flag set) -> thread (flag wait) ->
>> spi_read. This reader thread has a high pritority.
>>
>> When I write the card with a low priority thread, it blocks reading the
>> sensor. Sensor reading should be done in about every 5 ms.
>>
>> This is because dsr-s are locked by io/src/disk.c. So the question is,
>> what should I do to prevent losing samples? Writing a blocks of data
>> (512Byte) to the card can take some time (approx. 10 ms). Are these
>> really concurent request, so this locking mechanism is needed?
>>
> <snip>
>> So what is the recommened solution for handling lengthy operations in a
>> driver?
>>
>> This is a code part from the Atmel AT91 SPI driver:
>> // Wait for its completion
>> cyg_drv_dsr_lock();
>> {
>> while (!spi_bus->transfer_end)
>> cyg_drv_cond_wait(&spi_bus->transfer_cond);
(Continue reading)
Ross
RSS Feed