diff --git a/bsp/at91sam9260/application.c b/bsp/at91sam9260/application.c index b440c16ac14a06331482a8c70b95e5d553408d6f..91e39079466387704444c31b3e1532e93152dda4 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 6fed5123865ee6ac1cd47bb4da1fd5a960e8bb78..51a63c96137aa8bca65d78a909beedbf13909722 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 b6f559e34b7cc671cbec20c4562c1a14e203cbf9..20bb7dca7a24429008defec5bb379ba064e3a6cb 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 ca433fe2912827d681f33519b9436b951a80f1a7..1f7b38795ceabef54c35ab81b3c11fb29b6175dc 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 47718cd4a24c668df0c5d711efb86ee75cf844ba..b2491d75283e959b8894ee0e2bc453bdcdd56324 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 654ec257b78459b48b4dc2c312d6a9c6bea84c1e..5a0272bdb301a3ff2a3cbc7fb96985e79ba21e64 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 26c9b3aa6f0eb4dac813d0627fb74ca6939b9856..846aac69200dbefb2ec5c7d61dab51cf49cbfb6d 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 f232b8e514ee993543bea69ebe93757664be0afa..83477d00d47e90df2f585a3ee38fd4c844339e5e 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 4a5a514b939234ca5263b8ff6674280b1e84bc2f..3bb2736d050b68804b8aad7302160d1470d7b2ce 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 d11bcce3a899abaaa3502a03e69f8d5d780b6262..fb742278b75e9c41ac95b5cb7b22072ac239cd53 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 c00625a9e609c32202b236e6f509ad299899f800..da71d40310c41eb483e604514b9a0f9152da9f24 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 8a1d9aa199fe6db7537b383707fb41109850196e..18f4f85163f0decd708dd5f8575a46db09a367bf 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