This is an automated email from the ASF dual-hosted git repository. gustavonihei pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
The following commit(s) were added to refs/heads/master by this push: new fb92621 drivers/mmcsd: Add RPMB ioctl fb92621 is described below commit fb9262196252ad8f08156148981500d42923c9d7 Author: Xiang Xiao <xiaoxi...@xiaomi.com> AuthorDate: Mon Sep 6 21:15:19 2021 +0800 drivers/mmcsd: Add RPMB ioctl Signed-off-by: Xiang Xiao <xiaoxi...@xiaomi.com> --- include/nuttx/fs/ioctl.h | 6 ++++++ include/nuttx/mmcsd.h | 44 ++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 48 insertions(+), 2 deletions(-) diff --git a/include/nuttx/fs/ioctl.h b/include/nuttx/fs/ioctl.h index 74a529b..fc37683 100644 --- a/include/nuttx/fs/ioctl.h +++ b/include/nuttx/fs/ioctl.h @@ -88,6 +88,7 @@ #define _EFUSEBASE (0x3000) /* Efuse device ioctl commands */ #define _MTRIOBASE (0x3100) /* Motor device ioctl commands */ #define _MATHIOBASE (0x3200) /* MATH device ioctl commands */ +#define _MMCSDIOBASE (0x3300) /* MMCSD device ioctl commands */ #define _WLIOCBASE (0x8b00) /* Wireless modules ioctl network commands */ /* boardctl() commands share the same number space */ @@ -555,6 +556,11 @@ #define _MATHIOCVALID(c) (_IOC_TYPE(c) == _MATHIOBASE) #define _MATHIOC(nr) _IOC(_MATHIOBASE, nr) +/* MMCSD drivers ************************************************************/ + +#define _MMCSDIOCVALID(c) (_IOC_TYPE(c) == _MMCSDIOBASE) +#define _MMCSDIOC(nr) _IOC(_MMCSDIOBASE, nr) + /* Wireless driver network ioctl definitions ********************************/ /* (see nuttx/include/wireless/wireless.h */ diff --git a/include/nuttx/mmcsd.h b/include/nuttx/mmcsd.h index 8868f10..6ee185e 100644 --- a/include/nuttx/mmcsd.h +++ b/include/nuttx/mmcsd.h @@ -27,6 +27,47 @@ #include <nuttx/config.h> +#include <stdint.h> +#include <nuttx/fs/ioctl.h> + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* mmcsd ioctl */ + +#define MMC_RPMB_TRANSFER _MMCSDIOC(0x0000) + +/* rpmb request */ + +#define MMC_RPMB_WRITE_KEY 0x01 +#define MMC_RPMB_READ_CNT 0x02 +#define MMC_RPMB_WRITE 0x03 +#define MMC_RPMB_READ 0x04 + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +struct mmc_rpmb_frame_s +{ + uint8_t stuff[196]; + uint8_t key_mac[32]; + uint8_t data[256]; + uint8_t nonce[16]; + uint32_t write_counter; + uint16_t addr; + uint16_t block_count; + uint16_t result; + uint16_t req_resp; +}; + +struct mmc_rpmb_transfer_s +{ + unsigned int num_of_frames; + struct mmc_rpmb_frame_s frames[0]; +}; + /**************************************************************************** * Public Functions Definitions ****************************************************************************/ @@ -76,8 +117,7 @@ int mmcsd_slotinitialize(int minor, FAR struct sdio_dev_s *dev); ****************************************************************************/ struct spi_dev_s; /* See nuttx/spi/spi.h */ -int mmcsd_spislotinitialize(int minor, - int slotno, +int mmcsd_spislotinitialize(int minor, int slotno, FAR struct spi_dev_s *spi); #undef EXTERN