Skip to content

Commit 9de2942

Browse files
authored
Merge pull request #4 from RT-Thread/master
sync
2 parents fd05ad7 + 4539172 commit 9de2942

File tree

175 files changed

+8259
-2603
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

175 files changed

+8259
-2603
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ RT-Thread RTOS like a traditional real-time operating system. The kernel has rea
1717

1818
* Device Driver;
1919
* Component;
20-
* Dyanmic Module
20+
* Dynamic Module
2121

2222
The device driver is more like a driver framework, UART, IIC, SPI, SDIO, USB device/host, EMAC, MTD NAND etc. The developer can easily add low level driver and board configuration, then combined with the upper framework, he/she can use lots of features.
2323

2424
The Component is a software concept upon RT-Thread kernel, for example a shell (finsh/msh shell), virtual file system (FAT, YAFFS, UFFS, ROM/RAM file system etc), TCP/IP protocol stack (lwIP), POSIX (thread) interface etc. One component must be a directory under RT-Thread/Components and one component can be descripted by a SConscript file (then be compiled and linked into the system).
2525

26-
The Dyanmic Module, formerly named as User Applicaion (UA) is a dyanmic loaded module or library, it can be compiled standalone without Kernel. Each Dyanmic Module has its own object list to manage thread/semaphore/kernel object which was created or initialized inside this UA. More information about UA, please visit another [git repo](https://github.com/RT-Thread/rtthread-apps).
26+
The Dynamic Module, formerly named as User Applicaion (UA) is a dynamic loaded module or library, it can be compiled standalone without Kernel. Each Dynamic Module has its own object list to manage thread/semaphore/kernel object which was created or initialized inside this UA. More information about UA, please visit another [git repo](https://github.com/RT-Thread/rtthread-apps).
2727

2828
## Board Support Package ##
2929

bsp/allwinner_tina/libcpu/interrupt.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ void rt_hw_interrupt_mask(int vector)
102102
}
103103

104104
/**
105+
105106
* This function will un-mask a interrupt.
106107
* @param vector the interrupt number
107108
*/
@@ -167,7 +168,7 @@ rt_isr_handler_t rt_hw_interrupt_install(int vector, rt_isr_handler_t handler,
167168
return old_handler;
168169
}
169170

170-
void rt_interrupt_dispatch(void)
171+
void rt_interrupt_dispatch(rt_uint32_t fiq_irq)
171172
{
172173
void *param;
173174
int vector;

bsp/at91sam9g45/drivers/board.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636
extern int Image$$ER_ZI$$ZI$$Limit;
3737
#define HEAP_BEGIN (&Image$$ER_ZI$$ZI$$Limit)
3838
#elif (defined (__GNUC__))
39-
extern unsigned char __bss_end__;
40-
#define HEAP_BEGIN (&__bss_end__)
39+
extern unsigned char __bss_end;
40+
#define HEAP_BEGIN (&__bss_end)
4141
#elif (defined (__ICCARM__))
4242
#pragma section=".noinit"
4343
#define HEAP_BEGIN (__section_end(".noinit"))

bsp/at91sam9g45/link_scripts/at91sam9g45_ram.ld

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
22
OUTPUT_ARCH(arm)
3-
ENTRY(start)
3+
ENTRY(system_vectors)
44
SECTIONS
55
{
66
. = 0x70000000;
77

88
. = ALIGN(4);
99
.text :
1010
{
11-
*(.init)
11+
*(.vectors)
1212
*(.text)
1313
*(.gnu.linkonce.t*)
1414

@@ -76,9 +76,9 @@ SECTIONS
7676
.nobss : { *(.nobss) }
7777

7878
. = ALIGN(4);
79-
__bss_start__ = .;
79+
__bss_start = .;
8080
.bss : { *(.bss)}
81-
__bss_end__ = .;
81+
__bss_end = .;
8282

8383
/* stabs debugging sections. */
8484
.stab 0 : { *(.stab) }

bsp/at91sam9g45/platform/interrupt.c

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ void rt_hw_interrupt_umask(int irq)
332332
* @return old handler
333333
*/
334334
rt_isr_handler_t rt_hw_interrupt_install(int vector, rt_isr_handler_t handler,
335-
void *param, char *name)
335+
void *param, const char *name)
336336
{
337337
rt_isr_handler_t old_handler = RT_NULL;
338338

@@ -419,6 +419,29 @@ void rt_hw_interrupt_ack(rt_uint32_t fiq_irq, rt_uint32_t id)
419419
AT91C_BASE_AIC->AIC_EOICR = 0x0;
420420
}
421421

422+
void rt_interrupt_dispatch(rt_uint32_t fiq_irq)
423+
{
424+
rt_isr_handler_t isr_func;
425+
rt_uint32_t irq;
426+
void *param;
427+
428+
/* get irq number */
429+
irq = rt_hw_interrupt_get_active(fiq_irq);
430+
431+
/* get interrupt service routine */
432+
isr_func = irq_desc[irq].handler;
433+
param = irq_desc[irq].param;
434+
435+
/* turn to interrupt service routine */
436+
isr_func(irq, param);
437+
438+
rt_hw_interrupt_ack(fiq_irq, irq);
439+
#ifdef RT_USING_INTERRUPT_INFO
440+
irq_desc[irq].counter ++;
441+
#endif
442+
}
443+
444+
422445
#ifdef RT_USING_FINSH
423446
#ifdef RT_USING_INTERRUPT_INFO
424447
void list_irq(void)

bsp/at91sam9g45/rtconfig.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
if CROSS_TOOL == 'gcc':
1212
PLATFORM = 'gcc'
13-
EXEC_PATH = r'D:\arm-2013.11\bin'
13+
EXEC_PATH = '/usr/bin'
1414
elif CROSS_TOOL == 'keil':
1515
PLATFORM = 'armcc'
1616
EXEC_PATH = 'C:/Keil_v5'

bsp/es32f0334/drivers/board.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#define ES32F0_SRAM_SIZE 0x8000
1818
#define ES32F0_SRAM_END (0x20000000 + ES32F0_SRAM_SIZE)
1919

20-
#ifdef __CC_ARM
20+
#if defined(__CC_ARM) || defined(__CLANG_ARM)
2121
extern int Image$$RW_IRAM1$$ZI$$Limit;
2222
#define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit)
2323
#elif __ICCARM__

bsp/es32f0334/drivers/drv_pm.c

Lines changed: 13 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* Change Logs:
77
* Date Author Notes
88
* 2019-04-08 wangyq the first version
9+
* 2019-05-06 Zero-Free adapt to the new power management interface
910
*/
1011

1112
#include <rthw.h>
@@ -16,52 +17,26 @@
1617

1718
#ifdef RT_USING_PM
1819

19-
static void _drv_pm_enter(struct rt_pm *pm)
20+
static void _drv_pm_enter(struct rt_pm *pm, uint8_t mode)
2021
{
21-
rt_uint32_t mode;
22-
23-
mode = pm->current_mode;
24-
2522
switch (mode)
2623
{
27-
case PM_RUN_MODE_NORMAL:
24+
case PM_SLEEP_MODE_NONE:
2825
break;
2926

30-
case PM_SLEEP_MODE_SLEEP:
27+
case PM_SLEEP_MODE_IDLE:
3128
__WFI();
3229
break;
3330

34-
case PM_SLEEP_MODE_TIMER:
35-
pmu_stop2_enter();
36-
break;
37-
38-
case PM_SLEEP_MODE_SHUTDOWN:
39-
pmu_standby_enter(PMU_STANDBY_PORT_NONE);
40-
break;
41-
42-
default:
43-
RT_ASSERT(0);
44-
break;
45-
}
46-
}
47-
48-
static void _drv_pm_exit(struct rt_pm *pm)
49-
{
50-
rt_uint32_t mode;
51-
52-
RT_ASSERT(pm != RT_NULL);
53-
54-
mode = pm->current_mode;
55-
56-
switch (mode)
57-
{
58-
case PM_RUN_MODE_NORMAL:
31+
case PM_SLEEP_MODE_LIGHT:
5932
break;
6033

61-
case PM_SLEEP_MODE_SLEEP:
34+
case PM_SLEEP_MODE_DEEP:
35+
pmu_stop2_enter();
6236
break;
6337

64-
case PM_SLEEP_MODE_TIMER:
38+
case PM_SLEEP_MODE_STANDBY:
39+
pmu_standby_enter(PMU_STANDBY_PORT_NONE);
6540
break;
6641

6742
case PM_SLEEP_MODE_SHUTDOWN:
@@ -73,32 +48,21 @@ static void _drv_pm_exit(struct rt_pm *pm)
7348
}
7449
}
7550

76-
#if PM_RUN_MODE_COUNT > 1
77-
static void _drv_pm_frequency_change(struct rt_pm *pm, rt_uint32_t frequency)
78-
{
79-
return;
80-
}
81-
#endif
82-
8351
static int drv_hw_pm_init(void)
8452
{
8553
static const struct rt_pm_ops _ops =
8654
{
8755
_drv_pm_enter,
88-
_drv_pm_exit,
89-
90-
#if PM_RUN_MODE_COUNT > 1
91-
_drv_pm_frequency_change,
92-
#endif
56+
RT_NULL,
9357
RT_NULL,
9458
RT_NULL,
9559
RT_NULL
9660
};
9761

98-
rt_uint8_t timer_mask;
62+
rt_uint8_t timer_mask = 0;
9963

100-
/* initialize timer mask */
101-
timer_mask = 1UL << PM_SLEEP_MODE_TIMER;
64+
/* initialize timer mask(no need tickless) */
65+
// timer_mask = 1UL << PM_SLEEP_MODE_DEEP;
10266

10367
/* initialize system pm module */
10468
rt_system_pm_init(&_ops, timer_mask, RT_NULL);

bsp/es32f0654/drivers/board.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#define ES32F0_SRAM_SIZE 0x8000
1818
#define ES32F0_SRAM_END (0x20000000 + ES32F0_SRAM_SIZE)
1919

20-
#ifdef __CC_ARM
20+
#if defined(__CC_ARM) || defined(__CLANG_ARM)
2121
extern int Image$$RW_IRAM1$$ZI$$Limit;
2222
#define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit)
2323
#elif __ICCARM__

bsp/es32f0654/drivers/drv_pm.c

Lines changed: 13 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* Change Logs:
77
* Date Author Notes
88
* 2019-04-01 wangyq the first version
9+
* 2019-05-06 Zero-Free adapt to the new power management interface
910
*/
1011

1112
#include <rthw.h>
@@ -16,52 +17,26 @@
1617

1718
#ifdef RT_USING_PM
1819

19-
static void _drv_pm_enter(struct rt_pm *pm)
20+
static void _drv_pm_enter(struct rt_pm *pm, uint8_t mode)
2021
{
21-
rt_uint32_t mode;
22-
23-
mode = pm->current_mode;
24-
2522
switch (mode)
2623
{
27-
case PM_RUN_MODE_NORMAL:
24+
case PM_SLEEP_MODE_NONE:
2825
break;
2926

30-
case PM_SLEEP_MODE_SLEEP:
27+
case PM_SLEEP_MODE_IDLE:
3128
__WFI();
3229
break;
3330

34-
case PM_SLEEP_MODE_TIMER:
35-
pmu_stop2_enter();
36-
break;
37-
38-
case PM_SLEEP_MODE_SHUTDOWN:
39-
pmu_standby_enter(PMU_STANDBY_PORT_NONE);
40-
break;
41-
42-
default:
43-
RT_ASSERT(0);
44-
break;
45-
}
46-
}
47-
48-
static void _drv_pm_exit(struct rt_pm *pm)
49-
{
50-
rt_uint32_t mode;
51-
52-
RT_ASSERT(pm != RT_NULL);
53-
54-
mode = pm->current_mode;
55-
56-
switch (mode)
57-
{
58-
case PM_RUN_MODE_NORMAL:
31+
case PM_SLEEP_MODE_LIGHT:
5932
break;
6033

61-
case PM_SLEEP_MODE_SLEEP:
34+
case PM_SLEEP_MODE_DEEP:
35+
pmu_stop2_enter();
6236
break;
6337

64-
case PM_SLEEP_MODE_TIMER:
38+
case PM_SLEEP_MODE_STANDBY:
39+
pmu_standby_enter(PMU_STANDBY_PORT_NONE);
6540
break;
6641

6742
case PM_SLEEP_MODE_SHUTDOWN:
@@ -73,32 +48,21 @@ static void _drv_pm_exit(struct rt_pm *pm)
7348
}
7449
}
7550

76-
#if PM_RUN_MODE_COUNT > 1
77-
static void _drv_pm_frequency_change(struct rt_pm *pm, rt_uint32_t frequency)
78-
{
79-
return;
80-
}
81-
#endif
82-
8351
static int drv_hw_pm_init(void)
8452
{
8553
static const struct rt_pm_ops _ops =
8654
{
8755
_drv_pm_enter,
88-
_drv_pm_exit,
89-
90-
#if PM_RUN_MODE_COUNT > 1
91-
_drv_pm_frequency_change,
92-
#endif
56+
RT_NULL,
9357
RT_NULL,
9458
RT_NULL,
9559
RT_NULL
9660
};
9761

98-
rt_uint8_t timer_mask;
62+
rt_uint8_t timer_mask = 0;
9963

100-
/* initialize timer mask */
101-
timer_mask = 1UL << PM_SLEEP_MODE_TIMER;
64+
/* initialize timer mask(no need tickless) */
65+
timer_mask = 1UL << PM_SLEEP_MODE_DEEP;
10266

10367
/* initialize system pm module */
10468
rt_system_pm_init(&_ops, timer_mask, RT_NULL);

0 commit comments

Comments
 (0)