The tcDspMmc class is used to provide access to a standard MultiMedia card storage device via the MityDSP generic SPI interface. An instance of the tcDspSpi class, and an output latch selector and ID must be provided in the constructor.
This is a simple example of tcDspMmc creation and usage:
{ unsigned int gnSPI_BASE_ADDR = 0xB0000200; int bytes, myLatchID = 1; char lpBuffer[1024]; tcDspOutputLatch MyClass::mpOutputLatch; tcDspSpi *MyClass::mpSpi; tcDspMmc *MyClass::mpMmc; // create access to the SPI mpSpi = new tcDspSpi((void *)gnSPI_BASE_ADDR); // create access to MMC on SPI with provided CS latch mpMmc = new tcDspMmc(mpSpi, mpOutputLatch, myLatchID); tcDspError::report(__FILE__, __LINE__, status, "MMC Device Size is %.1f KB", mpMmc->getSizeKB()); // read 1K of data from sector 7 bytes = mpMmc->read(7, 0, (void *)lpBuffer, sizeof(lpBuffer)); // do something application-specific ... // write 512 bytes to disk, at an offset of 2K into the MMC bytes = mpMmc->write((void *)0x800, (void *)lpBuffer, 512); ... }