Updated: October 28, 2024 |
Get card ID information
#include <hw/dcmd_sim_mmcsd.h> #define DCMD_MMCSD_GET_CID __DIOTF(_DCMD_CAM, _SIM_MMCSD + 0, struct _mmcsd_cid)
Argument | Value |
---|---|
filedes | A file descriptor that you obtained by opening the device |
dcmd | DCMD_MMCSD_GET_CID |
dev_data_ptr | A pointer to a MMCSD_CID structure (see below) |
n_bytes | sizeof(MMCSD_CID) |
dev_info_ptr | NULL |
This command gets the card ID information from the device. The MMCSD_CID structure is defined as follows:
#define MMCSD_MAX_SLOTNAME_LEN 32 /* CID reg values of the card */ typedef struct _mmcsd_cid { uint32_t flags; uint8_t rsvd[4]; union{ struct{ uint32_t cid[4]; }full_cid; union{ struct{ uint8_t mid; /* Manufacture ID */ uint8_t oid[3]; /* OEM/Application ID */ uint8_t pnm[6]; /* Product name */ uint8_t prv; /* Product revision */ uint32_t psn; /* Product serial number */ uint16_t mdt; /* Manufacture date */ }sd_cid; struct{ uint32_t mid; /* Manufacture ID */ uint16_t oid; /* OEM ID */ uint8_t pnm[8]; /* Product name */ uint8_t hwr; /* HW revision */ uint8_t fwr; /* FW revision */ uint32_t psn; /* Product serial number */ uint8_t mcd; /* Month code */ uint16_t ycd; /* Year code */ }mmc_cid; }parsed_cid; }cid; pid_t pid; /* Store PID of driver process for this device */ uint32_t speed; /* Card speed currently working at */ uint32_t media_change; /* Media change counter */ uint8_t hwspec_version; /* physical layer spec */ uint8_t csd_version; /* CSD structure version */ uint8_t mmcprot_version; /* MMC proto version */ uint8_t type; /* card type, MMC or SD for now */ char slotname[MMCSD_MAX_SLOTNAME_LEN]; /* slot name */ } MMCSD_CID;
Some of the special values for these members include:
Zero the entire structure, and then set the flags member to a bitwise OR of MMCSD_FULL_CID, MMCSD_ECC_INFO, and MMCSD_CARD_STATUS, as required.
A filled-in MMCSD_CID structure.