[En-Nut-Discussion] MMC Driver and multiple SPI Devices
enut at cicely.de
Sat Aug 8 16:41:01 CEST 2009
On Sat, Aug 08, 2009 at 04:24:00PM +0200, Malte Marwedel wrote:
> I am trying to figure out how to use two slaves on the SPI device from
> different threads. One is a MMC and the other a mp3 decoder.
> So at every access, I had to set the proper chip select and SPI speed.
> My Idea is, to insert a MUTEX into the SpiMmCardSelect function, locking
> if the card select is 1 and releasing if the card select is 0 and doing
> the same for the mp3 decoder Select function driver.
> I tried to figure out where SpiMmCardSelect function in the given
> mmcard.c is called. There are several calls which Select(1) and Select(0).
> It looks like, beside of init and reset functions, there is always a
> Select(1) and a Select(0) later. Or is there anything I have overseen?
I'd just changed the exitsing mutex in dev/mmcard.c.
You only need to rename it so there is no collision on
export and of course remove the static to export.
I'd needed the SPI before MMC initialisation so I'd relocated the
initializer as well.
In your own code you need to restore the SPI setup.
B.Walter <bernd at bwct.de> http://www.bwct.de
Modbus/TCP Ethernet I/O Baugruppen, ARM basierte FreeBSD Rechner uvm.
More information about the En-Nut-Discussion