From dd5ac17fc8dc2c9dd166833b31ff08e7d9b316fb Mon Sep 17 00:00:00 2001 From: weety Date: Thu, 19 Oct 2017 19:14:06 +0800 Subject: [PATCH 1/2] [bsp][dm365] Using component initial; [drv][mmcsd] Add component initial. --- bsp/dm365/applications/application.c | 126 +-------------- bsp/dm365/applications/board.c | 26 ++- bsp/dm365/applications/startup.c | 148 ------------------ bsp/dm365/dm365_ram.ld | 8 + bsp/dm365/drivers/davinci_emac.c | 2 + bsp/dm365/drivers/davinci_serial.c | 5 +- bsp/dm365/drivers/i2c-davinci.c | 6 + bsp/dm365/rtconfig.h | 3 + .../drivers/include/drivers/mmcsd_core.h | 4 +- components/drivers/sdio/block_dev.c | 6 +- components/drivers/sdio/mmcsd_core.c | 7 +- components/drivers/sdio/sdio.c | 7 +- 12 files changed, 69 insertions(+), 279 deletions(-) delete mode 100644 bsp/dm365/applications/startup.c diff --git a/bsp/dm365/applications/application.c b/bsp/dm365/applications/application.c index 656083ad11..507e1d9592 100644 --- a/bsp/dm365/applications/application.c +++ b/bsp/dm365/applications/application.c @@ -29,63 +29,29 @@ /*@{*/ #include -//#include #ifdef RT_USING_DFS -/* dfs filesystem:ELM FatFs filesystem init */ -#include /* dfs Filesystem APIs */ #include -#ifdef RT_USING_DFS_UFFS -/* dfs filesystem:UFFS filesystem init */ -#include -#endif -#endif - -#if defined(RT_USING_DFS_DEVFS) -#include #endif #ifdef RT_USING_SDIO #include - -#endif - -#ifdef RT_USING_LWIP -#include #endif #ifdef RT_USING_SPI #include #endif -#ifdef RT_USING_LED -#include "led.h" -#endif - -#define RT_INIT_THREAD_STACK_SIZE (2*1024) - -#ifdef RT_USING_DFS_ROMFS -#include -#endif - -void rt_init_thread_entry(void* parameter) +int main(void) { platform_init(); /* Filesystem Initialization */ #ifdef RT_USING_DFS { - /* init the device filesystem */ - dfs_init(); - -#if defined(RT_USING_DFS_ELMFAT) - /* init the elm chan FatFs filesystam*/ - elm_init(); -#endif #if defined(RT_USING_DFS_ROMFS) - dfs_romfs_init(); if (dfs_mount(RT_NULL, "/rom", "rom", 0, &romfs_root) == 0) { rt_kprintf("ROM File System initialized!\n"); @@ -94,24 +60,8 @@ void rt_init_thread_entry(void* parameter) rt_kprintf("ROM File System initialzation failed!\n"); #endif -#if defined(RT_USING_DFS_DEVFS) - devfs_init(); - if (dfs_mount(RT_NULL, "/dev", "devfs", 0, 0) == 0) - rt_kprintf("Device File System initialized!\n"); - else - rt_kprintf("Device File System initialzation failed!\n"); - - #ifdef RT_USING_NEWLIB - /* init libc */ - libc_system_init(RT_CONSOLE_DEVICE_NAME); - #endif -#endif - #if defined(RT_USING_DFS_UFFS) { - /* init the uffs filesystem */ - dfs_uffs_init(); - /* mount flash device as flash directory */ if(dfs_mount("nand0", "/nand0", "uffs", 0, 0) == 0) rt_kprintf("UFFS File System initialized!\n"); @@ -120,13 +70,6 @@ void rt_init_thread_entry(void* parameter) } #endif -#ifdef RT_USING_I2C - { - rt_i2c_core_init(); - davinci_i2c_init("I2C1"); - } -#endif - #ifdef RT_USING_SPI { rt_hw_spi_init(); @@ -134,83 +77,26 @@ void rt_init_thread_entry(void* parameter) #endif #ifdef RT_USING_SDIO - rt_mmcsd_core_init(); - rt_mmcsd_blk_init(); rt_hw_mmcsd_init(); - rt_thread_delay(RT_TICK_PER_SECOND*2); - /* mount sd card fat partition 1 as root directory */ + if (MMCSD_HOST_PLUGED == mmcsd_wait_cd_changed(RT_TICK_PER_SECOND*2)) + { + /* mount sd card fat partition 1 as root directory */ if (dfs_mount("sd0", "/", "elm", 0, 0) == 0) { rt_kprintf("File System initialized!\n"); } else rt_kprintf("File System initialzation failed!%d\n", rt_get_errno()); + } #endif } #endif -#ifdef RT_USING_LWIP - { - /* register ethernetif device */ - eth_system_device_init(); - rt_hw_davinci_emac_init(); - /* init lwip system */ - lwip_system_init(); - } -#endif + /* put user application code here */ } -void rt_led_thread_entry(void* parameter) -{ - while(1) - { - /* light on leds for one second */ - rt_thread_delay(100); - - /* light off leds for one second */ - rt_thread_delay(100); - } -} - -int rt_application_init() -{ - rt_thread_t init_thread; -#ifdef RT_USING_LED - rt_thread_t led_thread; -#endif - -#if (RT_THREAD_PRIORITY_MAX == 32) - init_thread = rt_thread_create("init", - rt_init_thread_entry, RT_NULL, - RT_INIT_THREAD_STACK_SIZE, 8, 20); -#ifdef RT_USING_LED - led_thread = rt_thread_create("led", - rt_led_thread_entry, RT_NULL, - 512, 20, 20); -#endif -#else - init_thread = rt_thread_create("init", - rt_init_thread_entry, RT_NULL, - RT_INIT_THREAD_STACK_SIZE, 80, 20); -#ifdef RT_USING_LED - led_thread = rt_thread_create("led", - rt_led_thread_entry, RT_NULL, - 512, 200, 20); -#endif -#endif - - if (init_thread != RT_NULL) - rt_thread_startup(init_thread); -#ifdef RT_USING_LED - if(led_thread != RT_NULL) - rt_thread_startup(led_thread); -#endif - - return 0; -} - /* NFSv3 Initialization */ #if defined(RT_USING_DFS) && defined(RT_USING_LWIP) && defined(RT_USING_DFS_NFS) #include diff --git a/bsp/dm365/applications/board.c b/bsp/dm365/applications/board.c index 779217c8d0..cd66ae0588 100644 --- a/bsp/dm365/applications/board.c +++ b/bsp/dm365/applications/board.c @@ -32,6 +32,19 @@ * @addtogroup dm365 */ /*@{*/ +#if defined(__CC_ARM) + extern int Image$$ER_ZI$$ZI$$Base; + extern int Image$$ER_ZI$$ZI$$Length; + extern int Image$$ER_ZI$$ZI$$Limit; +#elif (defined (__GNUC__)) + rt_uint8_t _irq_stack_start[1024]; + rt_uint8_t _fiq_stack_start[1024]; + rt_uint8_t _undefined_stack_start[512]; + rt_uint8_t _abort_stack_start[512]; + rt_uint8_t _svc_stack_start[1024] SECTION(".nobss"); + extern unsigned char __bss_start; + extern unsigned char __bss_end; +#endif extern void rt_hw_clock_init(void); extern void rt_hw_uart_init(void); @@ -99,8 +112,10 @@ void rt_hw_board_init() //rt_hw_clock_init(); davinci_clk_init(); - /* initialize uart */ - rt_hw_uart_init(); + /* initialize early device */ +#ifdef RT_USING_COMPONENTS_INIT + rt_components_board_init(); +#endif #ifdef RT_USING_CONSOLE rt_console_set_device(RT_CONSOLE_DEVICE_NAME); #endif @@ -108,6 +123,13 @@ void rt_hw_board_init() /* initialize mmu */ rt_hw_mmu_init(dm365_mem_desc, sizeof(dm365_mem_desc)/sizeof(dm365_mem_desc[0])); + /* initialize heap memory system */ +#ifdef __CC_ARM + rt_system_heap_init((void*)&Image$$ER_ZI$$ZI$$Limit, (void*)0x88000000); +#else + rt_system_heap_init((void*)&__bss_end, (void*)0x88000000); +#endif + /* initialize timer0 */ rt_hw_timer_init(); diff --git a/bsp/dm365/applications/startup.c b/bsp/dm365/applications/startup.c deleted file mode 100644 index 8aacc3073c..0000000000 --- a/bsp/dm365/applications/startup.c +++ /dev/null @@ -1,148 +0,0 @@ -/* - * File : startup.c - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006, RT-Thread Development Team - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Change Logs: - * Date Author Notes - * 2011-01-13 weety first version - */ - -#include -#include - -#include -#ifdef RT_USING_FINSH -#include -#endif - -extern void rt_hw_interrupt_init(void); -extern void rt_hw_board_init(void); -extern void rt_serial_init(void); -extern void rt_system_timer_init(void); -extern void rt_system_scheduler_init(void); -extern void rt_thread_idle_init(void); -extern void rt_hw_cpu_icache_enable(void); -extern void rt_show_version(void); -extern void rt_system_heap_init(void*, void*); -extern void rt_hw_finsh_init(void); -extern void rt_application_init(void); - -/** - * @addtogroup dm365 - */ - -/*@{*/ -#if defined(__CC_ARM) - extern int Image$$ER_ZI$$ZI$$Base; - extern int Image$$ER_ZI$$ZI$$Length; - extern int Image$$ER_ZI$$ZI$$Limit; -#elif (defined (__GNUC__)) - rt_uint8_t _irq_stack_start[1024]; - rt_uint8_t _fiq_stack_start[1024]; - rt_uint8_t _undefined_stack_start[512]; - rt_uint8_t _abort_stack_start[512]; - rt_uint8_t _svc_stack_start[1024] SECTION(".nobss"); - extern unsigned char __bss_start; - extern unsigned char __bss_end; -#endif - -#ifdef RT_USING_FINSH -extern int finsh_system_init(void); -#endif - - -/** - * This function will startup RT-Thread RTOS. - */ -void rtthread_startup(void) -{ - /* enable cpu cache */ - //rt_hw_cpu_icache_enable(); - //rt_hw_cpu_dcache_enable(); - - /* initialize hardware interrupt */ - rt_hw_interrupt_init(); - - /* initialize board */ - rt_hw_board_init(); - - /* show version */ - rt_show_version(); - - /* initialize tick */ - rt_system_tick_init(); - - /* initialize kernel object */ - rt_system_object_init(); - - /* initialize timer system */ - rt_system_timer_init(); - - /* initialize heap memory system */ -#ifdef __CC_ARM - rt_system_heap_init((void*)&Image$$ER_ZI$$ZI$$Limit, (void*)0x88000000); -#else - rt_system_heap_init((void*)&__bss_end, (void*)0x88000000); -#endif - -#ifdef RT_USING_MODULE - /* initialize module system*/ - rt_system_module_init(); -#endif - - /* initialize scheduler system */ - rt_system_scheduler_init(); - - /* initialize application */ - rt_application_init(); - -#ifdef RT_USING_FINSH - /* initialize finsh */ - finsh_system_init(); -#ifdef RT_USING_DEVICE - finsh_set_device(RT_CONSOLE_DEVICE_NAME); -#endif -#endif - - /* initialize system timer thread */ - rt_system_timer_thread_init(); - - /* initialize idle thread */ - rt_thread_idle_init(); - - /* start scheduler */ - rt_system_scheduler_start(); - - /* never reach here */ - return ; -} - -int main(void) -{ - rt_uint32_t RT_UNUSED level; - - /* disable interrupt first */ - level = rt_hw_interrupt_disable(); - - /* startup RT-Thread RTOS */ - rtthread_startup(); - - return 0; -} - -/*@}*/ diff --git a/bsp/dm365/dm365_ram.ld b/bsp/dm365/dm365_ram.ld index 2a47d3a189..7715a53b0d 100644 --- a/bsp/dm365/dm365_ram.ld +++ b/bsp/dm365/dm365_ram.ld @@ -28,6 +28,14 @@ SECTIONS __rtmsymtab_start = .; KEEP(*(RTMSymTab)) __rtmsymtab_end = .; + . = ALIGN(4); + + /* section information for initial. */ + . = ALIGN(4); + __rt_init_start = .; + KEEP(*(SORT(.rti_fn*))) + __rt_init_end = .; + . = ALIGN(4); } . = ALIGN(4); diff --git a/bsp/dm365/drivers/davinci_emac.c b/bsp/dm365/drivers/davinci_emac.c index 312f79bc66..8db49a7c67 100644 --- a/bsp/dm365/drivers/davinci_emac.c +++ b/bsp/dm365/drivers/davinci_emac.c @@ -1698,6 +1698,8 @@ void rt_hw_davinci_emac_init() } +INIT_DEVICE_EXPORT(rt_hw_davinci_emac_init); + #ifdef RT_USING_FINSH #include diff --git a/bsp/dm365/drivers/davinci_serial.c b/bsp/dm365/drivers/davinci_serial.c index 9340befbcd..0671cb4e49 100644 --- a/bsp/dm365/drivers/davinci_serial.c +++ b/bsp/dm365/drivers/davinci_serial.c @@ -223,7 +223,7 @@ void davinci_uart1_init(void) /** * This function will handle init uart */ -void rt_hw_uart_init(void) +int rt_hw_uart_init(void) { davinci_serial_dev0.ops = &davinci_uart_ops; //davinci_serial_dev0.config = RT_SERIAL_CONFIG_DEFAULT; @@ -257,5 +257,8 @@ void rt_hw_uart_init(void) UART1); davinci_uart1_init(); + return 0; } +INIT_BOARD_EXPORT(rt_hw_uart_init); + diff --git a/bsp/dm365/drivers/i2c-davinci.c b/bsp/dm365/drivers/i2c-davinci.c index d77c31f69c..c1d8a07ba4 100644 --- a/bsp/dm365/drivers/i2c-davinci.c +++ b/bsp/dm365/drivers/i2c-davinci.c @@ -647,4 +647,10 @@ err: return r; } +int rt_hw_iic_init(void) +{ + davinci_i2c_init("I2C1"); +} + +INIT_DEVICE_EXPORT(rt_hw_iic_init); diff --git a/bsp/dm365/rtconfig.h b/bsp/dm365/rtconfig.h index 08843c77d0..bc6f728ab3 100644 --- a/bsp/dm365/rtconfig.h +++ b/bsp/dm365/rtconfig.h @@ -267,4 +267,7 @@ * #define RT_DFS_ELM_MAX_LFN 128 */ +#define RT_USING_COMPONENTS_INIT +#define RT_USING_USER_MAIN + #endif diff --git a/components/drivers/include/drivers/mmcsd_core.h b/components/drivers/include/drivers/mmcsd_core.h index e474fa28a8..36d71efeb2 100644 --- a/components/drivers/include/drivers/mmcsd_core.h +++ b/components/drivers/include/drivers/mmcsd_core.h @@ -247,9 +247,9 @@ void mmcsd_change(struct rt_mmcsd_host *host); void mmcsd_detect(void *param); struct rt_mmcsd_host *mmcsd_alloc_host(void); void mmcsd_free_host(struct rt_mmcsd_host *host); -void rt_mmcsd_core_init(void); +int rt_mmcsd_core_init(void); -void rt_mmcsd_blk_init(void); +int rt_mmcsd_blk_init(void); 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/sdio/block_dev.c b/components/drivers/sdio/block_dev.c index 3e142ee6e4..e6998f4fe3 100644 --- a/components/drivers/sdio/block_dev.c +++ b/components/drivers/sdio/block_dev.c @@ -479,7 +479,11 @@ void rt_mmcsd_blk_remove(struct rt_mmcsd_card *card) * @deprecated since 2.1.0, this function does not need to be invoked * in the system initialization. */ -void rt_mmcsd_blk_init(void) +int rt_mmcsd_blk_init(void) { /* nothing */ + return 0; } + +INIT_PREV_EXPORT(rt_mmcsd_blk_init); + diff --git a/components/drivers/sdio/mmcsd_core.c b/components/drivers/sdio/mmcsd_core.c index 02063efdd2..3e98444b71 100644 --- a/components/drivers/sdio/mmcsd_core.c +++ b/components/drivers/sdio/mmcsd_core.c @@ -655,6 +655,7 @@ void mmcsd_detect(void *param) if (init_sd(host, ocr)) mmcsd_power_off(host); mmcsd_host_unlock(host); + rt_mb_send(&mmcsd_hotpluge_mb, (rt_uint32_t)host); continue; } @@ -726,7 +727,7 @@ void mmcsd_free_host(struct rt_mmcsd_host *host) rt_free(host); } -void rt_mmcsd_core_init(void) +int rt_mmcsd_core_init(void) { rt_err_t ret; @@ -749,5 +750,9 @@ void rt_mmcsd_core_init(void) } rt_sdio_init(); + + return 0; } +INIT_PREV_EXPORT(rt_mmcsd_core_init); + diff --git a/components/drivers/sdio/sdio.c b/components/drivers/sdio/sdio.c index 496765854e..dc0cd1eb96 100644 --- a/components/drivers/sdio/sdio.c +++ b/components/drivers/sdio/sdio.c @@ -33,8 +33,8 @@ #define RT_SDIO_THREAD_PRIORITY 0x40 #endif -static rt_list_t sdio_cards; -static rt_list_t sdio_drivers; +static rt_list_t sdio_cards = RT_LIST_OBJECT_INIT(sdio_cards); +static rt_list_t sdio_drivers = RT_LIST_OBJECT_INIT(sdio_drivers); struct sdio_card { @@ -1397,7 +1397,6 @@ rt_int32_t sdio_unregister_driver(struct rt_sdio_driver *driver) void rt_sdio_init(void) { - rt_list_init(&sdio_cards); - rt_list_init(&sdio_drivers); + } From 5150e19d4b901db5b3f596b17e6aef857c4e424d Mon Sep 17 00:00:00 2001 From: weety Date: Fri, 20 Oct 2017 11:19:03 +0800 Subject: [PATCH 2/2] [bsp][dm365] Support rt_hw_console_output function; Adjust the initialization sequence; Cleanup code. [drv][mmcsd] Undo Changes. --- bsp/dm365/applications/application.c | 30 ++--- bsp/dm365/applications/board.c | 106 +++++++++++++++--- bsp/dm365/drivers/spi-davinci.c | 1 + bsp/dm365/platform/dm365.c | 3 +- bsp/dm365/platform/system_clock.c | 3 +- .../drivers/include/drivers/mmcsd_core.h | 4 +- components/drivers/sdio/block_dev.c | 5 +- components/drivers/sdio/mmcsd_core.c | 7 +- 8 files changed, 117 insertions(+), 42 deletions(-) diff --git a/bsp/dm365/applications/application.c b/bsp/dm365/applications/application.c index 507e1d9592..375a96935f 100644 --- a/bsp/dm365/applications/application.c +++ b/bsp/dm365/applications/application.c @@ -39,14 +39,10 @@ #include #endif -#ifdef RT_USING_SPI -#include -#endif - int main(void) { - platform_init(); - + int timeout = 0; + /* Filesystem Initialization */ #ifdef RT_USING_DFS { @@ -70,15 +66,17 @@ int main(void) } #endif -#ifdef RT_USING_SPI - { - rt_hw_spi_init(); - } -#endif - #ifdef RT_USING_SDIO + rt_mmcsd_core_init(); + rt_mmcsd_blk_init(); rt_hw_mmcsd_init(); - if (MMCSD_HOST_PLUGED == mmcsd_wait_cd_changed(RT_TICK_PER_SECOND*2)) + timeout = 0; + while ((rt_device_find("sd0") == RT_NULL) && (timeout++ < RT_TICK_PER_SECOND*2)) + { + rt_thread_delay(1); + } + + if (timeout < RT_TICK_PER_SECOND*2) { /* mount sd card fat partition 1 as root directory */ if (dfs_mount("sd0", "/", "elm", 0, 0) == 0) @@ -87,7 +85,11 @@ int main(void) } else rt_kprintf("File System initialzation failed!%d\n", rt_get_errno()); - } + } + else + { + rt_kprintf("No SD card found.\n"); + } #endif } #endif diff --git a/bsp/dm365/applications/board.c b/bsp/dm365/applications/board.c index cd66ae0588..0ed0b6ff64 100644 --- a/bsp/dm365/applications/board.c +++ b/bsp/dm365/applications/board.c @@ -75,6 +75,9 @@ void rt_timer_handler(int vector, void *param) volatile timer_regs_t *regs = (volatile timer_regs_t*)DAVINCI_TIMER1_BASE;//DAVINCI_TIMER0_BASE; + psc_change_state(DAVINCI_DM365_LPSC_TIMER0, 3); + psc_change_state(DAVINCI_DM365_LPSC_TIMER1, 3); + /*disable timer*/ regs->tcr &= ~(0x3UL << 6); @@ -101,16 +104,101 @@ void rt_timer_handler(int vector, void *param) } +#define LSR_DR 0x01 /* Data ready */ +#define LSR_THRE 0x20 /* Xmit holding register empty */ +#define BPS 115200 /* serial baudrate */ + +typedef struct uartport +{ + volatile rt_uint32_t rbr; + volatile rt_uint32_t ier; + volatile rt_uint32_t fcr; + volatile rt_uint32_t lcr; + volatile rt_uint32_t mcr; + volatile rt_uint32_t lsr; + volatile rt_uint32_t msr; + volatile rt_uint32_t scr; + volatile rt_uint32_t dll; + volatile rt_uint32_t dlh; + + volatile rt_uint32_t res[2]; + volatile rt_uint32_t pwremu_mgmt; + volatile rt_uint32_t mdr; +}uartport; + +#define thr rbr +#define iir fcr + +#define UART0 ((struct uartport *)DAVINCI_UART0_BASE) + +static void davinci_uart_putc(char c) +{ + while (!(UART0->lsr & LSR_THRE)); + UART0->thr = c; +} + +/** + * This function is used to display a string on console, normally, it's + * invoked by rt_kprintf + * + * @param str the displayed string + */ +void rt_hw_console_output(const char* str) +{ + while (*str) + { + if (*str=='\n') + { + davinci_uart_putc('\r'); + } + + davinci_uart_putc(*str++); + } +} + +static void rt_hw_console_init(void) +{ + rt_uint32_t divisor; + + divisor = (24000000 + (BPS * (16 / 2))) / (16 * BPS); + UART0->ier = 0; + UART0->lcr = 0x83; //8N1 + UART0->dll = 0; + UART0->dlh = 0; + UART0->lcr = 0x03; + UART0->mcr = 0x03; //RTS,CTS + UART0->fcr = 0x07; //FIFO + UART0->lcr = 0x83; + UART0->dll = divisor & 0xff; + UART0->dlh = (divisor >> 8) & 0xff; + UART0->lcr = 0x03; + UART0->mdr = 0; //16x over-sampling + UART0->pwremu_mgmt = 0x6000; +} + /** * This function will init dm365 board */ void rt_hw_board_init() { - psc_change_state(DAVINCI_DM365_LPSC_TIMER0, 3); - psc_change_state(DAVINCI_DM365_LPSC_TIMER1, 3); + /* initialize console */ + rt_hw_console_init(); + + /* initialize mmu */ + rt_hw_mmu_init(dm365_mem_desc, sizeof(dm365_mem_desc)/sizeof(dm365_mem_desc[0])); + + /* initialize hardware interrupt */ + rt_hw_interrupt_init(); + /* initialize the system clock */ - //rt_hw_clock_init(); - davinci_clk_init(); + rt_hw_clock_init(); + + /* initialize heap memory system */ +#ifdef __CC_ARM + rt_system_heap_init((void*)&Image$$ER_ZI$$ZI$$Limit, (void*)0x88000000); +#else + rt_system_heap_init((void*)&__bss_end, (void*)0x88000000); +#endif /* initialize early device */ #ifdef RT_USING_COMPONENTS_INIT @@ -120,16 +208,6 @@ void rt_hw_board_init() rt_console_set_device(RT_CONSOLE_DEVICE_NAME); #endif - /* initialize mmu */ - rt_hw_mmu_init(dm365_mem_desc, sizeof(dm365_mem_desc)/sizeof(dm365_mem_desc[0])); - - /* initialize heap memory system */ -#ifdef __CC_ARM - rt_system_heap_init((void*)&Image$$ER_ZI$$ZI$$Limit, (void*)0x88000000); -#else - rt_system_heap_init((void*)&__bss_end, (void*)0x88000000); -#endif - /* initialize timer0 */ rt_hw_timer_init(); diff --git a/bsp/dm365/drivers/spi-davinci.c b/bsp/dm365/drivers/spi-davinci.c index 443da606d5..fb5d9729d4 100644 --- a/bsp/dm365/drivers/spi-davinci.c +++ b/bsp/dm365/drivers/spi-davinci.c @@ -963,4 +963,5 @@ int rt_hw_spi_init(void) return 0; } +INIT_DEVICE_EXPORT(rt_hw_spi_init); diff --git a/bsp/dm365/platform/dm365.c b/bsp/dm365/platform/dm365.c index 42af671382..010e2a030e 100644 --- a/bsp/dm365/platform/dm365.c +++ b/bsp/dm365/platform/dm365.c @@ -316,11 +316,12 @@ int davinci_clk_init(void) return davinci_register_clks(clk_list, num_clks); } -void platform_init(void) +int platform_init(void) { edma_init(dm365_edma_info); } +INIT_BOARD_EXPORT(platform_init); /* Reset board using the watchdog timer */ void reset_system(void) diff --git a/bsp/dm365/platform/system_clock.c b/bsp/dm365/platform/system_clock.c index 6fd2a8d991..b4e81e98a2 100644 --- a/bsp/dm365/platform/system_clock.c +++ b/bsp/dm365/platform/system_clock.c @@ -26,12 +26,13 @@ #include #include "dm36x.h" +extern int davinci_clk_init(void); /** * @brief System Clock Configuration */ void rt_hw_clock_init(void) { - + davinci_clk_init(); } diff --git a/components/drivers/include/drivers/mmcsd_core.h b/components/drivers/include/drivers/mmcsd_core.h index 36d71efeb2..e474fa28a8 100644 --- a/components/drivers/include/drivers/mmcsd_core.h +++ b/components/drivers/include/drivers/mmcsd_core.h @@ -247,9 +247,9 @@ void mmcsd_change(struct rt_mmcsd_host *host); void mmcsd_detect(void *param); struct rt_mmcsd_host *mmcsd_alloc_host(void); void mmcsd_free_host(struct rt_mmcsd_host *host); -int rt_mmcsd_core_init(void); +void rt_mmcsd_core_init(void); -int rt_mmcsd_blk_init(void); +void rt_mmcsd_blk_init(void); 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/sdio/block_dev.c b/components/drivers/sdio/block_dev.c index e6998f4fe3..c986556879 100644 --- a/components/drivers/sdio/block_dev.c +++ b/components/drivers/sdio/block_dev.c @@ -479,11 +479,8 @@ void rt_mmcsd_blk_remove(struct rt_mmcsd_card *card) * @deprecated since 2.1.0, this function does not need to be invoked * in the system initialization. */ -int rt_mmcsd_blk_init(void) +void rt_mmcsd_blk_init(void) { /* nothing */ - return 0; } -INIT_PREV_EXPORT(rt_mmcsd_blk_init); - diff --git a/components/drivers/sdio/mmcsd_core.c b/components/drivers/sdio/mmcsd_core.c index 3e98444b71..02063efdd2 100644 --- a/components/drivers/sdio/mmcsd_core.c +++ b/components/drivers/sdio/mmcsd_core.c @@ -655,7 +655,6 @@ void mmcsd_detect(void *param) if (init_sd(host, ocr)) mmcsd_power_off(host); mmcsd_host_unlock(host); - rt_mb_send(&mmcsd_hotpluge_mb, (rt_uint32_t)host); continue; } @@ -727,7 +726,7 @@ void mmcsd_free_host(struct rt_mmcsd_host *host) rt_free(host); } -int rt_mmcsd_core_init(void) +void rt_mmcsd_core_init(void) { rt_err_t ret; @@ -750,9 +749,5 @@ int rt_mmcsd_core_init(void) } rt_sdio_init(); - - return 0; } -INIT_PREV_EXPORT(rt_mmcsd_core_init); -