-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.h
38 lines (24 loc) · 1.14 KB
/
main.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#ifndef MAIN_H_
#define MAIN_H_
#define MAX_TASKS 5
/* some stack memory calculations */
#define SIZE_TASK_STACK 1024U
#define SIZE_SCHED_STACK 1024U
#define SRAM_START 0x20000000U
#define SIZE_SRAM ( (128) * (1024))
#define SRAM_END ((SRAM_START) + (SIZE_SRAM) )
#define T1_STACK_START SRAM_END
#define T2_STACK_START ( (SRAM_END) - (1 * SIZE_TASK_STACK) )
#define T3_STACK_START ( (SRAM_END) - (2 * SIZE_TASK_STACK) )
#define T4_STACK_START ( (SRAM_END) - (3 * SIZE_TASK_STACK) )
#define IDLE_STACK_START ( (SRAM_END) - (4 * SIZE_TASK_STACK) )
#define SCHED_STACK_START ( (SRAM_END) - (5 * SIZE_TASK_STACK) )
#define TICK_HZ 1000U
#define HSI_CLOCK 16000000U
#define SYSTICK_TIM_CLK HSI_CLOCK
#define DUMMY_XPSR 0x01000000U
#define TASK_READY_STATE 0x00
#define TASK_BLOCKED_STATE 0XFF
#define INTERRUPT_DISABLE() do{__asm volatile ("MOV R0,#0x1"); asm volatile("MSR PRIMASK,R0"); } while(0)
#define INTERRUPT_ENABLE() do{__asm volatile ("MOV R0,#0x0"); asm volatile("MSR PRIMASK,R0"); } while(0)
#endif /* MAIN_H_ */