diff --git a/bsp/stm3210/application.c b/bsp/stm3210/application.c index f929cae1723a5e47bada5797749cc61380b8a32e..41e52bfa59d2eaf46002307553cff47e80875435 100644 --- a/bsp/stm3210/application.c +++ b/bsp/stm3210/application.c @@ -1,7 +1,7 @@ /* * File : application.c * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006, RT-Thread Development Team + * COPYRIGHT (C) 2009, RT-Thread Development Team * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at diff --git a/bsp/stm3210/board.c b/bsp/stm3210/board.c index 68de1e2c73eb3effffdeaf9c417e3e319bf0fc05..17f14392886d55e2305dee4344ad56b6d7a45238 100644 --- a/bsp/stm3210/board.c +++ b/bsp/stm3210/board.c @@ -1,7 +1,7 @@ /* * File : board.c * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006 - 2009 RT-Thread Develop Team + * COPYRIGHT (C) 2009 RT-Thread Develop Team * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at @@ -9,7 +9,7 @@ * * Change Logs: * Date Author Notes - * 2006-08-23 Bernard first implementation + * 2009-01-05 Bernard first implementation */ #include diff --git a/bsp/stm3210/board.h b/bsp/stm3210/board.h index 695b6c8bef46fe797f87c84e454a4735a2aa46ed..0a595ea6ce06ee87676d348749de928335fbe69b 100644 --- a/bsp/stm3210/board.h +++ b/bsp/stm3210/board.h @@ -1,7 +1,7 @@ /* * File : board.h * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006, RT-Thread Develop Team + * COPYRIGHT (C) 2009, RT-Thread Development Team * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at diff --git a/bsp/stm3210/dm9000a.c b/bsp/stm3210/dm9000a.c index e6eed05dca24b2d9ac5ecf7a02218fbe15749a9d..34a2498e2fdcdbbd7c0d87405d5b28a6521a3296 100644 --- a/bsp/stm3210/dm9000a.c +++ b/bsp/stm3210/dm9000a.c @@ -1,3 +1,16 @@ +/* + * File : dm9000a.c + * This file is part of RT-Thread RTOS + * COPYRIGHT (C) 2009, RT-Thread Development Team + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rt-thread.org/license/LICENSE + * + * Change Logs: + * Date Author Notes + * 2009-07-01 Bernard the first version + */ #include #include "dm9000a.h" @@ -620,10 +633,10 @@ static void FSMC_Configuration() FSMC_NORSRAMInitTypeDef FSMC_NORSRAMInitStructure; FSMC_NORSRAMTimingInitTypeDef p; GPIO_InitTypeDef GPIO_InitStructure; - + RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOD | RCC_APB2Periph_GPIOG | RCC_APB2Periph_GPIOE | RCC_APB2Periph_GPIOF, ENABLE); - + /*-- GPIO Configuration ------------------------------------------------------*/ /* SRAM Data lines configuration */ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_8 | GPIO_Pin_9 | @@ -631,37 +644,37 @@ static void FSMC_Configuration() GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_Init(GPIOD, &GPIO_InitStructure); - + GPIO_InitStructure.GPIO_Pin = GPIO_Pin_7 | GPIO_Pin_8 | GPIO_Pin_9 | GPIO_Pin_10 | GPIO_Pin_11 | GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15; GPIO_Init(GPIOE, &GPIO_InitStructure); - + /* SRAM Address lines configuration */ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_3 | GPIO_Pin_4 | GPIO_Pin_5 | GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15; GPIO_Init(GPIOF, &GPIO_InitStructure); - + GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_3 | GPIO_Pin_4 | GPIO_Pin_5; GPIO_Init(GPIOG, &GPIO_InitStructure); - + GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11 | GPIO_Pin_12 | GPIO_Pin_13; GPIO_Init(GPIOD, &GPIO_InitStructure); - + /* NOE and NWE configuration */ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4 |GPIO_Pin_5; GPIO_Init(GPIOD, &GPIO_InitStructure); - + /* NE3 NE4 configuration */ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10 | GPIO_Pin_12; GPIO_Init(GPIOG, &GPIO_InitStructure); - + /* NBL0, NBL1 configuration */ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1; GPIO_Init(GPIOE, &GPIO_InitStructure); - + /*-- FSMC Configuration ------------------------------------------------------*/ p.FSMC_AddressSetupTime = 0; p.FSMC_AddressHoldTime = 0; @@ -670,7 +683,7 @@ static void FSMC_Configuration() p.FSMC_CLKDivision = 0; p.FSMC_DataLatency = 0; p.FSMC_AccessMode = FSMC_AccessMode_A; - + FSMC_NORSRAMInitStructure.FSMC_Bank = FSMC_Bank1_NORSRAM4; FSMC_NORSRAMInitStructure.FSMC_DataAddressMux = FSMC_DataAddressMux_Disable; FSMC_NORSRAMInitStructure.FSMC_MemoryType = FSMC_MemoryType_SRAM; @@ -685,9 +698,9 @@ static void FSMC_Configuration() FSMC_NORSRAMInitStructure.FSMC_WriteBurst = FSMC_WriteBurst_Disable; FSMC_NORSRAMInitStructure.FSMC_ReadWriteTimingStruct = &p; FSMC_NORSRAMInitStructure.FSMC_WriteTimingStruct = &p; - + FSMC_NORSRAMInit(&FSMC_NORSRAMInitStructure); - + /* Enable FSMC Bank1_SRAM Bank4 */ FSMC_NORSRAMCmd(FSMC_Bank1_NORSRAM4, ENABLE); } diff --git a/bsp/stm3210/dm9000a.h b/bsp/stm3210/dm9000a.h index ec4b2d14bbb0b2c5a3e5eb5a5b600740d84e3536..418a0cb50c7fa5a19b87238627515b43fc74dd36 100644 --- a/bsp/stm3210/dm9000a.h +++ b/bsp/stm3210/dm9000a.h @@ -1,3 +1,17 @@ +/* + * File : dm9000a.c + * This file is part of RT-Thread RTOS + * COPYRIGHT (C) 2009, RT-Thread Development Team + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rt-thread.org/license/LICENSE + * + * Change Logs: + * Date Author Notes + * 2009-07-01 Bernard the first version + */ + #ifndef __DM9000_H__ #define __DM9000_H__ diff --git a/bsp/stm3210/enc28j60.c b/bsp/stm3210/enc28j60.c index 88bcb103e9f2ee2fda6752fc5655ee815a8edc93..245cd21dca8789ac46f5d171b2c2811c41072cb1 100644 --- a/bsp/stm3210/enc28j60.c +++ b/bsp/stm3210/enc28j60.c @@ -1,3 +1,16 @@ +/* + * File : enc28j60.c + * This file is part of RT-Thread RTOS + * COPYRIGHT (C) 2009, RT-Thread Development Team + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rt-thread.org/license/LICENSE + * + * Change Logs: + * Date Author Notes + * 2009-05-05 Bernard the first version + */ #include "enc28j60.h" #include diff --git a/bsp/stm3210/enc28j60.h b/bsp/stm3210/enc28j60.h index 6ed4e1bb45042f75e1e9170ee8d3412ec4cf36b4..38c4f207511abe377283d544bd450fd38eaf16ee 100644 --- a/bsp/stm3210/enc28j60.h +++ b/bsp/stm3210/enc28j60.h @@ -1,3 +1,17 @@ +/* + * File : enc28j60.h + * This file is part of RT-Thread RTOS + * COPYRIGHT (C) 2009, RT-Thread Development Team + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rt-thread.org/license/LICENSE + * + * Change Logs: + * Date Author Notes + * 2009-01-05 Bernard the first version + */ + #ifndef __ENC28J60_H__ #define __ENC28J60_H__ diff --git a/bsp/stm3210/led.c b/bsp/stm3210/led.c index c635bf64bdd95a3cf9fa2fa9e666d50b792231ae..25b44e3517418c08eccf859a757b424b993463fb 100644 --- a/bsp/stm3210/led.c +++ b/bsp/stm3210/led.c @@ -1,3 +1,16 @@ +/* + * File : led.c + * This file is part of RT-Thread RTOS + * COPYRIGHT (C) 2009, RT-Thread Development Team + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rt-thread.org/license/LICENSE + * + * Change Logs: + * Date Author Notes + * 2009-01-05 Bernard the first version + */ #include #include diff --git a/bsp/stm3210/led.h b/bsp/stm3210/led.h index a116ab14ef58c1b8f87623329b20c19f4116f534..10e0db0dd9f8d0db519a14caab2802140d5d1b27 100644 --- a/bsp/stm3210/led.h +++ b/bsp/stm3210/led.h @@ -1,5 +1,20 @@ +/* + * File : led.h + * This file is part of RT-Thread RTOS + * COPYRIGHT (C) 2009, RT-Thread Development Team + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rt-thread.org/license/LICENSE + * + * Change Logs: + * Date Author Notes + * 2009-01-05 Bernard the first version + */ + #ifndef __LED_H__ #define __LED_H__ + #include void rt_hw_led_init(void); diff --git a/bsp/stm3210/rtc.c b/bsp/stm3210/rtc.c index 05e7a9c1326a0795b0677b9cf80ac2c83090e279..3b6f064903b6360ba6e0ea6e29a435890eae7b8b 100644 --- a/bsp/stm3210/rtc.c +++ b/bsp/stm3210/rtc.c @@ -1,3 +1,17 @@ +/* + * File : rtc.c + * This file is part of RT-Thread RTOS + * COPYRIGHT (C) 2009, RT-Thread Development Team + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rt-thread.org/license/LICENSE + * + * Change Logs: + * Date Author Notes + * 2009-01-05 Bernard the first version + */ + #include #include @@ -8,7 +22,7 @@ static rt_err_t rt_rtc_open(rt_device_t dev, rt_uint16_t oflag) { /* Open Interrupt */ } - + return RT_EOK; } @@ -29,14 +43,14 @@ static rt_err_t rt_rtc_control(rt_device_t dev, rt_uint8_t cmd, void *args) /* read device */ *time = RTC_GetCounter(); break; - + case RT_DEVICE_CTRL_RTC_SET_TIME: { time = (rt_time_t *)args; - + /* Enable PWR and BKP clocks */ RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR | RCC_APB1Periph_BKP, ENABLE); - + /* Allow access to BKP Domain */ PWR_BackupAccessCmd(ENABLE); @@ -45,11 +59,11 @@ static rt_err_t rt_rtc_control(rt_device_t dev, rt_uint8_t cmd, void *args) /* Change the current time */ RTC_SetCounter(*time); - + /* Wait until last write operation on RTC registers has finished */ RTC_WaitForLastTask(); - BKP_WriteBackupRegister(BKP_DR1, 0xA5A5); + BKP_WriteBackupRegister(BKP_DR1, 0xA5A5); } break; } @@ -124,10 +138,10 @@ void rt_hw_rtc_init(void) rtc.read = rt_rtc_read; rtc.write = RT_NULL; rtc.control = rt_rtc_control; - + /* no private */ rtc.private = RT_NULL; - + rt_device_register(&rtc, "rtc", RT_DEVICE_FLAG_RDWR); return; @@ -138,14 +152,14 @@ time_t time(time_t* t) { rt_device_t device; time_t time; - + device = rt_device_find("rtc"); if (device != RT_NULL) { rt_device_control(device, RT_DEVICE_CTRL_RTC_GET_TIME, &time); if (t != RT_NULL) *t = time; } - + return time; } @@ -156,11 +170,11 @@ void set_date(rt_uint32_t year, rt_uint32_t month, rt_uint32_t day) time_t now; struct tm* ti; rt_device_t device; - + ti = RT_NULL; /* get current time */ time(&now); - + ti = localtime(&now); if (ti != RT_NULL) { @@ -168,9 +182,9 @@ void set_date(rt_uint32_t year, rt_uint32_t month, rt_uint32_t day) ti->tm_mon = month; ti->tm_mday = day; } - + now = mktime(ti); - + device = rt_device_find("rtc"); if (device != RT_NULL) { @@ -188,7 +202,7 @@ void set_time(rt_uint32_t hour, rt_uint32_t minute, rt_uint32_t second) ti = RT_NULL; /* get current time */ time(&now); - + ti = localtime(&now); if (ti != RT_NULL) { @@ -196,7 +210,7 @@ void set_time(rt_uint32_t hour, rt_uint32_t minute, rt_uint32_t second) ti->tm_min = minute; ti->tm_sec = second; } - + now = mktime(ti); device = rt_device_find("rtc"); if (device != RT_NULL) @@ -209,7 +223,7 @@ FINSH_FUNCTION_EXPORT(set_time, set second) void list_date() { time_t now; - + time(&now); rt_kprintf("%s\n", ctime(&now)); } diff --git a/bsp/stm3210/rtc.h b/bsp/stm3210/rtc.h index 29154aef9497e51cd555b8bec16d8c0f77712488..a100737d7e808af60eee1218fa406b1b2e9bc2c2 100644 --- a/bsp/stm3210/rtc.h +++ b/bsp/stm3210/rtc.h @@ -1,3 +1,17 @@ +/* + * File : rtc.h + * This file is part of RT-Thread RTOS + * COPYRIGHT (C) 2009, RT-Thread Development Team + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rt-thread.org/license/LICENSE + * + * Change Logs: + * Date Author Notes + * 2009-01-05 Bernard the first version + */ + #ifndef __RTC_H__ #define __RTC_H__ diff --git a/bsp/stm3210/rtconfig.h b/bsp/stm3210/rtconfig.h index 170addbbb1a3d02cd628cc986005b2ac849e625d..df9ea89f308659a6006d29c8408a940d8ce00442 100644 --- a/bsp/stm3210/rtconfig.h +++ b/bsp/stm3210/rtconfig.h @@ -17,7 +17,7 @@ /* SECTION: RT_DEBUG */ /* Thread Debug */ #define RT_DEBUG -#define RT_THREAD_DEBUG +/* #define RT_THREAD_DEBUG */ #define RT_USING_OVERFLOW_CHECK @@ -31,7 +31,7 @@ #define RT_TIMER_TICK_PER_SECOND 10 /* SECTION: IPC */ -/* Using Semaphore*/ +/* Using Semaphore */ #define RT_USING_SEMAPHORE /* Using Mutex */ @@ -62,16 +62,17 @@ #define RT_USING_UART1 /* SECTION: Console options */ -/* the buffer size of console*/ +/* the buffer size of console */ #define RT_CONSOLEBUF_SIZE 128 /* SECTION: finsh, a C-Express shell */ +/* Using FinSH as Shell*/ #define RT_USING_FINSH /* Using symbol table */ #define FINSH_USING_SYMTAB #define FINSH_USING_DESCRIPTION -/* SECTION: device filesystem */ +/* SECTION: device filesystem support */ #define RT_USING_DFS #define RT_USING_DFS_EFSL /* #define RT_USING_DFS_ELMFAT */ diff --git a/bsp/stm3210/startup.c b/bsp/stm3210/startup.c index 8efccc26a14565ebd96454918eb8c0aba54ccd92..b52f24bd2d0f9b4359761e6b34327008a74fac90 100644 --- a/bsp/stm3210/startup.c +++ b/bsp/stm3210/startup.c @@ -1,15 +1,15 @@ /* * File : startup.c * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006, RT-Thread Develop Team + * COPYRIGHT (C) 2009, RT-Thread Development Team * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at - * http://openlab.rt-thread.com/license/LICENSE + * http://www.rt-thread.org/license/LICENSE * * Change Logs: * Date Author Notes - * 2006-08-31 Bernard first implementation + * 2009-01-05 Bernard first implementation */ #include diff --git a/bsp/stm3210/stm3210c_eval_lcd.c b/bsp/stm3210/stm3210c_eval_lcd.c index 729ea11fc03f397a4a8be690fc5987a66740bae2..72a7a0702cbc8ff30dd87f64fcadc746aa378073 100644 --- a/bsp/stm3210/stm3210c_eval_lcd.c +++ b/bsp/stm3210/stm3210c_eval_lcd.c @@ -1,3 +1,17 @@ +/* + * File : stm3210c_eval_lcd.c + * This file is part of RT-Thread RTOS + * COPYRIGHT (C) 2009, RT-Thread Development Team + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rt-thread.org/license/LICENSE + * + * Change Logs: + * Date Author Notes + * 2009-11-01 Bernard the first version + */ + #include #include "stm3210c_eval_lcd.h" #include "stm32f10x.h" diff --git a/bsp/stm3210/stm3210c_eval_lcd.h b/bsp/stm3210/stm3210c_eval_lcd.h index c83d7262ee0f50bdb2f6bbe1a31f644dff7c0c3c..dcff8a6064d534f4d0d45e06b81163ad309b4783 100644 --- a/bsp/stm3210/stm3210c_eval_lcd.h +++ b/bsp/stm3210/stm3210c_eval_lcd.h @@ -1,3 +1,17 @@ +/* + * File : stm3210c_eval_lcd.h + * This file is part of RT-Thread RTOS + * COPYRIGHT (C) 2009, RT-Thread Development Team + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rt-thread.org/license/LICENSE + * + * Change Logs: + * Date Author Notes + * 2009-11-01 Bernard the first version + */ + #ifndef __STM3210C_EVAL_LCD_H__ #define __STM3210C_EVAL_LCD_H__ diff --git a/bsp/stm3210/stm3210e_eval_lcd.c b/bsp/stm3210/stm3210e_eval_lcd.c index f53fe02cd9799ca75336343d0268c8fc287f80b9..a02e99d6360be24edd523e5ac7e6abe2a8c7690f 100644 --- a/bsp/stm3210/stm3210e_eval_lcd.c +++ b/bsp/stm3210/stm3210e_eval_lcd.c @@ -1,3 +1,17 @@ +/* + * File : stm3210e_eval_lcd.c + * This file is part of RT-Thread RTOS + * COPYRIGHT (C) 2009, RT-Thread Development Team + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rt-thread.org/license/LICENSE + * + * Change Logs: + * Date Author Notes + * 2009-11-01 Bernard the first version + */ + #include #include "stm32f10x.h" @@ -9,8 +23,8 @@ #include #include -/* - * LCD Driver +/* + * LCD Driver * RGB mode (5-6-5) * 240 x 320 pixel LCD */ @@ -119,14 +133,14 @@ void LCD_DisplayOn(void) void LCD_DisplayOff(void) { /* Display Off */ - LCD_WriteReg(0x26, 0x0); + LCD_WriteReg(0x26, 0x0); } /******************************************************************************* * Function Name : LCD_SetCursor * Description : Sets the cursor position. * Input : - Xpos: specifies the X position. -* - Ypos: specifies the Y position. +* - Ypos: specifies the Y position. * Output : None * Return : None *******************************************************************************/ @@ -134,10 +148,10 @@ void LCD_SetCursor(rt_uint32_t x, rt_uint32_t y) { LCD_WriteReg(0x06, (x & 0xff00) >> 8); LCD_WriteReg(0x07, (x & 0x00ff)); - + LCD_WriteReg(0x02, (y & 0xff00) >> 8); LCD_WriteReg(0x03, (y & 0x00ff)); -} +} /******************************************************************************* * Function Name : LCD_CtrlLinesConfig @@ -150,10 +164,10 @@ void LCD_SetCursor(rt_uint32_t x, rt_uint32_t y) void LCD_CtrlLinesConfig(void) { GPIO_InitTypeDef GPIO_InitStructure; - + /* Enable FSMC, GPIOD, GPIOE, GPIOF, GPIOG and AFIO clocks */ RCC_AHBPeriphClockCmd(RCC_AHBPeriph_FSMC, ENABLE); - + RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA|RCC_APB2Periph_GPIOD | RCC_APB2Periph_GPIOE | RCC_APB2Periph_GPIOF | RCC_APB2Periph_GPIOG | RCC_APB2Periph_AFIO, ENABLE); @@ -169,10 +183,10 @@ void LCD_CtrlLinesConfig(void) GPIO_SetBits(GPIOC, GPIO_Pin_6); /* Set PD.00(D2), PD.01(D3), PD.04(NOE), PD.05(NWE), PD.08(D13), PD.09(D14), - PD.10(D15), PD.14(D0), PD.15(D1) as alternate + PD.10(D15), PD.14(D0), PD.15(D1) as alternate function push pull */ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_4 | GPIO_Pin_5 | - GPIO_Pin_8 | GPIO_Pin_9 | GPIO_Pin_10 | GPIO_Pin_14 | + GPIO_Pin_8 | GPIO_Pin_9 | GPIO_Pin_10 | GPIO_Pin_14 | GPIO_Pin_15; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; @@ -180,8 +194,8 @@ void LCD_CtrlLinesConfig(void) /* Set PE.07(D4), PE.08(D5), PE.09(D6), PE.10(D7), PE.11(D8), PE.12(D9), PE.13(D10), PE.14(D11), PE.15(D12) as alternate function push pull */ - GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6 | GPIO_Pin_7 | GPIO_Pin_8 | GPIO_Pin_9 | GPIO_Pin_10 | - GPIO_Pin_11 | GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_14 | + GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6 | GPIO_Pin_7 | GPIO_Pin_8 | GPIO_Pin_9 | GPIO_Pin_10 | + GPIO_Pin_11 | GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15; GPIO_Init(GPIOE, &GPIO_InitStructure); @@ -189,7 +203,7 @@ void LCD_CtrlLinesConfig(void) /* Set PF.00(A0 (RS)) as alternate function push pull */ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0; GPIO_Init(GPIOF, &GPIO_InitStructure); - + /* Set PG.12(NE4 (LCD/CS)) as alternate function push pull - CE3(LCD /CS) */ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12; GPIO_Init(GPIOG, &GPIO_InitStructure); @@ -206,7 +220,7 @@ void LCD_FSMCConfig(void) { FSMC_NORSRAMInitTypeDef FSMC_NORSRAMInitStructure; FSMC_NORSRAMTimingInitTypeDef p; - + /*-- FSMC Configuration ------------------------------------------------------*/ /*----------------------- SRAM Bank 4 ----------------------------------------*/ /* FSMC_Bank1_NORSRAM4 configuration */ @@ -217,7 +231,7 @@ void LCD_FSMCConfig(void) p.FSMC_CLKDivision = 0; p.FSMC_DataLatency = 0; p.FSMC_AccessMode = FSMC_AccessMode_A; - + /* Color LCD configuration ------------------------------------ LCD configured as follow: - Data/Address MUX = Disable @@ -241,9 +255,9 @@ void LCD_FSMCConfig(void) FSMC_NORSRAMInitStructure.FSMC_WriteBurst = FSMC_WriteBurst_Disable; FSMC_NORSRAMInitStructure.FSMC_ReadWriteTimingStruct = &p; FSMC_NORSRAMInitStructure.FSMC_WriteTimingStruct = &p; - - FSMC_NORSRAMInit(&FSMC_NORSRAMInitStructure); - + + FSMC_NORSRAMInit(&FSMC_NORSRAMInitStructure); + /* BANK 4 (of NOR/SRAM Bank 1~4) is enabled */ FSMC_NORSRAMCmd(FSMC_Bank1_NORSRAM4, ENABLE); } @@ -266,7 +280,7 @@ void rt_hw_lcd_set_pixel(rtgui_color_t *c, rt_base_t x, rt_base_t y) p = rtgui_color_to_565p(*c); LCD_SetCursor(y, x); - + /* Prepare to write GRAM */ LCD_WriteRAM_Prepare(); LCD_WriteRAM(p); @@ -275,7 +289,7 @@ void rt_hw_lcd_set_pixel(rtgui_color_t *c, rt_base_t x, rt_base_t y) void rt_hw_lcd_get_pixel(rtgui_color_t *c, rt_base_t x, rt_base_t y) { rt_uint16_t hc; - + LCD_SetCursor(y, x); hc = LCD_ReadRAM(); *c = rtgui_color_from_565p(hc); @@ -284,7 +298,7 @@ void rt_hw_lcd_get_pixel(rtgui_color_t *c, rt_base_t x, rt_base_t y) void rt_hw_lcd_draw_hline(rtgui_color_t *c, rt_base_t x1, rt_base_t x2, rt_base_t y) { rt_uint16_t hc; - + hc = rtgui_color_to_565p(*c); LCD_SetCursor(y, x1); @@ -356,10 +370,10 @@ void rt_hw_lcd_init() { /* Configure the LCD Control pins --------------------------------------------*/ LCD_CtrlLinesConfig(); - + /* Configure the FSMC Parallel interface -------------------------------------*/ LCD_FSMCConfig(); - + Delay(5); /* delay 50 ms */ // Gamma for CMO 3.2Ħħ LCD_WriteReg(0x46,0x94); @@ -374,7 +388,7 @@ void rt_hw_lcd_init() LCD_WriteReg(0x4f,0xcc); LCD_WriteReg(0x50,0x46); LCD_WriteReg(0x51,0x82); - + //240x320 window setting LCD_WriteReg(0x02,0x00); LCD_WriteReg(0x03,0x00); @@ -382,49 +396,49 @@ void rt_hw_lcd_init() LCD_WriteReg(0x05,0x3f); LCD_WriteReg(0x06,0x00); LCD_WriteReg(0x07,0x00); - LCD_WriteReg(0x08,0x00); - LCD_WriteReg(0x09,0xef); - + LCD_WriteReg(0x08,0x00); + LCD_WriteReg(0x09,0xef); + // Display Setting LCD_WriteReg(0x01,0x06); LCD_WriteReg(0x16,0x68); LCD_WriteReg(0x23,0x95); LCD_WriteReg(0x24,0x95); LCD_WriteReg(0x25,0xff); - + LCD_WriteReg(0x27,0x02); LCD_WriteReg(0x28,0x02); LCD_WriteReg(0x29,0x02); LCD_WriteReg(0x2a,0x02); LCD_WriteReg(0x2c,0x02); - LCD_WriteReg(0x2d,0x02); - + LCD_WriteReg(0x2d,0x02); + LCD_WriteReg(0x3a,0x01);///******************* LCD_WriteReg(0x3b,0x01); LCD_WriteReg(0x3c,0xf0); LCD_WriteReg(0x3d,0x00); - + Delay(2); - + LCD_WriteReg(0x35,0x38); LCD_WriteReg(0x36,0x78); - + LCD_WriteReg(0x3e,0x38); - + LCD_WriteReg(0x40,0x0f); LCD_WriteReg(0x41,0xf0); - + // Power Supply Setting LCD_WriteReg(0x19,0x49);//******** LCD_WriteReg(0x93,0x0f);//******* - + Delay(1); - + LCD_WriteReg(0x20,0x30); LCD_WriteReg(0x1d,0x07); LCD_WriteReg(0x1e,0x00); LCD_WriteReg(0x1f,0x07); - + // VCOM Setting for CMO 3.2Ħħ Panel LCD_WriteReg(0x44,0x4d);//4d***************4f LCD_WriteReg(0x45,0x13);//0x0a); @@ -435,9 +449,9 @@ void rt_hw_lcd_init() Delay(5); LCD_WriteReg(0x1b,0x08); Delay(4); - LCD_WriteReg(0x1b,0x10); + LCD_WriteReg(0x1b,0x10); Delay(4); - + // Display ON Setting LCD_WriteReg(0x90,0x7f); LCD_WriteReg(0x26,0x04); @@ -446,12 +460,12 @@ void rt_hw_lcd_init() LCD_WriteReg(0x26,0x2c); Delay(4); LCD_WriteReg(0x26,0x3c); - + // Set internal VDDD voltage LCD_WriteReg(0x57,0x02); LCD_WriteReg(0x55,0x00); LCD_WriteReg(0x57,0x00); - + /* add lcd driver into graphic driver */ rtgui_list_init(&_rtgui_lcd_driver.list); rtgui_graphic_driver_add(&_rtgui_lcd_driver); diff --git a/bsp/stm3210/stm3210e_eval_lcd.h b/bsp/stm3210/stm3210e_eval_lcd.h index 72cc1211a78feb471074c31b1ff3b0ec41210400..0229d804bfc3cf029e5d161ace81b6b20850807e 100644 --- a/bsp/stm3210/stm3210e_eval_lcd.h +++ b/bsp/stm3210/stm3210e_eval_lcd.h @@ -1,3 +1,17 @@ +/* + * File : stm3210e_eval_lcd.h + * This file is part of RT-Thread RTOS + * COPYRIGHT (C) 2009, RT-Thread Development Team + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rt-thread.org/license/LICENSE + * + * Change Logs: + * Date Author Notes + * 2009-11-01 Bernard the first version + */ + #ifndef __LCD_H__ #define __LCD_H__ diff --git a/bsp/stm3210/usart.c b/bsp/stm3210/usart.c index efa426deb8d802cd44648524f3d2887b2247ad04..0876708d8362d9cdd11681240f7b214fc007bb50 100644 --- a/bsp/stm3210/usart.c +++ b/bsp/stm3210/usart.c @@ -1,3 +1,17 @@ +/* + * File : usart.c + * This file is part of RT-Thread RTOS + * COPYRIGHT (C) 2009, RT-Thread Development Team + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rt-thread.org/license/LICENSE + * + * Change Logs: + * Date Author Notes + * 2009-01-05 Bernard the first version + */ + #include "usart.h" #include #include diff --git a/bsp/stm3210/usart.h b/bsp/stm3210/usart.h index ae74ffde7132a6288ae69ca580e2d7ece12d2fa7..36c5f19b1e398901f823954931a391451cccfb08 100644 --- a/bsp/stm3210/usart.h +++ b/bsp/stm3210/usart.h @@ -1,3 +1,17 @@ +/* + * File : usart.h + * This file is part of RT-Thread RTOS + * COPYRIGHT (C) 2009, RT-Thread Development Team + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rt-thread.org/license/LICENSE + * + * Change Logs: + * Date Author Notes + * 2009-01-05 Bernard the first version + */ + #ifndef __USART_H__ #define __USART_H__ diff --git a/libcpu/arm/stm32/context_gcc.S b/libcpu/arm/stm32/context_gcc.S index 1fbcfd72018ade556f303a7799db585fd2aa0808..04d45c132756be9d703aecb076e2dff244d84601 100644 --- a/libcpu/arm/stm32/context_gcc.S +++ b/libcpu/arm/stm32/context_gcc.S @@ -1,7 +1,7 @@ /* * File : context_gcc.S * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team + * COPYRIGHT (C) 2009, RT-Thread Development Team * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at @@ -151,9 +151,9 @@ rt_hw_context_switch_to: LDR r0, =NVIC_INT_CTRL /* trigger the PendSV exception (causes context switch) */ LDR r1, =NVIC_PENDSVSET STR r1, [r0] - + CPSIE I /* enable interrupts at processor level */ - + /* never reach here! */ /* compatible with old version */ diff --git a/libcpu/arm/stm32/context_iar.S b/libcpu/arm/stm32/context_iar.S index c6f8660bd39d158ba143fd6f2b650fffcb4d8dd4..ee2bb0f5936dc02c977834b5a30221766175cefb 100644 --- a/libcpu/arm/stm32/context_iar.S +++ b/libcpu/arm/stm32/context_iar.S @@ -1,7 +1,7 @@ ;/* -; * File : context.S +; * File : context_iar.S ; * This file is part of RT-Thread RTOS -; * COPYRIGHT (C) 2006, RT-Thread Development Team +; * COPYRIGHT (C) 2009, RT-Thread Development Team ; * ; * The license and distribution terms for this file may be ; * found in the file LICENSE in this distribution or at @@ -109,7 +109,7 @@ rt_hw_pend_sv: swtich_to_thread LDR r1, =rt_interrupt_to_thread LDR r1, [r1] - LDR r1, [r1] ; load thread stack pointer + LDR r1, [r1] ; load thread stack pointer LDMFD r1!, {r4 - r11} ; pop r4 - r11 register MSR psp, r1 ; update stack pointer @@ -148,9 +148,9 @@ rt_hw_context_switch_to: LDR r0, =NVIC_INT_CTRL ; trigger the PendSV exception (causes context switch) LDR r1, =NVIC_PENDSVSET STR r1, [r0] - + CPSIE I ; enable interrupts at processor level - + ; never reach here! ; compatible with old version diff --git a/libcpu/arm/stm32/context_rvds.S b/libcpu/arm/stm32/context_rvds.S index cf07b71bff04a202188445c6472d15df4c160a9e..e2dab09a80bf1eade576ea29d8b7b73cf6faecc2 100644 --- a/libcpu/arm/stm32/context_rvds.S +++ b/libcpu/arm/stm32/context_rvds.S @@ -1,7 +1,7 @@ ;/* -; * File : context.S +; * File : context_rvds.S ; * This file is part of RT-Thread RTOS -; * COPYRIGHT (C) 2006, RT-Thread Development Team +; * COPYRIGHT (C) 2009, RT-Thread Development Team ; * ; * The license and distribution terms for this file may be ; * found in the file LICENSE in this distribution or at @@ -112,7 +112,7 @@ rt_hw_pend_sv PROC swtich_to_thread LDR r1, =rt_interrupt_to_thread LDR r1, [r1] - LDR r1, [r1] ; load thread stack pointer + LDR r1, [r1] ; load thread stack pointer LDMFD r1!, {r4 - r11} ; pop r4 - r11 register MSR psp, r1 ; update stack pointer @@ -155,10 +155,10 @@ rt_hw_context_switch_to PROC LDR r0, =NVIC_INT_CTRL LDR r1, =NVIC_PENDSVSET STR r1, [r0] - + ; enable interrupts at processor level CPSIE I - + ; never reach here! ENDP diff --git a/libcpu/arm/stm32/cpu.c b/libcpu/arm/stm32/cpu.c index 080634c2b9a57fdc02376072feac42c01a4638af..bcd60f4811351d44482a1c3be8f82d900341d31e 100644 --- a/libcpu/arm/stm32/cpu.c +++ b/libcpu/arm/stm32/cpu.c @@ -1,15 +1,15 @@ /* * File : cpu.c * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006, RT-Thread Develop Team + * COPYRIGHT (C) 2009, RT-Thread Development Team * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at - * http://openlab.rt-thread.com/license/LICENSE + * http://www.rt-thread.org/license/LICENSE * * Change Logs: * Date Author Notes - * 2006-03-13 Bernard first version + * 2009-01-05 Bernard first version */ #include diff --git a/libcpu/arm/stm32/fault.c b/libcpu/arm/stm32/fault.c index 7e45d2569d64fc33616daa6ab62854523052ecac..17c4a08b1ffa8198f163fd8e868a222d209cf65c 100644 --- a/libcpu/arm/stm32/fault.c +++ b/libcpu/arm/stm32/fault.c @@ -1,3 +1,16 @@ +/* + * File : fault.c + * This file is part of RT-Thread RTOS + * COPYRIGHT (C) 2009, RT-Thread Development Team + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rt-thread.org/license/LICENSE + * + * Change Logs: + * Date Author Notes + * 2009-01-05 Bernard first version + */ #include struct stack_contex diff --git a/libcpu/arm/stm32/fault_gcc.S b/libcpu/arm/stm32/fault_gcc.S index 929c9c380e3f8ea9e65248942792139709d1df8d..fc8f1d79e42db9a64aa5e200f687c425e3901ea6 100644 --- a/libcpu/arm/stm32/fault_gcc.S +++ b/libcpu/arm/stm32/fault_gcc.S @@ -1,7 +1,7 @@ /* * File : fault_gcc.S * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team + * COPYRIGHT (C) 2009, RT-Thread Development Team * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at diff --git a/libcpu/arm/stm32/fault_iar.S b/libcpu/arm/stm32/fault_iar.S index 21f93025582579beb4a1d415c4e04f09eedb2301..512875e57d21abe66c16c176ca04bb1a3c59e219 100644 --- a/libcpu/arm/stm32/fault_iar.S +++ b/libcpu/arm/stm32/fault_iar.S @@ -1,7 +1,7 @@ ;/* -; * File : context.S +; * File : fault_iar.S ; * This file is part of RT-Thread RTOS -; * COPYRIGHT (C) 2006, RT-Thread Development Team +; * COPYRIGHT (C) 2009, RT-Thread Development Team ; * ; * The license and distribution terms for this file may be ; * found in the file LICENSE in this distribution or at diff --git a/libcpu/arm/stm32/fault_rvds.S b/libcpu/arm/stm32/fault_rvds.S index 799f8d40f169dcb8910461b007b95319092baf5a..9a422e16b91b69375562f28236a52543588168fa 100644 --- a/libcpu/arm/stm32/fault_rvds.S +++ b/libcpu/arm/stm32/fault_rvds.S @@ -1,5 +1,5 @@ ;/* -; * File : context.S +; * File : fault_rvds.S ; * This file is part of RT-Thread RTOS ; * COPYRIGHT (C) 2006, RT-Thread Development Team ; * diff --git a/libcpu/arm/stm32/interrupt.c b/libcpu/arm/stm32/interrupt.c index 3f6165a255036aad8597d5f8dc4395c5a9cf132e..8cf81a620fbe8aba0bd6d1022150c3e0b119e81f 100644 --- a/libcpu/arm/stm32/interrupt.c +++ b/libcpu/arm/stm32/interrupt.c @@ -1,15 +1,15 @@ /* - * File : trap.c + * File : interrupt.c * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006, RT-Thread Development Team + * COPYRIGHT (C) 2009, RT-Thread Development Team * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at - * http://openlab.rt-thread.com/license/LICENSE + * http://www.rt-thread.org/license/LICENSE * * Change Logs: * Date Author Notes - * 2006-03-13 Bernard first version + * 2009-01-05 Bernard first version */ #include diff --git a/libcpu/arm/stm32/serial.c b/libcpu/arm/stm32/serial.c index 54c8290687109564dd221bb8e5d57dfbe31336ef..19b0d80375443776bbb666f79b841a1a18ad4330 100644 --- a/libcpu/arm/stm32/serial.c +++ b/libcpu/arm/stm32/serial.c @@ -1,11 +1,11 @@ /* * File : serial.c * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006, RT-Thread Development Team + * COPYRIGHT (C) 2009, RT-Thread Development Team * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at - * http://openlab.rt-thread.com/license/LICENSE + * http://www.rt-thread.org/license/LICENSE * * Change Logs: * Date Author Notes @@ -17,7 +17,7 @@ #include "serial.h" #include -static void rt_serial_enable_dma(DMA_Channel_TypeDef* dma_channel, +static void rt_serial_enable_dma(DMA_Channel_TypeDef* dma_channel, rt_uint32_t address, rt_uint32_t size); /** @@ -34,10 +34,10 @@ int rt_serial_getc(struct stm32_serial_device* uart) { rt_base_t level; int ch = -1; - + /* disable interrupt */ level = rt_hw_interrupt_disable(); - + if (uart->int_rx->read_index != uart->int_rx->save_index) { ch = uart->int_rx->rx_buffer[uart->int_rx->read_index]; @@ -46,10 +46,10 @@ int rt_serial_getc(struct stm32_serial_device* uart) if (uart->int_rx->read_index >= UART_RX_BUFFER_SIZE) uart->int_rx->read_index = 0; } - + /* enable interrupt */ rt_hw_interrupt_enable(level); - + return ch; } @@ -57,7 +57,7 @@ int rt_serial_getc(struct stm32_serial_device* uart) void rt_serial_savechar(struct stm32_serial_device* uart, char ch) { rt_base_t level; - + /* disable interrupt */ level = rt_hw_interrupt_disable(); @@ -65,7 +65,7 @@ void rt_serial_savechar(struct stm32_serial_device* uart, char ch) uart->int_rx->save_index ++; if (uart->int_rx->save_index >= UART_RX_BUFFER_SIZE) uart->int_rx->save_index = 0; - + /* if the next position is read index, discard this 'read char' */ if (uart->int_rx->save_index == uart->int_rx->read_index) { @@ -107,26 +107,26 @@ static rt_err_t rt_serial_init (rt_device_t dev) { if (dev->flag & RT_DEVICE_FLAG_INT_RX) { - rt_memset(uart->int_rx->rx_buffer, 0, + rt_memset(uart->int_rx->rx_buffer, 0, sizeof(uart->int_rx->rx_buffer)); uart->int_rx->read_index = 0; uart->int_rx->save_index = 0; } - + if (dev->flag & RT_DEVICE_FLAG_DMA_RX) { RT_ASSERT(uart->dma_rx->dma_channel != RT_NULL); uart->dma_rx->read_index = uart->dma_rx->read_descriptor = 0; uart->dma_rx->is_full = RT_FALSE; } - + if (dev->flag & RT_DEVICE_FLAG_INT_TX) { - rt_memset(uart->int_tx->tx_buffer, 0, + rt_memset(uart->int_tx->tx_buffer, 0, sizeof(uart->int_tx->tx_buffer)); uart->int_tx->write_index = uart->int_tx->save_index = 0; } - + if (dev->flag & RT_DEVICE_FLAG_DMA_TX) { RT_ASSERT(uart->dma_rx->dma_channel != RT_NULL); @@ -145,28 +145,28 @@ static rt_err_t rt_serial_init (rt_device_t dev) static rt_err_t rt_serial_open(rt_device_t dev, rt_uint16_t oflag) { struct stm32_serial_device* uart; - + RT_ASSERT(dev != RT_NULL); - + uart = (struct stm32_serial_device*)dev->private; if (dev->flag & RT_DEVICE_FLAG_DMA_RX) { /* enable Rx DMA */ - rt_serial_enable_dma(uart->dma_rx->dma_channel, + rt_serial_enable_dma(uart->dma_rx->dma_channel, (rt_uint32_t)&(uart->dma_rx->rx_buffer[uart->dma_rx->save_descriptor][0]), UART_DMA_RX_BUFFER_SIZE); } - + return RT_EOK; } static rt_err_t rt_serial_close(rt_device_t dev) { struct stm32_serial_device* uart; - + RT_ASSERT(dev != RT_NULL); - + uart = (struct stm32_serial_device*)dev->private; if (dev->flag & RT_DEVICE_FLAG_DMA_RX) @@ -182,7 +182,7 @@ static rt_size_t rt_serial_read (rt_device_t dev, rt_off_t pos, void* buffer, rt rt_uint8_t* ptr; rt_err_t err_code; struct stm32_serial_device* uart; - + ptr = buffer; err_code = RT_EOK; uart = (struct stm32_serial_device*)dev->private; @@ -217,7 +217,7 @@ static rt_size_t rt_serial_read (rt_device_t dev, rt_off_t pos, void* buffer, rt /* set error code */ err_code = -RT_EEMPTY; } - else + else { /* read data */ while ((rt_uint32_t)ptr - (rt_uint32_t)buffer < size) @@ -225,16 +225,16 @@ static rt_size_t rt_serial_read (rt_device_t dev, rt_off_t pos, void* buffer, rt /* read buffer */ *ptr ++ = uart->dma_rx-> rx_buffer[uart->dma_rx->read_descriptor][uart->dma_rx->read_index]; - + /* move to next position */ uart->dma_rx->read_index ++; - + /* wrap read index */ if (uart->dma_rx->read_index >= UART_DMA_RX_BUFFER_SIZE) { /* wrap read index */ uart->dma_rx->read_index = 0; - + /* move to next read descriptor */ uart->dma_rx->read_descriptor ++; /* wrap read descriptor */ @@ -252,7 +252,7 @@ static rt_size_t rt_serial_read (rt_device_t dev, rt_off_t pos, void* buffer, rt rt_hw_interrupt_enable(level); /* re-enable DMA to receive */ - rt_serial_enable_dma(uart->dma_rx->dma_channel, + rt_serial_enable_dma(uart->dma_rx->dma_channel, (rt_uint32_t)&(uart->dma_rx->rx_buffer[uart->dma_rx->save_descriptor][0]), UART_DMA_RX_BUFFER_SIZE); } @@ -286,11 +286,11 @@ static rt_size_t rt_serial_read (rt_device_t dev, rt_off_t pos, void* buffer, rt return (rt_uint32_t)ptr - (rt_uint32_t)buffer; } -static void rt_serial_enable_dma(DMA_Channel_TypeDef* dma_channel, +static void rt_serial_enable_dma(DMA_Channel_TypeDef* dma_channel, rt_uint32_t address, rt_uint32_t size) { RT_ASSERT(dma_channel != RT_NULL); - + /* disable DMA */ DMA_Cmd(dma_channel, DISABLE); @@ -298,7 +298,7 @@ static void rt_serial_enable_dma(DMA_Channel_TypeDef* dma_channel, dma_channel->CMAR = address; /* set size */ dma_channel->CNDTR = size; - + /* enable DMA */ DMA_Cmd(dma_channel, ENABLE); } @@ -308,7 +308,7 @@ static rt_size_t rt_serial_write (rt_device_t dev, rt_off_t pos, const void* buf rt_uint8_t* ptr; rt_err_t err_code; struct stm32_serial_device* uart; - + err_code = RT_EOK; ptr = (rt_uint8_t*)buffer; uart = (struct stm32_serial_device*)dev->private; @@ -320,17 +320,17 @@ static rt_size_t rt_serial_write (rt_device_t dev, rt_off_t pos, const void* buf { /* save on tx buffer */ uart->int_tx->tx_buffer[uart->int_tx->save_index] = *ptr++; - + -- size; /* move to next position */ uart->int_tx->save_index ++; - + /* wrap save index */ if (uart->int_tx->save_index >= UART_TX_BUFFER_SIZE) uart->int_tx->save_index = 0; } - + /* set error code */ if (size > 0) err_code = -RT_EFULL; @@ -338,9 +338,9 @@ static rt_size_t rt_serial_write (rt_device_t dev, rt_off_t pos, const void* buf else if (dev->flag & RT_DEVICE_FLAG_DMA_TX) { /* DMA mode Tx */ - + /* allocate a data node */ - struct stm32_serial_data_node* data_node = + struct stm32_serial_data_node* data_node = (struct stm32_serial_data_node*) rt_malloc (sizeof(struct stm32_serial_data_node)); if (data_node == RT_NULL) { @@ -350,14 +350,14 @@ static rt_size_t rt_serial_write (rt_device_t dev, rt_off_t pos, const void* buf else { rt_uint32_t level; - + /* fill data node */ data_node->data_ptr = ptr; data_node->data_size = size; - + /* insert to data link */ data_node->next = RT_NULL; - + /* disable interrupt */ level = rt_hw_interrupt_disable(); @@ -365,15 +365,15 @@ static rt_size_t rt_serial_write (rt_device_t dev, rt_off_t pos, const void* buf if (uart->dma_tx->list_tail != RT_NULL) uart->dma_tx->list_tail->next = data_node; uart->dma_tx->list_tail = data_node; - + if (uart->dma_tx->list_head == RT_NULL) { /* start DMA to transmit data */ uart->dma_tx->list_head = data_node; - + /* Enable DMA Channel */ - rt_serial_enable_dma(uart->dma_tx->dma_channel, - (rt_uint32_t)uart->dma_tx->list_head->data_ptr, + rt_serial_enable_dma(uart->dma_tx->dma_channel, + (rt_uint32_t)uart->dma_tx->list_head->data_ptr, uart->dma_tx->list_head->data_size); } @@ -389,18 +389,18 @@ static rt_size_t rt_serial_write (rt_device_t dev, rt_off_t pos, const void* buf rt_serial_putc(dev, *ptr); ++ptr; --size; } - } + } /* set error code */ rt_set_errno(err_code); - + return (rt_uint32_t)ptr - (rt_uint32_t)buffer; } static rt_err_t rt_serial_control (rt_device_t dev, rt_uint8_t cmd, void *args) { struct stm32_serial_device* uart; - + RT_ASSERT(dev != RT_NULL); uart = (struct stm32_serial_device*)dev->private; @@ -411,19 +411,19 @@ static rt_err_t rt_serial_control (rt_device_t dev, rt_uint8_t cmd, void *args) dev->flag |= RT_DEVICE_FLAG_SUSPENDED; USART_Cmd(uart->uart_device, DISABLE); break; - + case RT_DEVICE_CTRL_RESUME: /* resume device */ dev->flag &= ~RT_DEVICE_FLAG_SUSPENDED; USART_Cmd(uart->uart_device, ENABLE); break; } - + return RT_EOK; } /* - * serial register for STM32 + * serial register for STM32 * support STM32F103VB and STM32F103ZE */ rt_err_t rt_hw_serial_register(rt_device_t device, const char* name, rt_uint32_t flag, struct stm32_serial_device *serial) @@ -449,10 +449,10 @@ rt_err_t rt_hw_serial_register(rt_device_t device, const char* name, rt_uint32_t void rt_hw_serial_isr(rt_device_t device) { struct stm32_serial_device* uart = (struct stm32_serial_device*) device->private; - + if(USART_GetITStatus(uart->uart_device, USART_IT_RXNE) != RESET) { - /* interrupt mode receive */ + /* interrupt mode receive */ RT_ASSERT(device->flag & RT_DEVICE_FLAG_INT_RX); /* save on rx buffer */ @@ -460,7 +460,7 @@ void rt_hw_serial_isr(rt_device_t device) { rt_serial_savechar(uart, uart->uart_device->DR & 0xff); } - + /* clear interrupt */ USART_ClearITPendingBit(uart->uart_device, USART_IT_RXNE); @@ -468,7 +468,7 @@ void rt_hw_serial_isr(rt_device_t device) if (device->rx_indicate != RT_NULL) { rt_size_t rx_length; - + /* get rx length */ rx_length = uart->int_rx->read_index > uart->int_rx->save_index ? UART_RX_BUFFER_SIZE - uart->int_rx->read_index + uart->int_rx->save_index : @@ -477,12 +477,12 @@ void rt_hw_serial_isr(rt_device_t device) device->rx_indicate(device, rx_length); } } - + if (USART_GetITStatus(uart->uart_device, USART_IT_TC) != RESET) { /* interrupt mode transmission */ RT_ASSERT(device->flag & RT_DEVICE_FLAG_INT_TX); - + /* transmission completed */ uart->int_tx->write_index ++; if (uart->int_tx->write_index >= UART_TX_BUFFER_SIZE) @@ -490,7 +490,7 @@ void rt_hw_serial_isr(rt_device_t device) /* clear interrupt */ USART_ClearITPendingBit(uart->uart_device, USART_IT_TC); - + /* start next transmission */ if (uart->int_tx->write_index < uart->int_tx->save_index) @@ -501,33 +501,33 @@ void rt_hw_serial_isr(rt_device_t device) } } -/* +/* * ISR for DMA mode Rx */ void rt_hw_serial_dma_rx_isr(rt_device_t device) { rt_uint32_t next_descriptor; struct stm32_serial_device* uart = (struct stm32_serial_device*) device->private; - - /* DMA mode receive */ + + /* DMA mode receive */ RT_ASSERT(device->flag & RT_DEVICE_FLAG_DMA_RX); - + /* invoke callback */ if (device->rx_indicate != RT_NULL) device->rx_indicate(device, UART_DMA_RX_BUFFER_SIZE); next_descriptor = uart->dma_rx->save_descriptor; - + /* move to next descriptor */ next_descriptor ++; if (next_descriptor >= UART_DMA_RX_DESCRIPTOR) next_descriptor = 0; - + if (next_descriptor != uart->dma_rx->read_descriptor) { uart->dma_rx->save_descriptor = next_descriptor; /* enable next DMA */ - rt_serial_enable_dma(uart->dma_rx->dma_channel, + rt_serial_enable_dma(uart->dma_rx->dma_channel, (rt_uint32_t)&(uart->dma_rx->rx_buffer[uart->dma_rx->save_descriptor][0]), UART_DMA_RX_BUFFER_SIZE); } @@ -539,7 +539,7 @@ void rt_hw_serial_dma_rx_isr(rt_device_t device) } } -/* +/* * ISR for DMA mode Tx */ void rt_hw_serial_dma_tx_isr(rt_device_t device) @@ -548,20 +548,20 @@ void rt_hw_serial_dma_tx_isr(rt_device_t device) struct stm32_serial_data_node* data_node; struct stm32_serial_device* uart = (struct stm32_serial_device*) device->private; - /* DMA mode receive */ + /* DMA mode receive */ RT_ASSERT(device->flag & RT_DEVICE_FLAG_DMA_TX); - + /* get the first data node */ data_node = uart->dma_tx->list_head; RT_ASSERT(data_node != RT_NULL); - + /* invoke call to notify tx complete */ if (device->tx_complete != RT_NULL) device->tx_complete(device, data_node->data_ptr); /* disable interrupt */ level = rt_hw_interrupt_disable(); - + /* remove list tail */ uart->dma_tx->list_tail = data_node->prev; if (uart->dma_tx->list_tail == RT_NULL) @@ -569,10 +569,10 @@ void rt_hw_serial_dma_tx_isr(rt_device_t device) /* enable interrupt */ rt_hw_interrupt_enable(level); - + /* free data node memory */ rt_free(data_node); - + if (uart->dma_tx->list_tail != RT_NULL) { /* transmit next data node */ diff --git a/libcpu/arm/stm32/serial.h b/libcpu/arm/stm32/serial.h index 5bf3b8155ec6f7e6d605baf10af276e8aff24a35..0b08e13cd55fe9ddd52e6ba9d4a8f91e5a6a125f 100644 --- a/libcpu/arm/stm32/serial.h +++ b/libcpu/arm/stm32/serial.h @@ -1,3 +1,16 @@ +/* + * File : serial.h + * This file is part of RT-Thread RTOS + * COPYRIGHT (C) 2009, RT-Thread Development Team + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rt-thread.org/license/LICENSE + * + * Change Logs: + * Date Author Notes + * 2009-01-05 Bernard first version + */ #ifndef __RT_HW_SERIAL_H__ #define __RT_HW_SERIAL_H__ diff --git a/libcpu/arm/stm32/stack.c b/libcpu/arm/stm32/stack.c index c7f8c71ab4076e74eed5ce0638f91f4faad1e2ed..bf2578b80320ecf33f8303632a5f12eddb7cad6c 100644 --- a/libcpu/arm/stm32/stack.c +++ b/libcpu/arm/stm32/stack.c @@ -1,11 +1,11 @@ /* * File : stack.c * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006, RT-Thread Development Team + * COPYRIGHT (C) 2009, RT-Thread Development Team * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at - * http://openlab.rt-thread.com/license/LICENSE + * http://www.rt-thread.org/license/LICENSE * * Change Logs: * Date Author Notes diff --git a/src/clock.c b/src/clock.c index b45ca8d24f97fc3f59cb18ce938b03cea697c67f..0b91dbcfc69afa53f16f23c2c2d9d9b6e6eedf97 100644 --- a/src/clock.c +++ b/src/clock.c @@ -1,11 +1,11 @@ /* * File : clock.c * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006, RT-Thread Development Team + * COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at - * http://openlab.rt-thread.com/license/LICENSE + * http://www.rt-thread.org/license/LICENSE * * Change Logs: * Date Author Notes @@ -50,7 +50,7 @@ rt_tick_t rt_tick_get() } /** - * This function will notify kernel there is one tick passed. Normally, + * This function will notify kernel there is one tick passed. Normally, * this function is invoked by clock ISR. */ void rt_tick_increase() diff --git a/src/device.c b/src/device.c index 30b29b832629d55930142803a431c9f7ecfed3b8..818f4e04455c33fba36e86037031051333443b6e 100644 --- a/src/device.c +++ b/src/device.c @@ -1,11 +1,11 @@ /* * File : device.c * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006, RT-Thread Development Team + * COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at - * http://openlab.rt-thread.com/license/LICENSE + * http://www.rt-thread.org/license/LICENSE * * Change Logs: * Date Author Notes @@ -81,7 +81,7 @@ rt_err_t rt_device_init_all() result = init(device); if (result != RT_EOK) { - rt_kprintf("To initialize device:%s failed. The error code is %d\n", + rt_kprintf("To initialize device:%s failed. The error code is %d\n", device->parent.name, result); } else diff --git a/src/idle.c b/src/idle.c index f7da5e2c81ccdb2367872d61c2790c54a0f57216..a86be531c26e6e3035534d315293156584562418 100644 --- a/src/idle.c +++ b/src/idle.c @@ -1,11 +1,11 @@ /* * File : idle.c * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006, RT-Thread Development Team + * COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at - * http://openlab.rt-thread.com/license/LICENSE + * http://www.rt-thread.org/license/LICENSE * * Change Logs: * Date Author Notes diff --git a/src/ipc.c b/src/ipc.c index c005221d8755d4bde04c6ac6c9b79166cb790acc..840465dc5297d2124891ee313719c9c856b94b9e 100644 --- a/src/ipc.c +++ b/src/ipc.c @@ -1,7 +1,7 @@ /* * File : ipc.c * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006, RT-Thread Development Team + * COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at @@ -26,9 +26,9 @@ * 2009-07-18 Bernard fix the event clear bug * 2009-09-09 Bernard remove fast event and fix ipc release bug * 2009-10-10 Bernard change semaphore and mutex value to unsigned value - * 2009-10-25 Bernard change the mb/mq receive timeout to 0 if the + * 2009-10-25 Bernard change the mb/mq receive timeout to 0 if the * re-calculated delta tick is a negative number. - * 2009-12-16 Bernard fix the rt_ipc_object_suspend issue when IPC flag + * 2009-12-16 Bernard fix the rt_ipc_object_suspend issue when IPC flag * is RT_IPC_FLAG_PRIO */ @@ -334,7 +334,7 @@ rt_err_t rt_sem_take (rt_sem_t sem, rt_int32_t time) temp = rt_hw_interrupt_disable(); #ifdef RT_IPC_DEBUG - rt_kprintf("thread %s take sem:%s, which value is: %d\n", rt_thread_self()->name, + rt_kprintf("thread %s take sem:%s, which value is: %d\n", rt_thread_self()->name, ((struct rt_object*)sem)->name, sem->value); #endif if (sem->value > 0) @@ -437,7 +437,7 @@ rt_err_t rt_sem_release(rt_sem_t sem) temp = rt_hw_interrupt_disable(); #ifdef RT_IPC_DEBUG - rt_kprintf("thread %s releases sem:%s, which value is: %d\n", rt_thread_self()->name, + rt_kprintf("thread %s releases sem:%s, which value is: %d\n", rt_thread_self()->name, ((struct rt_object*)sem)->name, sem->value); #endif @@ -612,7 +612,7 @@ rt_err_t rt_mutex_take (rt_mutex_t mutex, rt_int32_t time) #endif #ifdef RT_IPC_DEBUG - rt_kprintf("mutex_take: current thread %s, mutex value: %d, hold: %d\n", + rt_kprintf("mutex_take: current thread %s, mutex value: %d, hold: %d\n", thread->name, mutex->value, mutex->hold); #endif @@ -626,7 +626,7 @@ rt_err_t rt_mutex_take (rt_mutex_t mutex, rt_int32_t time) } else { - /* in initialization status, the value is 1. Therefore, if the + /* in initialization status, the value is 1. Therefore, if the * value is great than 1, which indicates the mutex is avaible. */ if (mutex->value > 0) @@ -737,7 +737,7 @@ rt_err_t rt_mutex_release(rt_mutex_t mutex) temp = rt_hw_interrupt_disable(); #ifdef RT_IPC_DEBUG - rt_kprintf("mutex_release:current thread %s, mutex value: %d, hold: %d\n", + rt_kprintf("mutex_release:current thread %s, mutex value: %d, hold: %d\n", thread->name, mutex->value, mutex->hold); #endif @@ -803,7 +803,7 @@ rt_err_t rt_mutex_release(rt_mutex_t mutex) /* perform a schedule */ if (need_schedule == RT_TRUE) rt_schedule(); - + return RT_EOK; } @@ -1799,7 +1799,7 @@ rt_err_t rt_mq_recv (rt_mq_t mq, void* buffer, rt_size_t size, rt_int32_t timeou /* get current thread */ thread = rt_thread_self(); - + /* message queue is empty */ while (mq->entry == 0) { @@ -1824,7 +1824,7 @@ rt_err_t rt_mq_recv (rt_mq_t mq, void* buffer, rt_size_t size, rt_int32_t timeou { /* get the start tick of timer */ tick_delta = rt_tick_get(); - + #ifdef RT_IPC_DEBUG rt_kprintf("set thread:%s to timer list\n", thread->name); #endif diff --git a/src/irq.c b/src/irq.c index cdad4039761222724c3f26606510cf009d504c8a..3edde2f7bf10510827f5e339db7e51e7439fe449 100644 --- a/src/irq.c +++ b/src/irq.c @@ -1,11 +1,11 @@ /* * File : irq.c * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006, RT-Thread Development Team + * COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at - * http://openlab.rt-thread.com/license/LICENSE + * http://www.rt-thread.org/license/LICENSE * * Change Logs: * Date Author Notes @@ -36,7 +36,7 @@ volatile rt_uint32_t rt_interrupt_nest; void rt_interrupt_enter() { rt_base_t level; - + #ifdef IRQ_DEBUG rt_kprintf("irq comming..., irq nest:%d\n", rt_interrupt_nest); #endif diff --git a/src/kservice.c b/src/kservice.c index af2c4e5caabbd458ec4cf5d5f76081a8699856c0..4a464b57dcfa33e72db48625e681a18cc54495a3 100644 --- a/src/kservice.c +++ b/src/kservice.c @@ -1,11 +1,11 @@ /* * File : kservice.c * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006, RT-Thread Development Team + * COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at - * http://openlab.rt-thread.com/license/LICENSE + * http://www.rt-thread.org/license/LICENSE * * Change Logs: * Date Author Notes @@ -31,16 +31,16 @@ int errno; /* * This function will get errno - * + * * @return errno */ rt_err_t rt_get_errno(void) { rt_thread_t tid; - + tid = rt_thread_self(); if (tid == RT_NULL) return errno; - + return tid->error; } @@ -52,10 +52,10 @@ rt_err_t rt_get_errno(void) void rt_set_errno(rt_err_t error) { rt_thread_t tid; - + tid = rt_thread_self(); if (tid == RT_NULL) { errno = error; return; } - + tid->error = error; } @@ -605,12 +605,12 @@ static rt_int32_t vsnprintf(char *buf, rt_size_t size, const char *fmt, va_list end = buf + size - 1; /* Make sure end is always >= buf */ - if (end < buf) + if (end < buf) { end = ((char *)-1); size = end - buf; } - + for (; *fmt ; ++fmt) { if (*fmt != '%') @@ -859,7 +859,7 @@ rt_int32_t rt_snprintf(char *buf, rt_size_t size, const char *fmt, ...) * This function will fill a formatted string to buffer * * @param buf the buffer to save formatted string - * @param arg_ptr the arg_ptr + * @param arg_ptr the arg_ptr * @param format the format */ rt_int32_t rt_vsprintf(char *buf, const char *format, va_list arg_ptr) @@ -877,11 +877,11 @@ rt_int32_t rt_sprintf(char *buf ,const char *format,...) { rt_int32_t n; va_list arg_ptr; - + va_start(arg_ptr, format); n = rt_vsprintf(buf ,format,arg_ptr); va_end (arg_ptr); - + return n; } diff --git a/src/kservice.h b/src/kservice.h index 2b82cbe9b8f155ce5eddeb68c370ed6e5328de61..e862dd0f19ada23fe4c596eb3a544c74db3a3295 100644 --- a/src/kservice.h +++ b/src/kservice.h @@ -1,11 +1,11 @@ /* * File : kservice.h * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006, RT-Thread Development Team + * COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at - * http://openlab.rt-thread.com/license/LICENSE + * http://www.rt-thread.org/license/LICENSE * * Change Logs: * Date Author Notes @@ -49,7 +49,7 @@ rt_inline void rt_list_insert_after(rt_list_t *l, rt_list_t *n) } /** - * @brief insert a node before a list + * @brief insert a node before a list * * @param n new node to be inserted * @param l list to insert it diff --git a/src/mem.c b/src/mem.c index e0b351e4acc4e0eebe6da705cec056b573d6b894..3aa1be8bb688518ae52e83a84a7d3637e9a1dc81 100644 --- a/src/mem.c +++ b/src/mem.c @@ -1,7 +1,7 @@ /* - * File : kservice.c + * File : mem.c * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2008, RT-Thread Development Team + * COPYRIGHT (C) 2008 - 2009, RT-Thread Development Team * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at @@ -61,9 +61,9 @@ static void (*rt_free_hook)(void *ptr); /*@{*/ /** - * This function will set a hook function, which will be invoked when a memory + * This function will set a hook function, which will be invoked when a memory * block is allocated from heap memory. - * + * * @param hook the hook function */ void rt_malloc_sethook(void (*hook)(void *ptr, rt_size_t size)) @@ -72,9 +72,9 @@ void rt_malloc_sethook(void (*hook)(void *ptr, rt_size_t size)) } /** - * This function will set a hook function, which will be invoked when a memory + * This function will set a hook function, which will be invoked when a memory * block is released to heap memory. - * + * * @param hook the hook function */ void rt_free_sethook(void (*hook)(void *ptr)) @@ -238,7 +238,7 @@ void *rt_malloc(rt_size_t size) /* take memory semaphore */ rt_sem_take(&heap_sem, RT_WAITING_FOREVER); - for (ptr = (rt_uint8_t *)lfree - heap_ptr; ptr < mem_size_aligned - size; + for (ptr = (rt_uint8_t *)lfree - heap_ptr; ptr < mem_size_aligned - size; ptr = ((struct heap_mem *)&heap_ptr[ptr])->next) { mem = (struct heap_mem *)&heap_ptr[ptr]; @@ -334,7 +334,7 @@ void *rt_malloc(rt_size_t size) * * @param rmem pointer to memory allocated by rt_malloc * @param newsize the required new size - * + * * @return the changed memory block address */ void *rt_realloc(void *rmem, rt_size_t newsize) @@ -356,7 +356,7 @@ void *rt_realloc(void *rmem, rt_size_t newsize) rt_sem_take(&heap_sem, RT_WAITING_FOREVER); - if ((rt_uint8_t *)rmem < (rt_uint8_t *)heap_ptr || + if ((rt_uint8_t *)rmem < (rt_uint8_t *)heap_ptr || (rt_uint8_t *)rmem >= (rt_uint8_t *)heap_end) { /* illegal memory */ @@ -404,8 +404,8 @@ void *rt_realloc(void *rmem, rt_size_t newsize) } /** - * This function will contiguously allocate enough space for count objects - * that are size bytes of memory each and returns a pointer to the allocated + * This function will contiguously allocate enough space for count objects + * that are size bytes of memory each and returns a pointer to the allocated * memory. * * The allocated memory is filled with bytes of value zero. @@ -429,7 +429,7 @@ void *rt_calloc(rt_size_t count, rt_size_t size) } /** - * This function will release the previously allocated memory block by rt_malloc. + * This function will release the previously allocated memory block by rt_malloc. * The released memory block is taken back to system heap. * * @param rmem the address of memory which will be released @@ -488,7 +488,7 @@ void rt_free(void *rmem) } #ifdef RT_MEM_STATS -void rt_memory_info(rt_uint32_t *total, +void rt_memory_info(rt_uint32_t *total, rt_uint32_t *used, rt_uint32_t *max_used) { @@ -496,7 +496,7 @@ void rt_memory_info(rt_uint32_t *total, if (used != RT_NULL) *used = used_mem; if (max_used != RT_NULL) *max_used = max_mem; } - + #ifdef RT_USING_FINSH #include void list_mem() diff --git a/src/mempool.c b/src/mempool.c index 4d28012b6622fdfce0b3c639c1267bfacf17e381..34b4d4c51c8496c5faad99b16fdd77ea50c86bff 100644 --- a/src/mempool.c +++ b/src/mempool.c @@ -1,16 +1,16 @@ /* - * File : partition.c + * File : mempool.c * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006, RT-Thread Development Team + * COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at - * http://openlab.rt-thread.com/license/LICENSE + * http://www.rt-thread.org/license/LICENSE * * Change Logs: * Date Author Notes * 2006-05-27 Bernard implement memory pool - * 2006-06-03 Bernard fix the thread timer init bug + * 2006-06-03 Bernard fix the thread timer init bug * 2006-06-30 Bernard fix the allocate/free block bug * 2006-08-04 Bernard add hook support * 2006-08-10 Bernard fix interrupt bug in rt_mp_alloc @@ -35,7 +35,7 @@ static void (*rt_mp_free_hook)(struct rt_mempool* mp, void *block); /** * This function will set a hook function, which will be invoked when a memory * block is allocated from memory pool. - * + * * @param hook the hook function */ void rt_mp_alloc_sethook(void (*hook)(struct rt_mempool* mp, void *block)) @@ -46,7 +46,7 @@ void rt_mp_alloc_sethook(void (*hook)(struct rt_mempool* mp, void *block)) /** * This function will set a hook function, which will be invoked when a memory * block is released to memory pool. - * + * * @param hook the hook function */ void rt_mp_free_sethook(void (*hook)(struct rt_mempool* mp, void *block)) @@ -135,7 +135,7 @@ rt_err_t rt_mp_detach(struct rt_mempool* mp) thread->error = -RT_ERROR; /* - * resume thread + * resume thread * In rt_thread_resume function, it will remove current thread from suspend * list */ @@ -238,7 +238,7 @@ rt_err_t rt_mp_delete(rt_mp_t mp) thread->error = -RT_ERROR; /* - * resume thread + * resume thread * In rt_thread_resume function, it will remove current thread from suspend * list */ @@ -253,7 +253,7 @@ rt_err_t rt_mp_delete(rt_mp_t mp) /* release allocated room */ rt_free(mp->start_address); - + /* detach object */ rt_object_delete(&(mp->parent)); @@ -275,7 +275,7 @@ void *rt_mp_alloc (rt_mp_t mp, rt_int32_t time) rt_uint8_t* block_ptr; register rt_base_t level; struct rt_thread* thread; - + /* disable interrupt */ level = rt_hw_interrupt_disable(); @@ -314,7 +314,7 @@ void *rt_mp_alloc (rt_mp_t mp, rt_int32_t time) { /* init thread timer and start it */ rt_timer_control(&(thread->thread_timer), RT_TIMER_CTRL_SET_TIME, &time); - rt_timer_start(&(thread->thread_timer)); + rt_timer_start(&(thread->thread_timer)); } /* enable interrupt */ @@ -336,7 +336,7 @@ void *rt_mp_alloc (rt_mp_t mp, rt_int32_t time) mp->block_list = *(rt_uint8_t**)block_ptr; /* point to memory pool */ - *(rt_uint8_t**)block_ptr = (rt_uint8_t*)mp; + *(rt_uint8_t**)block_ptr = (rt_uint8_t*)mp; } } diff --git a/src/object.c b/src/object.c index a19f0d4c46e4de6dc7121f83e6ef17d71dbfcfcb..daf2606b5198afe2aecb2cf9dabf2cd36797c2d9 100644 --- a/src/object.c +++ b/src/object.c @@ -1,11 +1,11 @@ /* * File : object.c * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006, RT-Thread Development Team + * COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at - * http://openlab.rt-thread.com/license/LICENSE + * http://www.rt-thread.org/license/LICENSE * * Change Logs: * Date Author Notes diff --git a/src/scheduler.c b/src/scheduler.c index 4714d3ea7377e808da7dab6d479a4b6222f267f3..6c214d4cd23bba785c66f58a3ede9bcba29f1260 100644 --- a/src/scheduler.c +++ b/src/scheduler.c @@ -1,11 +1,11 @@ /* * File : scheduler.c * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006, RT-Thread Development Team + * COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at - * http://openlab.rt-thread.com/license/LICENSE + * http://www.rt-thread.org/license/LICENSE * * Change Logs: * Date Author Notes diff --git a/src/slab.c b/src/slab.c index 59a1db7aa168e2a5d670c6df71f574d1c24d705c..dff6dd471cff5112b629b862c8acf60a49a50ca8 100644 --- a/src/slab.c +++ b/src/slab.c @@ -1,7 +1,7 @@ /* * File : slab.c * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2008, RT-Thread Development Team + * COPYRIGHT (C) 2008 - 2009, RT-Thread Development Team * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at diff --git a/src/thread.c b/src/thread.c index 53f6cbf6b06a411d3641c7ef8375b6c5eb1d37e9..a9bfd91144774e596f3801402d012cfaa0d57a1e 100644 --- a/src/thread.c +++ b/src/thread.c @@ -1,11 +1,11 @@ /* * File : thread.c * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006, RT-Thread Development Team + * COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at - * http://openlab.rt-thread.com/license/LICENSE + * http://www.rt-thread.org/license/LICENSE * * Change Logs: * Date Author Notes @@ -81,7 +81,7 @@ static rt_err_t _rt_thread_init(struct rt_thread* thread, /* init user data */ thread->user_data = 0; - + /* init thread timer */ rt_timer_init(&(thread->thread_timer), thread->name, diff --git a/src/timer.c b/src/timer.c index 285a9715203634625715521c2d1a84851a978a9f..a8e1f9b4790f21ec0e80d086e345e1d90a8af1ba 100644 --- a/src/timer.c +++ b/src/timer.c @@ -1,7 +1,7 @@ /* * File : timer.c * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006, RT-Thread Development Team + * COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at @@ -420,12 +420,12 @@ static struct rt_thread timer_thread; static rt_uint8_t timer_thread_stack[RT_TIMER_THREAD_STACK_SIZE]; static struct rt_semaphore timer_sem; -static rt_uint16_t timer_ex_cnt; +static rt_uint16_t timer_ex_cnt; void rt_soft_timer_tick_increase (void) { timer_ex_cnt++; - if (timer_ex_cnt >= (RT_TICK_PER_SECOND / RT_TIMER_EX_TICKS_PER_SEC)) + if (timer_ex_cnt >= (RT_TICK_PER_SECOND / RT_TIMER_TICK_PER_SECOND)) { timer_ex_cnt = 0; rt_sem_release(&timer_sem);