mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-10-02 14:23:19 +08:00
[device][mmcsd] Fix Arm Compiler 5 build compatibility #11690
This commit is contained in:
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -8,12 +8,15 @@
|
||||
* 2023-08-08 GuEe-GUI first version
|
||||
*/
|
||||
|
||||
#include <rtthread.h>
|
||||
|
||||
#include "blk_dfs.h"
|
||||
|
||||
#include <dfs_file.h>
|
||||
#include <drivers/classes/block.h>
|
||||
|
||||
#if defined(RT_USING_POSIX_DEVIO) && defined(RT_USING_DFS_V2)
|
||||
#include <dfs_file.h>
|
||||
|
||||
struct blk_fops_data
|
||||
{
|
||||
struct rt_device_blk_geometry geometry;
|
||||
@@ -55,7 +58,8 @@ static int blk_fops_ioctl(struct dfs_file *file, int cmd, void *arg)
|
||||
|
||||
static ssize_t blk_fops_read(struct dfs_file *file, void *buf, size_t count, off_t *pos)
|
||||
{
|
||||
void *rbuf;
|
||||
rt_uint8_t *rbuf;
|
||||
rt_uint8_t *read_buf = buf;
|
||||
rt_ssize_t res = 0;
|
||||
int bytes_per_sector, blk_pos, first_offs, rsize = 0;
|
||||
struct rt_device *dev = file->vnode->data;
|
||||
@@ -82,7 +86,7 @@ static ssize_t blk_fops_read(struct dfs_file *file, void *buf, size_t count, off
|
||||
{
|
||||
rsize = count;
|
||||
}
|
||||
rt_memcpy(buf, rbuf + first_offs, rsize);
|
||||
rt_memcpy(read_buf, rbuf + first_offs, rsize);
|
||||
++blk_pos;
|
||||
|
||||
/*
|
||||
@@ -99,12 +103,12 @@ static ssize_t blk_fops_read(struct dfs_file *file, void *buf, size_t count, off
|
||||
|
||||
if (count - rsize >= bytes_per_sector)
|
||||
{
|
||||
rt_memcpy(buf + rsize, rbuf, bytes_per_sector);
|
||||
rt_memcpy(read_buf + rsize, rbuf, bytes_per_sector);
|
||||
rsize += bytes_per_sector;
|
||||
}
|
||||
else
|
||||
{
|
||||
rt_memcpy(buf + rsize, rbuf, count - rsize);
|
||||
rt_memcpy(read_buf + rsize, rbuf, count - rsize);
|
||||
rsize = count;
|
||||
}
|
||||
}
|
||||
@@ -120,7 +124,8 @@ static ssize_t blk_fops_read(struct dfs_file *file, void *buf, size_t count, off
|
||||
|
||||
static ssize_t blk_fops_write(struct dfs_file *file, const void *buf, size_t count, off_t *pos)
|
||||
{
|
||||
void *rbuf;
|
||||
rt_uint8_t *rbuf;
|
||||
const rt_uint8_t *write_buf = buf;
|
||||
rt_ssize_t res = 0;
|
||||
int bytes_per_sector, blk_pos, first_offs, wsize = 0;
|
||||
struct rt_device *dev = file->vnode->data;
|
||||
@@ -150,7 +155,7 @@ static ssize_t blk_fops_write(struct dfs_file *file, const void *buf, size_t cou
|
||||
|
||||
if (res == 1)
|
||||
{
|
||||
rt_memcpy(rbuf + first_offs, buf, wsize);
|
||||
rt_memcpy(rbuf + first_offs, write_buf, wsize);
|
||||
res = rt_device_write(dev, blk_pos, (const void *)rbuf, 1);
|
||||
|
||||
if (res == 1)
|
||||
@@ -174,7 +179,8 @@ _goon:
|
||||
*/
|
||||
if ((count - wsize) / bytes_per_sector != 0)
|
||||
{
|
||||
res = rt_device_write(dev, blk_pos, buf + wsize, (count - wsize) / bytes_per_sector);
|
||||
res = rt_device_write(dev, blk_pos, write_buf + wsize,
|
||||
(count - wsize) / bytes_per_sector);
|
||||
|
||||
if (res != (count - wsize) / bytes_per_sector)
|
||||
{
|
||||
@@ -198,7 +204,7 @@ _goon:
|
||||
|
||||
if (res == 1)
|
||||
{
|
||||
rt_memcpy(rbuf, buf + wsize, count - wsize);
|
||||
rt_memcpy(rbuf, write_buf + wsize, count - wsize);
|
||||
res = rt_device_write(dev, blk_pos, (const void *)rbuf, 1);
|
||||
|
||||
if (res == 1)
|
||||
@@ -229,8 +235,7 @@ static int blk_fops_poll(struct dfs_file *file, struct rt_pollreq *req)
|
||||
return mask;
|
||||
}
|
||||
|
||||
const static struct dfs_file_ops blk_fops =
|
||||
{
|
||||
const static struct dfs_file_ops blk_fops = {
|
||||
.open = blk_fops_open,
|
||||
.close = blk_fops_close,
|
||||
.ioctl = blk_fops_ioctl,
|
||||
|
||||
@@ -93,8 +93,11 @@ rt_inline int pmbr_part_valid(gpt_mbr_record *part)
|
||||
*/
|
||||
static int is_pmbr_valid(legacy_mbr *mbr, rt_size_t total_sectors)
|
||||
{
|
||||
rt_uint32_t sz = 0;
|
||||
int part = 0, ret = 0; /* invalid by default */
|
||||
rt_uint32_t sz = 0;
|
||||
rt_uint32_t disk_size;
|
||||
int part = 0, ret = 0; /* invalid by default */
|
||||
|
||||
disk_size = total_sectors - 1 > RT_UINT32_MAX ? RT_UINT32_MAX : (rt_uint32_t)(total_sectors - 1);
|
||||
|
||||
if (!mbr || rt_le16_to_cpu(mbr->signature) != MSDOS_MBR_SIGNATURE)
|
||||
{
|
||||
@@ -148,10 +151,10 @@ _check_hybrid:
|
||||
{
|
||||
sz = rt_le32_to_cpu(mbr->partition_record[part].size_in_lba);
|
||||
|
||||
if (sz != (rt_uint32_t)total_sectors - 1 && sz != 0xffffffff)
|
||||
if (sz != disk_size && sz != RT_UINT32_MAX)
|
||||
{
|
||||
LOG_W("GPT: mbr size in lba (%u) different than whole disk (%u)",
|
||||
sz, rt_min_t(rt_uint32_t, total_sectors - 1, 0xffffffff));
|
||||
sz, disk_size);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,9 +175,9 @@ static rt_size_t read_lba(struct rt_blk_disk *disk,
|
||||
rt_uint64_t lba, rt_uint8_t *buffer, rt_size_t count)
|
||||
{
|
||||
rt_uint32_t lbs;
|
||||
rt_ssize_t cap_ss, lbs_ss;
|
||||
rt_size_t totalreadcount = 0;
|
||||
rt_uint8_t *secbuf = RT_NULL;
|
||||
rt_ssize_t cap_ss, lbs_ss;
|
||||
rt_size_t totalreadcount = 0;
|
||||
rt_uint8_t *secbuf = RT_NULL;
|
||||
rt_uint64_t capacity, disk_bytes, n512;
|
||||
|
||||
if (!buffer || count == 0)
|
||||
@@ -189,7 +192,7 @@ static rt_size_t read_lba(struct rt_blk_disk *disk,
|
||||
return 0;
|
||||
}
|
||||
|
||||
lbs = (rt_uint32_t)lbs_ss;
|
||||
lbs = (rt_uint32_t)lbs_ss;
|
||||
capacity = (rt_uint64_t)cap_ss;
|
||||
|
||||
if (lbs < 512 || (lbs % 512) != 0)
|
||||
@@ -203,7 +206,7 @@ static rt_size_t read_lba(struct rt_blk_disk *disk,
|
||||
}
|
||||
|
||||
disk_bytes = capacity * (rt_uint64_t)lbs;
|
||||
n512 = lba * ((rt_uint64_t)lbs / 512);
|
||||
n512 = lba * ((rt_uint64_t)lbs / 512);
|
||||
|
||||
secbuf = rt_malloc(lbs);
|
||||
if (!secbuf)
|
||||
@@ -213,8 +216,8 @@ static rt_size_t read_lba(struct rt_blk_disk *disk,
|
||||
|
||||
while (count > 0)
|
||||
{
|
||||
int copied = 512;
|
||||
rt_ssize_t rd;
|
||||
int copied = 512;
|
||||
rt_ssize_t rd;
|
||||
rt_uint32_t off;
|
||||
rt_uint64_t log_sec, byte_off = n512 * 512;
|
||||
|
||||
@@ -234,7 +237,7 @@ static rt_size_t read_lba(struct rt_blk_disk *disk,
|
||||
}
|
||||
|
||||
log_sec = byte_off / lbs;
|
||||
off = (rt_uint32_t)(byte_off % lbs);
|
||||
off = (rt_uint32_t)(byte_off % lbs);
|
||||
|
||||
if (off + (rt_uint32_t)copied <= lbs)
|
||||
{
|
||||
@@ -264,9 +267,9 @@ static rt_size_t read_lba(struct rt_blk_disk *disk,
|
||||
rt_memcpy(buffer + first, secbuf, copied - first);
|
||||
}
|
||||
|
||||
buffer += copied;
|
||||
buffer += copied;
|
||||
totalreadcount += copied;
|
||||
count -= copied;
|
||||
count -= copied;
|
||||
++n512;
|
||||
}
|
||||
|
||||
@@ -282,10 +285,10 @@ static rt_size_t read_lba(struct rt_blk_disk *disk,
|
||||
* @return ptes on success, null on error.
|
||||
*/
|
||||
static gpt_entry *alloc_read_gpt_entries(struct rt_blk_disk *disk,
|
||||
gpt_header *gpt)
|
||||
gpt_header *gpt)
|
||||
{
|
||||
rt_size_t count;
|
||||
gpt_entry *pte;
|
||||
rt_size_t count;
|
||||
gpt_entry *pte;
|
||||
rt_uint64_t entry_lba;
|
||||
|
||||
if (!gpt)
|
||||
@@ -333,7 +336,7 @@ static gpt_header *alloc_read_gpt_header(struct rt_blk_disk *disk, rt_uint64_t l
|
||||
{
|
||||
gpt_header *gpt;
|
||||
rt_uint32_t ssz;
|
||||
rt_ssize_t lbs_ss = rt_blk_disk_get_logical_block_size(disk);
|
||||
rt_ssize_t lbs_ss = rt_blk_disk_get_logical_block_size(disk);
|
||||
|
||||
if (lbs_ss <= 0)
|
||||
{
|
||||
@@ -375,7 +378,7 @@ static rt_bool_t is_gpt_valid(struct rt_blk_disk *disk,
|
||||
{
|
||||
rt_uint32_t crc, origcrc;
|
||||
rt_uint64_t lastlba, pt_size;
|
||||
rt_ssize_t logical_block_size;
|
||||
rt_ssize_t logical_block_size;
|
||||
|
||||
if (!ptes)
|
||||
{
|
||||
@@ -427,9 +430,9 @@ static rt_bool_t is_gpt_valid(struct rt_blk_disk *disk,
|
||||
}
|
||||
|
||||
/* Check the GUID Partition Table CRC */
|
||||
origcrc = rt_le32_to_cpu((*gpt)->header_crc32);
|
||||
origcrc = rt_le32_to_cpu((*gpt)->header_crc32);
|
||||
(*gpt)->header_crc32 = 0;
|
||||
crc = efi_crc32((const rt_uint8_t *)(*gpt), rt_le32_to_cpu((*gpt)->header_size));
|
||||
crc = efi_crc32((const rt_uint8_t *)(*gpt), rt_le32_to_cpu((*gpt)->header_size));
|
||||
|
||||
if (crc != origcrc)
|
||||
{
|
||||
@@ -695,13 +698,13 @@ static void compare_gpts(struct rt_blk_disk *disk,
|
||||
static rt_bool_t find_valid_gpt(struct rt_blk_disk *disk,
|
||||
gpt_header **gpt, gpt_entry **ptes)
|
||||
{
|
||||
int good_pgpt = 0, good_agpt = 0, good_pmbr = 0;
|
||||
int good_pgpt = 0, good_agpt = 0, good_pmbr = 0;
|
||||
gpt_header *pgpt = RT_NULL, *agpt = RT_NULL;
|
||||
gpt_entry *pptes = RT_NULL, *aptes = RT_NULL;
|
||||
gpt_entry *pptes = RT_NULL, *aptes = RT_NULL;
|
||||
legacy_mbr *legacymbr;
|
||||
rt_ssize_t cap_ss = rt_blk_disk_get_capacity(disk);
|
||||
rt_size_t total_sectors;
|
||||
rt_size_t lastlba;
|
||||
rt_ssize_t cap_ss = rt_blk_disk_get_capacity(disk);
|
||||
rt_size_t total_sectors;
|
||||
rt_size_t lastlba;
|
||||
|
||||
if (!ptes)
|
||||
{
|
||||
@@ -766,7 +769,7 @@ static rt_bool_t find_valid_gpt(struct rt_blk_disk *disk,
|
||||
/* The good cases */
|
||||
if (good_pgpt)
|
||||
{
|
||||
*gpt = pgpt;
|
||||
*gpt = pgpt;
|
||||
*ptes = pptes;
|
||||
rt_free(agpt);
|
||||
rt_free(aptes);
|
||||
@@ -780,7 +783,7 @@ static rt_bool_t find_valid_gpt(struct rt_blk_disk *disk,
|
||||
}
|
||||
else if (good_agpt)
|
||||
{
|
||||
*gpt = agpt;
|
||||
*gpt = agpt;
|
||||
*ptes = aptes;
|
||||
rt_free(pgpt);
|
||||
rt_free(pptes);
|
||||
@@ -796,7 +799,7 @@ _fail:
|
||||
rt_free(pptes);
|
||||
rt_free(aptes);
|
||||
|
||||
*gpt = RT_NULL;
|
||||
*gpt = RT_NULL;
|
||||
*ptes = RT_NULL;
|
||||
|
||||
return RT_FALSE;
|
||||
@@ -805,8 +808,8 @@ _fail:
|
||||
rt_err_t efi_partition(struct rt_blk_disk *disk)
|
||||
{
|
||||
rt_uint32_t entries_nr;
|
||||
gpt_header *gpt = RT_NULL;
|
||||
gpt_entry *ptes = RT_NULL;
|
||||
gpt_header *gpt = RT_NULL;
|
||||
gpt_entry *ptes = RT_NULL;
|
||||
|
||||
if (!find_valid_gpt(disk, &gpt, &ptes) || !gpt || !ptes)
|
||||
{
|
||||
@@ -821,8 +824,8 @@ rt_err_t efi_partition(struct rt_blk_disk *disk)
|
||||
for (int i = 0; i < entries_nr && i < disk->max_partitions; ++i)
|
||||
{
|
||||
rt_uint64_t start = rt_le64_to_cpu(ptes[i].starting_lba);
|
||||
rt_uint64_t size = rt_le64_to_cpu(ptes[i].ending_lba) -
|
||||
rt_le64_to_cpu(ptes[i].starting_lba) + 1ULL;
|
||||
rt_uint64_t size = rt_le64_to_cpu(ptes[i].ending_lba) -
|
||||
rt_le64_to_cpu(ptes[i].starting_lba) + 1ULL;
|
||||
|
||||
if (!is_pte_valid(&ptes[i], last_lba(disk)))
|
||||
{
|
||||
|
||||
@@ -40,9 +40,9 @@ struct rt_blk_disk
|
||||
struct rt_dm_ida *ida;
|
||||
#endif
|
||||
|
||||
rt_uint32_t read_only:1;
|
||||
rt_uint32_t parallel_io:1;
|
||||
rt_uint32_t removable:1;
|
||||
rt_uint32_t read_only : 1;
|
||||
rt_uint32_t parallel_io : 1;
|
||||
rt_uint32_t removable : 1;
|
||||
#define RT_BLK_DISK_MAGIC 0xbdaabdaa
|
||||
rt_uint32_t __magic;
|
||||
|
||||
@@ -62,9 +62,9 @@ struct rt_blk_disk
|
||||
struct rt_blk_disk_ops
|
||||
{
|
||||
rt_ssize_t (*read)(struct rt_blk_disk *disk, rt_off_t sector, void *buffer,
|
||||
rt_size_t sector_count);
|
||||
rt_size_t sector_count);
|
||||
rt_ssize_t (*write)(struct rt_blk_disk *disk, rt_off_t sector, const void *buffer,
|
||||
rt_size_t sector_count);
|
||||
rt_size_t sector_count);
|
||||
rt_err_t (*getgeome)(struct rt_blk_disk *disk, struct rt_device_blk_geometry *geometry);
|
||||
rt_err_t (*sync)(struct rt_blk_disk *disk);
|
||||
rt_err_t (*erase)(struct rt_blk_disk *disk);
|
||||
@@ -73,7 +73,18 @@ struct rt_blk_disk_ops
|
||||
};
|
||||
|
||||
#ifndef __DFS_H__
|
||||
#ifdef RT_USING_DFS
|
||||
#include <dfs_fs.h>
|
||||
#else
|
||||
/* Keep the legacy name available when the block layer is used without DFS. */
|
||||
struct dfs_partition
|
||||
{
|
||||
rt_uint8_t type;
|
||||
rt_off_t offset;
|
||||
rt_size_t size;
|
||||
rt_sem_t lock;
|
||||
};
|
||||
#endif /* RT_USING_DFS */
|
||||
|
||||
/**
|
||||
* @brief Logical blk device, if you don't used DFS it will be defined by default.
|
||||
@@ -132,4 +143,4 @@ rt_ssize_t rt_blk_disk_get_logical_block_size(struct rt_blk_disk *disk);
|
||||
|
||||
/*! @}*/
|
||||
|
||||
#endif /* __BLK_H__ */
|
||||
#endif /* __BLK_H__ */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -17,28 +17,28 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
/* class 1 */
|
||||
#define GO_IDLE_STATE 0 /* bc */
|
||||
#define SEND_OP_COND 1 /* bcr [31:0] OCR R3 */
|
||||
#define ALL_SEND_CID 2 /* bcr R2 */
|
||||
#define SET_RELATIVE_ADDR 3 /* ac [31:16] RCA R1 */
|
||||
#define SET_DSR 4 /* bc [31:16] RCA */
|
||||
#define SWITCH 6 /* ac [31:0] See below R1b */
|
||||
#define SELECT_CARD 7 /* ac [31:16] RCA R1 */
|
||||
#define SEND_EXT_CSD 8 /* adtc R1 */
|
||||
#define SEND_CSD 9 /* ac [31:16] RCA R2 */
|
||||
#define SEND_CID 10 /* ac [31:16] RCA R2 */
|
||||
#define VOLTAGE_SWITCH 11 /* ac [31:0] R1 */
|
||||
#define STOP_TRANSMISSION 12 /* ac R1b */
|
||||
#define SEND_STATUS 13 /* ac [31:16] RCA R1 */
|
||||
#define GO_INACTIVE_STATE 15 /* ac [31:16] RCA */
|
||||
#define SPI_READ_OCR 58 /* spi spi_R3 */
|
||||
#define SPI_CRC_ON_OFF 59 /* spi [0:0] flag spi_R1 */
|
||||
#define GO_IDLE_STATE 0 /* bc */
|
||||
#define SEND_OP_COND 1 /* bcr [31:0] OCR R3 */
|
||||
#define ALL_SEND_CID 2 /* bcr R2 */
|
||||
#define SET_RELATIVE_ADDR 3 /* ac [31:16] RCA R1 */
|
||||
#define SET_DSR 4 /* bc [31:16] RCA */
|
||||
#define MMC_SWITCH 6 /* ac [31:0] See below R1b */
|
||||
#define SELECT_CARD 7 /* ac [31:16] RCA R1 */
|
||||
#define SEND_EXT_CSD 8 /* adtc R1 */
|
||||
#define SEND_CSD 9 /* ac [31:16] RCA R2 */
|
||||
#define SEND_CID 10 /* ac [31:16] RCA R2 */
|
||||
#define VOLTAGE_SWITCH 11 /* ac [31:0] R1 */
|
||||
#define STOP_TRANSMISSION 12 /* ac R1b */
|
||||
#define SEND_STATUS 13 /* ac [31:16] RCA R1 */
|
||||
#define GO_INACTIVE_STATE 15 /* ac [31:16] RCA */
|
||||
#define SPI_READ_OCR 58 /* spi spi_R3 */
|
||||
#define SPI_CRC_ON_OFF 59 /* spi [0:0] flag spi_R1 */
|
||||
|
||||
/* class 2 */
|
||||
#define SET_BLOCKLEN 16 /* ac [31:0] block len R1 */
|
||||
#define READ_SINGLE_BLOCK 17 /* adtc [31:0] data addr R1 */
|
||||
#define READ_MULTIPLE_BLOCK 18 /* adtc [31:0] data addr R1 */
|
||||
#define SEND_TUNING_BLOCK 19 /* adtc R1 */
|
||||
#define SET_BLOCKLEN 16 /* ac [31:0] block len R1 */
|
||||
#define READ_SINGLE_BLOCK 17 /* adtc [31:0] data addr R1 */
|
||||
#define READ_MULTIPLE_BLOCK 18 /* adtc [31:0] data addr R1 */
|
||||
#define SEND_TUNING_BLOCK 19 /* adtc R1 */
|
||||
#define SEND_TUNING_BLOCK_HS200 21 /* adtc R1*/
|
||||
/* class 3 */
|
||||
#define WRITE_DAT_UNTIL_STOP 20 /* adtc [31:0] data addr R1 */
|
||||
@@ -51,77 +51,77 @@ extern "C" {
|
||||
#define PROGRAM_CSD 27 /* adtc R1 */
|
||||
|
||||
/* class 6 */
|
||||
#define SET_WRITE_PROT 28 /* ac [31:0] data addr R1b */
|
||||
#define CLR_WRITE_PROT 29 /* ac [31:0] data addr R1b */
|
||||
#define SEND_WRITE_PROT 30 /* adtc [31:0] wpdata addr R1 */
|
||||
#define SET_WRITE_PROT 28 /* ac [31:0] data addr R1b */
|
||||
#define CLR_WRITE_PROT 29 /* ac [31:0] data addr R1b */
|
||||
#define SEND_WRITE_PROT 30 /* adtc [31:0] wpdata addr R1 */
|
||||
|
||||
/* class 5 */
|
||||
#define ERASE_GROUP_START 35 /* ac [31:0] data addr R1 */
|
||||
#define ERASE_GROUP_END 36 /* ac [31:0] data addr R1 */
|
||||
#define ERASE 38 /* ac R1b */
|
||||
#define ERASE_GROUP_START 35 /* ac [31:0] data addr R1 */
|
||||
#define ERASE_GROUP_END 36 /* ac [31:0] data addr R1 */
|
||||
#define ERASE 38 /* ac R1b */
|
||||
|
||||
/* class 9 */
|
||||
#define FAST_IO 39 /* ac <Complex> R4 */
|
||||
#define GO_IRQ_STATE 40 /* bcr R5 */
|
||||
#define FAST_IO 39 /* ac <Complex> R4 */
|
||||
#define GO_IRQ_STATE 40 /* bcr R5 */
|
||||
|
||||
/* class 7 */
|
||||
#define LOCK_UNLOCK 42 /* adtc R1b */
|
||||
#define LOCK_UNLOCK 42 /* adtc R1b */
|
||||
|
||||
/* class 8 */
|
||||
#define APP_CMD 55 /* ac [31:16] RCA R1 */
|
||||
#define GEN_CMD 56 /* adtc [0] RD/WR R1 */
|
||||
#define APP_CMD 55 /* ac [31:16] RCA R1 */
|
||||
#define GEN_CMD 56 /* adtc [0] RD/WR R1 */
|
||||
|
||||
|
||||
/* SD commands type argument response */
|
||||
/* class 0 */
|
||||
/* This is basically the same command as for MMC with some quirks. */
|
||||
#define SD_SEND_RELATIVE_ADDR 3 /* bcr R6 */
|
||||
#define SD_SEND_IF_COND 8 /* bcr [11:0] See below R7 */
|
||||
#define SD_SEND_RELATIVE_ADDR 3 /* bcr R6 */
|
||||
#define SD_SEND_IF_COND 8 /* bcr [11:0] See below R7 */
|
||||
|
||||
/* class 10 */
|
||||
#define SD_SWITCH 6 /* adtc [31:0] See below R1 */
|
||||
#define SD_SWITCH 6 /* adtc [31:0] See below R1 */
|
||||
|
||||
/* Application commands */
|
||||
#define SD_APP_SET_BUS_WIDTH 6 /* ac [1:0] bus width R1 */
|
||||
#define SD_APP_SEND_NUM_WR_BLKS 22 /* adtc R1 */
|
||||
#define SD_APP_OP_COND 41 /* bcr [31:0] OCR R3 */
|
||||
#define SD_APP_SEND_SCR 51 /* adtc R1 */
|
||||
#define SD_APP_SET_BUS_WIDTH 6 /* ac [1:0] bus width R1 */
|
||||
#define SD_APP_SEND_NUM_WR_BLKS 22 /* adtc R1 */
|
||||
#define SD_APP_OP_COND 41 /* bcr [31:0] OCR R3 */
|
||||
#define SD_APP_SEND_SCR 51 /* adtc R1 */
|
||||
|
||||
#define SCR_SPEC_VER_0 0 /* Implements system specification 1.0 - 1.01 */
|
||||
#define SCR_SPEC_VER_1 1 /* Implements system specification 1.10 */
|
||||
#define SCR_SPEC_VER_2 2 /* Implements system specification 2.00 */
|
||||
#define SCR_SPEC_VER_0 0 /* Implements system specification 1.0 - 1.01 */
|
||||
#define SCR_SPEC_VER_1 1 /* Implements system specification 1.10 */
|
||||
#define SCR_SPEC_VER_2 2 /* Implements system specification 2.00 */
|
||||
|
||||
|
||||
/* SDIO commands type argument response */
|
||||
#define SD_IO_SEND_OP_COND 5 /* bcr [23:0] OCR R4 */
|
||||
#define SD_IO_RW_DIRECT 52 /* ac [31:0] See below R5 */
|
||||
#define SD_IO_RW_EXTENDED 53 /* adtc [31:0] See below R5 */
|
||||
#define SD_IO_SEND_OP_COND 5 /* bcr [23:0] OCR R4 */
|
||||
#define SD_IO_RW_DIRECT 52 /* ac [31:0] See below R5 */
|
||||
#define SD_IO_RW_EXTENDED 53 /* adtc [31:0] See below R5 */
|
||||
|
||||
|
||||
/* CMD52 arguments */
|
||||
#define SDIO_ARG_CMD52_READ (0<<31)
|
||||
#define SDIO_ARG_CMD52_WRITE (1u<<31)
|
||||
#define SDIO_ARG_CMD52_FUNC_SHIFT 28
|
||||
#define SDIO_ARG_CMD52_FUNC_MASK 0x7
|
||||
#define SDIO_ARG_CMD52_RAW_FLAG (1u<<27)
|
||||
#define SDIO_ARG_CMD52_REG_SHIFT 9
|
||||
#define SDIO_ARG_CMD52_REG_MASK 0x1ffff
|
||||
#define SDIO_ARG_CMD52_DATA_SHIFT 0
|
||||
#define SDIO_ARG_CMD52_DATA_MASK 0xff
|
||||
#define SDIO_R5_DATA(resp) ((resp)[0] & 0xff)
|
||||
#define SDIO_ARG_CMD52_READ (0 << 31)
|
||||
#define SDIO_ARG_CMD52_WRITE (1u << 31)
|
||||
#define SDIO_ARG_CMD52_FUNC_SHIFT 28
|
||||
#define SDIO_ARG_CMD52_FUNC_MASK 0x7
|
||||
#define SDIO_ARG_CMD52_RAW_FLAG (1u << 27)
|
||||
#define SDIO_ARG_CMD52_REG_SHIFT 9
|
||||
#define SDIO_ARG_CMD52_REG_MASK 0x1ffff
|
||||
#define SDIO_ARG_CMD52_DATA_SHIFT 0
|
||||
#define SDIO_ARG_CMD52_DATA_MASK 0xff
|
||||
#define SDIO_R5_DATA(resp) ((resp)[0] & 0xff)
|
||||
|
||||
/* CMD53 arguments */
|
||||
#define SDIO_ARG_CMD53_READ (0<<31)
|
||||
#define SDIO_ARG_CMD53_WRITE (1u<<31)
|
||||
#define SDIO_ARG_CMD53_FUNC_SHIFT 28
|
||||
#define SDIO_ARG_CMD53_FUNC_MASK 0x7
|
||||
#define SDIO_ARG_CMD53_BLOCK_MODE (1u<<27)
|
||||
#define SDIO_ARG_CMD53_INCREMENT (1u<<26)
|
||||
#define SDIO_ARG_CMD53_REG_SHIFT 9
|
||||
#define SDIO_ARG_CMD53_REG_MASK 0x1ffff
|
||||
#define SDIO_ARG_CMD53_LENGTH_SHIFT 0
|
||||
#define SDIO_ARG_CMD53_LENGTH_MASK 0x1ff
|
||||
#define SDIO_ARG_CMD53_LENGTH_MAX 511
|
||||
#define SDIO_ARG_CMD53_READ (0 << 31)
|
||||
#define SDIO_ARG_CMD53_WRITE (1u << 31)
|
||||
#define SDIO_ARG_CMD53_FUNC_SHIFT 28
|
||||
#define SDIO_ARG_CMD53_FUNC_MASK 0x7
|
||||
#define SDIO_ARG_CMD53_BLOCK_MODE (1u << 27)
|
||||
#define SDIO_ARG_CMD53_INCREMENT (1u << 26)
|
||||
#define SDIO_ARG_CMD53_REG_SHIFT 9
|
||||
#define SDIO_ARG_CMD53_REG_MASK 0x1ffff
|
||||
#define SDIO_ARG_CMD53_LENGTH_SHIFT 0
|
||||
#define SDIO_ARG_CMD53_LENGTH_MASK 0x1ff
|
||||
#define SDIO_ARG_CMD53_LENGTH_MAX 511
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user