summaryrefslogtreecommitdiff
path: root/components/drivers/include
diff options
context:
space:
mode:
authorguo <[email protected]>2022-12-03 12:07:44 +0800
committerGitHub <[email protected]>2022-12-03 12:07:44 +0800
commitecf2d8215961ca7c539132b62a72df6072cc3e14 (patch)
tree59005f0f74f2593c0435059264f624c862a89f55 /components/drivers/include
parentaaf5462c6d4ae9466a0a8cd2a4bb00cfe1fef2f2 (diff)
sync branch rt-smart. (#6641)
* Synchronize the code of the rt mart branch to the master branch. * TTY device * Add lwP code from rt-smart * Add vnode in DFS, but DFS will be re-write for rt-smart * There are three libcpu for rt-smart: * arm/cortex-a, arm/aarch64 * riscv64 Co-authored-by: Rbb666 <[email protected]> Co-authored-by: zhkag <[email protected]>
Diffstat (limited to 'components/drivers/include')
-rw-r--r--components/drivers/include/drivers/cputime.h4
-rw-r--r--components/drivers/include/drivers/gpt.h132
-rw-r--r--components/drivers/include/drivers/lcd.h111
-rw-r--r--components/drivers/include/drivers/mmcsd_card.h4
-rw-r--r--components/drivers/include/drivers/mmcsd_cmd.h3
-rw-r--r--components/drivers/include/drivers/mmcsd_core.h23
-rw-r--r--components/drivers/include/drivers/mmcsd_host.h53
-rw-r--r--components/drivers/include/drivers/rt_dev_bus.h18
-rw-r--r--components/drivers/include/drivers/serial.h2
-rw-r--r--components/drivers/include/drivers/serial_v2.h2
-rw-r--r--components/drivers/include/ipc/pipe.h8
-rw-r--r--components/drivers/include/ipc/waitqueue.h2
-rw-r--r--components/drivers/include/rtdevice.h4
13 files changed, 347 insertions, 19 deletions
diff --git a/components/drivers/include/drivers/cputime.h b/components/drivers/include/drivers/cputime.h
index ec98f3152e..bcc339ca35 100644
--- a/components/drivers/include/drivers/cputime.h
+++ b/components/drivers/include/drivers/cputime.h
@@ -22,8 +22,8 @@ struct rt_clock_cputime_ops
float clock_cpu_getres(void);
uint64_t clock_cpu_gettime(void);
-uint32_t clock_cpu_microsecond(uint32_t cpu_tick);
-uint32_t clock_cpu_millisecond(uint32_t cpu_tick);
+uint64_t clock_cpu_microsecond(uint64_t cpu_tick);
+uint64_t clock_cpu_millisecond(uint64_t cpu_tick);
int clock_cpu_setops(const struct rt_clock_cputime_ops *ops);
diff --git a/components/drivers/include/drivers/gpt.h b/components/drivers/include/drivers/gpt.h
new file mode 100644
index 0000000000..c1bdcb732a
--- /dev/null
+++ b/components/drivers/include/drivers/gpt.h
@@ -0,0 +1,132 @@
+/*
+ * Copyright (c) 2006-2021, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2022-05-05 linzhenxing first version
+ */
+#ifndef __GPT_H
+#define __GPT_H
+
+#include <rtthread.h>
+#include <stdint.h>
+
+typedef struct
+{
+ uint8_t b[16]; /* GUID 16 bytes*/
+} guid_t;
+
+#define MSDOS_MBR_SIGNATURE 0xaa55
+#define EFI_PMBR_OSTYPE_EFI 0xEF
+#define EFI_PMBR_OSTYPE_EFI_GPT 0xEE
+
+#define GPT_MBR_PROTECTIVE 1
+#define GPT_MBR_HYBRID 2
+
+#define GPT_HEADER_SIGNATURE 0x5452415020494645ULL
+#define GPT_HEADER_REVISION_V1 0x00010000
+#define GPT_PRIMARY_PARTITION_TABLE_LBA 1
+
+typedef guid_t gpt_guid_t __attribute__ ((aligned (4)));
+#define EFI_GUID(a, b, c, d...) (gpt_guid_t){ { \
+ (a) & 0xff, ((a) >> 8) & 0xff, ((a) >> 16) & 0xff, ((a) >> 24) & 0xff, \
+ (b) & 0xff, ((b) >> 8) & 0xff, \
+ (c) & 0xff, ((c) >> 8) & 0xff, d } }
+
+#define NULL_GUID \
+ EFI_GUID(0x00000000, 0x0000, 0x0000,\
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00)
+#define PARTITION_SYSTEM_GUID \
+ EFI_GUID( 0xC12A7328, 0xF81F, 0x11d2, \
+ 0xBA, 0x4B, 0x00, 0xA0, 0xC9, 0x3E, 0xC9, 0x3B)
+#define LEGACY_MBR_PARTITION_GUID \
+ EFI_GUID( 0x024DEE41, 0x33E7, 0x11d3, \
+ 0x9D, 0x69, 0x00, 0x08, 0xC7, 0x81, 0xF3, 0x9F)
+#define PARTITION_MSFT_RESERVED_GUID \
+ EFI_GUID( 0xE3C9E316, 0x0B5C, 0x4DB8, \
+ 0x81, 0x7D, 0xF9, 0x2D, 0xF0, 0x02, 0x15, 0xAE)
+#define PARTITION_BASIC_DATA_GUID \
+ EFI_GUID( 0xEBD0A0A2, 0xB9E5, 0x4433, \
+ 0x87, 0xC0, 0x68, 0xB6, 0xB7, 0x26, 0x99, 0xC7)
+#define PARTITION_LINUX_RAID_GUID \
+ EFI_GUID( 0xa19d880f, 0x05fc, 0x4d3b, \
+ 0xa0, 0x06, 0x74, 0x3f, 0x0f, 0x84, 0x91, 0x1e)
+#define PARTITION_LINUX_SWAP_GUID \
+ EFI_GUID( 0x0657fd6d, 0xa4ab, 0x43c4, \
+ 0x84, 0xe5, 0x09, 0x33, 0xc8, 0x4b, 0x4f, 0x4f)
+#define PARTITION_LINUX_LVM_GUID \
+ EFI_GUID( 0xe6d6d379, 0xf507, 0x44c2, \
+ 0xa2, 0x3c, 0x23, 0x8f, 0x2a, 0x3d, 0xf9, 0x28)
+#pragma pack(push, 1)
+typedef struct _gpt_header
+{
+ uint64_t signature;
+ uint32_t revision;
+ uint32_t header_size;
+ uint32_t header_crc32;
+ uint32_t reserved1;
+ uint64_t start_lba; /*GPT head start sector*/
+ uint64_t alternate_lba; /*GPT head alternate sector*/
+ uint64_t first_usable_lba;
+ uint64_t last_usable_lba;
+ gpt_guid_t disk_guid;
+ uint64_t partition_entry_lba;
+ uint32_t num_partition_entries;
+ uint32_t sizeof_partition_entry;
+ uint32_t partition_entry_array_crc32;
+
+ /* The rest of the logical block is reserved by UEFI and must be zero.
+ * EFI standard handles this by:
+ *
+ * uint8_t reserved2[ BlockSize - 92 ];
+ */
+} gpt_header;
+
+typedef struct _gpt_entry_attributes
+{
+ uint64_t required_to_function:1;
+ uint64_t reserved:47;
+ uint64_t type_guid_specific:16;
+} gpt_entry_attributes;
+
+typedef struct _gpt_entry
+{
+ gpt_guid_t partition_type_guid;
+ gpt_guid_t unique_partition_guid;
+ uint64_t starting_lba;
+ uint64_t ending_lba;
+ gpt_entry_attributes attributes;
+ uint16_t partition_name[72/sizeof(uint16_t)];
+} gpt_entry;
+
+typedef struct _gpt_mbr_record
+{
+ uint8_t boot_indicator; /* unused by EFI, set to 0x80 for bootable */
+ uint8_t start_head; /* unused by EFI, pt start in CHS */
+ uint8_t start_sector; /* unused by EFI, pt start in CHS */
+ uint8_t start_track;
+ uint8_t os_type; /* EFI and legacy non-EFI OS types */
+ uint8_t end_head; /* unused by EFI, pt end in CHS */
+ uint8_t end_sector; /* unused by EFI, pt end in CHS */
+ uint8_t end_track; /* unused by EFI, pt end in CHS */
+ uint32_t starting_lba; /* used by EFI - start addr of the on disk pt */
+ uint32_t size_in_lba; /* used by EFI - size of pt in LBA */
+} gpt_mbr_record;
+
+
+typedef struct _legacy_mbr
+{
+ uint8_t boot_code[440];
+ uint32_t unique_mbr_signature;
+ uint16_t unknown;
+ gpt_mbr_record partition_record[4];
+ uint16_t signature;
+} legacy_mbr;
+#pragma pack(pop)
+
+int check_gpt(struct rt_mmcsd_card *card);
+int gpt_get_partition_param(struct rt_mmcsd_card *card, struct dfs_partition *part, uint32_t pindex);
+void gpt_free(void);
+#endif /*__GPT_H*/
diff --git a/components/drivers/include/drivers/lcd.h b/components/drivers/include/drivers/lcd.h
new file mode 100644
index 0000000000..74d291feac
--- /dev/null
+++ b/components/drivers/include/drivers/lcd.h
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2006-2022, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2022-03-05 bernard first version.
+ */
+
+#ifndef RT_LCD_H__
+#define RT_LCD_H__
+
+/* ioctls
+ 0x46 is 'F' */
+
+#define FBIOGET_VSCREENINFO 0x4600
+#define FBIOPUT_VSCREENINFO 0x4601
+#define FBIOGET_FSCREENINFO 0x4602
+#define FBIOGETCMAP 0x4604
+#define FBIOPUTCMAP 0x4605
+#define FBIOPAN_DISPLAY 0x4606
+#define FBIO_CURSOR 0x4608
+/* #define FBIOGET_MONITORSPEC 0x460C */
+/* #define FBIOPUT_MONITORSPEC 0x460D */
+/* #define FBIOSWITCH_MONIBIT 0x460E */
+
+#define FBIOGET_CON2FBMAP 0x460F
+#define FBIOPUT_CON2FBMAP 0x4610
+#define FBIOBLANK 0x4611 /* arg: 0 or vesa level + 1 */
+#define FBIOGET_VBLANK 0x4612
+#define FBIO_ALLOC 0x4613
+#define FBIO_FREE 0x4614
+#define FBIOGET_GLYPH 0x4615
+#define FBIOGET_HWCINFO 0x4616
+#define FBIOPUT_MODEINFO 0x4617
+#define FBIOGET_DISPINFO 0x4618
+#define FBIO_WAITFORVSYNC 0x4620
+
+struct fb_bitfield
+{
+ uint32_t offset; /* beginning of bitfield */
+ uint32_t length; /* length of bitfield */
+ uint32_t msb_right; /* != 0 : Most significant bit is */
+ /* right */
+};
+
+struct fb_var_screeninfo
+{
+ uint32_t xres; /* visible resolution */
+ uint32_t yres;
+ uint32_t xres_virtual; /* virtual resolution */
+ uint32_t yres_virtual;
+ uint32_t xoffset; /* offset from virtual to visible */
+ uint32_t yoffset; /* resolution */
+
+ uint32_t bits_per_pixel; /* guess what */
+ uint32_t grayscale; /* 0 = color, 1 = grayscale, */
+ /* >1 = FOURCC */
+ struct fb_bitfield red; /* bitfield in fb mem if true color, */
+ struct fb_bitfield green; /* else only length is significant */
+ struct fb_bitfield blue;
+ struct fb_bitfield transp; /* transparency */
+
+ uint32_t nonstd; /* != 0 Non standard pixel format */
+
+ uint32_t activate; /* see FB_ACTIVATE_* */
+
+ uint32_t height; /* height of picture in mm */
+ uint32_t width; /* width of picture in mm */
+
+ uint32_t accel_flags; /* (OBSOLETE) see fb_info.flags */
+
+ /* Timing: All values in pixclocks, except pixclock (of course) */
+ uint32_t pixclock; /* pixel clock in ps (pico seconds) */
+ uint32_t left_margin; /* time from sync to picture */
+ uint32_t right_margin; /* time from picture to sync */
+ uint32_t upper_margin; /* time from sync to picture */
+ uint32_t lower_margin;
+ uint32_t hsync_len; /* length of horizontal sync */
+ uint32_t vsync_len; /* length of vertical sync */
+ uint32_t sync; /* see FB_SYNC_* */
+ uint32_t vmode; /* see FB_VMODE_* */
+ uint32_t rotate; /* angle we rotate counter clockwise */
+ uint32_t colorspace; /* colorspace for FOURCC-based modes */
+ uint32_t reserved[4]; /* Reserved for future compatibility */
+};
+
+struct fb_fix_screeninfo
+{
+ char id[16]; /* identification string eg "TT Builtin" */
+ unsigned long smem_start; /* Start of frame buffer mem */
+ /* (physical address) */
+ uint32_t smem_len; /* Length of frame buffer mem */
+ uint32_t type; /* see FB_TYPE_* */
+ uint32_t type_aux; /* Interleave for interleaved Planes */
+ uint32_t visual; /* see FB_VISUAL_* */
+ uint16_t xpanstep; /* zero if no hardware panning */
+ uint16_t ypanstep; /* zero if no hardware panning */
+ uint16_t ywrapstep; /* zero if no hardware ywrap */
+ uint32_t line_length; /* length of a line in bytes */
+ unsigned long mmio_start; /* Start of Memory Mapped I/O */
+ /* (physical address) */
+ uint32_t mmio_len; /* Length of Memory Mapped I/O */
+ uint32_t accel; /* Indicate to driver which */
+ /* specific chip/card we have */
+ uint16_t capabilities; /* see FB_CAP_* */
+ uint16_t reserved[2]; /* Reserved for future compatibility */
+};
+
+#endif
diff --git a/components/drivers/include/drivers/mmcsd_card.h b/components/drivers/include/drivers/mmcsd_card.h
index 8a49978a17..f877e60069 100644
--- a/components/drivers/include/drivers/mmcsd_card.h
+++ b/components/drivers/include/drivers/mmcsd_card.h
@@ -141,6 +141,7 @@ struct rt_mmcsd_card {
rt_uint32_t max_data_rate; /* max data transfer rate */
rt_uint32_t card_capacity; /* card capacity, unit:KB */
rt_uint32_t card_blksize; /* card block size */
+ rt_uint32_t card_sec_cnt; /* card sector count*/
rt_uint32_t erase_size; /* erase size in sectors */
rt_uint16_t card_type;
#define CARD_TYPE_MMC 0 /* MMC card */
@@ -152,7 +153,8 @@ struct rt_mmcsd_card {
#define CARD_FLAG_HIGHSPEED (1 << 0) /* SDIO bus speed 50MHz */
#define CARD_FLAG_SDHC (1 << 1) /* SDHC card */
#define CARD_FLAG_SDXC (1 << 2) /* SDXC card */
-
+#define CARD_FLAG_HIGHSPEED_DDR (1 << 3) /*HIGH SPEED DDR*/
+#define CARD_FLAG_HS200 (1 << 4) /* BUS SPEED 200mHz*/
struct rt_sd_scr scr;
struct rt_mmcsd_csd csd;
rt_uint32_t hs_max_data_rate; /* max data transfer rate in high speed mode */
diff --git a/components/drivers/include/drivers/mmcsd_cmd.h b/components/drivers/include/drivers/mmcsd_cmd.h
index 2993fe5406..2bd7b93ee1 100644
--- a/components/drivers/include/drivers/mmcsd_cmd.h
+++ b/components/drivers/include/drivers/mmcsd_cmd.h
@@ -37,7 +37,8 @@ extern "C" {
#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 */
diff --git a/components/drivers/include/drivers/mmcsd_core.h b/components/drivers/include/drivers/mmcsd_core.h
index 51263d35f2..04a6ffde2b 100644
--- a/components/drivers/include/drivers/mmcsd_core.h
+++ b/components/drivers/include/drivers/mmcsd_core.h
@@ -26,7 +26,8 @@ extern "C" {
#define mmcsd_dbg(fmt, ...)
#endif
-struct rt_mmcsd_data {
+struct rt_mmcsd_data
+{
rt_uint32_t blksize;
rt_uint32_t blks;
rt_uint32_t *buf;
@@ -43,9 +44,15 @@ struct rt_mmcsd_data {
rt_uint32_t timeout_ns;
rt_uint32_t timeout_clks;
+
+ void *sg; /* scatter list */
+ rt_uint16_t sg_len; /* size of scatter list */
+ rt_int16_t sg_count; /* mapped sg entries */
+ rt_ubase_t host_cookie; /* host driver private data */
};
-struct rt_mmcsd_cmd {
+struct rt_mmcsd_cmd
+{
rt_uint32_t cmd_code;
rt_uint32_t arg;
rt_uint32_t resp[4];
@@ -94,15 +101,20 @@ struct rt_mmcsd_cmd {
rt_int32_t retries; /* max number of retries */
rt_int32_t err;
+ unsigned int busy_timeout; /* busy detect timeout in ms */
struct rt_mmcsd_data *data;
struct rt_mmcsd_req *mrq; /* associated request */
};
-struct rt_mmcsd_req {
+struct rt_mmcsd_req
+{
struct rt_mmcsd_data *data;
struct rt_mmcsd_cmd *cmd;
struct rt_mmcsd_cmd *stop;
+ struct rt_mmcsd_cmd *sbc; /* SET_BLOCK_COUNT for multiblock */
+ /* Allow other commands during this ongoing data transfer or busy wait */
+ int cap_cmd_during_tfr;
};
/*the following is response bit*/
@@ -208,6 +220,7 @@ rt_inline rt_uint32_t __rt_fls(rt_uint32_t val)
#define MMCSD_HOST_PLUGED 0
#define MMCSD_HOST_UNPLUGED 1
+rt_int32_t mmcsd_excute_tuning(struct rt_mmcsd_card *card);
int mmcsd_wait_cd_changed(rt_int32_t timeout);
void mmcsd_host_lock(struct rt_mmcsd_host *host);
void mmcsd_host_unlock(struct rt_mmcsd_host *host);
@@ -226,14 +239,18 @@ void mmcsd_set_chip_select(struct rt_mmcsd_host *host, rt_int32_t mode);
void mmcsd_set_clock(struct rt_mmcsd_host *host, rt_uint32_t clk);
void mmcsd_set_bus_mode(struct rt_mmcsd_host *host, rt_uint32_t mode);
void mmcsd_set_bus_width(struct rt_mmcsd_host *host, rt_uint32_t width);
+void mmcsd_set_timing(struct rt_mmcsd_host *host, rt_uint32_t timing);
void mmcsd_set_data_timeout(struct rt_mmcsd_data *data, const struct rt_mmcsd_card *card);
rt_uint32_t mmcsd_select_voltage(struct rt_mmcsd_host *host, rt_uint32_t ocr);
void mmcsd_change(struct rt_mmcsd_host *host);
void mmcsd_detect(void *param);
+void mmcsd_host_init(struct rt_mmcsd_host *host);
struct rt_mmcsd_host *mmcsd_alloc_host(void);
void mmcsd_free_host(struct rt_mmcsd_host *host);
int rt_mmcsd_core_init(void);
+int rt_mmcsd_blk_init(void);
+rt_int32_t read_lba(struct rt_mmcsd_card *card, size_t lba, uint8_t *buffer, size_t count);
rt_int32_t rt_mmcsd_blk_probe(struct rt_mmcsd_card *card);
void rt_mmcsd_blk_remove(struct rt_mmcsd_card *card);
diff --git a/components/drivers/include/drivers/mmcsd_host.h b/components/drivers/include/drivers/mmcsd_host.h
index 44f7b1c916..774f515c8a 100644
--- a/components/drivers/include/drivers/mmcsd_host.h
+++ b/components/drivers/include/drivers/mmcsd_host.h
@@ -17,7 +17,8 @@
extern "C" {
#endif
-struct rt_mmcsd_io_cfg {
+struct rt_mmcsd_io_cfg
+{
rt_uint32_t clock; /* clock rate */
rt_uint16_t vdd;
@@ -45,21 +46,50 @@ struct rt_mmcsd_io_cfg {
#define MMCSD_BUS_WIDTH_1 0
#define MMCSD_BUS_WIDTH_4 2
#define MMCSD_BUS_WIDTH_8 3
-#define MMCSD_DDR_BUS_WIDTH_4 4
-#define MMCSD_DDR_BUS_WIDTH_8 5
+
+ unsigned char timing; /* timing specification used */
+
+#define MMCSD_TIMING_LEGACY 0
+#define MMCSD_TIMING_MMC_HS 1
+#define MMCSD_TIMING_SD_HS 2
+#define MMCSD_TIMING_UHS_SDR12 3
+#define MMCSD_TIMING_UHS_SDR25 4
+#define MMCSD_TIMING_UHS_SDR50 5
+#define MMCSD_TIMING_UHS_SDR104 6
+#define MMCSD_TIMING_UHS_DDR50 7
+#define MMCSD_TIMING_MMC_DDR52 8
+#define MMCSD_TIMING_MMC_HS200 9
+#define MMCSD_TIMING_MMC_HS400 10
+
+ unsigned char drv_type; /* driver type (A, B, C, D) */
+
+#define MMCSD_SET_DRIVER_TYPE_B 0
+#define MMCSD_SET_DRIVER_TYPE_A 1
+#define MMCSD_SET_DRIVER_TYPE_C 2
+#define MMCSD_SET_DRIVER_TYPE_D 3
+
+ unsigned char signal_voltage;
+
+#define MMCSD_SIGNAL_VOLTAGE_330 0
+#define MMCSD_SIGNAL_VOLTAGE_180 1
+#define MMCSD_SIGNAL_VOLTAGE_120 2
};
struct rt_mmcsd_host;
struct rt_mmcsd_req;
-struct rt_mmcsd_host_ops {
+struct rt_mmcsd_host_ops
+{
void (*request)(struct rt_mmcsd_host *host, struct rt_mmcsd_req *req);
void (*set_iocfg)(struct rt_mmcsd_host *host, struct rt_mmcsd_io_cfg *io_cfg);
rt_int32_t (*get_card_status)(struct rt_mmcsd_host *host);
void (*enable_sdio_irq)(struct rt_mmcsd_host *host, rt_int32_t en);
+ rt_int32_t (*execute_tuning)(struct rt_mmcsd_host *host, rt_int32_t opcode);
};
-struct rt_mmcsd_host {
+struct rt_mmcsd_host
+{
+ char name[RT_NAME_MAX];
struct rt_mmcsd_card *card;
const struct rt_mmcsd_host_ops *ops;
rt_uint32_t freq_min;
@@ -90,10 +120,15 @@ struct rt_mmcsd_host {
#define MMCSD_HOST_IS_SPI (1 << 3)
#define controller_is_spi(host) (host->flags & MMCSD_HOST_IS_SPI)
#define MMCSD_SUP_SDIO_IRQ (1 << 4) /* support signal pending SDIO IRQs */
-#define MMCSD_SUP_HIGHSPEED (1 << 5) /* support high speed */
-#define MMCSD_SUP_HIGHSPEED_DDR (1 << 6) /* support high speed(DDR) */
-#define MMCSD_SUP_HIGHSPEED_HS200 (1 << 7) /* support high speed HS200 */
-#define MMCSD_SUP_HIGHSPEED_HS400 (1 << 8) /* support high speed HS400 */
+#define MMCSD_SUP_HIGHSPEED (1 << 5) /* support high speed SDR*/
+#define MMCSD_SUP_DDR_3V3 (1 << 6)
+#define MMCSD_SUP_DDR_1V8 (1 << 7)
+#define MMCSD_SUP_DDR_1V2 (1 << 8)
+#define MMCSD_SUP_HIGHSPEED_DDR (MMCSD_SUP_DDR_3V3 | MMCSD_SUP_DDR_1V8 | MMCSD_SUP_DDR_1V2)/* HIGH SPEED DDR*/
+#define MMCSD_SUP_HS200_1V8 (1 << 9)
+#define MMCSD_SUP_HS200_1V2 (1 << 10)
+#define MMCSD_SUP_HS200 (MMCSD_SUP_HS200_1V2 | MMCSD_SUP_HS200_1V8) /* hs200 sdr */
+#define MMCSD_SUP_NONREMOVABLE (1 << 11)
rt_uint32_t max_seg_size; /* maximum size of one dma segment */
rt_uint32_t max_dma_segs; /* maximum number of dma segments in one request */
diff --git a/components/drivers/include/drivers/rt_dev_bus.h b/components/drivers/include/drivers/rt_dev_bus.h
new file mode 100644
index 0000000000..9fe8af893c
--- /dev/null
+++ b/components/drivers/include/drivers/rt_dev_bus.h
@@ -0,0 +1,18 @@
+/*
+ * Copyright (c) 2006-2022, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2022-10-13 flybreak the first version
+ */
+
+#ifndef __RT_DEV_BUS_H__
+#define __RT_DEV_BUS_H__
+#include <rtthread.h>
+
+rt_device_t rt_device_bus_create(char *name, int attach_size);
+rt_err_t rt_device_bus_destroy(rt_device_t dev);
+
+#endif /* __RT_BUS_H__ */
diff --git a/components/drivers/include/drivers/serial.h b/components/drivers/include/drivers/serial.h
index 3b0d4c80da..1d0b9afe5c 100644
--- a/components/drivers/include/drivers/serial.h
+++ b/components/drivers/include/drivers/serial.h
@@ -150,6 +150,8 @@ struct rt_serial_device
void *serial_rx;
void *serial_tx;
+
+ struct rt_device_notify rx_notify;
};
typedef struct rt_serial_device rt_serial_t;
diff --git a/components/drivers/include/drivers/serial_v2.h b/components/drivers/include/drivers/serial_v2.h
index a449372e8a..b1020aaf99 100644
--- a/components/drivers/include/drivers/serial_v2.h
+++ b/components/drivers/include/drivers/serial_v2.h
@@ -158,6 +158,8 @@ struct rt_serial_device
void *serial_rx;
void *serial_tx;
+
+ struct rt_device_notify rx_notify;
};
/**
diff --git a/components/drivers/include/ipc/pipe.h b/components/drivers/include/ipc/pipe.h
index 08b9f266c8..5f64506011 100644
--- a/components/drivers/include/ipc/pipe.h
+++ b/components/drivers/include/ipc/pipe.h
@@ -20,16 +20,18 @@ struct rt_pipe_device
{
struct rt_device parent;
rt_bool_t is_named;
+#ifdef RT_USING_POSIX_DEVIO
+ int pipeno; /* for unamed pipe */
+#endif
/* ring buffer in pipe device */
struct rt_ringbuffer *fifo;
rt_uint16_t bufsz;
- rt_uint8_t readers;
- rt_uint8_t writers;
-
rt_wqueue_t reader_queue;
rt_wqueue_t writer_queue;
+ int writer;
+ int reader;
struct rt_mutex lock;
};
diff --git a/components/drivers/include/ipc/waitqueue.h b/components/drivers/include/ipc/waitqueue.h
index fbf5f93142..0727810696 100644
--- a/components/drivers/include/ipc/waitqueue.h
+++ b/components/drivers/include/ipc/waitqueue.h
@@ -43,6 +43,8 @@ rt_inline void rt_wqueue_init(rt_wqueue_t *queue)
void rt_wqueue_add(rt_wqueue_t *queue, struct rt_wqueue_node *node);
void rt_wqueue_remove(struct rt_wqueue_node *node);
int rt_wqueue_wait(rt_wqueue_t *queue, int condition, int timeout);
+int rt_wqueue_wait_killable(rt_wqueue_t *queue, int condition, int timeout);
+int rt_wqueue_wait_interruptible(rt_wqueue_t *queue, int condition, int timeout);
void rt_wqueue_wakeup(rt_wqueue_t *queue, void *key);
#define DEFINE_WAIT_FUNC(name, function) \
diff --git a/components/drivers/include/rtdevice.h b/components/drivers/include/rtdevice.h
index 18c3ef9cd4..c7a61c1994 100644
--- a/components/drivers/include/rtdevice.h
+++ b/components/drivers/include/rtdevice.h
@@ -157,6 +157,10 @@ extern "C" {
#include "drivers/touch.h"
#endif
+#ifdef RT_USING_DEV_BUS
+#include "drivers/rt_dev_bus.h"
+#endif
+
#ifdef __cplusplus
}
#endif