Skip to content

Commit 5c899a3

Browse files
cy-opmKyle Kearney
authored andcommitted
Bug fixes to interrupt/event handling in SDHC HAL
1 parent 8ad377a commit 5c899a3

File tree

2 files changed

+137
-81
lines changed

2 files changed

+137
-81
lines changed

targets/TARGET_Cypress/TARGET_PSOC6/psoc6csp/hal/include/cyhal_sdhc.h

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -76,23 +76,23 @@ typedef enum
7676

7777
/** SDHC interrupt triggers */
7878
typedef enum {
79-
CYHAL_SDHC_CMD_COMPLETE, //!> Command Complete
80-
CYHAL_SDHC_XFER_COMPLETE, //!> Host read/write transfer is complete
81-
CYHAL_SDHC_BGAP_EVENT, //!> This bit is set when both read/write transaction is stopped
82-
CYHAL_SDHC_DMA_INTERRUPT, //!> Host controller detects an SDMA Buffer Boundary during transfer
83-
CYHAL_SDHC_BUF_WR_READY, //!> This bit is set if the Buffer Write Enable changes from 0 to 1
84-
CYHAL_SDHC_BUF_RD_READY, //!> This bit is set if the Buffer Read Enable changes from 0 to 1
85-
CYHAL_SDHC_CARD_INSERTION, //!> This bit is set if the Card Inserted in the Present State
86-
CYHAL_SDHC_CARD_REMOVAL, //!> This bit is set if the Card Inserted in the Present State
87-
CYHAL_SDHC_CARD_INTERRUPT, //!> The synchronized value of the DAT[1] interrupt input for SD mode
88-
CYHAL_SDHC_INT_A,
89-
CYHAL_SDHC_INT_B,
90-
CYHAL_SDHC_INT_C,
91-
CYHAL_SDHC_RE_TUNE_EVENT, //!> This bit is set if the Re-Tuning Request changes from 0 to 1
92-
CYHAL_SDHC_FX_EVENT, //!> This status is set when R[14] of response register is set to 1
93-
CYHAL_SDHC_CQE_EVENT, //!> This status is set if Command Queuing/Crypto event has occurred
94-
CYHAL_SDHC_ERR_INTERRUPT, //!> If any of the bits in the Error Interrupt Status register are set
95-
CYHAL_SDHC_ALL_INTERRUPTS, //!> Is used to enable/disable all interrupts
79+
CYHAL_SDHC_CMD_COMPLETE = 0x0001, //!> Command Complete
80+
CYHAL_SDHC_XFER_COMPLETE = 0x0002, //!> Host read/write transfer is complete
81+
CYHAL_SDHC_BGAP_EVENT = 0x0004, //!> This bit is set when both read/write transaction is stopped at the block gap
82+
CYHAL_SDHC_DMA_INTERRUPT = 0x0008, //!> Host controller detects an SDMA Buffer Boundary during transfer
83+
CYHAL_SDHC_BUF_WR_READY = 0x0010, //!> This bit is set if the Buffer Write Enable changes from 0 to 1
84+
CYHAL_SDHC_BUF_RD_READY = 0x0020, //!> This bit is set if the Buffer Read Enable changes from 0 to 1
85+
CYHAL_SDHC_CARD_INSERTION = 0x0040, //!> This bit is set if the Card Inserted in the Present State register changes from 0 to 1.
86+
CYHAL_SDHC_CARD_REMOVAL = 0x0080, //!> This bit is set if the Card Inserted in the Present State register changes from 1 to 0.
87+
CYHAL_SDHC_CARD_INTERRUPT = 0x0100, //!> The synchronized value of the DAT[1] interrupt input for SD mode
88+
CYHAL_SDHC_INT_A = 0x0200,
89+
CYHAL_SDHC_INT_B = 0x0400,
90+
CYHAL_SDHC_INT_C = 0x0800,
91+
CYHAL_SDHC_RE_TUNE_EVENT = 0x1000, //!> This bit is set if the Re-Tuning Request changes from 0 to 1
92+
CYHAL_SDHC_FX_EVENT = 0x2000, //!> This status is set when R[14] of response register is set to 1
93+
CYHAL_SDHC_CQE_EVENT = 0x4000, //!> This status is set if Command Queuing/Crypto event has occurred
94+
CYHAL_SDHC_ERR_INTERRUPT = 0x8000, //!> If any of the bits in the Error Interrupt Status register are set
95+
CYHAL_SDHC_ALL_INTERRUPTS = 0xFFFF, //!> Is used to enable/disable all interrupts
9696
} cyhal_sdhc_event_t;
9797

9898
/** \} group_hal_sdhc_enums */
@@ -121,7 +121,7 @@ typedef struct
121121
{
122122
bool enableLedControl; //!< Drive one IO to indicate when the card is being accessed
123123
bool lowVoltageSignaling; //!< Whether 1.8V signaling is supported
124-
bool isEmmc; //!< true if eMMC card, other way false
124+
bool isEmmc; //!< true if eMMC card, otherwise false
125125
uint8_t busWidth; //!< The desired bus width
126126
} cyhal_sdhc_config_t;
127127

@@ -186,7 +186,7 @@ void cyhal_sdhc_free(cyhal_sdhc_t *obj);
186186
* @param[in] obj The SDHC object
187187
* @param[in] address The address to read data from
188188
* @param[out] data Pointer to the byte-array of data to read from the device
189-
* @param[in,out] length Number of bytes to read, updated with the number actually read
189+
* @param[in,out] length Number of 512 byte blocks to read, updated with the number actually read
190190
* @return The status of the read request
191191
*/
192192
cy_rslt_t cyhal_sdhc_read(const cyhal_sdhc_t *obj, uint32_t address, uint8_t *data, size_t *length);
@@ -196,7 +196,7 @@ cy_rslt_t cyhal_sdhc_read(const cyhal_sdhc_t *obj, uint32_t address, uint8_t *da
196196
* @param[in] obj The SDHC object
197197
* @param[in] address The address to write data to
198198
* @param[in] data Pointer to the byte-array of data to write to the device
199-
* @param[in,out] length Number of bytes to read, updated with the number actually read
199+
* @param[in,out] length Number of 512 byte blocks to write, updated with the number actually written
200200
* @return The status of the write request
201201
*/
202202
cy_rslt_t cyhal_sdhc_write(const cyhal_sdhc_t *obj, uint32_t address, const uint8_t *data, size_t *length);
@@ -205,7 +205,7 @@ cy_rslt_t cyhal_sdhc_write(const cyhal_sdhc_t *obj, uint32_t address, const uint
205205
*
206206
* @param[in] obj The SDHC object
207207
* @param[in] startAddr Is the address of the first byte to erase
208-
* @param[in] length The number of bytes (starting at startAddr) to erase
208+
* @param[in] length Number of 512 byte blocks (starting at startAddr) to erase
209209
* @return The status of the erase request
210210
*/
211211
cy_rslt_t cyhal_sdhc_erase(const cyhal_sdhc_t *obj, uint32_t startAddr, size_t length);
@@ -215,7 +215,7 @@ cy_rslt_t cyhal_sdhc_erase(const cyhal_sdhc_t *obj, uint32_t startAddr, size_t l
215215
* @param[in] obj The SDHC object that holds the transfer information
216216
* @param[in] address The address to read data from
217217
* @param[out] data The receive buffer
218-
* @param[in,out] length Number of bytes to read, updated with the number actually read
218+
* @param[in,out] length Number of 512 byte blocks to read, updated with the number actually read
219219
* @return The status of the read_async request
220220
*/
221221
cy_rslt_t cyhal_sdhc_read_async(const cyhal_sdhc_t *obj, uint32_t address, uint8_t *data, size_t *length);
@@ -225,7 +225,7 @@ cy_rslt_t cyhal_sdhc_read_async(const cyhal_sdhc_t *obj, uint32_t address, uint8
225225
* @param[in] obj The SDHC object that holds the transfer information
226226
* @param[in] address The address to write data to
227227
* @param[in] data The transmit buffer
228-
* @param[in,out] length Number of bytes to read, updated with the number actually read
228+
* @param[in,out] length The number of 512 byte blocks to write, updated with the number actually written
229229
* @return The status of the write_async request
230230
*/
231231
cy_rslt_t cyhal_sdhc_write_async(const cyhal_sdhc_t *obj, uint32_t address, const uint8_t *data, size_t *length);

0 commit comments

Comments
 (0)