FreeRTOSConfig.h 2.84 KB
Newer Older
Rahix's avatar
Rahix committed
1
2
3
#ifndef FREERTOS_CONFIG_H
#define FREERTOS_CONFIG_H

Rahix's avatar
Rahix committed
4
5
6
#define  MXC_ASSERT_ENABLE
#include "mxc_assert.h"

Rahix's avatar
Rahix committed
7
8
9
#include "max32665.h"

/* CMSIS keeps a global updated with current system clock in Hz */
10
#define configCPU_CLOCK_HZ          ((unsigned long)96000000)
Rahix's avatar
Rahix committed
11
12
13
14

/* TODO: Adjust this for tickless idle */
#define configTICK_RATE_HZ          ((portTickType)1000)

15
16
17
18
/* Memory
 *
 * Heap is managed by libc (heap_3.c).
 */
swym's avatar
swym committed
19
#define configMINIMAL_STACK_SIZE    ((unsigned short)256)
Rahix's avatar
Rahix committed
20

21
/* FIXME: Assign proper priorities to all interrupts */
Rahix's avatar
Rahix committed
22
23
24
25
#define configMAX_PRIORITIES        5
/* # of priority bits (configured in hardware) is provided by CMSIS */
#define configPRIO_BITS             __NVIC_PRIO_BITS
/* Priority 7, or 255 as only the top three bits are implemented.  This is the lowest priority. */
26
27
28
29
#define configKERNEL_INTERRUPT_PRIORITY \
	( ( unsigned char ) 7 << ( 8 - configPRIO_BITS) )
#define configMAX_SYSCALL_INTERRUPT_PRIORITY \
	( ( unsigned char ) 2 << ( 8 - configPRIO_BITS) )
Rahix's avatar
Rahix committed
30
31

/* We want to use preemption to easier integrate components */
Rahix's avatar
Rahix committed
32
#define configUSE_PREEMPTION        1
Rahix's avatar
Rahix committed
33
34
35
36
37
38

/*
 * Tickless idle from the FreeRTOS port + our own hooks (defined further down in
 * this file)
 */
#define configUSE_TICKLESS_IDLE     1
Rahix's avatar
Rahix committed
39
40
41
42
43
44
45

/* TODO: Adjust */
#define configUSE_IDLE_HOOK         0
#define configUSE_TICK_HOOK         0
#define configUSE_CO_ROUTINES       0
#define configUSE_16_BIT_TICKS      0
#define configUSE_MUTEXES           1
46
47
48
49
50
#define configUSE_TIMERS            1

#define configTIMER_TASK_PRIORITY   (configMAX_PRIORITIES - 1)
#define configTIMER_QUEUE_LENGTH    10
#define configTIMER_TASK_STACK_DEPTH (configMINIMAL_STACK_SIZE * 2)
Rahix's avatar
Rahix committed
51
52
53

#define INCLUDE_vTaskSuspend        1
#define INCLUDE_vTaskDelay          1
54
#define INCLUDE_uxTaskGetStackHighWaterMark 1
swym's avatar
swym committed
55
#define INCLUDE_xTimerPendFunctionCall 1
Rahix's avatar
Rahix committed
56
57
58
/* Allow static allocation of data structures */
#define configSUPPORT_STATIC_ALLOCATION 1

59
60
61
62
63
64
65
/*
 * Enable stack overflow detector.
 *
 * TODO: Remove for production.
 */
#define configCHECK_FOR_STACK_OVERFLOW 2

Rahix's avatar
Rahix committed
66
67
68
69
70
/* Alias the default handler names to match CMSIS weak symbols */
#define vPortSVCHandler       SVC_Handler
#define xPortPendSVHandler    PendSV_Handler
#define xPortSysTickHandler   SysTick_Handler

Rahix's avatar
Rahix committed
71
72
73
74
75
76
77
78
79
80
81
82
83
/* Assert */
#define configASSERT(x)       MXC_ASSERT(x)

/* Tickless idle hooks */
typedef uint32_t TickType_t;
void pre_idle_sleep(TickType_t xExpectedIdleTime);
#define configPRE_SLEEP_PROCESSING(xModifiableIdleTime) \
	pre_idle_sleep(xModifiableIdleTime); xModifiableIdleTime = 0

void post_idle_sleep(TickType_t xExpectedIdleTime);
#define configPOST_SLEEP_PROCESSING(xExpectedIdleTime) \
	post_idle_sleep(xExpectedIdleTime)

swym's avatar
swym committed
84
85
86
87
88
89
90
/*
 * Uncomment to trace FreeRTOS malloc wrapper.
 *
 */
// extern int printf (const char *__restrict __format, ...);
// #define traceMALLOC( pvAddress, uiSize ) printf("[%s:%d] %p %d\n", __FILE__, __LINE__, pvAddress, uiSize)

Rahix's avatar
Rahix committed
91
#endif /* FREERTOS_CONFIG_H */