first
This commit is contained in:
1076
include_lib/system/os/FreeRTOS/FreeRTOS.h
Normal file
1076
include_lib/system/os/FreeRTOS/FreeRTOS.h
Normal file
File diff suppressed because it is too large
Load Diff
195
include_lib/system/os/FreeRTOS/FreeRTOSConfig.h
Normal file
195
include_lib/system/os/FreeRTOS/FreeRTOSConfig.h
Normal file
@ -0,0 +1,195 @@
|
||||
/*
|
||||
FreeRTOS V9.0.0 - Copyright (C) 2016 Real Time Engineers Ltd.
|
||||
All rights reserved
|
||||
|
||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||
|
||||
This file is part of the FreeRTOS distribution.
|
||||
|
||||
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License (version 2) as published by the
|
||||
Free Software Foundation >>>> AND MODIFIED BY <<<< the FreeRTOS exception.
|
||||
|
||||
***************************************************************************
|
||||
>>! NOTE: The modification to the GPL is included to allow you to !<<
|
||||
>>! distribute a combined work that includes FreeRTOS without being !<<
|
||||
>>! obliged to provide the source code for proprietary components !<<
|
||||
>>! outside of the FreeRTOS kernel. !<<
|
||||
***************************************************************************
|
||||
|
||||
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. Full license text is available on the following
|
||||
link: http://www.freertos.org/a00114.html
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* FreeRTOS provides completely free yet professionally developed, *
|
||||
* robust, strictly quality controlled, supported, and cross *
|
||||
* platform software that is more than just the market leader, it *
|
||||
* is the industry's de facto standard. *
|
||||
* *
|
||||
* Help yourself get started quickly while simultaneously helping *
|
||||
* to support the FreeRTOS project by purchasing a FreeRTOS *
|
||||
* tutorial book, reference manual, or both: *
|
||||
* http://www.FreeRTOS.org/Documentation *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading
|
||||
the FAQ page "My application does not run, what could be wrong?". Have you
|
||||
defined configASSERT()?
|
||||
|
||||
http://www.FreeRTOS.org/support - In return for receiving this top quality
|
||||
embedded software for free we request you assist our global community by
|
||||
participating in the support forum.
|
||||
|
||||
http://www.FreeRTOS.org/training - Investing in training allows your team to
|
||||
be as productive as possible as early as possible. Now you can receive
|
||||
FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers
|
||||
Ltd, and the world's leading authority on the world's leading RTOS.
|
||||
|
||||
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||
including FreeRTOS+Trace - an indispensable productivity tool, a DOS
|
||||
compatible FAT file system, and our tiny thread aware UDP/IP stack.
|
||||
|
||||
http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
|
||||
Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.
|
||||
|
||||
http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High
|
||||
Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||
licenses offer ticketed support, indemnification and commercial middleware.
|
||||
|
||||
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||
engineered and independently SIL3 certified version for use in safety and
|
||||
mission critical applications that require provable dependability.
|
||||
|
||||
1 tab == 4 spaces!
|
||||
*/
|
||||
|
||||
|
||||
#ifndef FREERTOS_CONFIG_H
|
||||
#define FREERTOS_CONFIG_H
|
||||
|
||||
/*-----------------------------------------------------------
|
||||
* Application specific definitions.
|
||||
*
|
||||
* These definitions should be adjusted for your particular hardware and
|
||||
* application requirements.
|
||||
*
|
||||
* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
|
||||
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE. See
|
||||
* http://www.freertos.org/a00110.html
|
||||
*----------------------------------------------------------*/
|
||||
#define configUSE_PREEMPTION 1
|
||||
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 1
|
||||
#define configUSE_IDLE_HOOK 1
|
||||
#define configUSE_TICK_HOOK 0
|
||||
#define configUSE_DAEMON_TASK_STARTUP_HOOK 1
|
||||
#define configTICK_RATE_HZ ( 100 ) /* In this non-real time simulated environment the tick frequency has to be at least a multiple of the Win32 tick frequency, and therefore very slow. */
|
||||
#define configMINIMAL_STACK_SIZE ( ( unsigned int) 256) /* In this simulated case, the stack only has to hold one small structure as the real stack is part of the win32 thread. */
|
||||
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 30 * 1024 ) )
|
||||
#define configMAX_TASK_NAME_LEN ( 12 )
|
||||
#define configUSE_TRACE_FACILITY 1
|
||||
#define configUSE_16_BIT_TICKS 0
|
||||
#define configIDLE_SHOULD_YIELD 1
|
||||
#define configUSE_MUTEXES 1
|
||||
#define configCHECK_FOR_STACK_OVERFLOW 0
|
||||
#define configUSE_RECURSIVE_MUTEXES 1
|
||||
#define configQUEUE_REGISTRY_SIZE 0
|
||||
#define configUSE_MALLOC_FAILED_HOOK 1
|
||||
#define configUSE_APPLICATION_TASK_TAG 1
|
||||
#define configUSE_COUNTING_SEMAPHORES 1
|
||||
#define configUSE_ALTERNATIVE_API 0
|
||||
#define configUSE_QUEUE_SETS 0
|
||||
#define configUSE_TASK_NOTIFICATIONS 0
|
||||
#define configSUPPORT_STATIC_ALLOCATION 1
|
||||
|
||||
|
||||
|
||||
/* Software timer related configuration options. */
|
||||
#define configUSE_TIMERS 0
|
||||
#define configTIMER_TASK_PRIORITY ( configMAX_PRIORITIES - 1 )
|
||||
#define configTIMER_QUEUE_LENGTH 20
|
||||
#define configTIMER_TASK_STACK_DEPTH ( configMINIMAL_STACK_SIZE * 2 )
|
||||
|
||||
#define configMAX_PRIORITIES ( 8 )
|
||||
|
||||
/* Run time stats gathering configuration options. */
|
||||
unsigned long ulGetRunTimeCounterValue(void); /* Prototype of function that returns run time counter. */
|
||||
void vConfigureTimerForRunTimeStats(void); /* Prototype of function that initialises the run time counter. */
|
||||
void vMainConfigureTimerForRunTimeStats(void);
|
||||
unsigned long ulMainGetRunTimeCounterValue(void);
|
||||
#define configGENERATE_RUN_TIME_STATS 0
|
||||
// #define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() vConfigureTimerForRunTimeStats()
|
||||
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() vMainConfigureTimerForRunTimeStats();
|
||||
#define portGET_RUN_TIME_COUNTER_VALUE() ulGetRunTimeCounterValue()
|
||||
|
||||
/* Co-routine related configuration options. */
|
||||
#define configUSE_CO_ROUTINES 1
|
||||
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
|
||||
|
||||
/* This demo makes use of one or more example stats formatting functions. These
|
||||
format the raw data provided by the uxTaskGetSystemState() function in to human
|
||||
readable ASCII form. See the notes in the implementation of vTaskList() within
|
||||
FreeRTOS/Source/tasks.c for limitations. */
|
||||
#define configUSE_STATS_FORMATTING_FUNCTIONS 1
|
||||
|
||||
/* Set the following definitions to 1 to include the API function, or zero
|
||||
to exclude the API function. In most cases the linker will remove unused
|
||||
functions anyway. */
|
||||
#define INCLUDE_vTaskPrioritySet 1
|
||||
#define INCLUDE_uxTaskPriorityGet 1
|
||||
#define INCLUDE_vTaskDelete 1
|
||||
#define INCLUDE_vTaskCleanUpResources 0
|
||||
#define INCLUDE_vTaskSuspend 1
|
||||
#define INCLUDE_vTaskDelayUntil 1
|
||||
#define INCLUDE_vTaskDelay 1
|
||||
#define INCLUDE_uxTaskGetStackHighWaterMark 1
|
||||
#define INCLUDE_xTaskGetSchedulerState 1
|
||||
#define INCLUDE_xTimerGetTimerDaemonTaskHandle 1
|
||||
#define INCLUDE_xTaskGetIdleTaskHandle 1
|
||||
#define INCLUDE_xTaskGetHandle 1
|
||||
#define INCLUDE_eTaskGetState 1
|
||||
#define INCLUDE_xSemaphoreGetMutexHolder 1
|
||||
#define INCLUDE_xTimerPendFunctionCall 0
|
||||
#define INCLUDE_xTaskAbortDelay 1
|
||||
|
||||
/* It is a good idea to define configASSERT() while developing. configASSERT()
|
||||
uses the same semantics as the standard C assert() macro. */
|
||||
#include "printf.h"
|
||||
static inline void vAssertCalled(const char *str, unsigned int ulLine)
|
||||
{
|
||||
/*
|
||||
if(OS_CPU_ID == 0)
|
||||
{
|
||||
C1_CON |=BIT(1) ;
|
||||
}else
|
||||
{
|
||||
C0_CON |=BIT(1) ;
|
||||
}*/
|
||||
local_irq_disable();
|
||||
printf("%s %d\n", str, ulLine) ;
|
||||
while (1);
|
||||
|
||||
}
|
||||
#define configASSERT( x ) if( ( x ) == 0 ) vAssertCalled(__func__, __LINE__)
|
||||
|
||||
/* Include the FreeRTOS+Trace FreeRTOS trace macro definitions. */
|
||||
#define TRACE_ENTER_CRITICAL_SECTION() portENTER_CRITICAL()
|
||||
#define TRACE_EXIT_CRITICAL_SECTION() portEXIT_CRITICAL()
|
||||
//#include "trcKernelPort.h"
|
||||
|
||||
#ifdef __GCC_PI32V2__
|
||||
#include "pi32v2/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef __GCC_PI32_LTO__
|
||||
#include "pi32_lto/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef __GCC_Q32S__
|
||||
#include "q32s/portmacro.h"
|
||||
#endif
|
||||
|
||||
#endif /* FREERTOS_CONFIG_H */
|
||||
321
include_lib/system/os/FreeRTOS/deprecated_definitions.h
Normal file
321
include_lib/system/os/FreeRTOS/deprecated_definitions.h
Normal file
@ -0,0 +1,321 @@
|
||||
/*
|
||||
FreeRTOS V9.0.0 - Copyright (C) 2016 Real Time Engineers Ltd.
|
||||
All rights reserved
|
||||
|
||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||
|
||||
This file is part of the FreeRTOS distribution.
|
||||
|
||||
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License (version 2) as published by the
|
||||
Free Software Foundation >>>> AND MODIFIED BY <<<< the FreeRTOS exception.
|
||||
|
||||
***************************************************************************
|
||||
>>! NOTE: The modification to the GPL is included to allow you to !<<
|
||||
>>! distribute a combined work that includes FreeRTOS without being !<<
|
||||
>>! obliged to provide the source code for proprietary components !<<
|
||||
>>! outside of the FreeRTOS kernel. !<<
|
||||
***************************************************************************
|
||||
|
||||
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. Full license text is available on the following
|
||||
link: http://www.freertos.org/a00114.html
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* FreeRTOS provides completely free yet professionally developed, *
|
||||
* robust, strictly quality controlled, supported, and cross *
|
||||
* platform software that is more than just the market leader, it *
|
||||
* is the industry's de facto standard. *
|
||||
* *
|
||||
* Help yourself get started quickly while simultaneously helping *
|
||||
* to support the FreeRTOS project by purchasing a FreeRTOS *
|
||||
* tutorial book, reference manual, or both: *
|
||||
* http://www.FreeRTOS.org/Documentation *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading
|
||||
the FAQ page "My application does not run, what could be wrong?". Have you
|
||||
defined configASSERT()?
|
||||
|
||||
http://www.FreeRTOS.org/support - In return for receiving this top quality
|
||||
embedded software for free we request you assist our global community by
|
||||
participating in the support forum.
|
||||
|
||||
http://www.FreeRTOS.org/training - Investing in training allows your team to
|
||||
be as productive as possible as early as possible. Now you can receive
|
||||
FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers
|
||||
Ltd, and the world's leading authority on the world's leading RTOS.
|
||||
|
||||
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||
including FreeRTOS+Trace - an indispensable productivity tool, a DOS
|
||||
compatible FAT file system, and our tiny thread aware UDP/IP stack.
|
||||
|
||||
http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
|
||||
Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.
|
||||
|
||||
http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High
|
||||
Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||
licenses offer ticketed support, indemnification and commercial middleware.
|
||||
|
||||
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||
engineered and independently SIL3 certified version for use in safety and
|
||||
mission critical applications that require provable dependability.
|
||||
|
||||
1 tab == 4 spaces!
|
||||
*/
|
||||
|
||||
#ifndef DEPRECATED_DEFINITIONS_H
|
||||
#define DEPRECATED_DEFINITIONS_H
|
||||
|
||||
|
||||
/* Each FreeRTOS port has a unique portmacro.h header file. Originally a
|
||||
pre-processor definition was used to ensure the pre-processor found the correct
|
||||
portmacro.h file for the port being used. That scheme was deprecated in favour
|
||||
of setting the compiler's include path such that it found the correct
|
||||
portmacro.h file - removing the need for the constant and allowing the
|
||||
portmacro.h file to be located anywhere in relation to the port being used. The
|
||||
definitions below remain in the code for backward compatibility only. New
|
||||
projects should not use them. */
|
||||
|
||||
#ifdef OPEN_WATCOM_INDUSTRIAL_PC_PORT
|
||||
#include "..\..\Source\portable\owatcom\16bitdos\pc\portmacro.h"
|
||||
typedef void (__interrupt __far *pxISR)();
|
||||
#endif
|
||||
|
||||
#ifdef OPEN_WATCOM_FLASH_LITE_186_PORT
|
||||
#include "..\..\Source\portable\owatcom\16bitdos\flsh186\portmacro.h"
|
||||
typedef void (__interrupt __far *pxISR)();
|
||||
#endif
|
||||
|
||||
#ifdef GCC_MEGA_AVR
|
||||
#include "../portable/GCC/ATMega323/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef IAR_MEGA_AVR
|
||||
#include "../portable/IAR/ATMega323/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef MPLAB_PIC24_PORT
|
||||
#include "../../Source/portable/MPLAB/PIC24_dsPIC/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef MPLAB_DSPIC_PORT
|
||||
#include "../../Source/portable/MPLAB/PIC24_dsPIC/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef MPLAB_PIC18F_PORT
|
||||
#include "../../Source/portable/MPLAB/PIC18F/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef MPLAB_PIC32MX_PORT
|
||||
#include "../../Source/portable/MPLAB/PIC32MX/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef _FEDPICC
|
||||
#include "libFreeRTOS/Include/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef SDCC_CYGNAL
|
||||
#include "../../Source/portable/SDCC/Cygnal/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef GCC_ARM7
|
||||
#include "../../Source/portable/GCC/ARM7_LPC2000/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef GCC_ARM7_ECLIPSE
|
||||
#include "portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef ROWLEY_LPC23xx
|
||||
#include "../../Source/portable/GCC/ARM7_LPC23xx/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef IAR_MSP430
|
||||
#include "..\..\Source\portable\IAR\MSP430\portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef GCC_MSP430
|
||||
#include "../../Source/portable/GCC/MSP430F449/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef ROWLEY_MSP430
|
||||
#include "../../Source/portable/Rowley/MSP430F449/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef ARM7_LPC21xx_KEIL_RVDS
|
||||
#include "..\..\Source\portable\RVDS\ARM7_LPC21xx\portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef SAM7_GCC
|
||||
#include "../../Source/portable/GCC/ARM7_AT91SAM7S/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef SAM7_IAR
|
||||
#include "..\..\Source\portable\IAR\AtmelSAM7S64\portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef SAM9XE_IAR
|
||||
#include "..\..\Source\portable\IAR\AtmelSAM9XE\portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef LPC2000_IAR
|
||||
#include "..\..\Source\portable\IAR\LPC2000\portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef STR71X_IAR
|
||||
#include "..\..\Source\portable\IAR\STR71x\portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef STR75X_IAR
|
||||
#include "..\..\Source\portable\IAR\STR75x\portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef STR75X_GCC
|
||||
#include "..\..\Source\portable\GCC\STR75x\portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef STR91X_IAR
|
||||
#include "..\..\Source\portable\IAR\STR91x\portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef GCC_H8S
|
||||
#include "../../Source/portable/GCC/H8S2329/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef GCC_AT91FR40008
|
||||
#include "../../Source/portable/GCC/ARM7_AT91FR40008/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef RVDS_ARMCM3_LM3S102
|
||||
#include "../../Source/portable/RVDS/ARM_CM3/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef GCC_ARMCM3_LM3S102
|
||||
#include "../../Source/portable/GCC/ARM_CM3/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef GCC_ARMCM3
|
||||
#include "../../Source/portable/GCC/ARM_CM3/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef IAR_ARM_CM3
|
||||
#include "../../Source/portable/IAR/ARM_CM3/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef IAR_ARMCM3_LM
|
||||
#include "../../Source/portable/IAR/ARM_CM3/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef HCS12_CODE_WARRIOR
|
||||
#include "../../Source/portable/CodeWarrior/HCS12/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef MICROBLAZE_GCC
|
||||
#include "../../Source/portable/GCC/MicroBlaze/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef TERN_EE
|
||||
#include "..\..\Source\portable\Paradigm\Tern_EE\small\portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef GCC_HCS12
|
||||
#include "../../Source/portable/GCC/HCS12/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef GCC_MCF5235
|
||||
#include "../../Source/portable/GCC/MCF5235/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef COLDFIRE_V2_GCC
|
||||
#include "../../../Source/portable/GCC/ColdFire_V2/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef COLDFIRE_V2_CODEWARRIOR
|
||||
#include "../../Source/portable/CodeWarrior/ColdFire_V2/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef GCC_PPC405
|
||||
#include "../../Source/portable/GCC/PPC405_Xilinx/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef GCC_PPC440
|
||||
#include "../../Source/portable/GCC/PPC440_Xilinx/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef _16FX_SOFTUNE
|
||||
#include "..\..\Source\portable\Softune\MB96340\portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef BCC_INDUSTRIAL_PC_PORT
|
||||
/* A short file name has to be used in place of the normal
|
||||
FreeRTOSConfig.h when using the Borland compiler. */
|
||||
#include "frconfig.h"
|
||||
#include "..\portable\BCC\16BitDOS\PC\prtmacro.h"
|
||||
typedef void (__interrupt __far *pxISR)();
|
||||
#endif
|
||||
|
||||
#ifdef BCC_FLASH_LITE_186_PORT
|
||||
/* A short file name has to be used in place of the normal
|
||||
FreeRTOSConfig.h when using the Borland compiler. */
|
||||
#include "frconfig.h"
|
||||
#include "..\portable\BCC\16BitDOS\flsh186\prtmacro.h"
|
||||
typedef void (__interrupt __far *pxISR)();
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
#ifdef __AVR32_AVR32A__
|
||||
#include "portmacro.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __ICCAVR32__
|
||||
#ifdef __CORE__
|
||||
#if __CORE__ == __AVR32A__
|
||||
#include "portmacro.h"
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __91467D
|
||||
#include "portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef __96340
|
||||
#include "portmacro.h"
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __IAR_V850ES_Fx3__
|
||||
#include "../../Source/portable/IAR/V850ES/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef __IAR_V850ES_Jx3__
|
||||
#include "../../Source/portable/IAR/V850ES/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef __IAR_V850ES_Jx3_L__
|
||||
#include "../../Source/portable/IAR/V850ES/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef __IAR_V850ES_Jx2__
|
||||
#include "../../Source/portable/IAR/V850ES/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef __IAR_V850ES_Hx2__
|
||||
#include "../../Source/portable/IAR/V850ES/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef __IAR_78K0R_Kx3__
|
||||
#include "../../Source/portable/IAR/78K0R/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef __IAR_78K0R_Kx3L__
|
||||
#include "../../Source/portable/IAR/78K0R/portmacro.h"
|
||||
#endif
|
||||
|
||||
#endif /* DEPRECATED_DEFINITIONS_H */
|
||||
|
||||
450
include_lib/system/os/FreeRTOS/list.h
Normal file
450
include_lib/system/os/FreeRTOS/list.h
Normal file
@ -0,0 +1,450 @@
|
||||
/*
|
||||
FreeRTOS V9.0.0 - Copyright (C) 2016 Real Time Engineers Ltd.
|
||||
All rights reserved
|
||||
|
||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||
|
||||
This file is part of the FreeRTOS distribution.
|
||||
|
||||
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License (version 2) as published by the
|
||||
Free Software Foundation >>>> AND MODIFIED BY <<<< the FreeRTOS exception.
|
||||
|
||||
***************************************************************************
|
||||
>>! NOTE: The modification to the GPL is included to allow you to !<<
|
||||
>>! distribute a combined work that includes FreeRTOS without being !<<
|
||||
>>! obliged to provide the source code for proprietary components !<<
|
||||
>>! outside of the FreeRTOS kernel. !<<
|
||||
***************************************************************************
|
||||
|
||||
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. Full license text is available on the following
|
||||
link: http://www.freertos.org/a00114.html
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* FreeRTOS provides completely free yet professionally developed, *
|
||||
* robust, strictly quality controlled, supported, and cross *
|
||||
* platform software that is more than just the market leader, it *
|
||||
* is the industry's de facto standard. *
|
||||
* *
|
||||
* Help yourself get started quickly while simultaneously helping *
|
||||
* to support the FreeRTOS project by purchasing a FreeRTOS *
|
||||
* tutorial book, reference manual, or both: *
|
||||
* http://www.FreeRTOS.org/Documentation *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading
|
||||
the FAQ page "My application does not run, what could be wrong?". Have you
|
||||
defined configASSERT()?
|
||||
|
||||
http://www.FreeRTOS.org/support - In return for receiving this top quality
|
||||
embedded software for free we request you assist our global community by
|
||||
participating in the support forum.
|
||||
|
||||
http://www.FreeRTOS.org/training - Investing in training allows your team to
|
||||
be as productive as possible as early as possible. Now you can receive
|
||||
FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers
|
||||
Ltd, and the world's leading authority on the world's leading RTOS.
|
||||
|
||||
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||
including FreeRTOS+Trace - an indispensable productivity tool, a DOS
|
||||
compatible FAT file system, and our tiny thread aware UDP/IP stack.
|
||||
|
||||
http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
|
||||
Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.
|
||||
|
||||
http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High
|
||||
Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||
licenses offer ticketed support, indemnification and commercial middleware.
|
||||
|
||||
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||
engineered and independently SIL3 certified version for use in safety and
|
||||
mission critical applications that require provable dependability.
|
||||
|
||||
1 tab == 4 spaces!
|
||||
*/
|
||||
|
||||
/*
|
||||
* This is the list implementation used by the scheduler. While it is tailored
|
||||
* heavily for the schedulers needs, it is also available for use by
|
||||
* application code.
|
||||
*
|
||||
* list_ts can only store pointers to list_item_ts. Each ListItem_t contains a
|
||||
* numeric value (xItemValue). Most of the time the lists are sorted in
|
||||
* descending item value order.
|
||||
*
|
||||
* Lists are created already containing one list item. The value of this
|
||||
* item is the maximum possible that can be stored, it is therefore always at
|
||||
* the end of the list and acts as a marker. The list member pxHead always
|
||||
* points to this marker - even though it is at the tail of the list. This
|
||||
* is because the tail contains a wrap back pointer to the true head of
|
||||
* the list.
|
||||
*
|
||||
* In addition to it's value, each list item contains a pointer to the next
|
||||
* item in the list (pxNext), a pointer to the list it is in (pxContainer)
|
||||
* and a pointer to back to the object that contains it. These later two
|
||||
* pointers are included for efficiency of list manipulation. There is
|
||||
* effectively a two way link between the object containing the list item and
|
||||
* the list item itself.
|
||||
*
|
||||
*
|
||||
* \page ListIntroduction List Implementation
|
||||
* \ingroup FreeRTOSIntro
|
||||
*/
|
||||
|
||||
#ifndef INC_FREERTOS_H
|
||||
#error FreeRTOS.h must be included before list.h
|
||||
#endif
|
||||
|
||||
#ifndef FREERTOS_LIST_H
|
||||
#define FREERTOS_LIST_H
|
||||
|
||||
/*
|
||||
* The list structure members are modified from within interrupts, and therefore
|
||||
* by rights should be declared volatile. However, they are only modified in a
|
||||
* functionally atomic way (within critical sections of with the scheduler
|
||||
* suspended) and are either passed by reference into a function or indexed via
|
||||
* a volatile variable. Therefore, in all use cases tested so far, the volatile
|
||||
* qualifier can be omitted in order to provide a moderate performance
|
||||
* improvement without adversely affecting functional behaviour. The assembly
|
||||
* instructions generated by the IAR, ARM and GCC compilers when the respective
|
||||
* compiler's options were set for maximum optimisation has been inspected and
|
||||
* deemed to be as intended. That said, as compiler technology advances, and
|
||||
* especially if aggressive cross module optimisation is used (a use case that
|
||||
* has not been exercised to any great extend) then it is feasible that the
|
||||
* volatile qualifier will be needed for correct optimisation. It is expected
|
||||
* that a compiler removing essential code because, without the volatile
|
||||
* qualifier on the list structure members and with aggressive cross module
|
||||
* optimisation, the compiler deemed the code unnecessary will result in
|
||||
* complete and obvious failure of the scheduler. If this is ever experienced
|
||||
* then the volatile qualifier can be inserted in the relevant places within the
|
||||
* list structures by simply defining configLIST_VOLATILE to volatile in
|
||||
* FreeRTOSConfig.h (as per the example at the bottom of this comment block).
|
||||
* If configLIST_VOLATILE is not defined then the preprocessor directives below
|
||||
* will simply #define configLIST_VOLATILE away completely.
|
||||
*
|
||||
* To use volatile list structure members then add the following line to
|
||||
* FreeRTOSConfig.h (without the quotes):
|
||||
* "#define configLIST_VOLATILE volatile"
|
||||
*/
|
||||
#ifndef configLIST_VOLATILE
|
||||
#define configLIST_VOLATILE
|
||||
#endif /* configSUPPORT_CROSS_MODULE_OPTIMISATION */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Macros that can be used to place known values within the list structures,
|
||||
then check that the known values do not get corrupted during the execution of
|
||||
the application. These may catch the list data structures being overwritten in
|
||||
memory. They will not catch data errors caused by incorrect configuration or
|
||||
use of FreeRTOS.*/
|
||||
#if( configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES == 0 )
|
||||
/* Define the macros to do nothing. */
|
||||
#define listFIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE
|
||||
#define listSECOND_LIST_ITEM_INTEGRITY_CHECK_VALUE
|
||||
#define listFIRST_LIST_INTEGRITY_CHECK_VALUE
|
||||
#define listSECOND_LIST_INTEGRITY_CHECK_VALUE
|
||||
#define listSET_FIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE( pxItem )
|
||||
#define listSET_SECOND_LIST_ITEM_INTEGRITY_CHECK_VALUE( pxItem )
|
||||
#define listSET_LIST_INTEGRITY_CHECK_1_VALUE( pxList )
|
||||
#define listSET_LIST_INTEGRITY_CHECK_2_VALUE( pxList )
|
||||
#define listTEST_LIST_ITEM_INTEGRITY( pxItem )
|
||||
#define listTEST_LIST_INTEGRITY( pxList )
|
||||
#else
|
||||
/* Define macros that add new members into the list structures. */
|
||||
#define listFIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE TickType_t xListItemIntegrityValue1;
|
||||
#define listSECOND_LIST_ITEM_INTEGRITY_CHECK_VALUE TickType_t xListItemIntegrityValue2;
|
||||
#define listFIRST_LIST_INTEGRITY_CHECK_VALUE TickType_t xListIntegrityValue1;
|
||||
#define listSECOND_LIST_INTEGRITY_CHECK_VALUE TickType_t xListIntegrityValue2;
|
||||
|
||||
/* Define macros that set the new structure members to known values. */
|
||||
#define listSET_FIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE( pxItem ) ( pxItem )->xListItemIntegrityValue1 = pdINTEGRITY_CHECK_VALUE
|
||||
#define listSET_SECOND_LIST_ITEM_INTEGRITY_CHECK_VALUE( pxItem ) ( pxItem )->xListItemIntegrityValue2 = pdINTEGRITY_CHECK_VALUE
|
||||
#define listSET_LIST_INTEGRITY_CHECK_1_VALUE( pxList ) ( pxList )->xListIntegrityValue1 = pdINTEGRITY_CHECK_VALUE
|
||||
#define listSET_LIST_INTEGRITY_CHECK_2_VALUE( pxList ) ( pxList )->xListIntegrityValue2 = pdINTEGRITY_CHECK_VALUE
|
||||
|
||||
/* Define macros that will assert if one of the structure members does not
|
||||
contain its expected value. */
|
||||
#define listTEST_LIST_ITEM_INTEGRITY( pxItem ) configASSERT( ( ( pxItem )->xListItemIntegrityValue1 == pdINTEGRITY_CHECK_VALUE ) && ( ( pxItem )->xListItemIntegrityValue2 == pdINTEGRITY_CHECK_VALUE ) )
|
||||
#define listTEST_LIST_INTEGRITY( pxList ) configASSERT( ( ( pxList )->xListIntegrityValue1 == pdINTEGRITY_CHECK_VALUE ) && ( ( pxList )->xListIntegrityValue2 == pdINTEGRITY_CHECK_VALUE ) )
|
||||
#endif /* configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES */
|
||||
|
||||
|
||||
/*
|
||||
* Definition of the only type of object that a list can contain.
|
||||
*/
|
||||
struct xLIST_ITEM {
|
||||
listFIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE /*< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
|
||||
configLIST_VOLATILE TickType_t xItemValue; /*< The value being listed. In most cases this is used to sort the list in descending order. */
|
||||
struct xLIST_ITEM *configLIST_VOLATILE pxNext; /*< Pointer to the next ListItem_t in the list. */
|
||||
struct xLIST_ITEM *configLIST_VOLATILE pxPrevious; /*< Pointer to the previous ListItem_t in the list. */
|
||||
void *pvOwner; /*< Pointer to the object (normally a TCB) that contains the list item. There is therefore a two way link between the object containing the list item and the list item itself. */
|
||||
void *configLIST_VOLATILE pvContainer; /*< Pointer to the list in which this list item is placed (if any). */
|
||||
listSECOND_LIST_ITEM_INTEGRITY_CHECK_VALUE /*< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
|
||||
};
|
||||
typedef struct xLIST_ITEM ListItem_t; /* For some reason lint wants this as two separate definitions. */
|
||||
|
||||
struct xMINI_LIST_ITEM {
|
||||
listFIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE /*< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
|
||||
configLIST_VOLATILE TickType_t xItemValue;
|
||||
struct xLIST_ITEM *configLIST_VOLATILE pxNext;
|
||||
struct xLIST_ITEM *configLIST_VOLATILE pxPrevious;
|
||||
};
|
||||
typedef struct xMINI_LIST_ITEM MiniListItem_t;
|
||||
|
||||
/*
|
||||
* Definition of the type of queue used by the scheduler.
|
||||
*/
|
||||
typedef struct xLIST {
|
||||
listFIRST_LIST_INTEGRITY_CHECK_VALUE /*< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
|
||||
configLIST_VOLATILE UBaseType_t uxNumberOfItems;
|
||||
ListItem_t *configLIST_VOLATILE pxIndex; /*< Used to walk through the list. Points to the last item returned by a call to listGET_OWNER_OF_NEXT_ENTRY (). */
|
||||
MiniListItem_t xListEnd; /*< List item that contains the maximum possible item value meaning it is always at the end of the list and is therefore used as a marker. */
|
||||
listSECOND_LIST_INTEGRITY_CHECK_VALUE /*< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
|
||||
} List_t;
|
||||
|
||||
/*
|
||||
* Access macro to set the owner of a list item. The owner of a list item
|
||||
* is the object (usually a TCB) that contains the list item.
|
||||
*
|
||||
* \page listSET_LIST_ITEM_OWNER listSET_LIST_ITEM_OWNER
|
||||
* \ingroup LinkedList
|
||||
*/
|
||||
#define listSET_LIST_ITEM_OWNER( pxListItem, pxOwner ) ( ( pxListItem )->pvOwner = ( void * ) ( pxOwner ) )
|
||||
|
||||
/*
|
||||
* Access macro to get the owner of a list item. The owner of a list item
|
||||
* is the object (usually a TCB) that contains the list item.
|
||||
*
|
||||
* \page listSET_LIST_ITEM_OWNER listSET_LIST_ITEM_OWNER
|
||||
* \ingroup LinkedList
|
||||
*/
|
||||
#define listGET_LIST_ITEM_OWNER( pxListItem ) ( ( pxListItem )->pvOwner )
|
||||
|
||||
/*
|
||||
* Access macro to set the value of the list item. In most cases the value is
|
||||
* used to sort the list in descending order.
|
||||
*
|
||||
* \page listSET_LIST_ITEM_VALUE listSET_LIST_ITEM_VALUE
|
||||
* \ingroup LinkedList
|
||||
*/
|
||||
#define listSET_LIST_ITEM_VALUE( pxListItem, xValue ) ( ( pxListItem )->xItemValue = ( xValue ) )
|
||||
|
||||
/*
|
||||
* Access macro to retrieve the value of the list item. The value can
|
||||
* represent anything - for example the priority of a task, or the time at
|
||||
* which a task should be unblocked.
|
||||
*
|
||||
* \page listGET_LIST_ITEM_VALUE listGET_LIST_ITEM_VALUE
|
||||
* \ingroup LinkedList
|
||||
*/
|
||||
#define listGET_LIST_ITEM_VALUE( pxListItem ) ( ( pxListItem )->xItemValue )
|
||||
|
||||
/*
|
||||
* Access macro to retrieve the value of the list item at the head of a given
|
||||
* list.
|
||||
*
|
||||
* \page listGET_LIST_ITEM_VALUE listGET_LIST_ITEM_VALUE
|
||||
* \ingroup LinkedList
|
||||
*/
|
||||
#define listGET_ITEM_VALUE_OF_HEAD_ENTRY( pxList ) ( ( ( pxList )->xListEnd ).pxNext->xItemValue )
|
||||
|
||||
/*
|
||||
* Return the list item at the head of the list.
|
||||
*
|
||||
* \page listGET_HEAD_ENTRY listGET_HEAD_ENTRY
|
||||
* \ingroup LinkedList
|
||||
*/
|
||||
#define listGET_HEAD_ENTRY( pxList ) ( ( ( pxList )->xListEnd ).pxNext )
|
||||
|
||||
/*
|
||||
* Return the list item at the head of the list.
|
||||
*
|
||||
* \page listGET_NEXT listGET_NEXT
|
||||
* \ingroup LinkedList
|
||||
*/
|
||||
#define listGET_NEXT( pxListItem ) ( ( pxListItem )->pxNext )
|
||||
|
||||
/*
|
||||
* Return the list item that marks the end of the list
|
||||
*
|
||||
* \page listGET_END_MARKER listGET_END_MARKER
|
||||
* \ingroup LinkedList
|
||||
*/
|
||||
#define listGET_END_MARKER( pxList ) ( ( ListItem_t const * ) ( &( ( pxList )->xListEnd ) ) )
|
||||
|
||||
/*
|
||||
* Access macro to determine if a list contains any items. The macro will
|
||||
* only have the value true if the list is empty.
|
||||
*
|
||||
* \page listLIST_IS_EMPTY listLIST_IS_EMPTY
|
||||
* \ingroup LinkedList
|
||||
*/
|
||||
#define listLIST_IS_EMPTY( pxList ) ( ( BaseType_t ) ( ( pxList )->uxNumberOfItems == ( UBaseType_t ) 0 ) )
|
||||
|
||||
/*
|
||||
* Access macro to return the number of items in the list.
|
||||
*/
|
||||
#define listCURRENT_LIST_LENGTH( pxList ) ( ( pxList )->uxNumberOfItems )
|
||||
|
||||
/*
|
||||
* Access function to obtain the owner of the next entry in a list.
|
||||
*
|
||||
* The list member pxIndex is used to walk through a list. Calling
|
||||
* listGET_OWNER_OF_NEXT_ENTRY increments pxIndex to the next item in the list
|
||||
* and returns that entry's pxOwner parameter. Using multiple calls to this
|
||||
* function it is therefore possible to move through every item contained in
|
||||
* a list.
|
||||
*
|
||||
* The pxOwner parameter of a list item is a pointer to the object that owns
|
||||
* the list item. In the scheduler this is normally a task control block.
|
||||
* The pxOwner parameter effectively creates a two way link between the list
|
||||
* item and its owner.
|
||||
*
|
||||
* @param pxTCB pxTCB is set to the address of the owner of the next list item.
|
||||
* @param pxList The list from which the next item owner is to be returned.
|
||||
*
|
||||
* \page listGET_OWNER_OF_NEXT_ENTRY listGET_OWNER_OF_NEXT_ENTRY
|
||||
* \ingroup LinkedList
|
||||
*/
|
||||
#define listGET_OWNER_OF_NEXT_ENTRY( pxTCB, pxList ) \
|
||||
{ \
|
||||
List_t * const pxConstList = ( pxList ); \
|
||||
/* Increment the index to the next item and return the item, ensuring */ \
|
||||
/* we don't return the marker used at the end of the list. */ \
|
||||
( pxConstList )->pxIndex = ( pxConstList )->pxIndex->pxNext; \
|
||||
if( ( void * ) ( pxConstList )->pxIndex == ( void * ) &( ( pxConstList )->xListEnd ) ) \
|
||||
{ \
|
||||
( pxConstList )->pxIndex = ( pxConstList )->pxIndex->pxNext; \
|
||||
} \
|
||||
( pxTCB ) = ( pxConstList )->pxIndex->pvOwner; \
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Access function to obtain the owner of the first entry in a list. Lists
|
||||
* are normally sorted in ascending item value order.
|
||||
*
|
||||
* This function returns the pxOwner member of the first item in the list.
|
||||
* The pxOwner parameter of a list item is a pointer to the object that owns
|
||||
* the list item. In the scheduler this is normally a task control block.
|
||||
* The pxOwner parameter effectively creates a two way link between the list
|
||||
* item and its owner.
|
||||
*
|
||||
* @param pxList The list from which the owner of the head item is to be
|
||||
* returned.
|
||||
*
|
||||
* \page listGET_OWNER_OF_HEAD_ENTRY listGET_OWNER_OF_HEAD_ENTRY
|
||||
* \ingroup LinkedList
|
||||
*/
|
||||
#define listGET_OWNER_OF_HEAD_ENTRY( pxList ) ( (&( ( pxList )->xListEnd ))->pxNext->pvOwner )
|
||||
|
||||
/*
|
||||
* Check to see if a list item is within a list. The list item maintains a
|
||||
* "container" pointer that points to the list it is in. All this macro does
|
||||
* is check to see if the container and the list match.
|
||||
*
|
||||
* @param pxList The list we want to know if the list item is within.
|
||||
* @param pxListItem The list item we want to know if is in the list.
|
||||
* @return pdTRUE if the list item is in the list, otherwise pdFALSE.
|
||||
*/
|
||||
#define listIS_CONTAINED_WITHIN( pxList, pxListItem ) ( ( BaseType_t ) ( ( pxListItem )->pvContainer == ( void * ) ( pxList ) ) )
|
||||
|
||||
/*
|
||||
* Return the list a list item is contained within (referenced from).
|
||||
*
|
||||
* @param pxListItem The list item being queried.
|
||||
* @return A pointer to the List_t object that references the pxListItem
|
||||
*/
|
||||
#define listLIST_ITEM_CONTAINER( pxListItem ) ( ( pxListItem )->pvContainer )
|
||||
|
||||
/*
|
||||
* This provides a crude means of knowing if a list has been initialised, as
|
||||
* pxList->xListEnd.xItemValue is set to portMAX_DELAY by the vListInitialise()
|
||||
* function.
|
||||
*/
|
||||
#define listLIST_IS_INITIALISED( pxList ) ( ( pxList )->xListEnd.xItemValue == portMAX_DELAY )
|
||||
|
||||
/*
|
||||
* Must be called before a list is used! This initialises all the members
|
||||
* of the list structure and inserts the xListEnd item into the list as a
|
||||
* marker to the back of the list.
|
||||
*
|
||||
* @param pxList Pointer to the list being initialised.
|
||||
*
|
||||
* \page vListInitialise vListInitialise
|
||||
* \ingroup LinkedList
|
||||
*/
|
||||
void vListInitialise(List_t *const pxList) PRIVILEGED_FUNCTION;
|
||||
|
||||
/*
|
||||
* Must be called before a list item is used. This sets the list container to
|
||||
* null so the item does not think that it is already contained in a list.
|
||||
*
|
||||
* @param pxItem Pointer to the list item being initialised.
|
||||
*
|
||||
* \page vListInitialiseItem vListInitialiseItem
|
||||
* \ingroup LinkedList
|
||||
*/
|
||||
void vListInitialiseItem(ListItem_t *const pxItem) PRIVILEGED_FUNCTION;
|
||||
|
||||
/*
|
||||
* Insert a list item into a list. The item will be inserted into the list in
|
||||
* a position determined by its item value (descending item value order).
|
||||
*
|
||||
* @param pxList The list into which the item is to be inserted.
|
||||
*
|
||||
* @param pxNewListItem The item that is to be placed in the list.
|
||||
*
|
||||
* \page vListInsert vListInsert
|
||||
* \ingroup LinkedList
|
||||
*/
|
||||
void vListInsert(List_t *const pxList, ListItem_t *const pxNewListItem) PRIVILEGED_FUNCTION;
|
||||
|
||||
/*
|
||||
* Insert a list item into a list. The item will be inserted in a position
|
||||
* such that it will be the last item within the list returned by multiple
|
||||
* calls to listGET_OWNER_OF_NEXT_ENTRY.
|
||||
*
|
||||
* The list member pxIndex is used to walk through a list. Calling
|
||||
* listGET_OWNER_OF_NEXT_ENTRY increments pxIndex to the next item in the list.
|
||||
* Placing an item in a list using vListInsertEnd effectively places the item
|
||||
* in the list position pointed to by pxIndex. This means that every other
|
||||
* item within the list will be returned by listGET_OWNER_OF_NEXT_ENTRY before
|
||||
* the pxIndex parameter again points to the item being inserted.
|
||||
*
|
||||
* @param pxList The list into which the item is to be inserted.
|
||||
*
|
||||
* @param pxNewListItem The list item to be inserted into the list.
|
||||
*
|
||||
* \page vListInsertEnd vListInsertEnd
|
||||
* \ingroup LinkedList
|
||||
*/
|
||||
void vListInsertEnd(List_t *const pxList, ListItem_t *const pxNewListItem) PRIVILEGED_FUNCTION;
|
||||
|
||||
/*
|
||||
* Remove an item from a list. The list item has a pointer to the list that
|
||||
* it is in, so only the list item need be passed into the function.
|
||||
*
|
||||
* @param uxListRemove The item to be removed. The item will remove itself from
|
||||
* the list pointed to by it's pxContainer parameter.
|
||||
*
|
||||
* @return The number of items that remain in the list after the list item has
|
||||
* been removed.
|
||||
*
|
||||
* \page uxListRemove uxListRemove
|
||||
* \ingroup LinkedList
|
||||
*/
|
||||
UBaseType_t uxListRemove(ListItem_t *const pxItemToRemove) PRIVILEGED_FUNCTION;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
201
include_lib/system/os/FreeRTOS/mpu_wrappers.h
Normal file
201
include_lib/system/os/FreeRTOS/mpu_wrappers.h
Normal file
@ -0,0 +1,201 @@
|
||||
/*
|
||||
FreeRTOS V9.0.0 - Copyright (C) 2016 Real Time Engineers Ltd.
|
||||
All rights reserved
|
||||
|
||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||
|
||||
This file is part of the FreeRTOS distribution.
|
||||
|
||||
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License (version 2) as published by the
|
||||
Free Software Foundation >>>> AND MODIFIED BY <<<< the FreeRTOS exception.
|
||||
|
||||
***************************************************************************
|
||||
>>! NOTE: The modification to the GPL is included to allow you to !<<
|
||||
>>! distribute a combined work that includes FreeRTOS without being !<<
|
||||
>>! obliged to provide the source code for proprietary components !<<
|
||||
>>! outside of the FreeRTOS kernel. !<<
|
||||
***************************************************************************
|
||||
|
||||
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. Full license text is available on the following
|
||||
link: http://www.freertos.org/a00114.html
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* FreeRTOS provides completely free yet professionally developed, *
|
||||
* robust, strictly quality controlled, supported, and cross *
|
||||
* platform software that is more than just the market leader, it *
|
||||
* is the industry's de facto standard. *
|
||||
* *
|
||||
* Help yourself get started quickly while simultaneously helping *
|
||||
* to support the FreeRTOS project by purchasing a FreeRTOS *
|
||||
* tutorial book, reference manual, or both: *
|
||||
* http://www.FreeRTOS.org/Documentation *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading
|
||||
the FAQ page "My application does not run, what could be wrong?". Have you
|
||||
defined configASSERT()?
|
||||
|
||||
http://www.FreeRTOS.org/support - In return for receiving this top quality
|
||||
embedded software for free we request you assist our global community by
|
||||
participating in the support forum.
|
||||
|
||||
http://www.FreeRTOS.org/training - Investing in training allows your team to
|
||||
be as productive as possible as early as possible. Now you can receive
|
||||
FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers
|
||||
Ltd, and the world's leading authority on the world's leading RTOS.
|
||||
|
||||
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||
including FreeRTOS+Trace - an indispensable productivity tool, a DOS
|
||||
compatible FAT file system, and our tiny thread aware UDP/IP stack.
|
||||
|
||||
http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
|
||||
Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.
|
||||
|
||||
http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High
|
||||
Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||
licenses offer ticketed support, indemnification and commercial middleware.
|
||||
|
||||
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||
engineered and independently SIL3 certified version for use in safety and
|
||||
mission critical applications that require provable dependability.
|
||||
|
||||
1 tab == 4 spaces!
|
||||
*/
|
||||
|
||||
#ifndef MPU_WRAPPERS_H
|
||||
#define MPU_WRAPPERS_H
|
||||
|
||||
/* This file redefines API functions to be called through a wrapper macro, but
|
||||
only for ports that are using the MPU. */
|
||||
#ifdef portUSING_MPU_WRAPPERS
|
||||
|
||||
/* MPU_WRAPPERS_INCLUDED_FROM_API_FILE will be defined when this file is
|
||||
included from queue.c or task.c to prevent it from having an effect within
|
||||
those files. */
|
||||
#ifndef MPU_WRAPPERS_INCLUDED_FROM_API_FILE
|
||||
|
||||
/*
|
||||
* Map standard (non MPU) API functions to equivalents that start
|
||||
* "MPU_". This will cause the application code to call the MPU_
|
||||
* version, which wraps the non-MPU version with privilege promoting
|
||||
* then demoting code, so the kernel code always runs will full
|
||||
* privileges.
|
||||
*/
|
||||
|
||||
/* Map standard tasks.h API functions to the MPU equivalents. */
|
||||
#define xTaskCreate MPU_xTaskCreate
|
||||
#define xTaskCreateStatic MPU_xTaskCreateStatic
|
||||
#define xTaskCreateRestricted MPU_xTaskCreateRestricted
|
||||
#define vTaskAllocateMPURegions MPU_vTaskAllocateMPURegions
|
||||
#define vTaskDelete MPU_vTaskDelete
|
||||
#define vTaskDelay MPU_vTaskDelay
|
||||
#define vTaskDelayUntil MPU_vTaskDelayUntil
|
||||
#define xTaskAbortDelay MPU_xTaskAbortDelay
|
||||
#define uxTaskPriorityGet MPU_uxTaskPriorityGet
|
||||
#define eTaskGetState MPU_eTaskGetState
|
||||
#define vTaskGetInfo MPU_vTaskGetInfo
|
||||
#define vTaskPrioritySet MPU_vTaskPrioritySet
|
||||
#define vTaskSuspend MPU_vTaskSuspend
|
||||
#define vTaskResume MPU_vTaskResume
|
||||
#define vTaskSuspendAll MPU_vTaskSuspendAll
|
||||
#define xTaskResumeAll MPU_xTaskResumeAll
|
||||
#define xTaskGetTickCount MPU_xTaskGetTickCount
|
||||
#define uxTaskGetNumberOfTasks MPU_uxTaskGetNumberOfTasks
|
||||
#define pcTaskGetName MPU_pcTaskGetName
|
||||
#define xTaskGetHandle MPU_xTaskGetHandle
|
||||
#define uxTaskGetStackHighWaterMark MPU_uxTaskGetStackHighWaterMark
|
||||
#define vTaskSetApplicationTaskTag MPU_vTaskSetApplicationTaskTag
|
||||
#define xTaskGetApplicationTaskTag MPU_xTaskGetApplicationTaskTag
|
||||
#define vTaskSetThreadLocalStoragePointer MPU_vTaskSetThreadLocalStoragePointer
|
||||
#define pvTaskGetThreadLocalStoragePointer MPU_pvTaskGetThreadLocalStoragePointer
|
||||
#define xTaskCallApplicationTaskHook MPU_xTaskCallApplicationTaskHook
|
||||
#define xTaskGetIdleTaskHandle MPU_xTaskGetIdleTaskHandle
|
||||
#define uxTaskGetSystemState MPU_uxTaskGetSystemState
|
||||
#define vTaskList MPU_vTaskList
|
||||
#define vTaskGetRunTimeStats MPU_vTaskGetRunTimeStats
|
||||
#define xTaskGenericNotify MPU_xTaskGenericNotify
|
||||
#define xTaskNotifyWait MPU_xTaskNotifyWait
|
||||
#define ulTaskNotifyTake MPU_ulTaskNotifyTake
|
||||
#define xTaskNotifyStateClear MPU_xTaskNotifyStateClear
|
||||
|
||||
#define xTaskGetCurrentTaskHandle MPU_xTaskGetCurrentTaskHandle
|
||||
#define vTaskSetTimeOutState MPU_vTaskSetTimeOutState
|
||||
#define xTaskCheckForTimeOut MPU_xTaskCheckForTimeOut
|
||||
#define xTaskGetSchedulerState MPU_xTaskGetSchedulerState
|
||||
|
||||
/* Map standard queue.h API functions to the MPU equivalents. */
|
||||
#define xQueueGenericSend MPU_xQueueGenericSend
|
||||
#define xQueueGenericReceive MPU_xQueueGenericReceive
|
||||
#define uxQueueMessagesWaiting MPU_uxQueueMessagesWaiting
|
||||
#define uxQueueSpacesAvailable MPU_uxQueueSpacesAvailable
|
||||
#define vQueueDelete MPU_vQueueDelete
|
||||
#define xQueueCreateMutex MPU_xQueueCreateMutex
|
||||
#define xQueueCreateMutexStatic MPU_xQueueCreateMutexStatic
|
||||
#define xQueueCreateCountingSemaphore MPU_xQueueCreateCountingSemaphore
|
||||
#define xQueueCreateCountingSemaphoreStatic MPU_xQueueCreateCountingSemaphoreStatic
|
||||
#define xQueueGetMutexHolder MPU_xQueueGetMutexHolder
|
||||
#define xQueueTakeMutexRecursive MPU_xQueueTakeMutexRecursive
|
||||
#define xQueueGiveMutexRecursive MPU_xQueueGiveMutexRecursive
|
||||
#define xQueueGenericCreate MPU_xQueueGenericCreate
|
||||
#define xQueueGenericCreateStatic MPU_xQueueGenericCreateStatic
|
||||
#define xQueueCreateSet MPU_xQueueCreateSet
|
||||
#define xQueueAddToSet MPU_xQueueAddToSet
|
||||
#define xQueueRemoveFromSet MPU_xQueueRemoveFromSet
|
||||
#define xQueueSelectFromSet MPU_xQueueSelectFromSet
|
||||
#define xQueueGenericReset MPU_xQueueGenericReset
|
||||
|
||||
#if( configQUEUE_REGISTRY_SIZE > 0 )
|
||||
#define vQueueAddToRegistry MPU_vQueueAddToRegistry
|
||||
#define vQueueUnregisterQueue MPU_vQueueUnregisterQueue
|
||||
#define pcQueueGetName MPU_pcQueueGetName
|
||||
#endif
|
||||
|
||||
/* Map standard timer.h API functions to the MPU equivalents. */
|
||||
#define xTimerCreate MPU_xTimerCreate
|
||||
#define xTimerCreateStatic MPU_xTimerCreateStatic
|
||||
#define pvTimerGetTimerID MPU_pvTimerGetTimerID
|
||||
#define vTimerSetTimerID MPU_vTimerSetTimerID
|
||||
#define xTimerIsTimerActive MPU_xTimerIsTimerActive
|
||||
#define xTimerGetTimerDaemonTaskHandle MPU_xTimerGetTimerDaemonTaskHandle
|
||||
#define xTimerPendFunctionCall MPU_xTimerPendFunctionCall
|
||||
#define pcTimerGetName MPU_pcTimerGetName
|
||||
#define xTimerGetPeriod MPU_xTimerGetPeriod
|
||||
#define xTimerGetExpiryTime MPU_xTimerGetExpiryTime
|
||||
#define xTimerGenericCommand MPU_xTimerGenericCommand
|
||||
|
||||
/* Map standard event_group.h API functions to the MPU equivalents. */
|
||||
#define xEventGroupCreate MPU_xEventGroupCreate
|
||||
#define xEventGroupCreateStatic MPU_xEventGroupCreateStatic
|
||||
#define xEventGroupWaitBits MPU_xEventGroupWaitBits
|
||||
#define xEventGroupClearBits MPU_xEventGroupClearBits
|
||||
#define xEventGroupSetBits MPU_xEventGroupSetBits
|
||||
#define xEventGroupSync MPU_xEventGroupSync
|
||||
#define vEventGroupDelete MPU_vEventGroupDelete
|
||||
|
||||
/* Remove the privileged function macro. */
|
||||
#define PRIVILEGED_FUNCTION
|
||||
|
||||
#else /* MPU_WRAPPERS_INCLUDED_FROM_API_FILE */
|
||||
|
||||
/* Ensure API functions go in the privileged execution section. */
|
||||
#define PRIVILEGED_FUNCTION __attribute__((section("privileged_functions")))
|
||||
#define PRIVILEGED_DATA __attribute__((section("privileged_data")))
|
||||
|
||||
#endif /* MPU_WRAPPERS_INCLUDED_FROM_API_FILE */
|
||||
|
||||
#else /* portUSING_MPU_WRAPPERS */
|
||||
|
||||
#define PRIVILEGED_FUNCTION
|
||||
#define PRIVILEGED_DATA
|
||||
#define portUSING_MPU_WRAPPERS 0
|
||||
|
||||
#endif /* portUSING_MPU_WRAPPERS */
|
||||
|
||||
|
||||
#endif /* MPU_WRAPPERS_H */
|
||||
|
||||
263
include_lib/system/os/FreeRTOS/pi32_lto/portmacro.h
Normal file
263
include_lib/system/os/FreeRTOS/pi32_lto/portmacro.h
Normal file
@ -0,0 +1,263 @@
|
||||
/*
|
||||
FreeRTOS V9.0.0 - Copyright (C) 2016 Real Time Engineers Ltd.
|
||||
All rights reserved
|
||||
|
||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||
|
||||
This file is part of the FreeRTOS distribution.
|
||||
|
||||
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License (version 2) as published by the
|
||||
Free Software Foundation >>>> AND MODIFIED BY <<<< the FreeRTOS exception.
|
||||
|
||||
***************************************************************************
|
||||
>>! NOTE: The modification to the GPL is included to allow you to !<<
|
||||
>>! distribute a combined work that includes FreeRTOS without being !<<
|
||||
>>! obliged to provide the source code for proprietary components !<<
|
||||
>>! outside of the FreeRTOS kernel. !<<
|
||||
***************************************************************************
|
||||
|
||||
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. Full license text is available on the following
|
||||
link: http://www.freertos.org/a00114.html
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* FreeRTOS provides completely free yet professionally developed, *
|
||||
* robust, strictly quality controlled, supported, and cross *
|
||||
* platform software that is more than just the market leader, it *
|
||||
* is the industry's de facto standard. *
|
||||
* *
|
||||
* Help yourself get started quickly while simultaneously helping *
|
||||
* to support the FreeRTOS project by purchasing a FreeRTOS *
|
||||
* tutorial book, reference manual, or both: *
|
||||
* http://www.FreeRTOS.org/Documentation *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading
|
||||
the FAQ page "My application does not run, what could be wrong?". Have you
|
||||
defined configASSERT()?
|
||||
|
||||
http://www.FreeRTOS.org/support - In return for receiving this top quality
|
||||
embedded software for free we request you assist our global community by
|
||||
participating in the support forum.
|
||||
|
||||
http://www.FreeRTOS.org/training - Investing in training allows your team to
|
||||
be as productive as possible as early as possible. Now you can receive
|
||||
FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers
|
||||
Ltd, and the world's leading authority on the world's leading RTOS.
|
||||
|
||||
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||
including FreeRTOS+Trace - an indispensable productivity tool, a DOS
|
||||
compatible FAT file system, and our tiny thread aware UDP/IP stack.
|
||||
|
||||
http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
|
||||
Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.
|
||||
|
||||
http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High
|
||||
Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||
licenses offer ticketed support, indemnification and commercial middleware.
|
||||
|
||||
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||
engineered and independently SIL3 certified version for use in safety and
|
||||
mission critical applications that require provable dependability.
|
||||
|
||||
1 tab == 4 spaces!
|
||||
*/
|
||||
|
||||
#ifndef PORTMACRO_H
|
||||
#define PORTMACRO_H
|
||||
#include "asm/cpu.h"
|
||||
#include <stdint.h>
|
||||
/******************************************************************************
|
||||
Defines
|
||||
******************************************************************************/
|
||||
/* Type definitions. */
|
||||
#define portCHAR char
|
||||
#define portFLOAT float
|
||||
#define portDOUBLE double
|
||||
#define portLONG long
|
||||
#define portSHORT short
|
||||
#define portSTACK_TYPE int
|
||||
#define portBASE_TYPE long
|
||||
#define portPOINTER_SIZE_TYPE size_t
|
||||
|
||||
typedef portSTACK_TYPE StackType_t;
|
||||
typedef long BaseType_t;
|
||||
typedef unsigned long UBaseType_t;
|
||||
|
||||
|
||||
#if( configUSE_16_BIT_TICKS == 1 )
|
||||
typedef uint16_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffff
|
||||
#else
|
||||
typedef uint32_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffffffffUL
|
||||
|
||||
/* 32/64-bit tick type on a 32/64-bit architecture, so reads of the tick
|
||||
count do not need to be guarded with a critical section. */
|
||||
#define portTICK_TYPE_IS_ATOMIC 1
|
||||
#endif
|
||||
|
||||
/* Hardware specifics. */
|
||||
#define portSTACK_GROWTH ( -1 )
|
||||
#define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
|
||||
#define portINLINE __inline
|
||||
|
||||
#if defined( __x86_64__) || defined( _M_X64 )
|
||||
#define portBYTE_ALIGNMENT 8
|
||||
#else
|
||||
#define portBYTE_ALIGNMENT 4
|
||||
#endif
|
||||
extern void vPortYield() ;
|
||||
#define portYIELD() vPortYield()
|
||||
#define OS_CPU_ID current_cpu_id()
|
||||
extern int current_cpu_id() ;
|
||||
#define OS_CPU_NUM CPU_CORE_NUM
|
||||
|
||||
/* Simulated interrupts return pdFALSE if no context switch should be performed,
|
||||
or a non-zero number if a context switch should be performed. */
|
||||
#define portYIELD_FROM_ISR( x ) return x
|
||||
#define portEND_SWITCHING_ISR( x ) portYIELD_FROM_ISR( ( x ) )
|
||||
|
||||
void vPortCloseRunningThread(void *pvTaskToDelete, volatile BaseType_t *pxPendYield);
|
||||
//void vPortDeleteThread( void *pvThreadToDelete );
|
||||
#define portCLEAN_UP_TCB( pxTCB ) //vPortDeleteThread( pxTCB )
|
||||
#define portPRE_TASK_DELETE_HOOK( pvTaskToDelete, pxPendYield ) //vPortCloseRunningThread( ( pvTaskToDelete ), ( pxPendYield ) )
|
||||
#define portDISABLE_INTERRUPTS() CPU_CRITICAL_ENTER()
|
||||
#define portENABLE_INTERRUPTS() CPU_CRITICAL_EXIT()
|
||||
|
||||
|
||||
/* Critical section handling. */
|
||||
void vPortEnterCritical(void);
|
||||
void vPortExitCritical(void);
|
||||
//extern void * malloc(int ) ;
|
||||
//extern void free(void *) ;
|
||||
|
||||
//#define pvPortMalloc malloc
|
||||
//#define vPortFree free
|
||||
|
||||
/*
|
||||
extern volatile int cpu_lock_cnt[];
|
||||
extern volatile int irq_lock_cnt[];
|
||||
#define __asm_csync() \
|
||||
do { \
|
||||
asm volatile("csync;"); \
|
||||
asm volatile("csync;"); \
|
||||
asm volatile("csync;"); \
|
||||
asm volatile("csync;"); \
|
||||
asm volatile("csync;"); \
|
||||
} while (0)
|
||||
|
||||
static inline void local_irq_disable()
|
||||
{
|
||||
__builtin_pi32v2_cli();
|
||||
irq_lock_cnt[current_cpu_id()]++;
|
||||
}
|
||||
|
||||
|
||||
static inline void local_irq_enable()
|
||||
{
|
||||
if (--irq_lock_cnt[current_cpu_id()] == 0) {
|
||||
__builtin_pi32v2_sti();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#define CPU_CRITICAL_ENTER() \
|
||||
do { \
|
||||
local_irq_disable(); \
|
||||
if(cpu_lock_cnt[current_cpu_id()]++ == 0) \
|
||||
asm volatile("lockset;"); \
|
||||
__asm_csync(); \
|
||||
}while(0)
|
||||
|
||||
|
||||
#define CPU_CRITICAL_EXIT() \
|
||||
do { \
|
||||
if (--cpu_lock_cnt[current_cpu_id()] == 0) \
|
||||
asm volatile("lockclr;"); \
|
||||
local_irq_enable();\
|
||||
}while(0)
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#define portENTER_CRITICAL() CPU_CRITICAL_ENTER() // vPortEnterCritical()
|
||||
#define portEXIT_CRITICAL() CPU_CRITICAL_EXIT() // vPortExitCritical()
|
||||
|
||||
|
||||
#ifndef configUSE_PORT_OPTIMISED_TASK_SELECTION
|
||||
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 1
|
||||
#endif
|
||||
|
||||
#if configUSE_PORT_OPTIMISED_TASK_SELECTION == 1
|
||||
|
||||
extern __attribute__((always_inline)) uint32_t ucPortCountLeadingZeros(uint32_t ulBitmap);
|
||||
|
||||
/* Check the configuration. */
|
||||
#if( configMAX_PRIORITIES > 32 )
|
||||
#error configUSE_PORT_OPTIMISED_TASK_SELECTION can only be set to 1 when configMAX_PRIORITIES is less than or equal to 32. It is very rare that a system requires more than 10 to 15 difference priorities as tasks that share a priority will time slice.
|
||||
#endif
|
||||
|
||||
/* Store/clear the ready priorities in a bit map. */
|
||||
#define portRECORD_READY_PRIORITY( uxPriority, uxReadyPriorities ) ( uxReadyPriorities ) |= ( 1UL << ( uxPriority ) )
|
||||
#define portRESET_READY_PRIORITY( uxPriority, uxReadyPriorities ) \
|
||||
do { \
|
||||
( uxReadyPriorities ) &= ~( 1UL << ( uxPriority ) ); \
|
||||
} while (0)
|
||||
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
// uxTopPriority = __builtin_pi32v2_clz(uxReadyPriorities)
|
||||
#ifdef __GNUC__
|
||||
#define portGET_HIGHEST_PRIORITY( uxTopPriority, uxReadyPriorities ) uxTopPriority = ( 31 - ucPortCountLeadingZeros( ( uxReadyPriorities ) ) )
|
||||
#else
|
||||
/* BitScanReverse returns the bit position of the most significant '1'
|
||||
in the word. */
|
||||
#define portGET_HIGHEST_PRIORITY( uxTopPriority, uxReadyPriorities ) _BitScanReverse( ( DWORD * ) &( uxTopPriority ), ( uxReadyPriorities ) )
|
||||
#endif /* __GNUC__ */
|
||||
|
||||
#endif /* taskRECORD_READY_PRIORITY */
|
||||
|
||||
#ifndef __GNUC__
|
||||
__pragma(warning(disable: 4211)) /* Nonstandard extension used, as extern is only nonstandard to MSVC. */
|
||||
#endif
|
||||
|
||||
|
||||
/* Task function macros as described on the FreeRTOS.org WEB site. */
|
||||
#define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void * pvParameters )
|
||||
#define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void * pvParameters )
|
||||
|
||||
#define portINTERRUPT_YIELD ( 0UL )
|
||||
#define portINTERRUPT_TICK ( 1UL )
|
||||
|
||||
/*
|
||||
* Raise a simulated interrupt represented by the bit mask in ulInterruptMask.
|
||||
* Each bit can be used to represent an individual interrupt - with the first
|
||||
* two bits being used for the Yield and Tick interrupts respectively.
|
||||
*/
|
||||
void vPortGenerateSimulatedInterrupt(uint32_t ulInterruptNumber);
|
||||
|
||||
/*
|
||||
* Install an interrupt handler to be called by the simulated interrupt handler
|
||||
* thread. The interrupt number must be above any used by the kernel itself
|
||||
* (at the time of writing the kernel was using interrupt numbers 0, 1, and 2
|
||||
* as defined above). The number must also be lower than 32.
|
||||
*
|
||||
* Interrupt handler functions must return a non-zero value if executing the
|
||||
* handler resulted in a task switch being required.
|
||||
*/
|
||||
void vPortSetInterruptHandler(uint32_t ulInterruptNumber, uint32_t (*pvHandler)(void));
|
||||
|
||||
/* Tickless idle/low power functionality. */
|
||||
#ifndef portSUPPRESS_TICKS_AND_SLEEP
|
||||
extern void vPortSuppressTicksAndSleep(TickType_t xExpectedIdleTime);
|
||||
#define portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime ) vPortSuppressTicksAndSleep( xExpectedIdleTime )
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
262
include_lib/system/os/FreeRTOS/pi32v2/portmacro.h
Normal file
262
include_lib/system/os/FreeRTOS/pi32v2/portmacro.h
Normal file
@ -0,0 +1,262 @@
|
||||
/*
|
||||
FreeRTOS V9.0.0 - Copyright (C) 2016 Real Time Engineers Ltd.
|
||||
All rights reserved
|
||||
|
||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||
|
||||
This file is part of the FreeRTOS distribution.
|
||||
|
||||
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License (version 2) as published by the
|
||||
Free Software Foundation >>>> AND MODIFIED BY <<<< the FreeRTOS exception.
|
||||
|
||||
***************************************************************************
|
||||
>>! NOTE: The modification to the GPL is included to allow you to !<<
|
||||
>>! distribute a combined work that includes FreeRTOS without being !<<
|
||||
>>! obliged to provide the source code for proprietary components !<<
|
||||
>>! outside of the FreeRTOS kernel. !<<
|
||||
***************************************************************************
|
||||
|
||||
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. Full license text is available on the following
|
||||
link: http://www.freertos.org/a00114.html
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* FreeRTOS provides completely free yet professionally developed, *
|
||||
* robust, strictly quality controlled, supported, and cross *
|
||||
* platform software that is more than just the market leader, it *
|
||||
* is the industry's de facto standard. *
|
||||
* *
|
||||
* Help yourself get started quickly while simultaneously helping *
|
||||
* to support the FreeRTOS project by purchasing a FreeRTOS *
|
||||
* tutorial book, reference manual, or both: *
|
||||
* http://www.FreeRTOS.org/Documentation *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading
|
||||
the FAQ page "My application does not run, what could be wrong?". Have you
|
||||
defined configASSERT()?
|
||||
|
||||
http://www.FreeRTOS.org/support - In return for receiving this top quality
|
||||
embedded software for free we request you assist our global community by
|
||||
participating in the support forum.
|
||||
|
||||
http://www.FreeRTOS.org/training - Investing in training allows your team to
|
||||
be as productive as possible as early as possible. Now you can receive
|
||||
FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers
|
||||
Ltd, and the world's leading authority on the world's leading RTOS.
|
||||
|
||||
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||
including FreeRTOS+Trace - an indispensable productivity tool, a DOS
|
||||
compatible FAT file system, and our tiny thread aware UDP/IP stack.
|
||||
|
||||
http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
|
||||
Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.
|
||||
|
||||
http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High
|
||||
Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||
licenses offer ticketed support, indemnification and commercial middleware.
|
||||
|
||||
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||
engineered and independently SIL3 certified version for use in safety and
|
||||
mission critical applications that require provable dependability.
|
||||
|
||||
1 tab == 4 spaces!
|
||||
*/
|
||||
|
||||
#ifndef PORTMACRO_H
|
||||
#define PORTMACRO_H
|
||||
#include "asm/cpu.h"
|
||||
#include <stdint.h>
|
||||
/******************************************************************************
|
||||
Defines
|
||||
******************************************************************************/
|
||||
/* Type definitions. */
|
||||
#define portCHAR char
|
||||
#define portFLOAT float
|
||||
#define portDOUBLE double
|
||||
#define portLONG long
|
||||
#define portSHORT short
|
||||
#define portSTACK_TYPE int
|
||||
#define portBASE_TYPE long
|
||||
#define portPOINTER_SIZE_TYPE size_t
|
||||
|
||||
typedef portSTACK_TYPE StackType_t;
|
||||
typedef long BaseType_t;
|
||||
typedef unsigned long UBaseType_t;
|
||||
|
||||
|
||||
#if( configUSE_16_BIT_TICKS == 1 )
|
||||
typedef uint16_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffff
|
||||
#else
|
||||
typedef uint32_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffffffffUL
|
||||
|
||||
/* 32/64-bit tick type on a 32/64-bit architecture, so reads of the tick
|
||||
count do not need to be guarded with a critical section. */
|
||||
#define portTICK_TYPE_IS_ATOMIC 1
|
||||
#endif
|
||||
|
||||
/* Hardware specifics. */
|
||||
#define portSTACK_GROWTH ( -1 )
|
||||
#define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
|
||||
#define portINLINE __inline
|
||||
|
||||
#if defined( __x86_64__) || defined( _M_X64 )
|
||||
#define portBYTE_ALIGNMENT 8
|
||||
#else
|
||||
#define portBYTE_ALIGNMENT 4
|
||||
#endif
|
||||
extern void vPortYield() ;
|
||||
#define portYIELD() vPortYield()
|
||||
#define OS_CPU_ID current_cpu_id()
|
||||
extern int current_cpu_id() ;
|
||||
#define OS_CPU_NUM CPU_CORE_NUM
|
||||
|
||||
/* Simulated interrupts return pdFALSE if no context switch should be performed,
|
||||
or a non-zero number if a context switch should be performed. */
|
||||
#define portYIELD_FROM_ISR( x ) return x
|
||||
#define portEND_SWITCHING_ISR( x ) portYIELD_FROM_ISR( ( x ) )
|
||||
|
||||
void vPortCloseRunningThread(void *pvTaskToDelete, volatile BaseType_t *pxPendYield);
|
||||
//void vPortDeleteThread( void *pvThreadToDelete );
|
||||
#define portCLEAN_UP_TCB( pxTCB ) //vPortDeleteThread( pxTCB )
|
||||
#define portPRE_TASK_DELETE_HOOK( pvTaskToDelete, pxPendYield ) //vPortCloseRunningThread( ( pvTaskToDelete ), ( pxPendYield ) )
|
||||
#define portDISABLE_INTERRUPTS() CPU_CRITICAL_ENTER()
|
||||
#define portENABLE_INTERRUPTS() CPU_CRITICAL_EXIT()
|
||||
|
||||
|
||||
/* Critical section handling. */
|
||||
void vPortEnterCritical(void);
|
||||
void vPortExitCritical(void);
|
||||
//extern void * malloc(int ) ;
|
||||
//extern void free(void *) ;
|
||||
|
||||
//#define pvPortMalloc malloc
|
||||
//#define vPortFree free
|
||||
|
||||
/*
|
||||
extern volatile int cpu_lock_cnt[];
|
||||
extern volatile int irq_lock_cnt[];
|
||||
#define __asm_csync() \
|
||||
do { \
|
||||
asm volatile("csync;"); \
|
||||
asm volatile("csync;"); \
|
||||
asm volatile("csync;"); \
|
||||
asm volatile("csync;"); \
|
||||
asm volatile("csync;"); \
|
||||
} while (0)
|
||||
|
||||
static inline void local_irq_disable()
|
||||
{
|
||||
__builtin_pi32v2_cli();
|
||||
irq_lock_cnt[current_cpu_id()]++;
|
||||
}
|
||||
|
||||
|
||||
static inline void local_irq_enable()
|
||||
{
|
||||
if (--irq_lock_cnt[current_cpu_id()] == 0) {
|
||||
__builtin_pi32v2_sti();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#define CPU_CRITICAL_ENTER() \
|
||||
do { \
|
||||
local_irq_disable(); \
|
||||
if(cpu_lock_cnt[current_cpu_id()]++ == 0) \
|
||||
asm volatile("lockset;"); \
|
||||
__asm_csync(); \
|
||||
}while(0)
|
||||
|
||||
|
||||
#define CPU_CRITICAL_EXIT() \
|
||||
do { \
|
||||
if (--cpu_lock_cnt[current_cpu_id()] == 0) \
|
||||
asm volatile("lockclr;"); \
|
||||
local_irq_enable();\
|
||||
}while(0)
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#define portENTER_CRITICAL() CPU_CRITICAL_ENTER() // vPortEnterCritical()
|
||||
#define portEXIT_CRITICAL() CPU_CRITICAL_EXIT() // vPortExitCritical()
|
||||
|
||||
|
||||
#ifndef configUSE_PORT_OPTIMISED_TASK_SELECTION
|
||||
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 1
|
||||
#endif
|
||||
|
||||
#if configUSE_PORT_OPTIMISED_TASK_SELECTION == 1
|
||||
|
||||
/* Check the configuration. */
|
||||
#if( configMAX_PRIORITIES > 32 )
|
||||
#error configUSE_PORT_OPTIMISED_TASK_SELECTION can only be set to 1 when configMAX_PRIORITIES is less than or equal to 32. It is very rare that a system requires more than 10 to 15 difference priorities as tasks that share a priority will time slice.
|
||||
#endif
|
||||
|
||||
/* Store/clear the ready priorities in a bit map. */
|
||||
#define portRECORD_READY_PRIORITY( uxPriority, uxReadyPriorities ) ( uxReadyPriorities ) |= ( 1UL << ( uxPriority ) )
|
||||
#define portRESET_READY_PRIORITY( uxPriority, uxReadyPriorities ) \
|
||||
do { \
|
||||
( uxReadyPriorities ) &= ~( 1UL << ( uxPriority ) ); \
|
||||
} while (0)
|
||||
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
// uxTopPriority = __builtin_pi32v2_clz(uxReadyPriorities)
|
||||
#ifdef __GNUC__
|
||||
#define portGET_HIGHEST_PRIORITY( uxTopPriority, uxReadyPriorities ) \
|
||||
uxTopPriority = 31- __builtin_clz(uxReadyPriorities)
|
||||
#else
|
||||
/* BitScanReverse returns the bit position of the most significant '1'
|
||||
in the word. */
|
||||
#define portGET_HIGHEST_PRIORITY( uxTopPriority, uxReadyPriorities ) _BitScanReverse( ( DWORD * ) &( uxTopPriority ), ( uxReadyPriorities ) )
|
||||
#endif /* __GNUC__ */
|
||||
|
||||
#endif /* taskRECORD_READY_PRIORITY */
|
||||
|
||||
#ifndef __GNUC__
|
||||
__pragma(warning(disable: 4211)) /* Nonstandard extension used, as extern is only nonstandard to MSVC. */
|
||||
#endif
|
||||
|
||||
|
||||
/* Task function macros as described on the FreeRTOS.org WEB site. */
|
||||
#define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void * pvParameters )
|
||||
#define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void * pvParameters )
|
||||
|
||||
#define portINTERRUPT_YIELD ( 0UL )
|
||||
#define portINTERRUPT_TICK ( 1UL )
|
||||
|
||||
/*
|
||||
* Raise a simulated interrupt represented by the bit mask in ulInterruptMask.
|
||||
* Each bit can be used to represent an individual interrupt - with the first
|
||||
* two bits being used for the Yield and Tick interrupts respectively.
|
||||
*/
|
||||
void vPortGenerateSimulatedInterrupt(uint32_t ulInterruptNumber);
|
||||
|
||||
/*
|
||||
* Install an interrupt handler to be called by the simulated interrupt handler
|
||||
* thread. The interrupt number must be above any used by the kernel itself
|
||||
* (at the time of writing the kernel was using interrupt numbers 0, 1, and 2
|
||||
* as defined above). The number must also be lower than 32.
|
||||
*
|
||||
* Interrupt handler functions must return a non-zero value if executing the
|
||||
* handler resulted in a task switch being required.
|
||||
*/
|
||||
void vPortSetInterruptHandler(uint32_t ulInterruptNumber, uint32_t (*pvHandler)(void));
|
||||
|
||||
/* Tickless idle/low power functionality. */
|
||||
#ifndef portSUPPRESS_TICKS_AND_SLEEP
|
||||
extern void vPortSuppressTicksAndSleep(TickType_t xExpectedIdleTime);
|
||||
#define portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime ) vPortSuppressTicksAndSleep( xExpectedIdleTime )
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
206
include_lib/system/os/FreeRTOS/portable.h
Normal file
206
include_lib/system/os/FreeRTOS/portable.h
Normal file
@ -0,0 +1,206 @@
|
||||
/*
|
||||
FreeRTOS V9.0.0 - Copyright (C) 2016 Real Time Engineers Ltd.
|
||||
All rights reserved
|
||||
|
||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||
|
||||
This file is part of the FreeRTOS distribution.
|
||||
|
||||
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License (version 2) as published by the
|
||||
Free Software Foundation >>>> AND MODIFIED BY <<<< the FreeRTOS exception.
|
||||
|
||||
***************************************************************************
|
||||
>>! NOTE: The modification to the GPL is included to allow you to !<<
|
||||
>>! distribute a combined work that includes FreeRTOS without being !<<
|
||||
>>! obliged to provide the source code for proprietary components !<<
|
||||
>>! outside of the FreeRTOS kernel. !<<
|
||||
***************************************************************************
|
||||
|
||||
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. Full license text is available on the following
|
||||
link: http://www.freertos.org/a00114.html
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* FreeRTOS provides completely free yet professionally developed, *
|
||||
* robust, strictly quality controlled, supported, and cross *
|
||||
* platform software that is more than just the market leader, it *
|
||||
* is the industry's de facto standard. *
|
||||
* *
|
||||
* Help yourself get started quickly while simultaneously helping *
|
||||
* to support the FreeRTOS project by purchasing a FreeRTOS *
|
||||
* tutorial book, reference manual, or both: *
|
||||
* http://www.FreeRTOS.org/Documentation *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading
|
||||
the FAQ page "My application does not run, what could be wrong?". Have you
|
||||
defined configASSERT()?
|
||||
|
||||
http://www.FreeRTOS.org/support - In return for receiving this top quality
|
||||
embedded software for free we request you assist our global community by
|
||||
participating in the support forum.
|
||||
|
||||
http://www.FreeRTOS.org/training - Investing in training allows your team to
|
||||
be as productive as possible as early as possible. Now you can receive
|
||||
FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers
|
||||
Ltd, and the world's leading authority on the world's leading RTOS.
|
||||
|
||||
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||
including FreeRTOS+Trace - an indispensable productivity tool, a DOS
|
||||
compatible FAT file system, and our tiny thread aware UDP/IP stack.
|
||||
|
||||
http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
|
||||
Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.
|
||||
|
||||
http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High
|
||||
Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||
licenses offer ticketed support, indemnification and commercial middleware.
|
||||
|
||||
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||
engineered and independently SIL3 certified version for use in safety and
|
||||
mission critical applications that require provable dependability.
|
||||
|
||||
1 tab == 4 spaces!
|
||||
*/
|
||||
|
||||
/*-----------------------------------------------------------
|
||||
* Portable layer API. Each function must be defined for each port.
|
||||
*----------------------------------------------------------*/
|
||||
|
||||
#ifndef PORTABLE_H
|
||||
#define PORTABLE_H
|
||||
|
||||
/* Each FreeRTOS port has a unique portmacro.h header file. Originally a
|
||||
pre-processor definition was used to ensure the pre-processor found the correct
|
||||
portmacro.h file for the port being used. That scheme was deprecated in favour
|
||||
of setting the compiler's include path such that it found the correct
|
||||
portmacro.h file - removing the need for the constant and allowing the
|
||||
portmacro.h file to be located anywhere in relation to the port being used.
|
||||
Purely for reasons of backward compatibility the old method is still valid, but
|
||||
to make it clear that new projects should not use it, support for the port
|
||||
specific constants has been moved into the deprecated_definitions.h header
|
||||
file. */
|
||||
#include "deprecated_definitions.h"
|
||||
|
||||
/* If portENTER_CRITICAL is not defined then including deprecated_definitions.h
|
||||
did not result in a portmacro.h header file being included - and it should be
|
||||
included here. In this case the path to the correct portmacro.h header file
|
||||
must be set in the compiler's include path. */
|
||||
#ifndef portENTER_CRITICAL
|
||||
#include "portmacro.h"
|
||||
#endif
|
||||
|
||||
#if portBYTE_ALIGNMENT == 32
|
||||
#define portBYTE_ALIGNMENT_MASK ( 0x001f )
|
||||
#endif
|
||||
|
||||
#if portBYTE_ALIGNMENT == 16
|
||||
#define portBYTE_ALIGNMENT_MASK ( 0x000f )
|
||||
#endif
|
||||
|
||||
#if portBYTE_ALIGNMENT == 8
|
||||
#define portBYTE_ALIGNMENT_MASK ( 0x0007 )
|
||||
#endif
|
||||
|
||||
#if portBYTE_ALIGNMENT == 4
|
||||
#define portBYTE_ALIGNMENT_MASK ( 0x0003 )
|
||||
#endif
|
||||
|
||||
#if portBYTE_ALIGNMENT == 2
|
||||
#define portBYTE_ALIGNMENT_MASK ( 0x0001 )
|
||||
#endif
|
||||
|
||||
#if portBYTE_ALIGNMENT == 1
|
||||
#define portBYTE_ALIGNMENT_MASK ( 0x0000 )
|
||||
#endif
|
||||
|
||||
#ifndef portBYTE_ALIGNMENT_MASK
|
||||
#error "Invalid portBYTE_ALIGNMENT definition"
|
||||
#endif
|
||||
|
||||
#ifndef portNUM_CONFIGURABLE_REGIONS
|
||||
#define portNUM_CONFIGURABLE_REGIONS 1
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "mpu_wrappers.h"
|
||||
|
||||
/*
|
||||
* Setup the stack of a new task so it is ready to be placed under the
|
||||
* scheduler control. The registers have to be placed on the stack in
|
||||
* the order that the port expects to find them.
|
||||
*
|
||||
*/
|
||||
#if( portUSING_MPU_WRAPPERS == 1 )
|
||||
StackType_t *pxPortInitialiseStack(StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters, BaseType_t xRunPrivileged) PRIVILEGED_FUNCTION;
|
||||
#else
|
||||
StackType_t *pxPortInitialiseStack(StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters) PRIVILEGED_FUNCTION;
|
||||
#endif
|
||||
|
||||
/* Used by heap_5.c. */
|
||||
typedef struct HeapRegion {
|
||||
uint8_t *pucStartAddress;
|
||||
size_t xSizeInBytes;
|
||||
} HeapRegion_t;
|
||||
|
||||
/*
|
||||
* Used to define multiple heap regions for use by heap_5.c. This function
|
||||
* must be called before any calls to pvPortMalloc() - not creating a task,
|
||||
* queue, semaphore, mutex, software timer, event group, etc. will result in
|
||||
* pvPortMalloc being called.
|
||||
*
|
||||
* pxHeapRegions passes in an array of HeapRegion_t structures - each of which
|
||||
* defines a region of memory that can be used as the heap. The array is
|
||||
* terminated by a HeapRegions_t structure that has a size of 0. The region
|
||||
* with the lowest start address must appear first in the array.
|
||||
*/
|
||||
void vPortDefineHeapRegions(const HeapRegion_t *const pxHeapRegions) PRIVILEGED_FUNCTION;
|
||||
|
||||
|
||||
/*
|
||||
* Map to the memory management routines required for the port.
|
||||
*/
|
||||
void *pvPortMalloc(size_t xSize) PRIVILEGED_FUNCTION;
|
||||
void vPortFree(void *pv) PRIVILEGED_FUNCTION;
|
||||
void vPortInitialiseBlocks(void) PRIVILEGED_FUNCTION;
|
||||
// size_t xPortGetFreeHeapSize(void) PRIVILEGED_FUNCTION;
|
||||
// size_t xPortGetMinimumEverFreeHeapSize(void) PRIVILEGED_FUNCTION;
|
||||
|
||||
/*
|
||||
* Setup the hardware ready for the scheduler to take control. This generally
|
||||
* sets up a tick interrupt and sets timers for the correct tick frequency.
|
||||
*/
|
||||
BaseType_t xPortStartScheduler(void) PRIVILEGED_FUNCTION;
|
||||
|
||||
/*
|
||||
* Undo any hardware/ISR setup that was performed by xPortStartScheduler() so
|
||||
* the hardware is left in its original condition after the scheduler stops
|
||||
* executing.
|
||||
*/
|
||||
void vPortEndScheduler(void) PRIVILEGED_FUNCTION;
|
||||
|
||||
/*
|
||||
* The structures and methods of manipulating the MPU are contained within the
|
||||
* port layer.
|
||||
*
|
||||
* Fills the xMPUSettings structure with the memory region information
|
||||
* contained in xRegions.
|
||||
*/
|
||||
#if( portUSING_MPU_WRAPPERS == 1 )
|
||||
struct xMEMORY_REGION;
|
||||
void vPortStoreTaskMPUSettings(xMPU_SETTINGS *xMPUSettings, const struct xMEMORY_REGION *const xRegions, StackType_t *pxBottomOfStack, uint32_t ulStackDepth) PRIVILEGED_FUNCTION;
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* PORTABLE_H */
|
||||
|
||||
161
include_lib/system/os/FreeRTOS/projdefs.h
Normal file
161
include_lib/system/os/FreeRTOS/projdefs.h
Normal file
@ -0,0 +1,161 @@
|
||||
/*
|
||||
FreeRTOS V9.0.0 - Copyright (C) 2016 Real Time Engineers Ltd.
|
||||
All rights reserved
|
||||
|
||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||
|
||||
This file is part of the FreeRTOS distribution.
|
||||
|
||||
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License (version 2) as published by the
|
||||
Free Software Foundation >>>> AND MODIFIED BY <<<< the FreeRTOS exception.
|
||||
|
||||
***************************************************************************
|
||||
>>! NOTE: The modification to the GPL is included to allow you to !<<
|
||||
>>! distribute a combined work that includes FreeRTOS without being !<<
|
||||
>>! obliged to provide the source code for proprietary components !<<
|
||||
>>! outside of the FreeRTOS kernel. !<<
|
||||
***************************************************************************
|
||||
|
||||
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. Full license text is available on the following
|
||||
link: http://www.freertos.org/a00114.html
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* FreeRTOS provides completely free yet professionally developed, *
|
||||
* robust, strictly quality controlled, supported, and cross *
|
||||
* platform software that is more than just the market leader, it *
|
||||
* is the industry's de facto standard. *
|
||||
* *
|
||||
* Help yourself get started quickly while simultaneously helping *
|
||||
* to support the FreeRTOS project by purchasing a FreeRTOS *
|
||||
* tutorial book, reference manual, or both: *
|
||||
* http://www.FreeRTOS.org/Documentation *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading
|
||||
the FAQ page "My application does not run, what could be wrong?". Have you
|
||||
defined configASSERT()?
|
||||
|
||||
http://www.FreeRTOS.org/support - In return for receiving this top quality
|
||||
embedded software for free we request you assist our global community by
|
||||
participating in the support forum.
|
||||
|
||||
http://www.FreeRTOS.org/training - Investing in training allows your team to
|
||||
be as productive as possible as early as possible. Now you can receive
|
||||
FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers
|
||||
Ltd, and the world's leading authority on the world's leading RTOS.
|
||||
|
||||
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||
including FreeRTOS+Trace - an indispensable productivity tool, a DOS
|
||||
compatible FAT file system, and our tiny thread aware UDP/IP stack.
|
||||
|
||||
http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
|
||||
Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.
|
||||
|
||||
http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High
|
||||
Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||
licenses offer ticketed support, indemnification and commercial middleware.
|
||||
|
||||
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||
engineered and independently SIL3 certified version for use in safety and
|
||||
mission critical applications that require provable dependability.
|
||||
|
||||
1 tab == 4 spaces!
|
||||
*/
|
||||
|
||||
#ifndef PROJDEFS_H
|
||||
#define PROJDEFS_H
|
||||
|
||||
/*
|
||||
* Defines the prototype to which task functions must conform. Defined in this
|
||||
* file to ensure the type is known before portable.h is included.
|
||||
*/
|
||||
typedef void (*TaskFunction_t)(void *);
|
||||
|
||||
/* Converts a time in milliseconds to a time in ticks. This macro can be
|
||||
overridden by a macro of the same name defined in FreeRTOSConfig.h in case the
|
||||
definition here is not suitable for your application. */
|
||||
#ifndef pdMS_TO_TICKS
|
||||
#define pdMS_TO_TICKS( xTimeInMs ) ( ( TickType_t ) ( ( ( TickType_t ) ( xTimeInMs ) * ( TickType_t ) configTICK_RATE_HZ ) / ( TickType_t ) 1000 ) )
|
||||
#endif
|
||||
|
||||
#define pdFALSE ( ( BaseType_t ) 0 )
|
||||
#define pdTRUE ( ( BaseType_t ) 1 )
|
||||
|
||||
#define pdPASS ( pdTRUE )
|
||||
#define pdFAIL ( pdFALSE )
|
||||
#define errQUEUE_EMPTY ( ( BaseType_t ) 0 )
|
||||
#define errQUEUE_FULL ( ( BaseType_t ) 0 )
|
||||
|
||||
/* FreeRTOS error definitions. */
|
||||
#define errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY ( -1 )
|
||||
#define errQUEUE_BLOCKED ( -4 )
|
||||
#define errQUEUE_YIELD ( -5 )
|
||||
|
||||
/* Macros used for basic data corruption checks. */
|
||||
#ifndef configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES
|
||||
#define configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES 0
|
||||
#endif
|
||||
|
||||
#if( configUSE_16_BIT_TICKS == 1 )
|
||||
#define pdINTEGRITY_CHECK_VALUE 0x5a5a
|
||||
#else
|
||||
#define pdINTEGRITY_CHECK_VALUE 0x5a5a5a5aUL
|
||||
#endif
|
||||
|
||||
/* The following errno values are used by FreeRTOS+ components, not FreeRTOS
|
||||
itself. */
|
||||
#define pdFREERTOS_ERRNO_NONE 0 /* No errors */
|
||||
#define pdFREERTOS_ERRNO_ENOENT 2 /* No such file or directory */
|
||||
#define pdFREERTOS_ERRNO_EINTR 4 /* Interrupted system call */
|
||||
#define pdFREERTOS_ERRNO_EIO 5 /* I/O error */
|
||||
#define pdFREERTOS_ERRNO_ENXIO 6 /* No such device or address */
|
||||
#define pdFREERTOS_ERRNO_EBADF 9 /* Bad file number */
|
||||
#define pdFREERTOS_ERRNO_EAGAIN 11 /* No more processes */
|
||||
#define pdFREERTOS_ERRNO_EWOULDBLOCK 11 /* Operation would block */
|
||||
#define pdFREERTOS_ERRNO_ENOMEM 12 /* Not enough memory */
|
||||
#define pdFREERTOS_ERRNO_EACCES 13 /* Permission denied */
|
||||
#define pdFREERTOS_ERRNO_EFAULT 14 /* Bad address */
|
||||
#define pdFREERTOS_ERRNO_EBUSY 16 /* Mount device busy */
|
||||
#define pdFREERTOS_ERRNO_EEXIST 17 /* File exists */
|
||||
#define pdFREERTOS_ERRNO_EXDEV 18 /* Cross-device link */
|
||||
#define pdFREERTOS_ERRNO_ENODEV 19 /* No such device */
|
||||
#define pdFREERTOS_ERRNO_ENOTDIR 20 /* Not a directory */
|
||||
#define pdFREERTOS_ERRNO_EISDIR 21 /* Is a directory */
|
||||
#define pdFREERTOS_ERRNO_EINVAL 22 /* Invalid argument */
|
||||
#define pdFREERTOS_ERRNO_ENOSPC 28 /* No space left on device */
|
||||
#define pdFREERTOS_ERRNO_ESPIPE 29 /* Illegal seek */
|
||||
#define pdFREERTOS_ERRNO_EROFS 30 /* Read only file system */
|
||||
#define pdFREERTOS_ERRNO_EUNATCH 42 /* Protocol driver not attached */
|
||||
#define pdFREERTOS_ERRNO_EBADE 50 /* Invalid exchange */
|
||||
#define pdFREERTOS_ERRNO_EFTYPE 79 /* Inappropriate file type or format */
|
||||
#define pdFREERTOS_ERRNO_ENMFILE 89 /* No more files */
|
||||
#define pdFREERTOS_ERRNO_ENOTEMPTY 90 /* Directory not empty */
|
||||
#define pdFREERTOS_ERRNO_ENAMETOOLONG 91 /* File or path name too long */
|
||||
#define pdFREERTOS_ERRNO_EOPNOTSUPP 95 /* Operation not supported on transport endpoint */
|
||||
#define pdFREERTOS_ERRNO_ENOBUFS 105 /* No buffer space available */
|
||||
#define pdFREERTOS_ERRNO_ENOPROTOOPT 109 /* Protocol not available */
|
||||
#define pdFREERTOS_ERRNO_EADDRINUSE 112 /* Address already in use */
|
||||
#define pdFREERTOS_ERRNO_ETIMEDOUT 116 /* Connection timed out */
|
||||
#define pdFREERTOS_ERRNO_EINPROGRESS 119 /* Connection already in progress */
|
||||
#define pdFREERTOS_ERRNO_EALREADY 120 /* Socket already connected */
|
||||
#define pdFREERTOS_ERRNO_EADDRNOTAVAIL 125 /* Address not available */
|
||||
#define pdFREERTOS_ERRNO_EISCONN 127 /* Socket is already connected */
|
||||
#define pdFREERTOS_ERRNO_ENOTCONN 128 /* Socket is not connected */
|
||||
#define pdFREERTOS_ERRNO_ENOMEDIUM 135 /* No medium inserted */
|
||||
#define pdFREERTOS_ERRNO_EILSEQ 138 /* An invalid UTF-16 sequence was encountered. */
|
||||
#define pdFREERTOS_ERRNO_ECANCELED 140 /* Operation canceled. */
|
||||
|
||||
/* The following endian values are used by FreeRTOS+ components, not FreeRTOS
|
||||
itself. */
|
||||
#define pdFREERTOS_LITTLE_ENDIAN 0
|
||||
#define pdFREERTOS_BIG_ENDIAN 1
|
||||
|
||||
#endif /* PROJDEFS_H */
|
||||
|
||||
|
||||
|
||||
262
include_lib/system/os/FreeRTOS/q32s/portmacro.h
Normal file
262
include_lib/system/os/FreeRTOS/q32s/portmacro.h
Normal file
@ -0,0 +1,262 @@
|
||||
/*
|
||||
FreeRTOS V9.0.0 - Copyright (C) 2016 Real Time Engineers Ltd.
|
||||
All rights reserved
|
||||
|
||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||
|
||||
This file is part of the FreeRTOS distribution.
|
||||
|
||||
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License (version 2) as published by the
|
||||
Free Software Foundation >>>> AND MODIFIED BY <<<< the FreeRTOS exception.
|
||||
|
||||
***************************************************************************
|
||||
>>! NOTE: The modification to the GPL is included to allow you to !<<
|
||||
>>! distribute a combined work that includes FreeRTOS without being !<<
|
||||
>>! obliged to provide the source code for proprietary components !<<
|
||||
>>! outside of the FreeRTOS kernel. !<<
|
||||
***************************************************************************
|
||||
|
||||
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. Full license text is available on the following
|
||||
link: http://www.freertos.org/a00114.html
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* FreeRTOS provides completely free yet professionally developed, *
|
||||
* robust, strictly quality controlled, supported, and cross *
|
||||
* platform software that is more than just the market leader, it *
|
||||
* is the industry's de facto standard. *
|
||||
* *
|
||||
* Help yourself get started quickly while simultaneously helping *
|
||||
* to support the FreeRTOS project by purchasing a FreeRTOS *
|
||||
* tutorial book, reference manual, or both: *
|
||||
* http://www.FreeRTOS.org/Documentation *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading
|
||||
the FAQ page "My application does not run, what could be wrong?". Have you
|
||||
defined configASSERT()?
|
||||
|
||||
http://www.FreeRTOS.org/support - In return for receiving this top quality
|
||||
embedded software for free we request you assist our global community by
|
||||
participating in the support forum.
|
||||
|
||||
http://www.FreeRTOS.org/training - Investing in training allows your team to
|
||||
be as productive as possible as early as possible. Now you can receive
|
||||
FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers
|
||||
Ltd, and the world's leading authority on the world's leading RTOS.
|
||||
|
||||
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||
including FreeRTOS+Trace - an indispensable productivity tool, a DOS
|
||||
compatible FAT file system, and our tiny thread aware UDP/IP stack.
|
||||
|
||||
http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
|
||||
Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.
|
||||
|
||||
http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High
|
||||
Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||
licenses offer ticketed support, indemnification and commercial middleware.
|
||||
|
||||
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||
engineered and independently SIL3 certified version for use in safety and
|
||||
mission critical applications that require provable dependability.
|
||||
|
||||
1 tab == 4 spaces!
|
||||
*/
|
||||
|
||||
#ifndef PORTMACRO_H
|
||||
#define PORTMACRO_H
|
||||
#include "asm/cpu.h"
|
||||
#include <stdint.h>
|
||||
/******************************************************************************
|
||||
Defines
|
||||
******************************************************************************/
|
||||
/* Type definitions. */
|
||||
#define portCHAR char
|
||||
#define portFLOAT float
|
||||
#define portDOUBLE double
|
||||
#define portLONG long
|
||||
#define portSHORT short
|
||||
#define portSTACK_TYPE int
|
||||
#define portBASE_TYPE long
|
||||
#define portPOINTER_SIZE_TYPE size_t
|
||||
|
||||
typedef portSTACK_TYPE StackType_t;
|
||||
typedef long BaseType_t;
|
||||
typedef unsigned long UBaseType_t;
|
||||
|
||||
|
||||
#if( configUSE_16_BIT_TICKS == 1 )
|
||||
typedef uint16_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffff
|
||||
#else
|
||||
typedef uint32_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffffffffUL
|
||||
|
||||
/* 32/64-bit tick type on a 32/64-bit architecture, so reads of the tick
|
||||
count do not need to be guarded with a critical section. */
|
||||
#define portTICK_TYPE_IS_ATOMIC 1
|
||||
#endif
|
||||
|
||||
/* Hardware specifics. */
|
||||
#define portSTACK_GROWTH ( -1 )
|
||||
#define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
|
||||
#define portINLINE __inline
|
||||
|
||||
#if defined( __x86_64__) || defined( _M_X64 )
|
||||
#define portBYTE_ALIGNMENT 8
|
||||
#else
|
||||
#define portBYTE_ALIGNMENT 4
|
||||
#endif
|
||||
extern void vPortYield() ;
|
||||
#define portYIELD() vPortYield()
|
||||
#define OS_CPU_ID current_cpu_id()
|
||||
extern int current_cpu_id() ;
|
||||
#define OS_CPU_NUM CPU_CORE_NUM
|
||||
|
||||
/* Simulated interrupts return pdFALSE if no context switch should be performed,
|
||||
or a non-zero number if a context switch should be performed. */
|
||||
#define portYIELD_FROM_ISR( x ) return x
|
||||
#define portEND_SWITCHING_ISR( x ) portYIELD_FROM_ISR( ( x ) )
|
||||
|
||||
void vPortCloseRunningThread(void *pvTaskToDelete, volatile BaseType_t *pxPendYield);
|
||||
//void vPortDeleteThread( void *pvThreadToDelete );
|
||||
#define portCLEAN_UP_TCB( pxTCB ) //vPortDeleteThread( pxTCB )
|
||||
#define portPRE_TASK_DELETE_HOOK( pvTaskToDelete, pxPendYield ) //vPortCloseRunningThread( ( pvTaskToDelete ), ( pxPendYield ) )
|
||||
#define portDISABLE_INTERRUPTS() CPU_CRITICAL_ENTER()
|
||||
#define portENABLE_INTERRUPTS() CPU_CRITICAL_EXIT()
|
||||
|
||||
|
||||
/* Critical section handling. */
|
||||
void vPortEnterCritical(void);
|
||||
void vPortExitCritical(void);
|
||||
//extern void * malloc(int ) ;
|
||||
//extern void free(void *) ;
|
||||
|
||||
//#define pvPortMalloc malloc
|
||||
//#define vPortFree free
|
||||
|
||||
/*
|
||||
extern volatile int cpu_lock_cnt[];
|
||||
extern volatile int irq_lock_cnt[];
|
||||
#define __asm_csync() \
|
||||
do { \
|
||||
asm volatile("csync;"); \
|
||||
asm volatile("csync;"); \
|
||||
asm volatile("csync;"); \
|
||||
asm volatile("csync;"); \
|
||||
asm volatile("csync;"); \
|
||||
} while (0)
|
||||
|
||||
static inline void local_irq_disable()
|
||||
{
|
||||
__builtin_pi32v2_cli();
|
||||
irq_lock_cnt[current_cpu_id()]++;
|
||||
}
|
||||
|
||||
|
||||
static inline void local_irq_enable()
|
||||
{
|
||||
if (--irq_lock_cnt[current_cpu_id()] == 0) {
|
||||
__builtin_pi32v2_sti();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#define CPU_CRITICAL_ENTER() \
|
||||
do { \
|
||||
local_irq_disable(); \
|
||||
if(cpu_lock_cnt[current_cpu_id()]++ == 0) \
|
||||
asm volatile("lockset;"); \
|
||||
__asm_csync(); \
|
||||
}while(0)
|
||||
|
||||
|
||||
#define CPU_CRITICAL_EXIT() \
|
||||
do { \
|
||||
if (--cpu_lock_cnt[current_cpu_id()] == 0) \
|
||||
asm volatile("lockclr;"); \
|
||||
local_irq_enable();\
|
||||
}while(0)
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#define portENTER_CRITICAL() CPU_CRITICAL_ENTER() // vPortEnterCritical()
|
||||
#define portEXIT_CRITICAL() CPU_CRITICAL_EXIT() // vPortExitCritical()
|
||||
|
||||
|
||||
#ifndef configUSE_PORT_OPTIMISED_TASK_SELECTION
|
||||
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 1
|
||||
#endif
|
||||
|
||||
#if configUSE_PORT_OPTIMISED_TASK_SELECTION == 1
|
||||
|
||||
/* Check the configuration. */
|
||||
#if( configMAX_PRIORITIES > 32 )
|
||||
#error configUSE_PORT_OPTIMISED_TASK_SELECTION can only be set to 1 when configMAX_PRIORITIES is less than or equal to 32. It is very rare that a system requires more than 10 to 15 difference priorities as tasks that share a priority will time slice.
|
||||
#endif
|
||||
|
||||
/* Store/clear the ready priorities in a bit map. */
|
||||
#define portRECORD_READY_PRIORITY( uxPriority, uxReadyPriorities ) ( uxReadyPriorities ) |= ( 1UL << ( uxPriority ) )
|
||||
#define portRESET_READY_PRIORITY( uxPriority, uxReadyPriorities ) \
|
||||
do { \
|
||||
( uxReadyPriorities ) &= ~( 1UL << ( uxPriority ) ); \
|
||||
} while (0)
|
||||
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
// uxTopPriority = __builtin_pi32v2_clz(uxReadyPriorities)
|
||||
#ifdef __GNUC__
|
||||
#define portGET_HIGHEST_PRIORITY( uxTopPriority, uxReadyPriorities ) \
|
||||
uxTopPriority = 31- __builtin_clz(uxReadyPriorities)
|
||||
#else
|
||||
/* BitScanReverse returns the bit position of the most significant '1'
|
||||
in the word. */
|
||||
#define portGET_HIGHEST_PRIORITY( uxTopPriority, uxReadyPriorities ) _BitScanReverse( ( DWORD * ) &( uxTopPriority ), ( uxReadyPriorities ) )
|
||||
#endif /* __GNUC__ */
|
||||
|
||||
#endif /* taskRECORD_READY_PRIORITY */
|
||||
|
||||
#ifndef __GNUC__
|
||||
__pragma(warning(disable: 4211)) /* Nonstandard extension used, as extern is only nonstandard to MSVC. */
|
||||
#endif
|
||||
|
||||
|
||||
/* Task function macros as described on the FreeRTOS.org WEB site. */
|
||||
#define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void * pvParameters )
|
||||
#define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void * pvParameters )
|
||||
|
||||
#define portINTERRUPT_YIELD ( 0UL )
|
||||
#define portINTERRUPT_TICK ( 1UL )
|
||||
|
||||
/*
|
||||
* Raise a simulated interrupt represented by the bit mask in ulInterruptMask.
|
||||
* Each bit can be used to represent an individual interrupt - with the first
|
||||
* two bits being used for the Yield and Tick interrupts respectively.
|
||||
*/
|
||||
void vPortGenerateSimulatedInterrupt(uint32_t ulInterruptNumber);
|
||||
|
||||
/*
|
||||
* Install an interrupt handler to be called by the simulated interrupt handler
|
||||
* thread. The interrupt number must be above any used by the kernel itself
|
||||
* (at the time of writing the kernel was using interrupt numbers 0, 1, and 2
|
||||
* as defined above). The number must also be lower than 32.
|
||||
*
|
||||
* Interrupt handler functions must return a non-zero value if executing the
|
||||
* handler resulted in a task switch being required.
|
||||
*/
|
||||
void vPortSetInterruptHandler(uint32_t ulInterruptNumber, uint32_t (*pvHandler)(void));
|
||||
|
||||
/* Tickless idle/low power functionality. */
|
||||
#ifndef portSUPPRESS_TICKS_AND_SLEEP
|
||||
// extern void vPortSuppressTicksAndSleep(TickType_t xExpectedIdleTime);
|
||||
// #define portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime ) vPortSuppressTicksAndSleep( xExpectedIdleTime )
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
1799
include_lib/system/os/FreeRTOS/queue.h
Normal file
1799
include_lib/system/os/FreeRTOS/queue.h
Normal file
File diff suppressed because it is too large
Load Diff
1175
include_lib/system/os/FreeRTOS/semphr.h
Normal file
1175
include_lib/system/os/FreeRTOS/semphr.h
Normal file
File diff suppressed because it is too large
Load Diff
2268
include_lib/system/os/FreeRTOS/task.h
Normal file
2268
include_lib/system/os/FreeRTOS/task.h
Normal file
File diff suppressed because it is too large
Load Diff
442
include_lib/system/os/os_api.h
Normal file
442
include_lib/system/os/os_api.h
Normal file
@ -0,0 +1,442 @@
|
||||
#ifndef OS_API_H
|
||||
#define OS_API_H
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
#include "generic/typedef.h"
|
||||
//#include "generic/list.h"
|
||||
#include "os/os_cpu.h"
|
||||
#include "os/os_error.h"
|
||||
#include "os/os_type.h"
|
||||
|
||||
|
||||
typedef void *TaskHandle_t;
|
||||
|
||||
#define Q_MSG 0x100000
|
||||
#define Q_EVENT 0x200000
|
||||
#define Q_CALLBACK 0x300000
|
||||
#define Q_USER 0x400000
|
||||
|
||||
#define OS_DEL_NO_PEND 0u
|
||||
#define OS_DEL_ALWAYS 1u
|
||||
|
||||
#define OS_TASK_DEL_REQ 0x01u
|
||||
#define OS_TASK_DEL_RES 0x02u
|
||||
#define OS_TASK_DEL_OK 0x03u
|
||||
|
||||
|
||||
#define OS_TASK_SELF (char *)0x1
|
||||
#define OS_TASK_FATHER (char *)0x2
|
||||
|
||||
|
||||
/* --------------------------------------------------------------------------*/
|
||||
/**
|
||||
* @brief reserved
|
||||
*/
|
||||
/* ----------------------------------------------------------------------------*/
|
||||
void os_init(void);
|
||||
|
||||
/* --------------------------------------------------------------------------*/
|
||||
/**
|
||||
* @brief reserved
|
||||
*/
|
||||
/* ----------------------------------------------------------------------------*/
|
||||
void os_start(void);
|
||||
|
||||
/* --------------------------------------------------------------------------*/
|
||||
/**
|
||||
* @brief reserved
|
||||
*/
|
||||
/* ----------------------------------------------------------------------------*/
|
||||
void os_init_tick(int);
|
||||
|
||||
/* --------------------------------------------------------------------------*/
|
||||
/**
|
||||
* @brief 创建任务
|
||||
*
|
||||
* @param task 任务回调函数
|
||||
* @param p_arg 传递给任务回调函数的参数
|
||||
* @param prio 任务的优先级
|
||||
* @param stksize 任务的堆栈大小, 单位(u32)
|
||||
* @param qsize 任务的queue大小,单位(byte)
|
||||
* @param name 任务名 (名字长度不能超过configMAX_TASK_NAME_LEN字节)
|
||||
*
|
||||
* @return 错误码
|
||||
*/
|
||||
/* ----------------------------------------------------------------------------*/
|
||||
int os_task_create(void (*task)(void *p_arg),
|
||||
void *p_arg,
|
||||
u8 prio,
|
||||
u32 stksize,
|
||||
int qsize,
|
||||
const char *name);
|
||||
|
||||
int os_task_create_affinity_core(void (*task)(void *p_arg),
|
||||
void *p_arg,
|
||||
u8 prio,
|
||||
u32 stksize,
|
||||
int qsize,
|
||||
const char *name,
|
||||
u8 core);
|
||||
|
||||
/* --------------------------------------------------------------------------*/
|
||||
/**
|
||||
* @brief 获取当前任务名
|
||||
*
|
||||
* @return 当前任务名
|
||||
*/
|
||||
/* ----------------------------------------------------------------------------*/
|
||||
const char *os_current_task();
|
||||
|
||||
/* --------------------------------------------------------------------------*/
|
||||
/**
|
||||
* @brief 删除任务
|
||||
*
|
||||
* @param name 任务名
|
||||
*
|
||||
* @return 错误码
|
||||
*/
|
||||
/* ----------------------------------------------------------------------------*/
|
||||
int os_task_del_req(const char *name);
|
||||
|
||||
/* --------------------------------------------------------------------------*/
|
||||
/**
|
||||
* @brief 响应任务删除请求,标记资源已经释放,可以删除当前任
|
||||
*
|
||||
* @param name 任务名,任务自己可以用OS_TASK_SELF
|
||||
*
|
||||
* @return 错误码
|
||||
*/
|
||||
/* ----------------------------------------------------------------------------*/
|
||||
int os_task_del_res(const char *name);
|
||||
|
||||
/* --------------------------------------------------------------------------*/
|
||||
/**
|
||||
* @brief 删除任务
|
||||
*
|
||||
* @param name 任务名
|
||||
*
|
||||
* @return 错误码
|
||||
*/
|
||||
/* ----------------------------------------------------------------------------*/
|
||||
int os_task_del(const char *name);
|
||||
|
||||
|
||||
/* --------------------------------------------------------------------------*/
|
||||
/**
|
||||
* @brief 延时。中断函数或者关闭系统总中断的情况下不能调用此函数
|
||||
*
|
||||
* @param time_tick 延时时间
|
||||
*/
|
||||
/* ----------------------------------------------------------------------------*/
|
||||
void os_time_dly(int time_tick);
|
||||
|
||||
|
||||
/* --------------------------------------------------------------------------*/
|
||||
/**
|
||||
* @brief 发送Q_USER类型taskq
|
||||
*
|
||||
* @param name 任务名
|
||||
* @param argc 后面传入的参数的个数。发送的最大参数个数限制为8个int类型
|
||||
*
|
||||
* @return 错误码
|
||||
*/
|
||||
/* ----------------------------------------------------------------------------*/
|
||||
int os_taskq_post(const char *name, int argc, ...);
|
||||
|
||||
/* --------------------------------------------------------------------------*/
|
||||
/**
|
||||
* @brief 非阻塞方式查询taskq
|
||||
*
|
||||
* @param argc 最大可获取的queue长度,单位(int)
|
||||
* @param argv 存放queue的buf
|
||||
*
|
||||
* @return 错误码
|
||||
*/
|
||||
/* ----------------------------------------------------------------------------*/
|
||||
int os_taskq_accept(int argc, int *argv);
|
||||
|
||||
/* --------------------------------------------------------------------------*/
|
||||
/**
|
||||
* @brief 阻塞方式获取taskq
|
||||
*
|
||||
* @param fmt 保留,传NULL
|
||||
* @param argv 存放queue的buf
|
||||
* @param argc 最大可获取的queue长度,单位(int)
|
||||
*
|
||||
* @return 错误码
|
||||
*/
|
||||
/* ----------------------------------------------------------------------------*/
|
||||
int os_taskq_pend(const char *fmt, int *argv, int argc);
|
||||
// int os_task_pend(const char *fmt, int *argv, int argc);
|
||||
// int __os_taskq_pend(int *argv, int argc, int tick);
|
||||
|
||||
|
||||
|
||||
/* --------------------------------------------------------------------------*/
|
||||
/**
|
||||
* @brief 发送指定类型的taskq
|
||||
*
|
||||
* @param name 任务名
|
||||
* @param type queue类型
|
||||
* @param argc 后面传入的参数的个数
|
||||
* @param argv
|
||||
*
|
||||
* @return 错误码
|
||||
*/
|
||||
/* ----------------------------------------------------------------------------*/
|
||||
int os_taskq_post_type(const char *name, int type, int argc, int *argv);
|
||||
|
||||
|
||||
/* --------------------------------------------------------------------------*/
|
||||
/**
|
||||
* @brief 发送Q_MSG类型的taskq
|
||||
*
|
||||
* @param name 任务名
|
||||
* @param argc 后面参数的个数
|
||||
*
|
||||
* @reutrn 错误码
|
||||
*/
|
||||
/* ----------------------------------------------------------------------------*/
|
||||
int os_taskq_post_msg(const char *name, int argc, ...);
|
||||
|
||||
|
||||
/* --------------------------------------------------------------------------*/
|
||||
/**
|
||||
* @brief 发送Q_EVENT类型的taskq
|
||||
*
|
||||
* @param name 任务名
|
||||
* @param argc 后面参数的个数
|
||||
*
|
||||
* @reutrn 错误码
|
||||
*/
|
||||
/* ----------------------------------------------------------------------------*/
|
||||
int os_taskq_post_event(const char *name, int argc, ...);
|
||||
|
||||
|
||||
/* --------------------------------------------------------------------------*/
|
||||
/**
|
||||
* @brief 删除指定类型的taskq
|
||||
*
|
||||
* @param name 任务名
|
||||
* @param type taskq的类型
|
||||
*
|
||||
* @reutrn 错误码
|
||||
*/
|
||||
/* ----------------------------------------------------------------------------*/
|
||||
int os_taskq_del_type(const char *name, int type);
|
||||
|
||||
/* --------------------------------------------------------------------------*/
|
||||
/**
|
||||
* @brief 清除所有taskq
|
||||
*
|
||||
* @reutrn 错误码
|
||||
*/
|
||||
/* ----------------------------------------------------------------------------*/
|
||||
int os_taskq_flush(void);
|
||||
|
||||
/* --------------------------------------------------------------------------*/
|
||||
/**
|
||||
* @brief 创建信号量
|
||||
*
|
||||
* @param sem 信号量
|
||||
* @param int 初始计数值
|
||||
*
|
||||
* @reutrn 错误码
|
||||
*/
|
||||
/* ----------------------------------------------------------------------------*/
|
||||
int os_sem_create(OS_SEM *, int);
|
||||
|
||||
/* --------------------------------------------------------------------------*/
|
||||
/**
|
||||
* @brief 非阻塞方式查询信号量
|
||||
*
|
||||
* @param sem 信号量
|
||||
*
|
||||
* @reutrn 错误码
|
||||
*/
|
||||
/* ----------------------------------------------------------------------------*/
|
||||
int os_sem_accept(OS_SEM *);
|
||||
|
||||
/* --------------------------------------------------------------------------*/
|
||||
/**
|
||||
* @brief 阻塞方式获取信号量
|
||||
*
|
||||
* @param sem 信号量
|
||||
* @param timeout 等待时长,0表示一直等待
|
||||
*
|
||||
* @reutrn 错误码
|
||||
*/
|
||||
/* ----------------------------------------------------------------------------*/
|
||||
int os_sem_pend(OS_SEM *, int timeout);
|
||||
|
||||
/* --------------------------------------------------------------------------*/
|
||||
/**
|
||||
* @brief 发送信号量
|
||||
*
|
||||
* @param sem 信号量
|
||||
*
|
||||
* @reutrn 错误码
|
||||
*/
|
||||
/* ----------------------------------------------------------------------------*/
|
||||
int os_sem_post(OS_SEM *);
|
||||
|
||||
/* --------------------------------------------------------------------------*/
|
||||
/**
|
||||
* @brief 信号量删除
|
||||
*
|
||||
* @param sem 信号量
|
||||
* @param block 保留
|
||||
*
|
||||
* @reutrn 错误码
|
||||
*/
|
||||
/* ----------------------------------------------------------------------------*/
|
||||
int os_sem_del(OS_SEM *, int block);
|
||||
|
||||
/* --------------------------------------------------------------------------*/
|
||||
/**
|
||||
* @brief 信号量设置
|
||||
*
|
||||
* @param sem 信号量
|
||||
* @param cnt 计数值
|
||||
*
|
||||
* @reutrn 错误码
|
||||
*/
|
||||
/* ----------------------------------------------------------------------------*/
|
||||
int os_sem_set(OS_SEM *, u16 cnt);
|
||||
|
||||
/* --------------------------------------------------------------------------*/
|
||||
/**
|
||||
* @brief 信号量类型是否queueQUEUE_TYPE_COUNTING_SEMAPHORE
|
||||
*
|
||||
* @param true:信号量匹配, fail:信号量不匹配
|
||||
*
|
||||
* @reutrn 错误码
|
||||
*/
|
||||
/* ----------------------------------------------------------------------------*/
|
||||
int os_sem_valid(OS_SEM *);
|
||||
|
||||
/* --------------------------------------------------------------------------*/
|
||||
/**
|
||||
* @brief 判断信号量是否可用
|
||||
*
|
||||
* @param sem 信号量
|
||||
*
|
||||
* @reutrn 可用数量
|
||||
*/
|
||||
/* ----------------------------------------------------------------------------*/
|
||||
int os_sem_query(OS_SEM *);
|
||||
|
||||
/* --------------------------------------------------------------------------*/
|
||||
/**
|
||||
* @brief 创建互斥量
|
||||
*
|
||||
* @param mutex 互斥量
|
||||
*
|
||||
* @reutrn 错误码
|
||||
*/
|
||||
/* ----------------------------------------------------------------------------*/
|
||||
int os_mutex_create(OS_MUTEX *);
|
||||
|
||||
/* --------------------------------------------------------------------------*/
|
||||
/**
|
||||
* @brief 非阻塞方式查询互斥量
|
||||
*
|
||||
* @param mutex:互斥量
|
||||
*
|
||||
* @reutrn 错误码
|
||||
*/
|
||||
/* ----------------------------------------------------------------------------*/
|
||||
int os_mutex_accept(OS_MUTEX *);
|
||||
|
||||
/* --------------------------------------------------------------------------*/
|
||||
/**
|
||||
* @brief 阻塞方式查询互斥量
|
||||
*
|
||||
* @param mutex 互斥量
|
||||
* @param timeout 等待时间,0表示一直等待
|
||||
*
|
||||
* @reutrn 错误码
|
||||
*/
|
||||
/* ----------------------------------------------------------------------------*/
|
||||
int os_mutex_pend(OS_MUTEX *, int timeout);
|
||||
|
||||
/* --------------------------------------------------------------------------*/
|
||||
/**
|
||||
* @brief 发送斥量
|
||||
*
|
||||
* @param mutex 互斥量
|
||||
*
|
||||
* @reutrn 错误码
|
||||
*/
|
||||
/* ----------------------------------------------------------------------------*/
|
||||
int os_mutex_post(OS_MUTEX *);
|
||||
|
||||
/* --------------------------------------------------------------------------*/
|
||||
/**
|
||||
* @brief 删除斥量
|
||||
*
|
||||
* @param mutex 互斥量
|
||||
* @param block 保留
|
||||
*
|
||||
* @reutrn 错误码
|
||||
*/
|
||||
/* ----------------------------------------------------------------------------*/
|
||||
int os_mutex_del(OS_MUTEX *, int block);
|
||||
|
||||
/* --------------------------------------------------------------------------*/
|
||||
/**
|
||||
* @brief 互斥量类型是否queueQUEUE_TYPE_MUTEX
|
||||
*
|
||||
* @param true:互斥量匹配, fail:互斥量不匹配
|
||||
*
|
||||
* @reutrn 错误码
|
||||
*/
|
||||
/* ----------------------------------------------------------------------------*/
|
||||
int os_mutex_valid(OS_MUTEX *);
|
||||
|
||||
/*struct os_msg *os_message_create(int size);
|
||||
|
||||
int os_message_receive(struct os_msg **msg, int block_time);
|
||||
|
||||
int os_message_send(const char *task_name, struct os_msg *msg, int msgflg);
|
||||
|
||||
int os_message_delete(struct os_msg *msg);*/
|
||||
|
||||
|
||||
|
||||
int os_q_create(OS_QUEUE *pevent, /*void **start, */QS size);
|
||||
|
||||
int os_q_del(OS_QUEUE *pevent, u8 opt);
|
||||
|
||||
int os_q_flush(OS_QUEUE *pevent);
|
||||
|
||||
int os_q_pend(OS_QUEUE *pevent, int timeout, void *msg);
|
||||
|
||||
int os_q_post(OS_QUEUE *pevent, void *msg);
|
||||
|
||||
int os_q_query(OS_QUEUE *pevent);
|
||||
|
||||
int os_q_valid(OS_QUEUE *pevent);
|
||||
|
||||
int task_queue_post_event(const char *name, void *data, int len);
|
||||
|
||||
void *os_task_get_handle(const char *name);
|
||||
|
||||
void os_suspend_other_core(void);
|
||||
|
||||
void os_resume_other_core(void);
|
||||
|
||||
void os_system_info_output(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
135
include_lib/system/os/os_cfg.h
Normal file
135
include_lib/system/os/os_cfg.h
Normal file
@ -0,0 +1,135 @@
|
||||
/***********************************Jieli tech************************************************
|
||||
File : os_cfg.h
|
||||
By : Juntham
|
||||
date : 2014-07-03 09:09
|
||||
********************************************************************************************/
|
||||
|
||||
#ifndef OS_CFG_H
|
||||
#define OS_CFG_H
|
||||
#include "os/os_cpu.h"
|
||||
|
||||
#define OS_TIME_SLICE_EN 1
|
||||
|
||||
#define OS_PRIORITY_INVERSION 1 /*是否处理优先级翻转*/
|
||||
|
||||
/* ---------------------- MISCELLANEOUS ----------------------- */
|
||||
#define OS_ARG_CHK_EN 0 /* Enable (1) or Disable (0) argument checking */
|
||||
#define OS_CPU_HOOKS_EN 1 /* hooks are found in the processor port files */
|
||||
|
||||
#if OS_TIME_SLICE_EN > 0
|
||||
#define OS_LOWEST_PRIO (0) /* Defines the lowest priority that can be assigned ... */
|
||||
#else
|
||||
#define OS_LOWEST_PRIO (0+OS_CPU_CORE-1)/* Defines the lowest priority that can be assigned */
|
||||
#endif
|
||||
|
||||
#define OS_IDLE_PRIO (OS_LOWEST_PRIO) /* IDLE task priority */
|
||||
|
||||
#define OS_MAX_TASKS 31 /* Max. number of tasks in your application, MUST be >= 2 */
|
||||
|
||||
#define OS_SCHED_LOCK_EN 1 /* Include code for OSSchedLock() and OSSchedUnlock() */
|
||||
|
||||
#define OS_TICKS_PER_SEC 100 /* Set the number of ticks in one second */
|
||||
|
||||
#define OS_PARENT_TCB 1 /* 是否记录父任务的TCB */
|
||||
|
||||
#define OS_CHILD_TCB 0 /* 是否记录子任务的TCB */
|
||||
|
||||
/* ----------------------TASK MESSAGE QUEUES ---------------------- */
|
||||
#define OS_TASKQ_EN 1 /* Enable (1) or Disable (0) code generation for QUEUES */
|
||||
#define OS_TASKQ_ACCEPT_EN 1 /* Include code for OSTaskQAccept() */
|
||||
#define OS_TASKQ_PEND_EN 1 /* Include code for OSTaskQAccept() */
|
||||
#define OS_TASKQ_FLUSH_EN 1 /* Include code for OSTaskQFlush() */
|
||||
#define OS_TASKQ_POST_EN 1 /* Include code for OSTaskQPost() */
|
||||
#define OS_TASKQ_POST_FRONT_EN 1 /* Include code for OSTaskQPostFront() */
|
||||
#define OS_TASKQ_QUERY_EN 1 /* Include code for OSTaskQQuery() */
|
||||
|
||||
/* ---------------- MUTUAL EXCLUSION SEMAPHORES --------------- */
|
||||
#define OS_MUTEX_EN 1 /* Enable (1) or Disable (0) code generation for MUTEX */
|
||||
#define OS_MUTEX_ACCEPT_EN 1 /* Include code for OSMutexAccept() */
|
||||
#define OS_MUTEX_DEL_EN 1 /* Include code for OSMutexDel() */
|
||||
#define OS_MUTEX_QUERY_EN 0 /* Include code for OSMutexQuery() */
|
||||
|
||||
/* ------------------------ SEMAPHORES ------------------------ */
|
||||
#define OS_SEM_EN 1 /* Enable (1) or Disable (0) code generation for SEMAPHORES */
|
||||
#define OS_SEM_ACCEPT_EN 1 /* Include code for OSSemAccept() */
|
||||
#define OS_SEM_DEL_EN 1 /* Include code for OSSemDel() */
|
||||
#define OS_SEM_QUERY_EN 1 /* Include code for OSSemQuery() */
|
||||
#define OS_SEM_SET_EN 1 /* Include code for OSSemSet() */
|
||||
|
||||
/* ---------------------- MESSAGE QUEUES ---------------------- */
|
||||
#define OS_Q_EN 1 /* Enable (1) or Disable (0) code generation for QUEUES */
|
||||
#define OS_Q_ACCEPT_EN 1 /* Include code for OSQAccept() */
|
||||
#define OS_Q_DEL_EN 1 /* Include code for OSQDel() */
|
||||
#define OS_Q_FLUSH_EN 1 /* Include code for OSQFlush() */
|
||||
#define OS_Q_POST_EN 1 /* Include code for OSQPost() */
|
||||
#define OS_Q_POST_FRONT_EN 1 /* Include code for OSQPostFront() */
|
||||
#define OS_Q_POST_OPT_EN 1 /* Include code for OSQPostOpt() */
|
||||
#define OS_Q_QUERY_EN 1 /* Include code for OSQQuery() */
|
||||
|
||||
/* ----------------------- EVENT FLAGS ------------------------ */
|
||||
#define OS_FLAG_EN 0 /* Enable (1) or Disable (0) code generation for EVENT FLAGS */
|
||||
#define OS_MAX_FLAGS 1 /* Max. number of Event Flag Groups in your application */
|
||||
#define OS_FLAG_WAIT_CLR_EN 1 /* Include code for Wait on Clear EVENT FLAGS */
|
||||
#define OS_FLAG_ACCEPT_EN 1 /* Include code for OSFlagAccept() */
|
||||
#define OS_FLAG_DEL_EN 1 /* Include code for OSFlagDel() */
|
||||
#define OS_FLAG_NAME_SIZE 0//32 /* Determine the size of the name of an event flag group */
|
||||
#define OS_FLAG_QUERY_EN 1 /* Include code for OSFlagQuery() */
|
||||
#define OS_FLAGS_NBITS 32 /* Size in #bits of OS_FLAGS data type (8, 16 or 32) */
|
||||
|
||||
/* --------------------- TASK MANAGEMENT ---------------------- */
|
||||
#define OS_TASK_CHANGE_PRIO_EN 1 /* Include code for OSTaskChangePrio() */
|
||||
#define OS_TASK_CREATE_EN 1 /* Include code for OSTaskCreate() */
|
||||
#define OS_TASK_DEL_EN 1 /* Include code for OSTaskDel() */
|
||||
#define OS_TASK_QUERY_EN 0 /* Include code for OSTaskQuery() */
|
||||
#define OS_TASK_SUSPEND_EN 1 /* Include code for OSTaskSuspend() and OSTaskResume() */
|
||||
#define OS_TASK_SW_HOOK_EN 0 /* Include code for OSTaskSwHook() */
|
||||
#define OS_TASK_STK_CHK 0
|
||||
|
||||
/* --------------------- TIME MANAGEMENT ---------------------- */
|
||||
#define OS_TIME_DLY_HMSM_EN 0 /* Include code for OSTimeDlyHMSM() */
|
||||
#define OS_TIME_DLY_RESUME_EN 1 /* Include code for OSTimeDlyResume() */
|
||||
#define OS_TIME_GET_SET_EN 1 /* Include code for OSTimeGet() and OSTimeSet() */
|
||||
#define OS_TIME_TICK_HOOK_EN 0 /* Include code for OSTimeTickHook() */
|
||||
|
||||
#define OS_EVENT_EN ((OS_Q_EN > 0) || (OS_SEM_EN > 0) || (OS_MUTEX_EN > 0))
|
||||
|
||||
|
||||
//for make
|
||||
#define portMAX_DELAY 0
|
||||
|
||||
#ifndef tskIDLE_PRIORITY
|
||||
#define tskIDLE_PRIORITY 0
|
||||
#endif /* #ifndef tskIDLE_PRIORITY */
|
||||
|
||||
#ifndef configMAX_PRIORITIES
|
||||
#define configMAX_PRIORITIES 8
|
||||
#endif /* #ifndef configMAX_PRIORITIES */
|
||||
|
||||
#ifndef configSUPPORT_DYNAMIC_ALLOCATION
|
||||
/* Defaults to 1 for backward compatibility. */
|
||||
#define configSUPPORT_DYNAMIC_ALLOCATION 1
|
||||
#endif
|
||||
|
||||
#ifndef OS_CPU_NUM
|
||||
#define OS_CPU_NUM CPU_CORE_NUM
|
||||
#endif /* #ifndef OS_CPU_NUM */
|
||||
|
||||
|
||||
#ifndef OS_MBOX_EN
|
||||
#define OS_MBOX_EN 0
|
||||
#endif
|
||||
|
||||
#ifndef OS_MEM_EN
|
||||
#define OS_MEM_EN 0
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef configAPPLICATION_ALLOCATED_HEAP
|
||||
#define configAPPLICATION_ALLOCATED_HEAP 0
|
||||
#endif
|
||||
|
||||
#ifndef configUSE_MALLOC_FAILED_HOOK
|
||||
#define configUSE_MALLOC_FAILED_HOOK 0
|
||||
#endif
|
||||
|
||||
#endif
|
||||
117
include_lib/system/os/os_cpu.h
Normal file
117
include_lib/system/os/os_cpu.h
Normal file
@ -0,0 +1,117 @@
|
||||
/***********************************Jieli tech************************************************
|
||||
File : os_cpu.h
|
||||
By : Juntham
|
||||
date : 2014-07-03 09:06
|
||||
********************************************************************************************/
|
||||
#ifndef _OS_CPU_H
|
||||
#define _OS_CPU_H
|
||||
|
||||
#include "asm/cpu.h"
|
||||
#include "jiffies.h"
|
||||
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
typedef unsigned short QS;
|
||||
typedef unsigned int OS_STK; /* Each stack entry is 32-bit wide*/
|
||||
typedef unsigned int OS_CPU_SR; /* Unsigned 32 bit quantity */
|
||||
typedef unsigned int OS_CPU_DATA; /* Unsigned 32 bit quantity */
|
||||
#endif
|
||||
|
||||
#define OS_CPU_EXT extern
|
||||
#define OS_CPU_CORE CPU_CORE_NUM
|
||||
|
||||
#define OS_CPU_ID current_cpu_id()
|
||||
#define OS_STK_GROWTH 1 /* Stack grows from HIGH to LOW memory*/
|
||||
|
||||
#define OS_CPU_MMU 0
|
||||
|
||||
#define OS_CPU_VIRTUAL_MEM 1 //临时定义:区别于OS_CPU_MMU
|
||||
|
||||
#ifndef OS_CORE_AFFINITY_ENABLE
|
||||
#define OS_CORE_AFFINITY_ENABLE 0
|
||||
#endif
|
||||
|
||||
#define OS_TASK_CLR(a) CPU_TASK_CLR(a)
|
||||
#define OS_TASK_SW(a) CPU_TASK_SW(a) /* 任务级任务切换函数*/
|
||||
#define OS_INT_NESTING CPU_INT_NESTING
|
||||
|
||||
#define CPU_SR_ALLOC()
|
||||
|
||||
#define OS_SR_ALLOC()
|
||||
|
||||
#define OS_ENTER_CRITICAL() \
|
||||
CPU_CRITICAL_ENTER(); \
|
||||
|
||||
#define OS_EXIT_CRITICAL() \
|
||||
CPU_CRITICAL_EXIT()
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
/*#include "system/spinlock.h"
|
||||
|
||||
extern spinlock_t os_lock;
|
||||
|
||||
#define OS_ENTER_CRITICAL() \
|
||||
spin_lock(&os_lock)
|
||||
|
||||
#define OS_EXIT_CRITICAL() \
|
||||
spin_unlock(&os_lock)*/
|
||||
|
||||
|
||||
void OSCtxSw(void);
|
||||
|
||||
extern void EnableOtherCpu(void) ;
|
||||
|
||||
#define os_ctx_sw OSCtxSw
|
||||
|
||||
void OSInitTick(u32 hz);
|
||||
|
||||
void InstallOSISR(void);
|
||||
|
||||
void os_task_dead(const char *task_name);
|
||||
|
||||
//=======================================================//
|
||||
// 系统进临界区多核同步类型 //
|
||||
//=======================================================//
|
||||
enum CPU_SUSPEND_TYPE {
|
||||
CPU_SUSPEND_TYPE_NONE = 0,
|
||||
CPU_SUSPEND_TYPE_SFC = 0x55, //操作Flash
|
||||
CPU_SUSPEND_TYPE_PDOWN, //系统进低功耗Pdown
|
||||
CPU_SUSPEND_TYPE_POFF, //系统进低功耗Pdown
|
||||
CPU_SUSPEND_TYPE_SOFF,
|
||||
};
|
||||
|
||||
/* ---------------------------------------------------------------------------- */
|
||||
/**
|
||||
* @brief 系统进入临界区用于多核同步
|
||||
*/
|
||||
/* ---------------------------------------------------------------------------- */
|
||||
void cpu_suspend_other_core(enum CPU_SUSPEND_TYPE type);
|
||||
|
||||
/* ---------------------------------------------------------------------------- */
|
||||
/**
|
||||
* @brief 系统退出临界区用于多核同步
|
||||
*/
|
||||
/* ---------------------------------------------------------------------------- */
|
||||
void cpu_resume_other_core(enum CPU_SUSPEND_TYPE type);
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
*********************************************************************************************************
|
||||
* DATA TYPES
|
||||
* (Compiler Specific)
|
||||
*********************************************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
#define OS_CRITICAL_METHOD 3
|
||||
#if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
|
||||
//#define CPU_SR_ALLOC() OS_CPU_SR cpu_sr
|
||||
#endif
|
||||
|
||||
|
||||
#endif /*_OS_CPU_H */
|
||||
79
include_lib/system/os/os_error.h
Normal file
79
include_lib/system/os/os_error.h
Normal file
@ -0,0 +1,79 @@
|
||||
#ifndef __OS_ERROR_H__
|
||||
#define __OS_ERROR_H__
|
||||
|
||||
#define OS_ERR_NONE 0
|
||||
|
||||
|
||||
enum {
|
||||
OS_NO_ERR = 0,
|
||||
OS_TRUE,
|
||||
OS_ERR_EVENT_TYPE,
|
||||
OS_ERR_PEND_ISR,
|
||||
OS_ERR_POST_NULL_PTR,
|
||||
OS_ERR_PEVENT_NULL,
|
||||
OS_ERR_POST_ISR,
|
||||
OS_ERR_QUERY_ISR,
|
||||
OS_ERR_INVALID_OPT,
|
||||
OS_ERR_TASK_WAITING,
|
||||
OS_ERR_PDATA_NULL,
|
||||
OS_TIMEOUT,
|
||||
OS_TIMER,
|
||||
OS_TASKQ,
|
||||
OS_TASK_NOT_EXIST,
|
||||
OS_ERR_EVENT_NAME_TOO_LONG,
|
||||
OS_ERR_FLAG_NAME_TOO_LONG,
|
||||
OS_ERR_TASK_NAME_TOO_LONG,
|
||||
OS_ERR_PNAME_NULL,
|
||||
OS_ERR_TASK_CREATE_ISR,
|
||||
OS_MBOX_FULL,
|
||||
OS_Q_FULL,
|
||||
OS_Q_EMPTY,
|
||||
OS_Q_ERR,
|
||||
OS_ERR_NO_QBUF,
|
||||
OS_PRIO_EXIST,
|
||||
OS_PRIO_ERR,
|
||||
OS_PRIO_INVALID,
|
||||
OS_SEM_OVF,
|
||||
OS_TASK_DEL_ERR,
|
||||
OS_TASK_DEL_IDLE,
|
||||
OS_TASK_DEL_ISR,
|
||||
OS_NO_MORE_TCB,
|
||||
OS_TIME_NOT_DLY,
|
||||
OS_TIME_INVALID_MINUTES,
|
||||
OS_TIME_INVALID_SECONDS,
|
||||
OS_TIME_INVALID_MILLI,
|
||||
OS_TIME_ZERO_DLY,
|
||||
OS_TASK_SUSPEND_PRIO,
|
||||
OS_TASK_SUSPEND_IDLE,
|
||||
OS_TASK_RESUME_PRIO,
|
||||
OS_TASK_NOT_SUSPENDED,
|
||||
OS_MEM_INVALID_PART,
|
||||
OS_MEM_INVALID_BLKS,
|
||||
OS_MEM_INVALID_SIZE,
|
||||
OS_MEM_NO_FREE_BLKS,
|
||||
OS_MEM_FULL,
|
||||
OS_MEM_INVALID_PBLK,
|
||||
OS_MEM_INVALID_PMEM,
|
||||
OS_MEM_INVALID_PDATA,
|
||||
OS_MEM_INVALID_ADDR,
|
||||
OS_MEM_NAME_TOO_LONG,
|
||||
OS_ERR_MEM_NO_MEM,
|
||||
OS_ERR_NOT_MUTEX_OWNER,
|
||||
OS_TASK_OPT_ERR,
|
||||
OS_ERR_DEL_ISR,
|
||||
OS_ERR_CREATE_ISR,
|
||||
OS_FLAG_INVALID_PGRP,
|
||||
OS_FLAG_ERR_WAIT_TYPE,
|
||||
OS_FLAG_ERR_NOT_RDY,
|
||||
OS_FLAG_INVALID_OPT,
|
||||
OS_FLAG_GRP_DEPLETED,
|
||||
OS_ERR_PIP_LOWER,
|
||||
OS_ERR_MSG_POOL_EMPTY,
|
||||
OS_ERR_MSG_POOL_NULL_PTR,
|
||||
OS_ERR_MSG_POOL_FULL,
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
35
include_lib/system/os/os_type.h
Normal file
35
include_lib/system/os/os_type.h
Normal file
@ -0,0 +1,35 @@
|
||||
#ifndef __OS_TYPE_H
|
||||
#define __OS_TYPE_H
|
||||
|
||||
|
||||
#define OS_TICKS_PER_SEC 100
|
||||
|
||||
#if defined CONFIG_UCOS_ENABLE
|
||||
|
||||
typedef struct {
|
||||
unsigned char OSEventType;
|
||||
int aa;
|
||||
void *bb;
|
||||
unsigned char value;
|
||||
unsigned char prio;
|
||||
unsigned short cc;
|
||||
} OS_SEM, OS_MUTEX, OS_QUEUE;
|
||||
|
||||
#include <os/ucos_ii.h>
|
||||
|
||||
#elif defined CONFIG_FREE_RTOS_ENABLE
|
||||
|
||||
#include "FreeRTOS/FreeRTOS.h"
|
||||
#include "FreeRTOS/semphr.h"
|
||||
#include "FreeRTOS/task.h"
|
||||
|
||||
typedef StaticSemaphore_t OS_SEM, OS_MUTEX;
|
||||
typedef StaticQueue_t OS_QUEUE;
|
||||
|
||||
|
||||
#else
|
||||
#error "no_os_defined"
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
806
include_lib/system/os/ucos_ii.h
Normal file
806
include_lib/system/os/ucos_ii.h
Normal file
@ -0,0 +1,806 @@
|
||||
/***********************************Jieli tech************************************************
|
||||
File : ucos_ii.h
|
||||
By : Juntham
|
||||
date : 2014-07-03 09:09
|
||||
********************************************************************************************/
|
||||
|
||||
#ifndef OS_uCOS_II_H
|
||||
#define OS_uCOS_II_H
|
||||
|
||||
|
||||
#include "generic/typedef.h"
|
||||
#include "os/os_cpu.h"
|
||||
#include "os/os_cfg.h"
|
||||
#include "os/os_api.h"
|
||||
|
||||
/*
|
||||
*********************************************************************************************************
|
||||
* INCLUDE HEADER FILES
|
||||
*********************************************************************************************************
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
|
||||
// #define uCOS_ENTER_CRITICAL() CPU_CRITICAL_ENTER()
|
||||
// #define uCOS_EXIT_CRITICAL() CPU_CRITICAL_EXIT()
|
||||
|
||||
void uCOS_ENTER_CRITICAL(void);
|
||||
void uCOS_EXIT_CRITICAL(void);
|
||||
|
||||
|
||||
#define OS_VERSION 100u /* Version */
|
||||
|
||||
#define OS_STAT_RDY 0x00u /* Ready to run */
|
||||
#define OS_STAT_SEM 0x01u /* Pending on semaphore */
|
||||
#define OS_STAT_Q 0x02u /* Pending on queue */
|
||||
#define OS_STAT_SUSPEND 0x04u /* Task is suspended */
|
||||
#define OS_STAT_MUTEX 0x08u /* Pending on mutual exclusion semaphore */
|
||||
#define OS_STAT_TASK_Q 0x10u /* Pending on task Q */
|
||||
#define OS_STAT_DELAY 0x20u /* Task on delay */
|
||||
#define OS_STAT_FLAG 0x40u /* Pending on event flag group */
|
||||
|
||||
#define OS_STAT_PEND_ANY (OS_STAT_SEM | OS_STAT_Q | OS_STAT_MUTEX | OS_STAT_TASK_Q)
|
||||
|
||||
/*
|
||||
*********************************************************************************************************
|
||||
* OS_EVENT types
|
||||
*********************************************************************************************************
|
||||
*/
|
||||
#define OS_EVENT_TYPE_UNUSED 0u
|
||||
#define OS_EVENT_TYPE_Q 1u
|
||||
#define OS_EVENT_TYPE_SEM 2u
|
||||
#define OS_EVENT_TYPE_MUTEX 3u
|
||||
#define OS_EVENT_TYPE_FLAG 5u
|
||||
|
||||
/*
|
||||
*********************************************************************************************************
|
||||
* OS???PostOpt() OPTIONS
|
||||
*
|
||||
* These #defines are used to establish the options for OSMboxPostOpt() and OSQPostOpt().
|
||||
*********************************************************************************************************
|
||||
*/
|
||||
#define OS_POST_OPT_NONE 0x00u /* NO option selected */
|
||||
#define OS_POST_OPT_BROADCAST 0x01u /* Broadcast message to ALL tasks waiting */
|
||||
#define OS_POST_OPT_FRONT 0x02u /* Post to highest priority task waiting */
|
||||
|
||||
/*
|
||||
*********************************************************************************************************
|
||||
* MISCELLANEOUS
|
||||
*********************************************************************************************************
|
||||
*/
|
||||
|
||||
#ifdef OS_GLOBALS
|
||||
#define OS_EXT
|
||||
#else
|
||||
#define OS_EXT extern
|
||||
#endif
|
||||
/*
|
||||
*********************************************************************************************************
|
||||
* EVENT CONTROL BLOCK
|
||||
*********************************************************************************************************
|
||||
*/
|
||||
#if OS_EVENT_EN
|
||||
struct event_cnt {
|
||||
u16 cnt;
|
||||
};
|
||||
struct event_mutex {
|
||||
u8 value;
|
||||
u8 prio;
|
||||
u16 OwnerNestingCtr;
|
||||
};
|
||||
|
||||
struct os_tcb;
|
||||
|
||||
typedef struct os_event {
|
||||
u8 OSEventType; /* Type of event control block (see OS_EVENT_TYPE_xxxx) */
|
||||
#if OS_TIME_SLICE_EN > 0
|
||||
struct os_tcb *OSTCBList; /* TCB List */
|
||||
#else
|
||||
OS_CPU_DATA OSTCBList;
|
||||
#endif
|
||||
void *OSEventPtr; /* Pointer to message or queue structure */
|
||||
union {
|
||||
struct event_cnt OSEvent;
|
||||
struct event_mutex OSMutex;
|
||||
};
|
||||
} OS_EVENT;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
*********************************************************************************************************
|
||||
* EVENT FLAGS CONTROL BLOCK
|
||||
*********************************************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
#if (OS_FLAG_EN > 0) && (OS_MAX_FLAGS > 0)
|
||||
/*
|
||||
*********************************************************************************************************
|
||||
* EVENT FLAGS
|
||||
*********************************************************************************************************
|
||||
*/
|
||||
#define OS_FLAG_WAIT_CLR_ALL 0u /* Wait for ALL the bits specified to be CLR (i.e. 0) */
|
||||
#define OS_FLAG_WAIT_CLR_AND 0u
|
||||
|
||||
#define OS_FLAG_WAIT_CLR_ANY 1u /* Wait for ANY of the bits specified to be CLR (i.e. 0) */
|
||||
#define OS_FLAG_WAIT_CLR_OR 1u
|
||||
|
||||
#define OS_FLAG_WAIT_SET_ALL 2u /* Wait for ALL the bits specified to be SET (i.e. 1) */
|
||||
#define OS_FLAG_WAIT_SET_AND 2u
|
||||
|
||||
#define OS_FLAG_WAIT_SET_ANY 3u /* Wait for ANY of the bits specified to be SET (i.e. 1) */
|
||||
#define OS_FLAG_WAIT_SET_OR 3u
|
||||
|
||||
|
||||
#define OS_FLAG_CONSUME 0x80u /* Consume the flags if condition(s) satisfied */
|
||||
|
||||
|
||||
#define OS_FLAG_CLR 0u
|
||||
#define OS_FLAG_SET 1u
|
||||
|
||||
#if OS_FLAGS_NBITS == 8 /* Determine the size of OS_FLAGS (8, 16 or 32 bits) */
|
||||
typedef INT8U OS_FLAGS;
|
||||
#endif
|
||||
|
||||
#if OS_FLAGS_NBITS == 16
|
||||
typedef INT16U OS_FLAGS;
|
||||
#endif
|
||||
|
||||
#if OS_FLAGS_NBITS == 32
|
||||
typedef u32 OS_FLAGS;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
typedef struct os_flag_grp { /* Event Flag Group */
|
||||
u8 OSFlagType; /* Should be set to OS_EVENT_TYPE_FLAG */
|
||||
void *OSFlagWaitList; /* Pointer to first NODE of task waiting on event flag */
|
||||
OS_FLAGS OSFlagFlags; /* 8, 16 or 32 bit flags */
|
||||
#if OS_FLAG_NAME_SIZE > 1
|
||||
u8 OSFlagName[OS_FLAG_NAME_SIZE];
|
||||
#endif
|
||||
} OS_FLAG_GRP;
|
||||
|
||||
|
||||
|
||||
typedef struct os_flag_node { /* Event Flag Wait List Node */
|
||||
void *OSFlagNodeNext; /* Pointer to next NODE in wait list */
|
||||
void *OSFlagNodePrev; /* Pointer to previous NODE in wait list */
|
||||
void *OSFlagNodeTCB; /* Pointer to TCB of waiting task */
|
||||
void *OSFlagNodeFlagGrp; /* Pointer to Event Flag Group */
|
||||
OS_FLAGS OSFlagNodeFlags; /* Event flag to wait on */
|
||||
u8 OSFlagNodeWaitType; /* Type of wait: */
|
||||
/* OS_FLAG_WAIT_AND */
|
||||
/* OS_FLAG_WAIT_ALL */
|
||||
/* OS_FLAG_WAIT_OR */
|
||||
/* OS_FLAG_WAIT_ANY */
|
||||
} OS_FLAG_NODE;
|
||||
|
||||
OS_EXT OS_FLAG_GRP OSFlagTbl[OS_MAX_FLAGS]; /* Table containing event flag groups */
|
||||
OS_EXT OS_FLAG_GRP *OSFlagFreeList; /* Pointer to free list of event flag groups */
|
||||
|
||||
OS_FLAG_GRP *OSFlagCreate(OS_FLAGS flags, u8 *err);
|
||||
OS_FLAG_GRP *OSFlagDel(OS_FLAG_GRP *pgrp, u8 opt, u8 *err);
|
||||
OS_FLAGS OSFlagPend(OS_FLAG_GRP *pgrp, OS_FLAGS flags, u8 wait_type, u16 timeout, u8 *err);
|
||||
OS_FLAGS OSFlagPost(OS_FLAG_GRP *pgrp, OS_FLAGS flags, u8 opt, u8 *err);
|
||||
#endif
|
||||
|
||||
/*$PAGE*/
|
||||
|
||||
/*
|
||||
*********************************************************************************************************
|
||||
* MESSAGE QUEUE DATA
|
||||
*********************************************************************************************************
|
||||
*/
|
||||
|
||||
#if (OS_Q_EN > 0) || (OS_TASKQ_EN > 0)
|
||||
typedef struct os_q { /* QUEUE CONTROL BLOCK */
|
||||
QS OSQIn;
|
||||
QS OSQOut;
|
||||
QS OSQSize; /* Size of queue (maximum number of entries) */
|
||||
QS OSQEntries; /* Current number of entries in the queue */
|
||||
void **OSQStart; /* Pointer to start of queue data */
|
||||
} OS_Q;
|
||||
#endif
|
||||
|
||||
/*$PAGE*/
|
||||
|
||||
/*
|
||||
*********************************************************************************************************
|
||||
* TASK CONTROL BLOCK
|
||||
*********************************************************************************************************
|
||||
*/
|
||||
typedef struct os_tcb {
|
||||
OS_STK *OSTCBStkPtr; /* Pointer to current top of stack */
|
||||
|
||||
#if OS_CPU_MMU > 0
|
||||
u8 *frame;
|
||||
#endif
|
||||
|
||||
#if OS_TIME_SLICE_EN > 0
|
||||
u8 slice_quanta; /* 时间片初始值 */
|
||||
u8 slice_cnt; /* 时间片模式下的计数值 */
|
||||
u16 OSTCBDly; /* Nbr ticks to delay task or, timeout waiting for event */
|
||||
#endif
|
||||
|
||||
#if OS_TASKQ_EN > 0
|
||||
OS_Q task_q;
|
||||
#endif
|
||||
|
||||
#if OS_PARENT_TCB > 0
|
||||
struct os_tcb *OSTCBParent;
|
||||
#endif
|
||||
|
||||
#if OS_CHILD_TCB > 0
|
||||
struct os_tcb *OSTCBChildNext;
|
||||
#endif
|
||||
|
||||
#if OS_TIME_SLICE_EN > 0
|
||||
struct os_tcb *OSTCBEventNext; /* Pointer to next TCB in the event waiting TCB list */
|
||||
struct os_tcb *OSTCBEventPrev; /* Pointer to previous TCB in the event waiting TCB list */
|
||||
struct os_tcb *OSTCBSliceNext; /* Pointer to next TCB in the time slice TCB list */
|
||||
struct os_tcb *OSTCBSlicePrev; /* Pointer to previous TCB in the time slice TCB list */
|
||||
#endif
|
||||
|
||||
#if OS_EVENT_EN
|
||||
OS_EVENT *OSTCBEventPtr; /* Pointer to event control block */
|
||||
#endif
|
||||
|
||||
#if (OS_Q_EN > 0) || (OS_TASKQ_EN > 0)
|
||||
void *OSTCBMsg; /* Message received from OSMboxPost() or OSQPost() */
|
||||
#endif
|
||||
|
||||
#if OS_FLAG_EN > 0
|
||||
OS_FLAG_NODE *OSTCBFlagNode; /* Pointer to event flag node */
|
||||
OS_FLAGS OSTCBFlagsRdy;
|
||||
#endif
|
||||
|
||||
#if OS_TIME_SLICE_EN == 0
|
||||
u16 OSTCBDly; /* Nbr ticks to delay task or, timeout waiting for event */
|
||||
#endif
|
||||
u8 OSTCBPrio; /* Task priority (0 == highest) */
|
||||
u8 OSTCBStat; /* Task status */
|
||||
u8 OSTCBPendTO; /* Flag indicating PEND timed out (TRUE == timed out) */
|
||||
|
||||
|
||||
#if OS_TASK_DEL_EN > 0
|
||||
u8 OSTCBDelReq; /* Indicates whether a task needs to delete itself */
|
||||
#endif
|
||||
|
||||
u8 OSCoreAffinity; /* core */
|
||||
|
||||
u8 fork_thread;
|
||||
OS_STK *OSTCBStkTos;
|
||||
int *pid;
|
||||
OS_STK stk_size;
|
||||
OS_STK *p_stk_base;
|
||||
char *name;
|
||||
u32 timeout;
|
||||
u32 RunTimeCounterStart;
|
||||
u32 RunTimeCounterTotal;
|
||||
} OS_TCB;
|
||||
|
||||
|
||||
typedef struct os_tcb_list {
|
||||
OS_TCB *ptcb;
|
||||
#if OS_TIME_SLICE_EN > 0
|
||||
OS_TCB *idle_ptcb;
|
||||
#endif
|
||||
} OS_TCB_LIST;
|
||||
|
||||
/*
|
||||
*********************************************************************************************************
|
||||
* MUTUAL EXCLUSION SEMAPHORE MANAGEMENT
|
||||
*********************************************************************************************************
|
||||
*/
|
||||
|
||||
#if OS_MUTEX_EN > 0
|
||||
|
||||
#if OS_MUTEX_ACCEPT_EN > 0
|
||||
u8 OSMutexAccept(OS_EVENT *pevent);
|
||||
#endif
|
||||
|
||||
u8 OSMutexCreate(OS_EVENT *pevent);
|
||||
|
||||
#if OS_MUTEX_DEL_EN > 0
|
||||
u8 OSMutexDel(OS_EVENT *pevent, u8 opt);
|
||||
#endif
|
||||
|
||||
u8 OSMutexPend(OS_EVENT *pevent, u16 timeout);
|
||||
u8 OSMutexPost(OS_EVENT *pevent);
|
||||
|
||||
#if OS_MUTEX_QUERY_EN > 0
|
||||
u8 OSMutexQuery(OS_EVENT *pevent, OS_MUTEX_DATA *p_mutex_data);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/*
|
||||
*********************************************************************************************************
|
||||
* MESSAGE QUEUE MANAGEMENT
|
||||
*********************************************************************************************************
|
||||
*/
|
||||
|
||||
#if (OS_Q_EN > 0)
|
||||
|
||||
#if OS_Q_ACCEPT_EN > 0
|
||||
u8 OSQAccept(OS_EVENT *pevent, void *msg);
|
||||
#endif
|
||||
|
||||
u8 OSQCreate(OS_EVENT *pevent, /*void **start, */QS size);
|
||||
|
||||
#if OS_Q_DEL_EN > 0
|
||||
u8 OSQDel(OS_EVENT *pevent, u8 opt);
|
||||
#endif
|
||||
|
||||
#if OS_Q_FLUSH_EN > 0
|
||||
u8 OSQFlush(OS_EVENT *pevent);
|
||||
#endif
|
||||
|
||||
u8 OSQPend(OS_EVENT *pevent, u16 timeout, void *msg);
|
||||
|
||||
#if OS_Q_POST_EN > 0
|
||||
u8 OSQPost(OS_EVENT *pevent, void *msg);
|
||||
#endif
|
||||
|
||||
#if OS_Q_POST_FRONT_EN > 0
|
||||
u8 OSQPostFront(OS_EVENT *pevent, void *msg);
|
||||
#endif
|
||||
|
||||
#if OS_Q_POST_OPT_EN > 0
|
||||
u8 OSQPostOpt(OS_EVENT *pevent, void *msg, u8 opt);
|
||||
#endif
|
||||
|
||||
#if OS_Q_QUERY_EN > 0
|
||||
u16 OSQQuery(OS_EVENT *pevent);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/*$PAGE*/
|
||||
/*
|
||||
*********************************************************************************************************
|
||||
* SEMAPHORE MANAGEMENT
|
||||
*********************************************************************************************************
|
||||
*/
|
||||
#if OS_SEM_EN > 0
|
||||
|
||||
#if OS_SEM_ACCEPT_EN > 0
|
||||
u16 OSSemAccept(OS_EVENT *pevent);
|
||||
#endif
|
||||
|
||||
u8 OSSemCreate(OS_EVENT *pevent, u16 cnt);
|
||||
|
||||
#if OS_SEM_DEL_EN > 0
|
||||
u8 OSSemDel(OS_EVENT *pevent, u8 opt);
|
||||
#endif
|
||||
|
||||
u8 OSSemPend(OS_EVENT *pevent, u16 timeout);
|
||||
u8 OSSemPost(OS_EVENT *pevent);
|
||||
|
||||
#if OS_SEM_QUERY_EN > 0
|
||||
u16 OSSemQuery(OS_EVENT *pevent);
|
||||
#endif
|
||||
|
||||
#if OS_SEM_SET_EN > 0
|
||||
u8 OSSemSet(OS_EVENT *pevent, u16 cnt);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/*$PAGE*/
|
||||
/*
|
||||
*********************************************************************************************************
|
||||
* TASK MANAGEMENT
|
||||
*********************************************************************************************************
|
||||
*/
|
||||
#if OS_TASK_CHANGE_PRIO_EN > 0
|
||||
u8 OSTaskChangePrio(char *name, u8 newprio);
|
||||
#endif
|
||||
|
||||
#if OS_TASK_CREATE_EN > 0
|
||||
u8 OSTaskCreate(void (*task)(void *p_arg), OS_TCB *task_tcb, void *p_arg
|
||||
#if OS_CPU_MMU == 0
|
||||
, OS_STK *ptos
|
||||
#endif
|
||||
, u8 prio
|
||||
#if OS_TASKQ_EN > 0
|
||||
, void **start, QS qsize
|
||||
#endif
|
||||
#if OS_TIME_SLICE_EN > 0
|
||||
, u8 time_quanta
|
||||
#endif
|
||||
, s8 *name
|
||||
);
|
||||
#endif
|
||||
|
||||
u8 OSTaskQAccept(int argc, int *argv);
|
||||
|
||||
u8 OSTaskQPend(u16 timeout, int argc, int *argv);
|
||||
|
||||
u8 OSTaskQPost(const char *name, int argc, ...);
|
||||
|
||||
u8 OSTaskQFlush(const char *name);
|
||||
|
||||
u8 OSTaskQPostFront(const char *name, int argc, ...);
|
||||
|
||||
u8 OSTaskQQuery(const char *name, u8 *task_q_entries);
|
||||
|
||||
#if OS_TASK_DEL_EN > 0
|
||||
u8 OSTaskDel(const char *name);
|
||||
u8 OSTaskDelReq(const char *name);
|
||||
void OSTaskDelRes(const char *name);
|
||||
#endif
|
||||
|
||||
|
||||
#if OS_TASK_SUSPEND_EN > 0
|
||||
u8 OSTaskResume(const char *name);
|
||||
u8 OSTaskSuspend(const char *name);
|
||||
#endif
|
||||
|
||||
#if OS_TASK_QUERY_EN > 0
|
||||
u8 OSTaskQuery(const char *name, OS_TCB *p_task_data);
|
||||
#endif
|
||||
|
||||
|
||||
/*$PAGE*/
|
||||
/*
|
||||
*********************************************************************************************************
|
||||
* TIME MANAGEMENT
|
||||
*********************************************************************************************************
|
||||
*/
|
||||
|
||||
void OSTimeDly(u16 ticks);
|
||||
|
||||
|
||||
#if OS_TIME_GET_SET_EN > 0
|
||||
u32 OSTimeGet(void);
|
||||
void OSTimeSet(u32 ticks);
|
||||
|
||||
#endif
|
||||
|
||||
void OSTimeTick(void);
|
||||
|
||||
/*
|
||||
*********************************************************************************************************
|
||||
* MISCELLANEOUS
|
||||
*********************************************************************************************************
|
||||
*/
|
||||
|
||||
void OSInit(void);
|
||||
|
||||
void OSStart();
|
||||
|
||||
u16 OSVersion(void);
|
||||
#endif
|
||||
/*
|
||||
*********************************************************************************************************
|
||||
* GLOBAL VARIABLES
|
||||
*********************************************************************************************************
|
||||
*/
|
||||
|
||||
OS_EXT volatile u8 OSRunning; /* Flag indicating that kernel is running */
|
||||
OS_EXT volatile OS_CPU_DATA OSRdyTbl;
|
||||
OS_EXT volatile u32 OSIdleCtr; /* Idle counter */
|
||||
OS_EXT OS_TCB *OSTCBCur[OS_CPU_CORE]; /* Pointer to currently running TCB */
|
||||
OS_EXT OS_TCB *OSTCBHighRdy[OS_CPU_CORE]; /* Pointer to highest priority TCB R-to-R */
|
||||
OS_EXT OS_TCB_LIST OSTCBPrioTbl[OS_MAX_TASKS + 1]; /* Table of pointers to created TCBs */
|
||||
|
||||
|
||||
#if (OS_INT_NESTING == 1)
|
||||
OS_EXT u8 OSIntNesting;
|
||||
#elif (OS_INT_NESTING == 2)
|
||||
extern int is_cpu_int_nesting();
|
||||
#define OSIntNesting is_cpu_int_nesting()
|
||||
#endif
|
||||
|
||||
#if OS_TIME_GET_SET_EN > 0
|
||||
OS_EXT volatile u32 OSTime; /* Current value of system time (in ticks) */
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
*********************************************************************************************************
|
||||
* MISCELLANEOUS
|
||||
*********************************************************************************************************
|
||||
*/
|
||||
|
||||
/* void OSInit(void); */
|
||||
|
||||
void OSIntEnter(void);
|
||||
void OSIntExit(void);
|
||||
|
||||
#if OS_SCHED_LOCK_EN > 0
|
||||
void OSSchedLock(void);
|
||||
void OSSchedUnlock(void);
|
||||
#endif
|
||||
|
||||
u32 OS_HighPrio(OS_CPU_DATA table);
|
||||
|
||||
void OS_SchedRoundRobin(OS_TCB *ptcb);
|
||||
|
||||
void OS_InsertRdyListHead(OS_TCB *ptcb);
|
||||
|
||||
void OS_InsertRdyListTail(OS_TCB *ptcb);
|
||||
|
||||
void OS_InsertIdleList(OS_TCB *ptcb);
|
||||
|
||||
void OS_RemoveRdyList(OS_TCB *ptcb);
|
||||
|
||||
void OS_RemoveIdleList(OS_TCB *ptcb);
|
||||
|
||||
void OS_InsertListHead(OS_TCB *ptcb);
|
||||
|
||||
void OS_RemoveList(OS_TCB *ptcb);
|
||||
|
||||
/* void OSStart(); */
|
||||
|
||||
void OSStatInit(void);
|
||||
|
||||
/* u16 OSVersion(void); */
|
||||
|
||||
/*$PAGE*/
|
||||
|
||||
/*
|
||||
*********************************************************************************************************
|
||||
* INTERNAL FUNCTION PROTOTYPES
|
||||
* (Your application MUST NOT call these functions)
|
||||
*********************************************************************************************************
|
||||
*/
|
||||
|
||||
#if OS_TASK_DEL_EN > 0
|
||||
void OS_Dummy(void);
|
||||
#endif
|
||||
|
||||
#if OS_EVENT_EN
|
||||
void OS_ExchangePrio(OS_TCB *ptcba, OS_TCB *ptcbb);
|
||||
|
||||
#if OS_TIME_SLICE_EN > 0
|
||||
OS_TCB *OS_EventHighestTask(OS_TCB *ptcb, u8 prio);
|
||||
void OS_EventTaskRdy(OS_EVENT *pevent, OS_TCB *ptcb, void *msg, u8 msk);
|
||||
#else
|
||||
OS_TCB *OS_EventTaskRdy(OS_EVENT *pevent, void *msg, u8 msk);
|
||||
#endif
|
||||
|
||||
void OS_EventTaskWait(OS_EVENT *pevent, OS_TCB *OSTCB);
|
||||
void OS_EventTO(OS_EVENT *pevent, OS_TCB *OSTCB);
|
||||
void OS_EventWaitListInit(OS_EVENT *pevent);
|
||||
#endif
|
||||
|
||||
void OS_MemClr(u8 *pdest, u16 size);
|
||||
void OS_MemCopy(u8 *pdest, u8 *psrc, u16 size);
|
||||
|
||||
#if OS_Q_EN > 0
|
||||
void OS_QInit(void);
|
||||
#endif
|
||||
|
||||
int OS_Sched(void);
|
||||
|
||||
void OS_TaskIdle(void *p_arg);
|
||||
|
||||
void OSIdleOtherCore(void);
|
||||
|
||||
void OSResumOtherCore(void);
|
||||
|
||||
void OS_CoreAffinitySet(const char *name, u8 Core);
|
||||
|
||||
/*$PAGE*/
|
||||
|
||||
/*
|
||||
*********************************************************************************************************
|
||||
* FUNCTION PROTOTYPES
|
||||
* (Target Specific Functions)
|
||||
*********************************************************************************************************
|
||||
*/
|
||||
|
||||
#if OS_VERSION >= 204
|
||||
void OSInitHookBegin(void);
|
||||
void OSInitHookEnd(void);
|
||||
#endif
|
||||
|
||||
#ifndef OS_ISR_PROTO_EXT
|
||||
void OSIntCtxSw(void);
|
||||
void OSStartHighRdy(void);
|
||||
#endif
|
||||
|
||||
void OSTaskCreateHook(OS_TCB *ptcb);
|
||||
void OSTaskDelHook(OS_TCB *ptcb);
|
||||
|
||||
#if OS_VERSION >= 251
|
||||
void OSTaskIdleHook(void);
|
||||
#endif
|
||||
|
||||
void OSTaskStatHook(void);
|
||||
OS_STK *OSTaskStkInit(void(*p_task)(void *pd), void *p_arg, OS_STK *p_stk_base, u16 opt);
|
||||
|
||||
#if OS_TASK_SW_HOOK_EN > 0
|
||||
void OSTaskSwHook(void);
|
||||
#endif
|
||||
|
||||
#if OS_VERSION >= 204
|
||||
void OSTCBInitHook(OS_TCB *ptcb);
|
||||
#endif
|
||||
|
||||
#if OS_TIME_TICK_HOOK_EN > 0
|
||||
void OSTimeTickHook(void);
|
||||
#endif
|
||||
extern void OS_TASK_DEL_HOOK(OS_TCB *ptcb) ;
|
||||
/*$PAGE*/
|
||||
/*
|
||||
*********************************************************************************************************
|
||||
* LOOK FOR MISSING #define CONSTANTS
|
||||
*
|
||||
* This section is used to generate ERROR messages at compile time if certain #define constants are
|
||||
* MISSING in OS_CFG.H. This allows you to quickly determine the source of the error.
|
||||
*
|
||||
* You SHOULD NOT change this section UNLESS you would like to add more comments as to the source of the
|
||||
* compile time error.
|
||||
*********************************************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
*********************************************************************************************************
|
||||
* MUTUAL EXCLUSION SEMAPHORES
|
||||
*********************************************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef OS_MUTEX_EN
|
||||
#error "OS_CFG.H, Missing OS_MUTEX_EN: Enable (1) or Disable (0) code generation for MUTEX"
|
||||
#else
|
||||
#ifndef OS_MUTEX_ACCEPT_EN
|
||||
#error "OS_CFG.H, Missing OS_MUTEX_ACCEPT_EN: Include code for OSMutexAccept()"
|
||||
#endif
|
||||
|
||||
#ifndef OS_MUTEX_DEL_EN
|
||||
#error "OS_CFG.H, Missing OS_MUTEX_DEL_EN: Include code for OSMutexDel()"
|
||||
#endif
|
||||
|
||||
#ifndef OS_MUTEX_QUERY_EN
|
||||
#error "OS_CFG.H, Missing OS_MUTEX_QUERY_EN: Include code for OSMutexQuery()"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
*********************************************************************************************************
|
||||
* SEMAPHORES
|
||||
*********************************************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef OS_SEM_EN
|
||||
#error "OS_CFG.H, Missing OS_SEM_EN: Enable (1) or Disable (0) code generation for SEMAPHORES"
|
||||
#else
|
||||
#ifndef OS_SEM_ACCEPT_EN
|
||||
#error "OS_CFG.H, Missing OS_SEM_ACCEPT_EN: Include code for OSSemAccept()"
|
||||
#endif
|
||||
|
||||
#ifndef OS_SEM_DEL_EN
|
||||
#error "OS_CFG.H, Missing OS_SEM_DEL_EN: Include code for OSSemDel()"
|
||||
#endif
|
||||
|
||||
#ifndef OS_SEM_QUERY_EN
|
||||
#error "OS_CFG.H, Missing OS_SEM_QUERY_EN: Include code for OSSemQuery()"
|
||||
#endif
|
||||
|
||||
#ifndef OS_SEM_SET_EN
|
||||
#error "OS_CFG.H, Missing OS_SEM_SET_EN: Include code for OSSemSet()"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
*********************************************************************************************************
|
||||
* TASK MANAGEMENT
|
||||
*********************************************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef OS_MAX_TASKS
|
||||
#error "OS_CFG.H, Missing OS_MAX_TASKS: Max. number of tasks in your application"
|
||||
#else
|
||||
#if OS_MAX_TASKS < 2
|
||||
#error "OS_CFG.H, OS_MAX_TASKS must be >= 2"
|
||||
#endif
|
||||
|
||||
/* #if OS_MAX_TASKS > (OS_LOWEST_PRIO - OS_N_SYS_TASKS + 1) */
|
||||
/* #error "OS_CFG.H, OS_MAX_TASKS must be <= OS_LOWEST_PRIO - OS_N_SYS_TASKS + 1" */
|
||||
/* #endif */
|
||||
|
||||
#endif
|
||||
|
||||
#if OS_VERSION < 280
|
||||
#if OS_LOWEST_PRIO > 63
|
||||
#error "OS_CFG.H, OS_LOWEST_PRIO must be <= 63 in V2.7x or lower"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if OS_VERSION >= 280
|
||||
#if OS_LOWEST_PRIO > 254
|
||||
#error "OS_CFG.H, OS_LOWEST_PRIO must be <= 254 in V2.8x and higher"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef OS_TASK_CHANGE_PRIO_EN
|
||||
#error "OS_CFG.H, Missing OS_TASK_CHANGE_PRIO_EN: Include code for OSTaskChangePrio()"
|
||||
#endif
|
||||
|
||||
#ifndef OS_TASK_CREATE_EN
|
||||
#error "OS_CFG.H, Missing OS_TASK_CREATE_EN: Include code for OSTaskCreate()"
|
||||
#endif
|
||||
|
||||
#ifndef OS_TASK_DEL_EN
|
||||
#error "OS_CFG.H, Missing OS_TASK_DEL_EN: Include code for OSTaskDel()"
|
||||
#endif
|
||||
|
||||
#ifndef OS_TASK_SUSPEND_EN
|
||||
#error "OS_CFG.H, Missing OS_TASK_SUSPEND_EN: Include code for OSTaskSuspend() and OSTaskResume()"
|
||||
#endif
|
||||
|
||||
#ifndef OS_TASK_QUERY_EN
|
||||
#error "OS_CFG.H, Missing OS_TASK_QUERY_EN: Include code for OSTaskQuery()"
|
||||
#endif
|
||||
|
||||
/*
|
||||
*********************************************************************************************************
|
||||
* TIME MANAGEMENT
|
||||
*********************************************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef OS_TICKS_PER_SEC
|
||||
#error "OS_CFG.H, Missing OS_TICKS_PER_SEC: Sets the number of ticks in one second"
|
||||
#endif
|
||||
|
||||
#ifndef OS_TIME_DLY_HMSM_EN
|
||||
#error "OS_CFG.H, Missing OS_TIME_DLY_HMSM_EN: Include code for OSTimeDlyHMSM()"
|
||||
#endif
|
||||
|
||||
#ifndef OS_TIME_DLY_RESUME_EN
|
||||
#error "OS_CFG.H, Missing OS_TIME_DLY_RESUME_EN: Include code for OSTimeDlyResume()"
|
||||
#endif
|
||||
|
||||
#ifndef OS_TIME_GET_SET_EN
|
||||
#error "OS_CFG.H, Missing OS_TIME_GET_SET_EN: Include code for OSTimeGet() and OSTimeSet()"
|
||||
#endif
|
||||
|
||||
/*
|
||||
*********************************************************************************************************
|
||||
* MISCELLANEOUS
|
||||
*********************************************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef OS_ARG_CHK_EN
|
||||
#error "OS_CFG.H, Missing OS_ARG_CHK_EN: Enable (1) or Disable (0) argument checking"
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef OS_CPU_HOOKS_EN
|
||||
#error "OS_CFG.H, Missing OS_CPU_HOOKS_EN: uC/OS-II hooks are found in the processor port files when 1"
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef OS_LOWEST_PRIO
|
||||
#error "OS_CFG.H, Missing OS_LOWEST_PRIO: Defines the lowest priority that can be assigned"
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef OS_SCHED_LOCK_EN
|
||||
#error "OS_CFG.H, Missing OS_SCHED_LOCK_EN: Include code for OSSchedLock() and OSSchedUnlock()"
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#ifndef OS_TASK_SW_HOOK_EN
|
||||
#error "OS_CFG.H, Missing OS_TASK_SW_HOOK_EN: Allows you to include the code for OSTaskSwHook() or not"
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef OS_TIME_TICK_HOOK_EN
|
||||
#error "OS_CFG.H, Missing OS_TIME_TICK_HOOK_EN: Allows you to include the code for OSTimeTickHook() or not"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
Reference in New Issue
Block a user