This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
RE: Disk I/O -> scheduling problems
- From: "Paul D. DeRocco" <pderocco at ix dot netcom dot com>
- To: "eCos Discuss" <ecos-discuss at ecos dot sourceware dot org>
- Date: Thu, 30 Apr 2009 20:05:31 -0700
- Subject: RE: [ECOS] Disk I/O -> scheduling problems
> From: Szentirmai Gergely [mailto:gergely.szentirmai@axelero.hu]
>
> Paul D. DeRocco írta:
>
> > Does the existing MCI driver do the
> > entire sector transfer without using any interrupts?
>
> No, but it polls for the result. This is what could be modified to the
> code here, I have posted.
>
> Here comes the thing which is not clear. Examine this code (perhaps an
> eCos-recommended solution, is it?):
> >> cyg_drv_dsr_lock();
> >> {
> >> while (!spi_bus->transfer_end)
> >> cyg_drv_cond_wait(&spi_bus->transfer_cond);
> >> }
> >> cyg_drv_dsr_unlock();
>
> spi_bus->transfer_cond is set by an interrupt. Until the operation is
> not finished, dsr-s are locked.
>
> I have found my answer, what is the difference between these
> implementations:
> http://osdir.com/ml/ecos.general/2003-03/msg00178.html
> DSR locking works in a per-thread basis. So
> cyg_drv_cond_wait(&spi_bus->transfer_cond); would trigger a task switch.
>
> Thank you for your help!
> Gergely Szentirmai
>
> > But in this chip the MCI interface can transfer a sector via the PDC,
> > so this shouldn't be necessary. You may have to start from
> > scratch and write
> > a better MCI driver that uses DMA and an interrupt at the end.
>
> It do use it.
Since you earlier said that you poll for the result, I assume you mean here
that you use DMA but not an interrupt. If so, then all you have to do is
have a null ISR that just schedules a DSR, have the DSR signal a condition
variable, and use the same sort of code that the SPI driver uses. Then, your
MCI driver will work in a manner similar to the SPI driver, and they'll
happily interleave the initiation and completion of their respective
transfers.
--
Ciao, Paul D. DeRocco
Paul mailto:pderocco@ix.netcom.com
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss