From 7729b4a1e4fa0cda20ba5b8ff21701f9bc89e78c Mon Sep 17 00:00:00 2001 From: "luohui2320@gmail.com" Date: Sun, 8 Jul 2012 14:43:08 +0000 Subject: [PATCH] move SDIO driver header files to the drivers/include directory and update rtdevice.h git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2209 bbd45198-f89e-11dd-88c7-29a3b14d5316 --- bsp/at91sam9260/application.c | 2 +- bsp/at91sam9260/at91_mci.c | 2 +- .../{sdio => include/drivers}/mmcsd_card.h | 36 ++++++++++++++++- .../{sdio => include/drivers}/mmcsd_cmd.h | 0 .../{sdio => include/drivers}/mmcsd_core.h | 6 +-- .../{sdio => include/drivers}/mmcsd_host.h | 0 .../drivers/{sdio => include/drivers}/sd.h | 2 +- .../drivers/{sdio => include/drivers}/sdio.h | 40 ++----------------- .../{sdio => include/drivers}/sdio_func_ids.h | 0 components/drivers/include/rtdevice.h | 6 +++ components/drivers/sdio/SConscript | 2 +- components/drivers/sdio/block_dev.c | 3 +- components/drivers/sdio/mmcsd_core.c | 6 +-- components/drivers/sdio/sd.c | 4 +- components/drivers/sdio/sdio.c | 4 +- 15 files changed, 57 insertions(+), 56 deletions(-) rename components/drivers/{sdio => include/drivers}/mmcsd_card.h (83%) rename components/drivers/{sdio => include/drivers}/mmcsd_cmd.h (100%) rename components/drivers/{sdio => include/drivers}/mmcsd_core.h (98%) rename components/drivers/{sdio => include/drivers}/mmcsd_host.h (100%) rename components/drivers/{sdio => include/drivers}/sd.h (92%) rename components/drivers/{sdio => include/drivers}/sdio.h (84%) rename components/drivers/{sdio => include/drivers}/sdio_func_ids.h (100%) diff --git a/bsp/at91sam9260/application.c b/bsp/at91sam9260/application.c index b440c16ac..91e390794 100755 --- a/bsp/at91sam9260/application.c +++ b/bsp/at91sam9260/application.c @@ -38,7 +38,7 @@ #endif #ifdef RT_USING_SDIO -#include +#include #include "at91_mci.h" #endif diff --git a/bsp/at91sam9260/at91_mci.c b/bsp/at91sam9260/at91_mci.c index 6fed51238..51a63c961 100644 --- a/bsp/at91sam9260/at91_mci.c +++ b/bsp/at91sam9260/at91_mci.c @@ -14,7 +14,7 @@ #include #include -#include +#include #include #include "at91_mci.h" diff --git a/components/drivers/sdio/mmcsd_card.h b/components/drivers/include/drivers/mmcsd_card.h similarity index 83% rename from components/drivers/sdio/mmcsd_card.h rename to components/drivers/include/drivers/mmcsd_card.h index b6f559e34..20bb7dca7 100644 --- a/components/drivers/sdio/mmcsd_card.h +++ b/components/drivers/include/drivers/mmcsd_card.h @@ -15,8 +15,7 @@ #ifndef __MMCSD_CARD_H__ #define __MMCSD_CARD_H__ -#include "mmcsd_host.h" -#include "sdio.h" +#include #ifdef __cplusplus extern "C" { @@ -95,6 +94,39 @@ struct rt_sdio_cis { rt_uint32_t max_tran_speed; }; +/* + * SDIO function CIS tuple (unknown to the core) + */ +struct rt_sdio_function_tuple { + struct rt_sdio_function_tuple *next; + rt_uint8_t code; + rt_uint8_t size; + rt_uint8_t *data; +}; + +struct rt_sdio_function; +typedef void (rt_sdio_irq_handler_t)(struct rt_sdio_function *); + +/* + * SDIO function devices + */ +struct rt_sdio_function { + struct rt_mmcsd_card *card; /* the card this device belongs to */ + rt_sdio_irq_handler_t *irq_handler; /* IRQ callback */ + rt_uint8_t num; /* function number */ + + rt_uint8_t func_code; /* Standard SDIO Function interface code */ + rt_uint16_t manufacturer; /* manufacturer id */ + rt_uint16_t product; /* product id */ + + rt_uint32_t max_blk_size; /* maximum block size */ + rt_uint32_t cur_blk_size; /* current block size */ + + rt_uint32_t enable_timeout_val; /* max enable timeout in msec */ + + struct rt_sdio_function_tuple *tuples; +}; + #define SDIO_MAX_FUNCTIONS 7 diff --git a/components/drivers/sdio/mmcsd_cmd.h b/components/drivers/include/drivers/mmcsd_cmd.h similarity index 100% rename from components/drivers/sdio/mmcsd_cmd.h rename to components/drivers/include/drivers/mmcsd_cmd.h diff --git a/components/drivers/sdio/mmcsd_core.h b/components/drivers/include/drivers/mmcsd_core.h similarity index 98% rename from components/drivers/sdio/mmcsd_core.h rename to components/drivers/include/drivers/mmcsd_core.h index ca433fe29..1f7b38795 100644 --- a/components/drivers/sdio/mmcsd_core.h +++ b/components/drivers/include/drivers/mmcsd_core.h @@ -16,9 +16,9 @@ #define __CORE_H__ #include -#include "mmcsd_host.h" -#include "mmcsd_card.h" -#include "mmcsd_cmd.h" +#include +#include +#include #ifdef __cplusplus extern "C" { diff --git a/components/drivers/sdio/mmcsd_host.h b/components/drivers/include/drivers/mmcsd_host.h similarity index 100% rename from components/drivers/sdio/mmcsd_host.h rename to components/drivers/include/drivers/mmcsd_host.h diff --git a/components/drivers/sdio/sd.h b/components/drivers/include/drivers/sd.h similarity index 92% rename from components/drivers/sdio/sd.h rename to components/drivers/include/drivers/sd.h index 47718cd4a..b2491d752 100644 --- a/components/drivers/sdio/sd.h +++ b/components/drivers/include/drivers/sd.h @@ -15,7 +15,7 @@ */ #include -#include "mmcsd_host.h" +#include #ifdef __cplusplus extern "C" { diff --git a/components/drivers/sdio/sdio.h b/components/drivers/include/drivers/sdio.h similarity index 84% rename from components/drivers/sdio/sdio.h rename to components/drivers/include/drivers/sdio.h index 654ec257b..5a0272bdb 100644 --- a/components/drivers/sdio/sdio.h +++ b/components/drivers/include/drivers/sdio.h @@ -18,48 +18,14 @@ #include -#include "mmcsd_host.h" -#include "mmcsd_card.h" -#include "sdio_func_ids.h" +#include +#include +#include #ifdef __cplusplus extern "C" { #endif -struct rt_sdio_function; - -typedef void (rt_sdio_irq_handler_t)(struct rt_sdio_function *); - -/* - * SDIO function CIS tuple (unknown to the core) - */ -struct rt_sdio_function_tuple { - struct rt_sdio_function_tuple *next; - rt_uint8_t code; - rt_uint8_t size; - rt_uint8_t *data; -}; - -/* - * SDIO function devices - */ -struct rt_sdio_function { - struct rt_mmcsd_card *card; /* the card this device belongs to */ - rt_sdio_irq_handler_t *irq_handler; /* IRQ callback */ - rt_uint8_t num; /* function number */ - - rt_uint8_t func_code; /* Standard SDIO Function interface code */ - rt_uint16_t manufacturer; /* manufacturer id */ - rt_uint16_t product; /* product id */ - - rt_uint32_t max_blk_size; /* maximum block size */ - rt_uint32_t cur_blk_size; /* current block size */ - - rt_uint32_t enable_timeout_val; /* max enable timeout in msec */ - - struct rt_sdio_function_tuple *tuples; -}; - /* * Card Common Control Registers (CCCR) */ diff --git a/components/drivers/sdio/sdio_func_ids.h b/components/drivers/include/drivers/sdio_func_ids.h similarity index 100% rename from components/drivers/sdio/sdio_func_ids.h rename to components/drivers/include/drivers/sdio_func_ids.h diff --git a/components/drivers/include/rtdevice.h b/components/drivers/include/rtdevice.h index 26c9b3aa6..846aac692 100644 --- a/components/drivers/include/rtdevice.h +++ b/components/drivers/include/rtdevice.h @@ -90,4 +90,10 @@ rt_size_t rt_ringbuffer_emptry_size(struct rt_ringbuffer* rb); #include "drivers/pm.h" #endif +#ifdef RT_USING_SDIO +#include "drivers/mmcsd_core.h" +#include "drivers/sd.h" +#include "drivers/sdio.h" +#endif + #endif /* __RT_DEVICE_H__ */ diff --git a/components/drivers/sdio/SConscript b/components/drivers/sdio/SConscript index f232b8e51..83477d00d 100644 --- a/components/drivers/sdio/SConscript +++ b/components/drivers/sdio/SConscript @@ -10,7 +10,7 @@ sdio.c """) # The set of source files associated with this SConscript file. -path = [cwd] +path = [cwd + '/../include'] group = DefineGroup('DeviceDrivers', src, depend = ['RT_USING_SDIO'], CPPPATH = path) diff --git a/components/drivers/sdio/block_dev.c b/components/drivers/sdio/block_dev.c index 4a5a514b9..3bb2736d0 100644 --- a/components/drivers/sdio/block_dev.c +++ b/components/drivers/sdio/block_dev.c @@ -15,8 +15,7 @@ #include #include -#include "mmcsd_core.h" -#include "mmcsd_cmd.h" +#include static rt_list_t blk_devices; diff --git a/components/drivers/sdio/mmcsd_core.c b/components/drivers/sdio/mmcsd_core.c index d11bcce3a..fb742278b 100644 --- a/components/drivers/sdio/mmcsd_core.c +++ b/components/drivers/sdio/mmcsd_core.c @@ -13,10 +13,8 @@ */ #include -#include "mmcsd_core.h" -#include "mmcsd_card.h" -#include "mmcsd_cmd.h" -#include "sd.h" +#include +#include #ifndef RT_MMCSD_STACK_SIZE #define RT_MMCSD_STACK_SIZE 1024 diff --git a/components/drivers/sdio/sd.c b/components/drivers/sdio/sd.c index c00625a9e..da71d4031 100644 --- a/components/drivers/sdio/sd.c +++ b/components/drivers/sdio/sd.c @@ -12,8 +12,8 @@ * 2011-07-25 weety first version */ -#include "mmcsd_core.h" -#include "mmcsd_cmd.h" +#include +#include static const rt_uint32_t tran_unit[] = { 10000, 100000, 1000000, 10000000, diff --git a/components/drivers/sdio/sdio.c b/components/drivers/sdio/sdio.c index 8a1d9aa19..18f4f8516 100644 --- a/components/drivers/sdio/sdio.c +++ b/components/drivers/sdio/sdio.c @@ -12,8 +12,8 @@ * 2012-01-13 weety first version */ -#include "mmcsd_core.h" -#include "mmcsd_cmd.h" +#include +#include #ifndef RT_SDIO_STACK_SIZE #define RT_SDIO_STACK_SIZE 512 -- GitLab