Skip to content

Commit 2660eb8

Browse files
tangzz98mysterywolf
authored andcommitted
Add files for esp-idf
1 parent 0b29aab commit 2660eb8

File tree

20 files changed

+1609
-3
lines changed

20 files changed

+1609
-3
lines changed

FreeRTOS/SConscript

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ src = Glob('*.c')
66
src += Glob(os.path.join("portable", "rt-thread", "*.c"))
77
src += Glob(os.path.join("portable", "MemMang", "heap_3.c"))
88

9-
CPPPATH = [os.path.join(cwd, "include"), os.path.join(cwd, "portable", "rt-thread")]
9+
CPPPATH = [os.path.join(cwd, "include", "freertos"), os.path.join(cwd, "portable", "rt-thread")]
1010

1111
group = DefineGroup('FreeRTOS', src, depend = [''], CPPPATH = CPPPATH)
1212

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,15 @@
6767
/* Definitions specific to the port being used. */
6868
#include "portable.h"
6969

70-
/* Read only */
71-
#define configUSE_NEWLIB_REENTRANT 0
70+
/* Must be defaulted before configUSE_NEWLIB_REENTRANT is used below. */
71+
#ifndef configUSE_NEWLIB_REENTRANT
72+
#define configUSE_NEWLIB_REENTRANT 0
73+
#endif
74+
75+
/* Required if struct _reent is used. */
76+
#if ( configUSE_NEWLIB_REENTRANT == 1 )
77+
#include <reent.h>
78+
#endif
7279

7380
/*
7481
* Check all the required application specific macros have been defined.

FreeRTOS/include/freertos/list.h

Lines changed: 499 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@
5757
#endif
5858
/* *INDENT-ON* */
5959

60+
#ifdef configUSE_FREERTOS_PROVIDED_HEAP
61+
6062
/* Used by heap_5.c to define the start address and size of each memory region
6163
* that together comprise the total FreeRTOS heap space. */
6264
typedef struct HeapRegion
@@ -105,6 +107,21 @@ void vPortInitialiseBlocks( void );
105107
size_t xPortGetFreeHeapSize( void );
106108
size_t xPortGetMinimumEverFreeHeapSize( void );
107109

110+
#else // configUSE_FREERTOS_PROVIDED_HEAP
111+
112+
/*
113+
* Map to the memory management routines required for the port.
114+
*
115+
* Note that libc standard malloc/free are also available for
116+
* non-FreeRTOS-specific code, and behave the same as
117+
* pvPortMalloc()/vPortFree().
118+
*/
119+
#define pvPortMalloc malloc
120+
#define vPortFree free
121+
#define xPortGetFreeHeapSize esp_get_free_heap_size
122+
#define xPortGetMinimumEverFreeHeapSize esp_get_minimum_free_heap_size
123+
124+
#endif
108125
void vPortEndScheduler( void );
109126

110127
/* *INDENT-OFF* */
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ typedef void (* TaskFunction_t)( void * );
4242
#define pdMS_TO_TICKS( xTimeInMs ) ( ( TickType_t ) rt_tick_from_millisecond( (rt_int32_t) xTimeInMs ) )
4343
#endif
4444

45+
#ifdef ESP_PLATFORM
46+
#ifndef pdTICKS_TO_MS
47+
#define pdTICKS_TO_MS( xTicks ) ( ( uint32_t ) ( xTicks ) * 1000 / configTICK_RATE_HZ )
48+
#endif
49+
#endif // ESP_PLATFORM
50+
4551
#define pdFALSE ( ( BaseType_t ) 0 )
4652
#define pdTRUE ( ( BaseType_t ) 1 )
4753

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1163,6 +1163,25 @@ BaseType_t xQueueGiveMutexRecursive( QueueHandle_t xMutex );
11631163
BaseType_t xQueueGenericReset( QueueHandle_t xQueue,
11641164
BaseType_t xNewQueue );
11651165

1166+
#ifdef ESP_PLATFORM
1167+
/* Unimplemented */
1168+
typedef struct QueueDefinition * QueueSetHandle_t;
1169+
typedef struct QueueDefinition * QueueSetMemberHandle_t;
1170+
QueueSetHandle_t xQueueCreateSet( const UBaseType_t uxEventQueueLength );
1171+
BaseType_t xQueueAddToSet( QueueSetMemberHandle_t xQueueOrSemaphore,
1172+
QueueSetHandle_t xQueueSet );
1173+
BaseType_t xQueueRemoveFromSet( QueueSetMemberHandle_t xQueueOrSemaphore,
1174+
QueueSetHandle_t xQueueSet );
1175+
QueueSetMemberHandle_t xQueueSelectFromSet( QueueSetHandle_t xQueueSet,
1176+
const TickType_t xTicksToWait );
1177+
QueueSetMemberHandle_t xQueueSelectFromSetFromISR( QueueSetHandle_t xQueueSet );
1178+
BaseType_t xQueuePeek( QueueHandle_t xQueue,
1179+
void * const pvBuffer,
1180+
TickType_t xTicksToWait );
1181+
BaseType_t xQueueOverwrite(QueueHandle_t xQueue, const void * pvItemToQueue);
1182+
BaseType_t xQueueOverwriteFromISR(QueueHandle_t xQueue, const void * pvItemToQueue, BaseType_t *pxHigherPriorityTaskWoken);
1183+
#endif
1184+
11661185
/* *INDENT-OFF* */
11671186
#ifdef __cplusplus
11681187
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@
6363
* array. */
6464
#define tskDEFAULT_INDEX_TO_NOTIFY ( 0 )
6565

66+
#ifdef ESP_PLATFORM
67+
#define tskNO_AFFINITY ( 0x7FFFFFFF )
68+
#endif
69+
6670
/**
6771
* task. h
6872
*
@@ -293,6 +297,19 @@ typedef struct xTIME_OUT
293297
TaskHandle_t * const pxCreatedTask );
294298
#endif
295299

300+
#ifdef ESP_PLATFORM
301+
#if( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
302+
BaseType_t xTaskCreatePinnedToCore( TaskFunction_t pvTaskCode,
303+
const char * const pcName,
304+
const uint32_t usStackDepth,
305+
void * const pvParameters,
306+
UBaseType_t uxPriority,
307+
TaskHandle_t * const pvCreatedTask,
308+
const BaseType_t xCoreID);
309+
310+
#endif
311+
#endif
312+
296313
/**
297314
* task. h
298315
* @code{c}
@@ -2226,6 +2243,24 @@ TaskHandle_t xTaskGetCurrentTaskHandle( void );
22262243
*/
22272244
BaseType_t xTaskGetSchedulerState( void );
22282245

2246+
#ifdef ESP_PLATFORM
2247+
BaseType_t xTaskGetAffinity( TaskHandle_t xTask );
2248+
TaskHandle_t xTaskGetCurrentTaskHandleForCPU( BaseType_t cpuid );
2249+
TaskHandle_t xTaskGetIdleTaskHandleForCPU( UBaseType_t cpuid );
2250+
/* Unimplemented */
2251+
#if ( configNUM_THREAD_LOCAL_STORAGE_POINTERS > 0 )
2252+
void vTaskSetThreadLocalStoragePointer( TaskHandle_t xTaskToSet,
2253+
BaseType_t xIndex,
2254+
void * pvValue );
2255+
void * pvTaskGetThreadLocalStoragePointer( TaskHandle_t xTaskToQuery,
2256+
BaseType_t xIndex );
2257+
#if ( configTHREAD_LOCAL_STORAGE_DELETE_CALLBACKS )
2258+
typedef void (*TlsDeleteCallbackFunction_t)( int, void * );
2259+
void vTaskSetThreadLocalStoragePointerAndDelCallback( TaskHandle_t xTaskToSet, BaseType_t xIndex, void *pvValue, TlsDeleteCallbackFunction_t pvDelCallback);
2260+
#endif
2261+
#endif
2262+
#endif
2263+
22292264
/* *INDENT-OFF* */
22302265
#ifdef __cplusplus
22312266
}

0 commit comments

Comments
 (0)