DCMD_SDMMC_GEN_CMD

Updated: April 19, 2023

Send a general command to the device

Synopsis:

#include <hw/dcmd_sim_sdmmc.h>

#define DCMD_SDMMC_GEN_CMD	__DIOTF(_DCMD_CAM, _SIM_SDMMC + 12, struct _sdmmc_gen_cmd)

Arguments to devctl():

Argument Value
filedes A file descriptor that you obtained by opening the device
dcmd DCMD_SDMMC_GEN_CMD
dev_data_ptr A pointer to an SDMMC_GEN_CMD that's followed by a buffer
n_bytes sizeof(SDMMC_GEN_CMD) plus the size of the buffer
dev_info_ptr NULL

Description:

This is a general command whose meaning, expected input data, and output data are defined by the vendor. For instance, this command could extract vendor-specific device health information, or configure a proprietary mechanism such as refresh.

The SDMMC_GEN_CMD structure is defined as follows:

typedef struct _sdmmc_gen_cmd {
        uint32_t                 arg;
        uint16_t                 flags;
        uint16_t                 blklen;
/*      uint8_t                  data[0];        variable-length data */
} SDMMC_GEN_CMD;

The members include:

arg
Additional command arguments, as defined by the vendor.
flags
Flags indicating the data direction and whether there is a chained command.

On input, this field must contain either SDMMC_GENCMD_READ for reading or SDMMC_GENCMD_WRITE for writing, and may also contain SDMMC_GENCMD_NEXT to indicate there is a chained command.

The SDMMC_GENCMD_DIR mask can be used to extract the data direction bit.

blklen
The length of the data field that follows this structure.

Input:

Fill in the arg, flags, and blklen members. Any data that is to be sent to the device must be written into the data field that follows the command structure. The format of the data is vendor-specific.

Output:

The buffer that data points to is filled with the response, and blklen is set to its length. The contents and format of the data are vendor-specific.

See also:

devctl() in the QNX Neutrino C Library Reference