[260] | 1 | #include "r2ca_app.h"
|
---|
[136] | 2 |
|
---|
| 3 | /*
|
---|
| 4 | * Max number of task
|
---|
| 5 | */
|
---|
[260] | 6 | #define R2CA_NUM_TASK_MAX 5
|
---|
[136] | 7 |
|
---|
| 8 | /*
|
---|
| 9 | * Check number of task
|
---|
| 10 | */
|
---|
[260] | 11 | #if R2CA_NUM_TASK > R2CA_NUM_TASK_MAX
|
---|
[136] | 12 | #error The number of Task is over!
|
---|
[260] | 13 | #endif /* R2CA_NUM_TASK > R2CA_NUM_TASK_MAX */
|
---|
[136] | 14 |
|
---|
| 15 | /*
|
---|
| 16 | * Idle task loop count per 10ms at idle state
|
---|
| 17 | */
|
---|
| 18 | #define IDLE_TASK_IDLE_LOOP_10MS 42178
|
---|
| 19 |
|
---|
| 20 | /*
|
---|
| 21 | * Default Macro
|
---|
| 22 | */
|
---|
| 23 |
|
---|
| 24 | /*
|
---|
| 25 | * Priotiry
|
---|
| 26 | */
|
---|
[260] | 27 | #ifndef R2CA_MAINTASK_PRI
|
---|
| 28 | #define R2CA_MAINTASK_PRI 5
|
---|
| 29 | #endif /* R2CA_MAINTASK_SETUP_PRI */
|
---|
[136] | 30 |
|
---|
[260] | 31 | #ifndef R2CA_TASK1_PRI
|
---|
| 32 | #define R2CA_TASK1_PRI 5
|
---|
| 33 | #endif /* R2CA_TASK1_SETUP_PRI */
|
---|
[136] | 34 |
|
---|
[260] | 35 | #ifndef R2CA_TASK2_PRI
|
---|
| 36 | #define R2CA_TASK2_PRI 5
|
---|
| 37 | #endif /* R2CA_TASK2_SETUP_PRI */
|
---|
[136] | 38 |
|
---|
[260] | 39 | #ifndef R2CA_TASK3_PRI
|
---|
| 40 | #define R2CA_TASK3_PRI 5
|
---|
| 41 | #endif /* R2CA_TASK3_SETUP_PRI */
|
---|
[136] | 42 |
|
---|
[260] | 43 | #ifndef R2CA_TASK4_PRI
|
---|
| 44 | #define R2CA_TASK4_PRI 5
|
---|
| 45 | #endif /* R2CA_TASK4_SETUP_PRI */
|
---|
[136] | 46 |
|
---|
[260] | 47 | #ifndef R2CA_TASK5_PRI
|
---|
| 48 | #define R2CA_TASK5_PRI 5
|
---|
| 49 | #endif /* R2CA_TASK3_SETUP_PRI */
|
---|
[136] | 50 |
|
---|
| 51 | /*
|
---|
| 52 | * Stack Size
|
---|
| 53 | */
|
---|
[260] | 54 | #ifndef R2CA_MAINTASK_STACK_SIZE
|
---|
| 55 | #define R2CA_MAINTASK_STACK_SIZE 2048
|
---|
| 56 | #endif /* R2CA_MAINTASK_STACK_SIZE */
|
---|
[136] | 57 |
|
---|
[260] | 58 | #ifndef R2CA_TASK1_STACK_SIZE
|
---|
| 59 | #define R2CA_TASK1_STACK_SIZE 1024
|
---|
| 60 | #endif /* R2CA_TASK1_STACK_SIZE */
|
---|
[136] | 61 |
|
---|
[260] | 62 | #ifndef R2CA_TASK2_STACK_SIZE
|
---|
| 63 | #define R2CA_TASK2_STACK_SIZE 1024
|
---|
| 64 | #endif /* R2CA_TASK2_STACK_SIZE */
|
---|
[136] | 65 |
|
---|
[260] | 66 | #ifndef R2CA_TASK3_STACK_SIZE
|
---|
| 67 | #define R2CA_TASK3_STACK_SIZE 1024
|
---|
| 68 | #endif /* R2CA_TASK3_STACK_SIZE */
|
---|
[136] | 69 |
|
---|
[260] | 70 | #ifndef R2CA_TASK4_STACK_SIZE
|
---|
| 71 | #define R2CA_TASK4_STACK_SIZE 1024
|
---|
| 72 | #endif /* R2CA_TASK4_STACK_SIZE */
|
---|
[136] | 73 |
|
---|
[260] | 74 | #ifndef R2CA_TASK5_STACK_SIZE
|
---|
| 75 | #define R2CA_TASK5_STACK_SIZE 1024
|
---|
| 76 | #endif /* R2CA_TASK5_STACK_SIZE */
|
---|
[136] | 77 |
|
---|
[238] | 78 |
|
---|
| 79 | /*
|
---|
| 80 | * Round Robin Scheduling cycle
|
---|
| 81 | */
|
---|
[260] | 82 | #ifndef R2CA_RR_SCHEDULE_CYCLE
|
---|
| 83 | #define R2CA_RR_SCHEDULE_CYCLE 1
|
---|
| 84 | #endif /* R2CA_RR_SCHEDULE_CYCLE */
|
---|
| 85 |
|
---|
| 86 | #ifndef R2CA_RR_SCHEDULE_PRI
|
---|
| 87 | #define R2CA_RR_SCHEDULE_PRI 0x0000
|
---|
| 88 | #endif /* R2CA_RR_SCHEDULE_PRI */
|
---|
[238] | 89 |
|
---|
[136] | 90 | #ifdef __cplusplus
|
---|
| 91 | extern "C" {
|
---|
| 92 | #endif
|
---|
| 93 |
|
---|
[260] | 94 | extern void r2ca_init(intptr_t exinf);
|
---|
| 95 | extern void r2ca_maintask(intptr_t exinf);
|
---|
| 96 | extern void r2ca_task1(intptr_t exinf);
|
---|
| 97 | extern void r2ca_task2(intptr_t exinf);
|
---|
| 98 | extern void r2ca_task3(intptr_t exinf);
|
---|
| 99 | extern void r2ca_task4(intptr_t exinf);
|
---|
| 100 | extern void r2ca_task5(intptr_t exinf);
|
---|
| 101 | extern void r2ca_CycHandler(intptr_t exinf);
|
---|
[136] | 102 |
|
---|
[260] | 103 | extern void r2ca_USB_Handler(void);
|
---|
| 104 | extern void r2ca_SERCOM0_Handler(void);
|
---|
| 105 | extern void r2ca_SERCOM2_Handler(void);
|
---|
| 106 | extern void r2ca_SERCOM3_Handler(void);
|
---|
| 107 | extern void r2ca_SERCOM4_Handler(void);
|
---|
| 108 | extern void r2ca_SERCOM5_Handler(void);
|
---|
| 109 | extern void r2ca_EIC_Handler(void);
|
---|
| 110 | extern void r2ca_TC5_Handler(void);
|
---|
| 111 | extern void r2ca_RTC_Handler(void);
|
---|
[136] | 112 |
|
---|
[260] | 113 | #ifdef R2CA_ENABLE_PROFILING
|
---|
| 114 | extern void r2ca_idle_task(intptr_t exinf);
|
---|
| 115 | extern volatile uint32_t r2ca_idle_result;
|
---|
| 116 | extern volatile uint32_t r2ca_isr_result;
|
---|
| 117 | extern volatile uint32_t r2ca_dispatch_result;
|
---|
| 118 | extern volatile uint32_t r2ca_timer_isr_result;
|
---|
| 119 | extern volatile uint32_t r2ca_usb_isr_result;
|
---|
| 120 | extern volatile uint32_t r2ca_sercom0_isr_result;
|
---|
| 121 | extern volatile uint32_t r2ca_sercom4_isr_result;
|
---|
| 122 | extern volatile uint32_t r2ca_sercom5_isr_result;
|
---|
| 123 | extern volatile uint32_t r2ca_eic_isr_result;
|
---|
| 124 | extern volatile uint32_t r2ca_tc5_isr_result;
|
---|
| 125 | extern volatile uint32_t r2ca_rtc_isr_result;
|
---|
[136] | 126 |
|
---|
[260] | 127 | #ifdef R2CA_USE_SERIAL3
|
---|
| 128 | extern volatile uint32_t r2ca_sercom3_isr_result;
|
---|
| 129 | #endif /* R2CA_USE_SERIAL3 */
|
---|
[136] | 130 |
|
---|
[260] | 131 | #endif /* R2CA_ENABLE_PROFILING */
|
---|
[136] | 132 |
|
---|
[196] | 133 | #define WIRE_ENTER_CRITICAL wai_sem(WIRE_SEM);
|
---|
| 134 | #define WIRE_LEAVE_CRITICAL sig_sem(WIRE_SEM);
|
---|
| 135 |
|
---|
[136] | 136 | #ifdef __cplusplus
|
---|
| 137 | }
|
---|
| 138 | #endif
|
---|