#define MMC_INTERFACE "mmc"
SIM_INTERFACE(mmc) {
#if !defined(PYWRAP)
int (*send_command)(conf_object_t *obj, uint8 cmd, uint32 args,
buffer_t response);
int (*read_data)(conf_object_t *obj, buffer_t data);
#endif
int (*write_data)(conf_object_t *obj, bytes_t data);
};
Interface that should be implemented by all MMC/SD/SDHC/SDIO card models.
send_command: sends a 5-byte command to the card (1-byte command index and 4 bytes command arguments). Caller provides the response length. Card fills in actual response data. The response data is 0, 6 or 17 bytes, in big-endian (see the MMC/SD specification for details). Return value: number of response bytes, -1 if the command wasn't accepted (e.g. command is not supported or illegal in current state, or command is not supported or illegal for current card type).
read_data: reads data. Caller provides the length. Return value: the card fills in the provided buffer, and returns the number of bytes actually read, which might be less than the buffer length in case of error.
write_data: writes data. Caller provides in both length and data. Return value: number of bytes actually written, which might be less than the provided data length in case of error.