STM32L443xx HAL User Manual
Functions
Input and Output operation functions
MMC Exported Functions

Data transfer functions. More...

Functions

HAL_StatusTypeDef HAL_MMC_ReadBlocks (MMC_HandleTypeDef *hmmc, uint8_t *pData, uint32_t BlockAdd, uint32_t NumberOfBlocks, uint32_t Timeout)
 Reads block(s) from a specified address in a card.
HAL_StatusTypeDef HAL_MMC_WriteBlocks (MMC_HandleTypeDef *hmmc, uint8_t *pData, uint32_t BlockAdd, uint32_t NumberOfBlocks, uint32_t Timeout)
 Allows to write block(s) to a specified address in a card.
HAL_StatusTypeDef HAL_MMC_ReadBlocks_IT (MMC_HandleTypeDef *hmmc, uint8_t *pData, uint32_t BlockAdd, uint32_t NumberOfBlocks)
 Reads block(s) from a specified address in a card.
HAL_StatusTypeDef HAL_MMC_WriteBlocks_IT (MMC_HandleTypeDef *hmmc, uint8_t *pData, uint32_t BlockAdd, uint32_t NumberOfBlocks)
 Writes block(s) to a specified address in a card.
HAL_StatusTypeDef HAL_MMC_ReadBlocks_DMA (MMC_HandleTypeDef *hmmc, uint8_t *pData, uint32_t BlockAdd, uint32_t NumberOfBlocks)
 Reads block(s) from a specified address in a card.
HAL_StatusTypeDef HAL_MMC_WriteBlocks_DMA (MMC_HandleTypeDef *hmmc, uint8_t *pData, uint32_t BlockAdd, uint32_t NumberOfBlocks)
 Writes block(s) to a specified address in a card.
HAL_StatusTypeDef HAL_MMC_Erase (MMC_HandleTypeDef *hmmc, uint32_t BlockStartAdd, uint32_t BlockEndAdd)
 Erases the specified memory area of the given MMC card.
void HAL_MMC_IRQHandler (MMC_HandleTypeDef *hmmc)
 This function handles MMC card interrupt request.
HAL_MMC_StateTypeDef HAL_MMC_GetState (MMC_HandleTypeDef *hmmc)
 return the MMC state
uint32_t HAL_MMC_GetError (MMC_HandleTypeDef *hmmc)
 Return the MMC error code.
__weak void HAL_MMC_TxCpltCallback (MMC_HandleTypeDef *hmmc)
 Tx Transfer completed callbacks.
__weak void HAL_MMC_RxCpltCallback (MMC_HandleTypeDef *hmmc)
 Rx Transfer completed callbacks.
__weak void HAL_MMC_ErrorCallback (MMC_HandleTypeDef *hmmc)
 MMC error callbacks.
__weak void HAL_MMC_AbortCallback (MMC_HandleTypeDef *hmmc)
 MMC Abort callbacks.
HAL_StatusTypeDef HAL_MMC_RegisterCallback (MMC_HandleTypeDef *hmmc, HAL_MMC_CallbackIDTypeDef CallbackId, pMMC_CallbackTypeDef pCallback)
 Register a User MMC Callback To be used instead of the weak (surcharged) predefined callback.
HAL_StatusTypeDef HAL_MMC_UnRegisterCallback (MMC_HandleTypeDef *hmmc, HAL_MMC_CallbackIDTypeDef CallbackId)
 Unregister a User MMC Callback MMC Callback is redirected to the weak (surcharged) predefined callback.

Detailed Description

Data transfer functions.

  ==============================================================================
                        ##### IO operation functions #####
  ==============================================================================
  [..]
    This subsection provides a set of functions allowing to manage the data
    transfer from/to MMC card.


Function Documentation

MMC Abort callbacks.

Parameters:
hmmcPointer MMC handle
Return values:
None

Definition at line 2020 of file stm32l4xx_hal_mmc.c.

Referenced by HAL_MMC_Abort_IT(), HAL_MMC_Init(), HAL_MMC_IRQHandler(), HAL_MMC_UnRegisterCallback(), MMC_DMARxAbort(), and MMC_DMATxAbort().

HAL_StatusTypeDef HAL_MMC_Erase ( MMC_HandleTypeDef hmmc,
uint32_t  BlockStartAdd,
uint32_t  BlockEndAdd 
)

Erases the specified memory area of the given MMC card.

Note:
This API should be followed by a check on the card state through HAL_MMC_GetCardState().
Parameters:
hmmcPointer to MMC handle
BlockStartAddStart Block address
BlockEndAddEnd Block address
Return values:
HALstatus

Definition at line 1542 of file stm32l4xx_hal_mmc.c.

References __HAL_MMC_CLEAR_FLAG, HAL_MMC_CardInfoTypeDef::CardType, HAL_MMC_CardInfoTypeDef::Class, __MMC_HandleTypeDef::ErrorCode, HAL_MMC_ERROR_ADDR_OUT_OF_RANGE, HAL_MMC_ERROR_LOCK_UNLOCK_FAILED, HAL_MMC_ERROR_NONE, HAL_MMC_ERROR_PARAM, HAL_MMC_ERROR_REQUEST_NOT_APPLICABLE, HAL_MMC_STATE_BUSY, HAL_MMC_STATE_READY, __MMC_HandleTypeDef::Instance, HAL_MMC_CardInfoTypeDef::LogBlockNbr, MMC_HIGH_CAPACITY_CARD, __MMC_HandleTypeDef::MmcCard, and __MMC_HandleTypeDef::State.

MMC error callbacks.

Parameters:
hmmcPointer MMC handle
Return values:
None

Definition at line 2005 of file stm32l4xx_hal_mmc.c.

Referenced by HAL_MMC_Init(), HAL_MMC_IRQHandler(), HAL_MMC_UnRegisterCallback(), MMC_DMAError(), MMC_DMAReceiveCplt(), MMC_DMARxAbort(), and MMC_DMATxAbort().

uint32_t HAL_MMC_GetError ( MMC_HandleTypeDef hmmc)

Return the MMC error code.

Parameters:
hmmc: Pointer to a MMC_HandleTypeDef structure that contains the configuration information.
Return values:
MMCError Code

Definition at line 1965 of file stm32l4xx_hal_mmc.c.

References __MMC_HandleTypeDef::ErrorCode.

return the MMC state

Parameters:
hmmcPointer to mmc handle
Return values:
HALstate

Definition at line 1954 of file stm32l4xx_hal_mmc.c.

References __MMC_HandleTypeDef::State.

HAL_StatusTypeDef HAL_MMC_ReadBlocks ( MMC_HandleTypeDef hmmc,
uint8_t *  pData,
uint32_t  BlockAdd,
uint32_t  NumberOfBlocks,
uint32_t  Timeout 
)

Reads block(s) from a specified address in a card.

The Data transfer is managed by polling mode.

Note:
This API should be followed by a check on the card state through HAL_MMC_GetCardState().
Parameters:
hmmcPointer to MMC handle
pDatapointer to the buffer that will contain the received data
BlockAddBlock Address from where data is to be read
NumberOfBlocksNumber of MMC blocks to read
TimeoutSpecify timeout value
Return values:
HALstatus

Definition at line 643 of file stm32l4xx_hal_mmc.c.

References __HAL_MMC_CLEAR_FLAG, __HAL_MMC_GET_FLAG, HAL_MMC_CardInfoTypeDef::CardType, __MMC_HandleTypeDef::Context, __MMC_HandleTypeDef::ErrorCode, HAL_GetTick(), HAL_MMC_ERROR_ADDR_OUT_OF_RANGE, HAL_MMC_ERROR_BUSY, HAL_MMC_ERROR_DATA_CRC_FAIL, HAL_MMC_ERROR_DATA_TIMEOUT, HAL_MMC_ERROR_NONE, HAL_MMC_ERROR_PARAM, HAL_MMC_ERROR_RX_OVERRUN, HAL_MMC_ERROR_TIMEOUT, HAL_MMC_STATE_BUSY, HAL_MMC_STATE_READY, __MMC_HandleTypeDef::Instance, HAL_MMC_CardInfoTypeDef::LogBlockNbr, MMC_BLOCKSIZE, MMC_CONTEXT_NONE, MMC_CONTEXT_READ_MULTIPLE_BLOCK, MMC_CONTEXT_READ_SINGLE_BLOCK, MMC_HIGH_CAPACITY_CARD, __MMC_HandleTypeDef::MmcCard, and __MMC_HandleTypeDef::State.

HAL_StatusTypeDef HAL_MMC_ReadBlocks_DMA ( MMC_HandleTypeDef hmmc,
uint8_t *  pData,
uint32_t  BlockAdd,
uint32_t  NumberOfBlocks 
)

Reads block(s) from a specified address in a card.

The Data transfer is managed by DMA mode.

Note:
This API should be followed by a check on the card state through HAL_MMC_GetCardState().
You could also check the DMA transfer process through the MMC Rx interrupt event.
Parameters:
hmmcPointer MMC handle
pDataPointer to the buffer that will contain the received data
BlockAddBlock Address from where data is to be read
NumberOfBlocksNumber of blocks to read.
Return values:
HALstatus

Definition at line 1268 of file stm32l4xx_hal_mmc.c.

References __HAL_MMC_CLEAR_FLAG, __HAL_MMC_DMA_ENABLE, __HAL_MMC_ENABLE_IT, HAL_MMC_CardInfoTypeDef::CardType, __MMC_HandleTypeDef::Context, __MMC_HandleTypeDef::ErrorCode, HAL_DMA_Start_IT(), HAL_MMC_ERROR_ADDR_OUT_OF_RANGE, HAL_MMC_ERROR_DMA, HAL_MMC_ERROR_NONE, HAL_MMC_ERROR_PARAM, HAL_MMC_STATE_BUSY, HAL_MMC_STATE_READY, __MMC_HandleTypeDef::hdmarx, __MMC_HandleTypeDef::Instance, HAL_MMC_CardInfoTypeDef::LogBlockNbr, MMC_BLOCKSIZE, MMC_CONTEXT_DMA, MMC_CONTEXT_NONE, MMC_CONTEXT_READ_MULTIPLE_BLOCK, MMC_CONTEXT_READ_SINGLE_BLOCK, MMC_DMAError(), MMC_DMAReceiveCplt(), MMC_HIGH_CAPACITY_CARD, __MMC_HandleTypeDef::MmcCard, __MMC_HandleTypeDef::pRxBuffPtr, __MMC_HandleTypeDef::RxXferSize, __MMC_HandleTypeDef::State, __DMA_HandleTypeDef::XferAbortCallback, __DMA_HandleTypeDef::XferCpltCallback, and __DMA_HandleTypeDef::XferErrorCallback.

HAL_StatusTypeDef HAL_MMC_ReadBlocks_IT ( MMC_HandleTypeDef hmmc,
uint8_t *  pData,
uint32_t  BlockAdd,
uint32_t  NumberOfBlocks 
)

Reads block(s) from a specified address in a card.

The Data transfer is managed in interrupt mode.

Note:
This API should be followed by a check on the card state through HAL_MMC_GetCardState().
You could also check the IT transfer process through the MMC Rx interrupt event.
Parameters:
hmmcPointer to MMC handle
pDataPointer to the buffer that will contain the received data
BlockAddBlock Address from where data is to be read
NumberOfBlocksNumber of blocks to read.
Return values:
HALstatus

Definition at line 1061 of file stm32l4xx_hal_mmc.c.

References __HAL_MMC_CLEAR_FLAG, __HAL_MMC_ENABLE_IT, HAL_MMC_CardInfoTypeDef::CardType, __MMC_HandleTypeDef::Context, __MMC_HandleTypeDef::ErrorCode, HAL_MMC_ERROR_ADDR_OUT_OF_RANGE, HAL_MMC_ERROR_NONE, HAL_MMC_ERROR_PARAM, HAL_MMC_STATE_BUSY, HAL_MMC_STATE_READY, __MMC_HandleTypeDef::Instance, HAL_MMC_CardInfoTypeDef::LogBlockNbr, MMC_BLOCKSIZE, MMC_CONTEXT_IT, MMC_CONTEXT_NONE, MMC_CONTEXT_READ_MULTIPLE_BLOCK, MMC_CONTEXT_READ_SINGLE_BLOCK, MMC_HIGH_CAPACITY_CARD, __MMC_HandleTypeDef::MmcCard, __MMC_HandleTypeDef::pRxBuffPtr, __MMC_HandleTypeDef::RxXferSize, and __MMC_HandleTypeDef::State.

HAL_StatusTypeDef HAL_MMC_RegisterCallback ( MMC_HandleTypeDef hmmc,
HAL_MMC_CallbackIDTypeDef  CallbackId,
pMMC_CallbackTypeDef  pCallback 
)

Register a User MMC Callback To be used instead of the weak (surcharged) predefined callback.

Parameters:
hmmc: MMC handle
CallbackId: ID of the callback to be registered This parameter can be one of the following values:
pCallback: pointer to the Callback function
Return values:
status

Definition at line 2050 of file stm32l4xx_hal_mmc.c.

References __MMC_HandleTypeDef::AbortCpltCallback, __MMC_HandleTypeDef::ErrorCallback, __MMC_HandleTypeDef::ErrorCode, HAL_MMC_ABORT_CB_ID, HAL_MMC_ERROR_CB_ID, HAL_MMC_ERROR_INVALID_CALLBACK, HAL_MMC_MSP_DEINIT_CB_ID, HAL_MMC_MSP_INIT_CB_ID, HAL_MMC_RX_CPLT_CB_ID, HAL_MMC_STATE_READY, HAL_MMC_STATE_RESET, HAL_MMC_TX_CPLT_CB_ID, __MMC_HandleTypeDef::MspDeInitCallback, __MMC_HandleTypeDef::MspInitCallback, __MMC_HandleTypeDef::RxCpltCallback, __MMC_HandleTypeDef::State, and __MMC_HandleTypeDef::TxCpltCallback.

Rx Transfer completed callbacks.

Parameters:
hmmcPointer MMC handle
Return values:
None

Definition at line 1990 of file stm32l4xx_hal_mmc.c.

Referenced by HAL_MMC_Init(), HAL_MMC_IRQHandler(), HAL_MMC_UnRegisterCallback(), and MMC_DMAReceiveCplt().

Tx Transfer completed callbacks.

Parameters:
hmmcPointer to MMC handle
Return values:
None

Definition at line 1975 of file stm32l4xx_hal_mmc.c.

Referenced by HAL_MMC_Init(), HAL_MMC_IRQHandler(), and HAL_MMC_UnRegisterCallback().

HAL_StatusTypeDef HAL_MMC_UnRegisterCallback ( MMC_HandleTypeDef hmmc,
HAL_MMC_CallbackIDTypeDef  CallbackId 
)

Unregister a User MMC Callback MMC Callback is redirected to the weak (surcharged) predefined callback.

Parameters:
hmmc: MMC handle
CallbackId: ID of the callback to be unregistered This parameter can be one of the following values:
Return values:
status

Definition at line 2157 of file stm32l4xx_hal_mmc.c.

References __MMC_HandleTypeDef::AbortCpltCallback, __MMC_HandleTypeDef::ErrorCallback, __MMC_HandleTypeDef::ErrorCode, HAL_MMC_ABORT_CB_ID, HAL_MMC_AbortCallback(), HAL_MMC_ERROR_CB_ID, HAL_MMC_ERROR_INVALID_CALLBACK, HAL_MMC_ErrorCallback(), HAL_MMC_MSP_DEINIT_CB_ID, HAL_MMC_MSP_INIT_CB_ID, HAL_MMC_MspDeInit(), HAL_MMC_MspInit(), HAL_MMC_RX_CPLT_CB_ID, HAL_MMC_RxCpltCallback(), HAL_MMC_STATE_READY, HAL_MMC_STATE_RESET, HAL_MMC_TX_CPLT_CB_ID, HAL_MMC_TxCpltCallback(), __MMC_HandleTypeDef::MspDeInitCallback, __MMC_HandleTypeDef::MspInitCallback, __MMC_HandleTypeDef::RxCpltCallback, __MMC_HandleTypeDef::State, and __MMC_HandleTypeDef::TxCpltCallback.

HAL_StatusTypeDef HAL_MMC_WriteBlocks ( MMC_HandleTypeDef hmmc,
uint8_t *  pData,
uint32_t  BlockAdd,
uint32_t  NumberOfBlocks,
uint32_t  Timeout 
)

Allows to write block(s) to a specified address in a card.

The Data transfer is managed by polling mode.

Note:
This API should be followed by a check on the card state through HAL_MMC_GetCardState().
Parameters:
hmmcPointer to MMC handle
pDatapointer to the buffer that will contain the data to transmit
BlockAddBlock Address where data will be written
NumberOfBlocksNumber of MMC blocks to write
TimeoutSpecify timeout value
Return values:
HALstatus

Definition at line 863 of file stm32l4xx_hal_mmc.c.

References __HAL_MMC_CLEAR_FLAG, __HAL_MMC_GET_FLAG, HAL_MMC_CardInfoTypeDef::CardType, __MMC_HandleTypeDef::Context, __MMC_HandleTypeDef::ErrorCode, HAL_GetTick(), HAL_MMC_ERROR_ADDR_OUT_OF_RANGE, HAL_MMC_ERROR_BUSY, HAL_MMC_ERROR_DATA_CRC_FAIL, HAL_MMC_ERROR_DATA_TIMEOUT, HAL_MMC_ERROR_NONE, HAL_MMC_ERROR_PARAM, HAL_MMC_ERROR_TX_UNDERRUN, HAL_MMC_STATE_BUSY, HAL_MMC_STATE_READY, __MMC_HandleTypeDef::Instance, HAL_MMC_CardInfoTypeDef::LogBlockNbr, MMC_BLOCKSIZE, MMC_CONTEXT_NONE, MMC_CONTEXT_WRITE_MULTIPLE_BLOCK, MMC_CONTEXT_WRITE_SINGLE_BLOCK, MMC_HIGH_CAPACITY_CARD, __MMC_HandleTypeDef::MmcCard, and __MMC_HandleTypeDef::State.

HAL_StatusTypeDef HAL_MMC_WriteBlocks_DMA ( MMC_HandleTypeDef hmmc,
uint8_t *  pData,
uint32_t  BlockAdd,
uint32_t  NumberOfBlocks 
)

Writes block(s) to a specified address in a card.

The Data transfer is managed by DMA mode.

Note:
This API should be followed by a check on the card state through HAL_MMC_GetCardState().
You could also check the DMA transfer process through the MMC Tx interrupt event.
Parameters:
hmmcPointer to MMC handle
pDataPointer to the buffer that will contain the data to transmit
BlockAddBlock Address where data will be written
NumberOfBlocksNumber of blocks to write
Return values:
HALstatus

Definition at line 1404 of file stm32l4xx_hal_mmc.c.

References __HAL_MMC_CLEAR_FLAG, __HAL_MMC_DMA_ENABLE, __HAL_MMC_ENABLE_IT, HAL_MMC_CardInfoTypeDef::CardType, __MMC_HandleTypeDef::Context, __MMC_HandleTypeDef::ErrorCode, HAL_DMA_Start_IT(), HAL_MMC_ERROR_ADDR_OUT_OF_RANGE, HAL_MMC_ERROR_DMA, HAL_MMC_ERROR_NONE, HAL_MMC_ERROR_PARAM, HAL_MMC_STATE_BUSY, HAL_MMC_STATE_READY, __MMC_HandleTypeDef::hdmatx, __MMC_HandleTypeDef::Instance, HAL_MMC_CardInfoTypeDef::LogBlockNbr, MMC_BLOCKSIZE, MMC_CONTEXT_DMA, MMC_CONTEXT_NONE, MMC_CONTEXT_WRITE_MULTIPLE_BLOCK, MMC_CONTEXT_WRITE_SINGLE_BLOCK, MMC_DMAError(), MMC_DMATransmitCplt(), MMC_HIGH_CAPACITY_CARD, __MMC_HandleTypeDef::MmcCard, __MMC_HandleTypeDef::pTxBuffPtr, __MMC_HandleTypeDef::State, __MMC_HandleTypeDef::TxXferSize, __DMA_HandleTypeDef::XferAbortCallback, __DMA_HandleTypeDef::XferCpltCallback, and __DMA_HandleTypeDef::XferErrorCallback.

HAL_StatusTypeDef HAL_MMC_WriteBlocks_IT ( MMC_HandleTypeDef hmmc,
uint8_t *  pData,
uint32_t  BlockAdd,
uint32_t  NumberOfBlocks 
)

Writes block(s) to a specified address in a card.

The Data transfer is managed in interrupt mode.

Note:
This API should be followed by a check on the card state through HAL_MMC_GetCardState().
You could also check the IT transfer process through the MMC Tx interrupt event.
Parameters:
hmmcPointer to MMC handle
pDataPointer to the buffer that will contain the data to transmit
BlockAddBlock Address where data will be written
NumberOfBlocksNumber of blocks to write
Return values:
HALstatus

Definition at line 1160 of file stm32l4xx_hal_mmc.c.

References __HAL_MMC_CLEAR_FLAG, __HAL_MMC_ENABLE_IT, HAL_MMC_CardInfoTypeDef::CardType, __MMC_HandleTypeDef::Context, __MMC_HandleTypeDef::ErrorCode, HAL_MMC_ERROR_ADDR_OUT_OF_RANGE, HAL_MMC_ERROR_NONE, HAL_MMC_ERROR_PARAM, HAL_MMC_STATE_BUSY, HAL_MMC_STATE_READY, __MMC_HandleTypeDef::Instance, HAL_MMC_CardInfoTypeDef::LogBlockNbr, MMC_BLOCKSIZE, MMC_CONTEXT_IT, MMC_CONTEXT_NONE, MMC_CONTEXT_WRITE_MULTIPLE_BLOCK, MMC_CONTEXT_WRITE_SINGLE_BLOCK, MMC_HIGH_CAPACITY_CARD, __MMC_HandleTypeDef::MmcCard, __MMC_HandleTypeDef::pTxBuffPtr, __MMC_HandleTypeDef::State, and __MMC_HandleTypeDef::TxXferSize.