- Note
- EMMC Flash card is not available in AM263X board.
Multi-Media Card Secure Digital (MMCSD) peripheral is a driver which provides an interface with storage devices which follows MMC/SD/SDIO protocol. The driver supports single bit and four bit data lines to communicate with the connected media. The MMCSD controller provides accessibility to external MMC/SD/SDIO devices using a programmed IO method. There is only one MMCSD module inside the SOC - MMCSD0.
Features Supported
- 64-bit data, address width System Bus Interface
- SD command/response sets as defined in the SD Physical Layer specification v2.00
- Operating voltage range VCC = 3.3 V
- Default-speed & High-speed MMCSD protocol.
SysConfig Features
- Note
- It is strongly recommend to use SysConfig where it is available instead of using direct SW API calls. This will help simplify the SW application and also catch common mistakes early in the development cycle.
Features not Supported
- No integrated DMA Controller Support.
- MMCSD instance does not support DDR mode.
Usage Overview
API Sequence
To use the MMCSD LLD driver to write/read data to or from a MMC/SD Device, the application calls the following APIs:
Initializing the MMCSD LLD Driver
MMCSD_lld_init() must be called before any other MMCSD APIs. This function uses mmcsd lld handle to initialize each instance.
Calling MMCSD_lld_init() a second time with the same handle previously passed to MMCSD_lld_init() will result in an error. You can, though, re-use the handle if the instance is closed via MMCSD_lld_deInit().
Please note that initializing MMCSD LLD driver is taken care by the SysConfig generated code.
MMCSD Transfer Mode
The MMCSD driver supports two transfer modes of operation: Polling and Interrupt Mode.
In Polling mode transfer can be initiated with all the polling mode APIs.
In Interrupt mode Users have to register the appropriate ISR and assign a callback function before calling the interrupt mode APIs.
DMA can enabled in any mode of operation if enabled.
Example Usage
Include the below file to access the APIs
#include <string.h>
#include <kernel/dpl/MutexArmP.h>
#include <kernel/nortos/dpl/r5/HwiP_armv7r_vim.h>
Instance Open Example
Instance Close Example
Non-Blocking Transfer Example
intrNum = gMmcsdLldHandle->initHandle->intrNum;
intcBaseAddr = gHwiConfig.intcBaseAddr;
gMmcsdVimStsAddr = intcBaseAddr + (0x404u + (((intrNum)>> 5) & 0xFu)*0x20u);
gMmcsdVimStsClrMask = 0x1u << ((intrNum) & 0x1Fu);
gMmcsdLldHandle->transferCompleteCallback = MMCSD_lld_transferCompleteCallback_implementation;
HwiP_setVecAddr(intrNum, (uintptr_t)&App_MMCSD_ISR);
HwiP_setPri(intrNum, MMCSD_INTERRUPT_PRIORITY);
uint32_t numBlocks = APP_MMCSD_DATA_SIZE / blockSize;
if((APP_MMCSD_DATA_SIZE % blockSize) != 0)
{
numBlocks += 1;
}
mmcsd_io_fill_buffers();
gMMCSDTransferMutex = MUTEX_ARM_LOCKED;
APP_MMCSD_START_BLK, numBlocks);
while(try_lock_mutex(&gMMCSDTransferMutex) == MUTEX_ARM_LOCKED);
Non-Blocking Example transfer callback
void MMCSD_lld_transferCompleteCallback_implementation (
void *
args,
int32_t transferStatus)
{
unlock_mutex(&gMMCSDTransferMutex);
}
Non-Blocking Example ISR CALL callback
static __attribute__((__section__(
".text.hwi"), noinline, naked, target(
"arm"), aligned(4))) void App_MMCSD_ISR(
void)
{
gMmcsdLldHandle, \
intrNum, \
gMmcsdVimStsAddr, \
gMmcsdVimStsClrMask,
intcBaseAddr);
}
API
APIs for MMCSD LLD