DCMD_MMCSD_GET_CID

Get card ID information

Synopsis:

#include <hw/dcmd_sim_mmcsd.h>

#define DCMD_MMCSD_GET_CID   __DIOTF(_DCMD_CAM, _SIM_MMCSD + 0, struct _mmcsd_cid)

Arguments to devctl():

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

Description:

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:

flags
The bits include:
  • MMCSD_FULL_CID — request a raw/full CID instead of a parsed CID
  • MMCSD_ECC_INFO — request ECC error information
  • MMCSD_CARD_STATUS — request an MMC_SEND_STATUS command to see if the card is alive
  • MMCSD_DEV_RDONLY — write protected
  • MMCSD_DEV_NO_MEDIA — no media inserted
  • MMCSD_DEV_RDY — the media is ready to accept I/O
  • MMCSD_DEV_PRELOAD — the device is in the slot before the driver started
  • MMCSD_DEV_LOCKED — the device is locked
  • MMCSD_DEV_MEDIA_ERROR — the device is inserted but there were error when identifying it
  • MMCSD_DEV_ECC — the device has an ECC error
type
MMCSD_CARD_TYPE_UNKNOWN, MMCSD_CARD_TYPE_MMC, or MMCSD_CARD_TYPE_SD. This indicates which member of the parsed_cid union to examine.

Input:

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.

Output:

A filled-in MMCSD_CID structure.

See also:

DCMD_MMCSD_GET_CID_RAW

devctl() in the QNX Neutrino C Library Reference