Print card CID in storage info (#2227)
This commit is contained in:
@@ -779,25 +779,10 @@ uint8_t SD_GetCIDRegister(SD_CID* Cid) {
|
||||
Cid->ManufacturerID = CID_Tab[0];
|
||||
|
||||
/* Byte 1 */
|
||||
Cid->OEM_AppliID = CID_Tab[1] << 8;
|
||||
|
||||
/* Byte 2 */
|
||||
Cid->OEM_AppliID |= CID_Tab[2];
|
||||
memcpy(Cid->OEM_AppliID, CID_Tab + 1, 2);
|
||||
|
||||
/* Byte 3 */
|
||||
Cid->ProdName1 = CID_Tab[3] << 24;
|
||||
|
||||
/* Byte 4 */
|
||||
Cid->ProdName1 |= CID_Tab[4] << 16;
|
||||
|
||||
/* Byte 5 */
|
||||
Cid->ProdName1 |= CID_Tab[5] << 8;
|
||||
|
||||
/* Byte 6 */
|
||||
Cid->ProdName1 |= CID_Tab[6];
|
||||
|
||||
/* Byte 7 */
|
||||
Cid->ProdName2 = CID_Tab[7];
|
||||
memcpy(Cid->ProdName, CID_Tab + 3, 5);
|
||||
|
||||
/* Byte 8 */
|
||||
Cid->ProdRev = CID_Tab[8];
|
||||
@@ -815,11 +800,12 @@ uint8_t SD_GetCIDRegister(SD_CID* Cid) {
|
||||
Cid->ProdSN |= CID_Tab[12];
|
||||
|
||||
/* Byte 13 */
|
||||
Cid->Reserved1 |= (CID_Tab[13] & 0xF0) >> 4;
|
||||
Cid->ManufactDate = (CID_Tab[13] & 0x0F) << 8;
|
||||
Cid->Reserved1 = (CID_Tab[13] & 0xF0) >> 4;
|
||||
Cid->ManufactYear = (CID_Tab[13] & 0x0F) << 4;
|
||||
|
||||
/* Byte 14 */
|
||||
Cid->ManufactDate |= CID_Tab[14];
|
||||
Cid->ManufactYear |= (CID_Tab[14] & 0xF0) >> 4;
|
||||
Cid->ManufactMonth = (CID_Tab[14] & 0x0F);
|
||||
|
||||
/* Byte 15 */
|
||||
Cid->CID_CRC = (CID_Tab[15] & 0xFE) >> 1;
|
||||
@@ -837,6 +823,21 @@ uint8_t SD_GetCIDRegister(SD_CID* Cid) {
|
||||
return retr;
|
||||
}
|
||||
|
||||
uint8_t BSP_SD_GetCIDRegister(SD_CID* Cid) {
|
||||
uint8_t retr = BSP_SD_ERROR;
|
||||
|
||||
/* Slow speed init */
|
||||
furi_hal_spi_acquire(&furi_hal_spi_bus_handle_sd_slow);
|
||||
furi_hal_sd_spi_handle = &furi_hal_spi_bus_handle_sd_slow;
|
||||
|
||||
memset(Cid, 0, sizeof(SD_CID));
|
||||
retr = SD_GetCIDRegister(Cid);
|
||||
|
||||
furi_hal_sd_spi_handle = NULL;
|
||||
furi_hal_spi_release(&furi_hal_spi_bus_handle_sd_slow);
|
||||
return retr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Sends 5 bytes command to the SD card and get response
|
||||
* @param Cmd: The user expected command to send to SD card.
|
||||
|
@@ -133,16 +133,16 @@ typedef struct {
|
||||
* @brief Card Identification Data: CID Register
|
||||
*/
|
||||
typedef struct {
|
||||
__IO uint8_t ManufacturerID; /* ManufacturerID */
|
||||
__IO uint16_t OEM_AppliID; /* OEM/Application ID */
|
||||
__IO uint32_t ProdName1; /* Product Name part1 */
|
||||
__IO uint8_t ProdName2; /* Product Name part2*/
|
||||
__IO uint8_t ProdRev; /* Product Revision */
|
||||
__IO uint32_t ProdSN; /* Product Serial Number */
|
||||
__IO uint8_t Reserved1; /* Reserved1 */
|
||||
__IO uint16_t ManufactDate; /* Manufacturing Date */
|
||||
__IO uint8_t CID_CRC; /* CID CRC */
|
||||
__IO uint8_t Reserved2; /* always 1 */
|
||||
uint8_t ManufacturerID; /* ManufacturerID */
|
||||
char OEM_AppliID[2]; /* OEM/Application ID */
|
||||
char ProdName[5]; /* Product Name */
|
||||
uint8_t ProdRev; /* Product Revision */
|
||||
uint32_t ProdSN; /* Product Serial Number */
|
||||
uint8_t Reserved1; /* Reserved1 */
|
||||
uint8_t ManufactYear; /* Manufacturing Year */
|
||||
uint8_t ManufactMonth; /* Manufacturing Month */
|
||||
uint8_t CID_CRC; /* CID CRC */
|
||||
uint8_t Reserved2; /* always 1 */
|
||||
} SD_CID;
|
||||
|
||||
/**
|
||||
@@ -207,6 +207,7 @@ uint8_t
|
||||
uint8_t BSP_SD_Erase(uint32_t StartAddr, uint32_t EndAddr);
|
||||
uint8_t BSP_SD_GetCardState(void);
|
||||
uint8_t BSP_SD_GetCardInfo(SD_CardInfo* pCardInfo);
|
||||
uint8_t BSP_SD_GetCIDRegister(SD_CID* Cid);
|
||||
|
||||
/* Link functions for SD Card peripheral*/
|
||||
void SD_SPI_Slow_Init(void);
|
||||
|
Reference in New Issue
Block a user