STM32Cube  Version 2.0
Create Projects for STM32L4 Series with STM32Cube HAL and STM32CubeMX
 All Files Functions Variables Macros Pages
MCI_STM32L4xx.c File Reference
#include "MCI_STM32L4xx.h"
#include "stm32L4xx_ll_dma.h"

Macros

#define ARM_MCI_DRV_VERSION   ARM_DRIVER_VERSION_MAJOR_MINOR(1,1) /* driver version */
 
#define MCI_BUS_MODE_HS   0U
 
#define MemoryCard_CD_Pin_Active   GPIO_PIN_RESET
 
#define MemoryCard_WP_Pin_Active   GPIO_PIN_SET
 

Functions

static void RX_DMA_Complete (struct __DMA_HandleTypeDef *hdma)
 
void SDMMC1_IRQHandler (void)
 
static ARM_DRIVER_VERSION GetVersion (void)
 Get driver version. More...
 
static ARM_MCI_CAPABILITIES GetCapabilities (void)
 
static int32_t Initialize (ARM_MCI_SignalEvent_t cb_event)
 Initialize the Memory Card Interface. More...
 
static int32_t Uninitialize (void)
 De-initialize Memory Card Interface. More...
 
static int32_t PowerControl (ARM_POWER_STATE state)
 Control Memory Card Interface Power. More...
 
static int32_t CardPower (uint32_t voltage)
 Set Memory Card supply voltage. More...
 
static int32_t ReadCD (void)
 Read Card Detect (CD) state. More...
 
static int32_t ReadWP (void)
 Read Write Protect (WP) state. More...
 
static int32_t SendCommand (uint32_t cmd, uint32_t arg, uint32_t flags, uint32_t *response)
 Send Command to card and get the response. More...
 
static int32_t SetupTransfer (uint8_t *data, uint32_t block_count, uint32_t block_size, uint32_t mode)
 Setup read or write transfer operation. More...
 
static int32_t AbortTransfer (void)
 Abort current read/write data transfer. More...
 
static int32_t Control (uint32_t control, uint32_t arg)
 Control MCI Interface. More...
 
static ARM_MCI_STATUS GetStatus (void)
 Get MCI status. More...
 

Variables

SD_HandleTypeDef hsd1
 
DMA_HandleTypeDef hdma_sdmmc1_rx
 
DMA_HandleTypeDef hdma_sdmmc1_tx
 
static MCI_INFO MCI
 
static const ARM_DRIVER_VERSION DriverVersion
 
static const ARM_MCI_CAPABILITIES DriverCapabilities
 
ARM_DRIVER_MCI Driver_MCI0
 

Macro Definition Documentation

#define ARM_MCI_DRV_VERSION   ARM_DRIVER_VERSION_MAJOR_MINOR(1,1) /* driver version */
#define MCI_BUS_MODE_HS   0U
#define MemoryCard_CD_Pin_Active   GPIO_PIN_RESET
#define MemoryCard_WP_Pin_Active   GPIO_PIN_SET

Function Documentation

int32_t AbortTransfer ( void  )
static
Returns
execution_status
int32_t CardPower ( uint32_t  voltage)
static
Parameters
[in]voltageMemory Card supply voltage
Returns
execution_status
int32_t Control ( uint32_t  control,
uint32_t  arg 
)
static
Parameters
[in]controlOperation
[in]argArgument of operation (optional)
Returns
execution_status
static ARM_MCI_CAPABILITIES GetCapabilities ( void  )
static
ARM_MCI_STATUS GetStatus ( void  )
static
Returns
MCI status ARM_MCI_STATUS
ARM_DRV_VERSION GetVersion ( void  )
static
Returns
ARM_DRV_VERSION
int32_t Initialize ( ARM_MCI_SignalEvent_t  cb_event)
static
Parameters
[in]cb_eventPointer to ARM_MCI_SignalEvent
Returns
execution_status
int32_t PowerControl ( ARM_POWER_STATE  state)
static
Parameters
[in]statePower state ARM_POWER_STATE
Returns
execution_status
int32_t ReadCD ( void  )
static
Returns
1:card detected, 0:card not detected, or error
int32_t ReadWP ( void  )
static
Returns
1:write protected, 0:not write protected, or error
static void RX_DMA_Complete ( struct __DMA_HandleTypeDef *  hdma)
static
void SDMMC1_IRQHandler ( void  )
int32_t SendCommand ( uint32_t  cmd,
uint32_t  arg,
uint32_t  flags,
uint32_t *  response 
)
static
Parameters
[in]cmdMemory Card command
[in]argCommand argument
[in]flagsCommand flags
[out]responsePointer to buffer for response
Returns
execution_status
int32_t SetupTransfer ( uint8_t *  data,
uint32_t  block_count,
uint32_t  block_size,
uint32_t  mode 
)
static
Parameters
[in,out]dataPointer to data block(s) to be written or read
[in]block_countNumber of blocks
[in]block_sizeSize of a block in bytes
[in]modeTransfer mode
Returns
execution_status
int32_t Uninitialize ( void  )
static
Returns
execution_status

Variable Documentation

ARM_DRIVER_MCI Driver_MCI0
Initial value:
= {
}
static int32_t SetupTransfer(uint8_t *data, uint32_t block_count, uint32_t block_size, uint32_t mode)
Setup read or write transfer operation.
Definition: MCI_STM32L4xx.c:488
static int32_t Uninitialize(void)
De-initialize Memory Card Interface.
Definition: MCI_STM32L4xx.c:231
static int32_t AbortTransfer(void)
Abort current read/write data transfer.
Definition: MCI_STM32L4xx.c:579
static int32_t Initialize(ARM_MCI_SignalEvent_t cb_event)
Initialize the Memory Card Interface.
Definition: MCI_STM32L4xx.c:207
static int32_t ReadCD(void)
Read Card Detect (CD) state.
Definition: MCI_STM32L4xx.c:352
static ARM_MCI_STATUS GetStatus(void)
Get MCI status.
Definition: MCI_STM32L4xx.c:765
static int32_t PowerControl(ARM_POWER_STATE state)
Control Memory Card Interface Power.
Definition: MCI_STM32L4xx.c:256
static ARM_MCI_CAPABILITIES GetCapabilities(void)
Definition: MCI_STM32L4xx.c:196
static ARM_DRIVER_VERSION GetVersion(void)
Get driver version.
Definition: MCI_STM32L4xx.c:186
static int32_t Control(uint32_t control, uint32_t arg)
Control MCI Interface.
Definition: MCI_STM32L4xx.c:628
static int32_t ReadWP(void)
Read Write Protect (WP) state.
Definition: MCI_STM32L4xx.c:372
static int32_t CardPower(uint32_t voltage)
Set Memory Card supply voltage.
Definition: MCI_STM32L4xx.c:339
static int32_t SendCommand(uint32_t cmd, uint32_t arg, uint32_t flags, uint32_t *response)
Send Command to card and get the response.
Definition: MCI_STM32L4xx.c:399
const ARM_MCI_CAPABILITIES DriverCapabilities
static
const ARM_DRIVER_VERSION DriverVersion
static
Initial value:
= {
ARM_MCI_API_VERSION,
}
#define ARM_MCI_DRV_VERSION
Definition: MCI_STM32L4xx.c:107
DMA_HandleTypeDef hdma_sdmmc1_rx
DMA_HandleTypeDef hdma_sdmmc1_tx
SD_HandleTypeDef hsd1
MCI_INFO MCI
static