create vendor folder & add freeRTOS 7.3 from lpcopen
This commit is contained in:
		
							
								
								
									
										94
									
								
								vendor/freertos/freertoslpc/FreeRTOSCommonHooks.c
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										94
									
								
								vendor/freertos/freertoslpc/FreeRTOSCommonHooks.c
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,94 @@ | ||||
| /* | ||||
|  * @brief Common FreeRTOS functions shared among platforms | ||||
|  * | ||||
|  * @note | ||||
|  * Copyright(C) NXP Semiconductors, 2012 | ||||
|  * All rights reserved. | ||||
|  * | ||||
|  * @par | ||||
|  * Software that is described herein is for illustrative purposes only | ||||
|  * which provides customers with programming information regarding the | ||||
|  * LPC products.  This software is supplied "AS IS" without any warranties of | ||||
|  * any kind, and NXP Semiconductors and its licensor disclaim any and | ||||
|  * all warranties, express or implied, including all implied warranties of | ||||
|  * merchantability, fitness for a particular purpose and non-infringement of | ||||
|  * intellectual property rights.  NXP Semiconductors assumes no responsibility | ||||
|  * or liability for the use of the software, conveys no license or rights under any | ||||
|  * patent, copyright, mask work right, or any other intellectual property rights in | ||||
|  * or to any products. NXP Semiconductors reserves the right to make changes | ||||
|  * in the software without notification. NXP Semiconductors also makes no | ||||
|  * representation or warranty that such application will be suitable for the | ||||
|  * specified use without further testing or modification. | ||||
|  * | ||||
|  * @par | ||||
|  * Permission to use, copy, modify, and distribute this software and its | ||||
|  * documentation is hereby granted, under NXP Semiconductors' and its | ||||
|  * licensor's relevant copyrights in the software, without fee, provided that it | ||||
|  * is used in conjunction with NXP Semiconductors microcontrollers.  This | ||||
|  * copyright, permission, and disclaimer notice must appear in all copies of | ||||
|  * this code. | ||||
|  */ | ||||
|  | ||||
| #include "FreeRTOS.h" | ||||
| #include "task.h" | ||||
| #include "FreeRTOSCommonHooks.h" | ||||
|  | ||||
| #include "chip.h" | ||||
|  | ||||
| /***************************************************************************** | ||||
|  * Private types/enumerations/variables | ||||
|  ****************************************************************************/ | ||||
|  | ||||
| /***************************************************************************** | ||||
|  * Public types/enumerations/variables | ||||
|  ****************************************************************************/ | ||||
|  | ||||
| /***************************************************************************** | ||||
|  * Private functions | ||||
|  ****************************************************************************/ | ||||
|  | ||||
| /***************************************************************************** | ||||
|  * Public functions | ||||
|  ****************************************************************************/ | ||||
|  | ||||
| /* Delay for the specified number of milliSeconds */ | ||||
| void FreeRTOSDelay(uint32_t ms) | ||||
| { | ||||
| 	portTickType xDelayTime; | ||||
|  | ||||
| 	xDelayTime = xTaskGetTickCount(); | ||||
| 	vTaskDelayUntil(&xDelayTime, ms); | ||||
| } | ||||
|  | ||||
| /* FreeRTOS malloc fail hook */ | ||||
| void vApplicationMallocFailedHook(void) | ||||
| { | ||||
| 	DEBUGSTR("DIE:ERROR:FreeRTOS: Malloc Failure!\r\n"); | ||||
| 	taskDISABLE_INTERRUPTS(); | ||||
| 	for (;; ) {} | ||||
| } | ||||
|  | ||||
| /* FreeRTOS application idle hook */ | ||||
| void vApplicationIdleHook(void) | ||||
| { | ||||
| 	/* Best to sleep here until next systick */ | ||||
| 	__WFI(); | ||||
| } | ||||
|  | ||||
| /* FreeRTOS stack overflow hook */ | ||||
| void vApplicationStackOverflowHook(xTaskHandle pxTask, signed char *pcTaskName) | ||||
| { | ||||
| 	(void) pxTask; | ||||
| 	(void) pcTaskName; | ||||
|  | ||||
| 	DEBUGOUT("DIE:ERROR:FreeRTOS: Stack overflow in task %s\r\n", pcTaskName); | ||||
| 	/* Run time stack overflow checking is performed if | ||||
| 	   configCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2.  This hook | ||||
| 	   function is called if a stack overflow is detected. */ | ||||
| 	taskDISABLE_INTERRUPTS(); | ||||
| 	for (;; ) {} | ||||
| } | ||||
|  | ||||
| /* FreeRTOS application tick hook */ | ||||
| void vApplicationTickHook(void) | ||||
| {} | ||||
							
								
								
									
										81
									
								
								vendor/freertos/freertoslpc/FreeRTOSCommonHooks.h
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										81
									
								
								vendor/freertos/freertoslpc/FreeRTOSCommonHooks.h
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,81 @@ | ||||
| /* | ||||
|  * @brief Common FreeRTOS functions shared among platforms | ||||
|  * | ||||
|  * @note | ||||
|  * Copyright(C) NXP Semiconductors, 2012 | ||||
|  * All rights reserved. | ||||
|  * | ||||
|  * @par | ||||
|  * Software that is described herein is for illustrative purposes only | ||||
|  * which provides customers with programming information regarding the | ||||
|  * LPC products.  This software is supplied "AS IS" without any warranties of | ||||
|  * any kind, and NXP Semiconductors and its licensor disclaim any and | ||||
|  * all warranties, express or implied, including all implied warranties of | ||||
|  * merchantability, fitness for a particular purpose and non-infringement of | ||||
|  * intellectual property rights.  NXP Semiconductors assumes no responsibility | ||||
|  * or liability for the use of the software, conveys no license or rights under any | ||||
|  * patent, copyright, mask work right, or any other intellectual property rights in | ||||
|  * or to any products. NXP Semiconductors reserves the right to make changes | ||||
|  * in the software without notification. NXP Semiconductors also makes no | ||||
|  * representation or warranty that such application will be suitable for the | ||||
|  * specified use without further testing or modification. | ||||
|  * | ||||
|  * @par | ||||
|  * Permission to use, copy, modify, and distribute this software and its | ||||
|  * documentation is hereby granted, under NXP Semiconductors' and its | ||||
|  * licensor's relevant copyrights in the software, without fee, provided that it | ||||
|  * is used in conjunction with NXP Semiconductors microcontrollers.  This | ||||
|  * copyright, permission, and disclaimer notice must appear in all copies of | ||||
|  * this code. | ||||
|  */ | ||||
|  | ||||
| #ifndef __FREERTOSCOMMONHOOKS_H_ | ||||
| #define __FREERTOSCOMMONHOOKS_H_ | ||||
|  | ||||
| /** @ingroup FreeRTOS_COMMON | ||||
|  * @{ | ||||
|  */ | ||||
|  | ||||
| /** | ||||
|  * @brief	Delay for the specified number of milliSeconds | ||||
|  * @param	ms	: Delay in milliSeconds | ||||
|  * @return	Nothing | ||||
|  * @note	Delays the specified number of milliSeoconds using a task delay | ||||
|  */ | ||||
| void FreeRTOSDelay(uint32_t ms); | ||||
|  | ||||
| /** | ||||
|  * @brief	FreeRTOS malloc fail hook | ||||
|  * @return	Nothing | ||||
|  * @note	This function is alled when a malloc fails to allocate data. | ||||
|  */ | ||||
| void vApplicationMallocFailedHook(void); | ||||
|  | ||||
| /** | ||||
|  * @brief	FreeRTOS application idle hook | ||||
|  * @return	Nothing | ||||
|  * @note	Calls ARM Wait for Interrupt function to idle core | ||||
|  */ | ||||
| void vApplicationIdleHook(void); | ||||
|  | ||||
| /** | ||||
|  * @brief	FreeRTOS stack overflow hook | ||||
|  * @param	pxTask		: Task handle that overflowed stack | ||||
|  * @param	pcTaskName	: Task name that overflowed stack | ||||
|  * @return	Nothing | ||||
|  * @note	This function is alled when a stack overflow occurs. | ||||
|  */ | ||||
| void vApplicationStackOverflowHook(xTaskHandle pxTask, signed char *pcTaskName); | ||||
|  | ||||
| /** | ||||
|  * @brief	FreeRTOS application tick hook | ||||
|  * @return	Nothing | ||||
|  * @note	This just returns to the caller. | ||||
|  */ | ||||
| void vApplicationTickHook(void); | ||||
|  | ||||
| /** | ||||
|  * @} | ||||
|  */ | ||||
|  | ||||
| #endif /* __FREERTOSCOMMONHOOKS_H_ */ | ||||
							
								
								
									
										124
									
								
								vendor/freertos/freertoslpc/FreeRTOS_lpc43xx_m0_Tick.c
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										124
									
								
								vendor/freertos/freertoslpc/FreeRTOS_lpc43xx_m0_Tick.c
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,124 @@ | ||||
| /* | ||||
|  * @brief FreeRTOS LPC43xx M0 core tick function using RITimer | ||||
|  * | ||||
|  * @note | ||||
|  * Copyright(C) NXP Semiconductors, 2012 | ||||
|  * All rights reserved. | ||||
|  * | ||||
|  * @par | ||||
|  * Software that is described herein is for illustrative purposes only | ||||
|  * which provides customers with programming information regarding the | ||||
|  * LPC products.  This software is supplied "AS IS" without any warranties of | ||||
|  * any kind, and NXP Semiconductors and its licensor disclaim any and | ||||
|  * all warranties, express or implied, including all implied warranties of | ||||
|  * merchantability, fitness for a particular purpose and non-infringement of | ||||
|  * intellectual property rights.  NXP Semiconductors assumes no responsibility | ||||
|  * or liability for the use of the software, conveys no license or rights under any | ||||
|  * patent, copyright, mask work right, or any other intellectual property rights in | ||||
|  * or to any products. NXP Semiconductors reserves the right to make changes | ||||
|  * in the software without notification. NXP Semiconductors also makes no | ||||
|  * representation or warranty that such application will be suitable for the | ||||
|  * specified use without further testing or modification. | ||||
|  * | ||||
|  * @par | ||||
|  * Permission to use, copy, modify, and distribute this software and its | ||||
|  * documentation is hereby granted, under NXP Semiconductors' and its | ||||
|  * licensor's relevant copyrights in the software, without fee, provided that it | ||||
|  * is used in conjunction with NXP Semiconductors microcontrollers.  This | ||||
|  * copyright, permission, and disclaimer notice must appear in all copies of | ||||
|  * this code. | ||||
|  */ | ||||
|  | ||||
| #include "chip.h" | ||||
| #include "FreeRTOS.h" | ||||
|  | ||||
| /** @defgroup FreeRTOS_43XX_M0_TICK LPC43xx M0 core tick function using RITimer | ||||
|  * @ingroup RTOS_FreeRTOS | ||||
|  * @note	This driver adds support for the RITimer for the FreeRTOS tick on the LPC43xx. | ||||
|  * The M0 core in LPC43XX series of controllers does not have internal systick timer, | ||||
|  * so the RITIMER is used to generate the RTOS ticks. | ||||
|  * @{ | ||||
|  */ | ||||
|  | ||||
|  #if (defined(CHIP_LPC43XX) && defined(CORE_M0) && (configUSE_CUSTOM_TICK == 1)) | ||||
|  | ||||
|  /***************************************************************************** | ||||
|  * Private types/enumerations/variables | ||||
|  ****************************************************************************/ | ||||
|  | ||||
| #define portNVIC_PENDSVSET          0x10000000 | ||||
| #define portNVIC_INT_CTRL           ((volatile unsigned long *) 0xe000ed04) | ||||
| #define portMIN_INTERRUPT_PRIORITY  (255UL) | ||||
| #define portNVIC_SYSTICK_PRI        portMIN_INTERRUPT_PRIORITY | ||||
|  | ||||
| #define RITENCLR               (1 << 1) | ||||
| #define RITINT                 (1 << 0) | ||||
|  | ||||
| /* Timer reload value for next tick */ | ||||
| static uint32_t reload_val; | ||||
|  | ||||
| /***************************************************************************** | ||||
|  * Public types/enumerations/variables | ||||
|  ****************************************************************************/ | ||||
|  | ||||
| /* FreeRTOS tick update function */ | ||||
| extern void vTaskIncrementTick(void); | ||||
|  | ||||
| /***************************************************************************** | ||||
|  * Private functions | ||||
|  ****************************************************************************/ | ||||
|  | ||||
| /***************************************************************************** | ||||
|  * Public functions | ||||
|  ****************************************************************************/ | ||||
|  | ||||
| /** | ||||
|  * @brief	Tick interrupt handler routine | ||||
|  * @return	Nothing | ||||
|  * @note	This function handles the tick interrupts that are generated by RITIMER. | ||||
|  */ | ||||
| void xPortSysTickHandler(void) | ||||
| { | ||||
| 	unsigned long ulDummy; | ||||
|  | ||||
| 	/* TODO: check if WWDT interrupt and redirect */ | ||||
| 	Chip_RIT_ClearInt(LPC_RITIMER); | ||||
| 	Chip_RIT_SetCOMPVAL(LPC_RITIMER, Chip_RIT_GetCounter(LPC_RITIMER) + reload_val);/* Reload value */ | ||||
|  | ||||
| #if configUSE_PREEMPTION == 1 | ||||
| 	/* If using preemption, also force a context switch. */ | ||||
| 	*(portNVIC_INT_CTRL) = portNVIC_PENDSVSET; | ||||
| #endif | ||||
|  | ||||
| 	ulDummy = portSET_INTERRUPT_MASK_FROM_ISR(); | ||||
| 	{ | ||||
| 		vTaskIncrementTick(); | ||||
| 	} | ||||
| 	portCLEAR_INTERRUPT_MASK_FROM_ISR(ulDummy); | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * @brief	Initialize tick interrupts | ||||
|  * @return	Nothing | ||||
|  * @note	This function initializes the tick interrupts, and must | ||||
|  * be called before starting the freeRTOS scheduler. | ||||
|  */ | ||||
| void prvSetupTimerInterrupt(void) | ||||
| { | ||||
| 	/* Clear any pending interrupt */ | ||||
| 	Chip_RIT_ClearInt(LPC_RITIMER); | ||||
|  | ||||
| 	/* Calculate reload value */ | ||||
| 	reload_val = (configCPU_CLOCK_HZ / configTICK_RATE_HZ); | ||||
| 	Chip_RIT_SetCOMPVAL(LPC_RITIMER, Chip_RIT_GetCounter(LPC_RITIMER) + reload_val);/* Start tick */ | ||||
|  | ||||
| 	/* Set the priority and enable the interrupt */ | ||||
| 	NVIC_SetPriority((IRQn_Type) RITIMER_IRQn, portNVIC_SYSTICK_PRI); | ||||
| 	NVIC_EnableIRQ((IRQn_Type) RITIMER_IRQn); | ||||
| } | ||||
|  | ||||
| #endif | ||||
|  | ||||
| /** | ||||
|  * @} | ||||
|  */ | ||||
		Reference in New Issue
	
	Block a user
	 hathach
					hathach