![]() |
Altera HWLIB
16.0
The Altera HW Manager API Reference Manual
|
The declarations and functions in this group provide general purpose control and status functions for the SD/MMC Controller.
Data Structures | |
struct | ALT_SDMMC_CARD_INFO_s |
struct | ALT_SDMMC_CMD_CONFIG_s |
struct | ALT_SDMMC_RESPONSE_s |
Typedefs | |
typedef enum ALT_SDMMC_CARD_TYPE_e | ALT_SDMMC_CARD_TYPE_t |
typedef struct ALT_SDMMC_CARD_INFO_s | ALT_SDMMC_CARD_INFO_t |
typedef enum ALT_SDMMC_CMD_TYPE_e | ALT_SDMMC_CMD_TYPE_t |
typedef enum ALT_SDMMC_TRANSFER_SPEED_e | ALT_SDMMC_TRANSFER_SPEED_t |
typedef enum ALT_SDMMC_CMD_INDEX_e | ALT_SDMMC_CMD_INDEX_t |
typedef struct ALT_SDMMC_CMD_CONFIG_s | ALT_SDMMC_CMD_CONFIG_t |
typedef struct ALT_SDMMC_RESPONSE_s | ALT_SDMMC_RESPONSE_t |
typedef enum ALT_SDMMC_INT_STATUS_e | ALT_SDMMC_INT_STATUS_t |
Functions | |
ALT_STATUS_CODE | alt_sdmmc_init (void) |
ALT_STATUS_CODE | alt_sdmmc_uninit (void) |
ALT_STATUS_CODE | alt_sdmmc_reset (void) |
ALT_STATUS_CODE | alt_sdmmc_command_send (ALT_SDMMC_CMD_TYPE_t command_type, ALT_SDMMC_CMD_INDEX_t command, uint32_t command_arg, uint32_t *response) |
ALT_STATUS_CODE | alt_sdmmc_read_long_response (ALT_SDMMC_RESPONSE_t *response) |
uint32_t | alt_sdmmc_int_status_get (void) |
uint32_t | alt_sdmmc_int_mask_get (void) |
ALT_STATUS_CODE | alt_sdmmc_int_clear (const uint32_t mask) |
ALT_STATUS_CODE | alt_sdmmc_int_disable (const uint32_t mask) |
ALT_STATUS_CODE | alt_sdmmc_int_enable (const uint32_t mask) |
struct ALT_SDMMC_CARD_INFO_s |
This type defines a structure to hold identification and type information for a card connected to the SD/MMC controller.
Data Fields | ||
---|---|---|
ALT_SDMMC_CARD_TYPE_t | card_type | Type of the card |
uint32_t | rca | Releative Card Address (RCA) |
uint32_t | xfer_speed | The maximum data transfer rate (bit/s) |
uint32_t | max_r_blkln | Max read data block length |
uint32_t | max_w_blkln | Max write data block length |
bool | partial_r_allowed | Partial blocks for read allowed |
bool | partial_w_allowed | Partial blocks for write allowed |
bool | high_speed | 50MHz high speed allowed |
uint32_t | scr_sd_spec | SD_SPEC field in SCR register |
uint32_t | csd_ccc | CCC field in CSD register |
uint32_t | blk_number_high | High 32-bit of total number of blocks |
uint32_t | blk_number_low | Low 32-bit of total number of blocks. Total number of blocks calculated from C_SIZE_MULT and C_SIZE field in CSD register version 1.0: blk_number = (C_SIZE + 1) * (1 << (C_SIZE_MULT + 2)). memory capacity = blk_number_low * max_r_blnln. Total number of blocks calculated from C_SIZE in CSD register version 2.0: blk_number_high = ((C_SIZE+1) * 1024) >> 32. blk_number_low = ((C_SIZE+1) * 1024) & 0xFFFFFFFF. memory capacity = (block_number_high << 32 | block_number_low) * 512 byte |
uint32_t | scr_bus_widths | SD_BUS_WIDTHS field in SCR register |
struct ALT_SDMMC_CMD_CONFIG_s |
This type defines a structure for command with options.
struct ALT_SDMMC_RESPONSE_s |
This type defines a structure for get long response of last last complete command.
typedef enum ALT_SDMMC_CARD_TYPE_e ALT_SDMMC_CARD_TYPE_t |
This type enumerates the possible card/device type that may be connected to the SD/MMC controller.
typedef struct ALT_SDMMC_CARD_INFO_s ALT_SDMMC_CARD_INFO_t |
This type defines a structure to hold identification and type information for a card connected to the SD/MMC controller.
typedef enum ALT_SDMMC_CMD_TYPE_e ALT_SDMMC_CMD_TYPE_t |
This type enumerates the SD/MMC basic commands, application specific commands etc.
typedef enum ALT_SDMMC_TRANSFER_SPEED_e ALT_SDMMC_TRANSFER_SPEED_t |
This type enumerates two common SD/MMC bus speeds for demonstration purpose only. It's not a complete list of actual bus speeds supported.
typedef enum ALT_SDMMC_CMD_INDEX_e ALT_SDMMC_CMD_INDEX_t |
This type enumerates the SDMMC evailable commands. Read specification to the appropriate card type
typedef struct ALT_SDMMC_CMD_CONFIG_s ALT_SDMMC_CMD_CONFIG_t |
This type defines a structure for command with options.
typedef struct ALT_SDMMC_RESPONSE_s ALT_SDMMC_RESPONSE_t |
This type defines a structure for get long response of last last complete command.
typedef enum ALT_SDMMC_INT_STATUS_e ALT_SDMMC_INT_STATUS_t |
This type definition enumerates the interrupt status conditions that contribute to the ALT_INT_INTERRUPT_SDMMC_IRQ signal state.
NOTE: Both the general purpose interrupt status conditions for the SD/MMC controller (ALT_SDMMC_INT_STATUS_t) and the interrupt status conditions for the internal DMA controller (ALT_SDMMC_DMA_INT_STATUS_t) contribute to the overall ALT_INT_INTERRUPT_SDMMC_IRQ signal state
This type enumerates the possible card/device type that may be connected to the SD/MMC controller.
enum ALT_SDMMC_CMD_TYPE_e |
This type enumerates the SDMMC evailable commands. Read specification to the appropriate card type
This type definition enumerates the interrupt status conditions that contribute to the ALT_INT_INTERRUPT_SDMMC_IRQ signal state.
NOTE: Both the general purpose interrupt status conditions for the SD/MMC controller (ALT_SDMMC_INT_STATUS_t) and the interrupt status conditions for the internal DMA controller (ALT_SDMMC_DMA_INT_STATUS_t) contribute to the overall ALT_INT_INTERRUPT_SDMMC_IRQ signal state
ALT_STATUS_CODE alt_sdmmc_init | ( | void | ) |
Initialize the SD/MMC controller.
Initializes the SD/MMC controller by gracefully bringing the controller out of reset. This function also initializes the registers, FIFO buffer pointers, DMA interface controls, and state machines in the controller. All interrupts are cleared and disabled (masked) and timeout parameters set to default values.
ALT_E_SUCCESS | The operation was successful. |
ALT_E_ERROR | The operation failed. |
ALT_STATUS_CODE alt_sdmmc_uninit | ( | void | ) |
Uninitializes the SD/MMC controller by stopping any data transfers in progress and putting the controller into reset.
ALT_E_SUCCESS | The operation was successful. |
ALT_E_ERROR | The operation failed. |
ALT_STATUS_CODE alt_sdmmc_reset | ( | void | ) |
Reset the SD/MMC controller by stopping any data transfers in progress and putting the controller into reset and reinit it after reset complete.
ALT_E_SUCCESS | The operation was successful. |
ALT_E_ERROR | The operation failed. |
ALT_STATUS_CODE alt_sdmmc_command_send | ( | ALT_SDMMC_CMD_TYPE_t | command_type, |
ALT_SDMMC_CMD_INDEX_t | command, | ||
uint32_t | command_arg, | ||
uint32_t * | response | ||
) |
Send the a command and command argument to the card and optionally return the command response.
command_type | The type of card command. |
command | The card command. |
command_arg | The card command argument. |
response | [out] A pointer to a 4 (32-bit) word to return the card command response. If NULL is passed then any card command response is ignored. |
ALT_E_SUCCESS | The operation was successful. |
ALT_E_ERROR | The operation failed. |
ALT_STATUS_CODE alt_sdmmc_read_long_response | ( | ALT_SDMMC_RESPONSE_t * | response | ) |
Get the long response of the last compleated command.
response | [out] Pointer to a ALT_SDMMC_RESPONSE_t structure to hold the long response. |
ALT_E_SUCCESS | Successful status. |
ALT_E_ERROR | Details about error status code |
uint32_t alt_sdmmc_int_status_get | ( | void | ) |
Returns the SD/MMC controller interrupt status register value which reflects interrupt controller interrupt status conditions before masking.
uint32_t alt_sdmmc_int_mask_get | ( | void | ) |
Returns the SD/MMC controller interrupt mask register value which reflects the enabled (i.e. unmasked) interrupt status conditions.
ALT_STATUS_CODE alt_sdmmc_int_clear | ( | const uint32_t | mask | ) |
Clears the specified SD/MMC controller interrupt status conditions identified in the mask.
This function clears one or more of the status conditions as contributors to the ALT_INT_INTERRUPT_SDMMC_IRQ interrupt signal state.
mask | Specifies the SD/MMC controller status conditions to clear. mask is a mask of logically OR'ed ALT_SDMMC_INT_STATUS_t values that designate the status conditions to clear. |
ALT_E_SUCCESS | Indicates successful completion. |
ALT_E_ERROR | Indicates an error occurred. |
ALT_STATUS_CODE alt_sdmmc_int_disable | ( | const uint32_t | mask | ) |
Disable the specified SD/MMC controller interrupt status conditions identified in the mask.
This function disables one or more of the status conditions as contributors to the ALT_INT_INTERRUPT_SDMMC_IRQ interrupt signal state.
NOTE: A cleared bit for any status condition in the mask value does not have the effect of enabling it as a contributor to the ALT_INT_INTERRUPT_SDMMC_IRQ interrupt signal state. The function alt_sdmmc_int_enable() is used to enable status source conditions.
mask | Specifies the status conditions to disable as interrupt source contributors. mask is a mask of logically OR'ed ALT_SDMMC_INT_STATUS_t values that designate the status conditions to disable. |
ALT_E_SUCCESS | Indicates successful completion. |
ALT_E_ERROR | Indicates an error occurred. |
ALT_STATUS_CODE alt_sdmmc_int_enable | ( | const uint32_t | mask | ) |
Enable the specified SD/MMC controller interrupt status conditions identified in the mask.
This function enables one or more of the status conditions as contributors to the ALT_INT_INTERRUPT_SDMMC_IRQ interrupt signal state.
NOTE: A cleared bit for any status condition in the mask value does not have the effect of disabling it as a contributor to the ALT_INT_INTERRUPT_SDMMC_IRQ interrupt signal state. The function alt_sdmmc_int_disable() is used to disable status source conditions.
mask | Specifies the status conditions to enable as interrupt source contributors. mask is a mask of logically OR'ed ALT_SDMMC_INT_STATUS_t values that designate the status conditions to enable. |
ALT_E_SUCCESS | Indicates successful completion. |
ALT_E_ERROR | Indicates an error occurred. |