亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? port.c

?? freertosV4.40 是一種small的嵌入式系統。利于嵌入式開好者入門學習嵌入式操作系統。通過對于源碼的學習可以很好的掌握freertos的運行機制。
?? C
字號:
/*
	FreeRTOS.org V4.4.0 - Copyright (C) 2003-2007 Richard Barry.

	This file is part of the FreeRTOS.org distribution.

	FreeRTOS.org is free software; you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation; either version 2 of the License, or
	(at your option) any later version.

	FreeRTOS.org 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.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with FreeRTOS.org; if not, write to the Free Software
	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

	A special exception to the GPL can be applied should you wish to distribute
	a combined work that includes FreeRTOS.org, without being obliged to provide
	the source code for any proprietary components.  See the licensing section
	of http://www.FreeRTOS.org for full details of how and when the exception
	can be applied.

	***************************************************************************
	See http://www.FreeRTOS.org for documentation, latest information, license
	and contact details.  Please ensure to read the configuration and relevant
	port sections of the online documentation.

	Also see http://www.SafeRTOS.com for an IEC 61508 compliant version along
	with commercial development and support options.
	***************************************************************************
*/

/*-----------------------------------------------------------
 * Implementation of functions defined in portable.h for the Philips ARM7 port.
 *----------------------------------------------------------*/

/*
	Changes from V3.2.2

	+ Bug fix - The prescale value for the timer setup is now written to T0PR 
	  instead of T0PC.  This bug would have had no effect unless a prescale 
	  value was actually used.
*/

/* Standard includes. */
#include <stdlib.h>
#include <intrinsic.h>

/* Scheduler includes. */
#include "FreeRTOS.h"
#include "task.h"

/* Constants required to setup the tick ISR. */
#define portENABLE_TIMER			( ( unsigned portCHAR ) 0x01 )
#define portPRESCALE_VALUE			0x00
#define portINTERRUPT_ON_MATCH		( ( unsigned portLONG ) 0x01 )
#define portRESET_COUNT_ON_MATCH	( ( unsigned portLONG ) 0x02 )

/* Constants required to setup the initial stack. */
#define portINITIAL_SPSR				( ( portSTACK_TYPE ) 0x3f ) /* System mode, THUMB mode, interrupts enabled. */
#define portINSTRUCTION_SIZE			( ( portSTACK_TYPE ) 4 )

/* Constants required to setup the PIT. */
#define portPIT_CLOCK_DIVISOR			( ( unsigned portLONG ) 16 )
#define portPIT_COUNTER_VALUE			( ( ( configCPU_CLOCK_HZ / portPIT_CLOCK_DIVISOR ) / 1000UL ) * portTICK_RATE_MS )

/* Constants required to handle interrupts. */
#define portTIMER_MATCH_ISR_BIT		( ( unsigned portCHAR ) 0x01 )
#define portCLEAR_VIC_INTERRUPT		( ( unsigned portLONG ) 0 )

/* Constants required to handle critical sections. */
#define portNO_CRITICAL_NESTING 		( ( unsigned portLONG ) 0 )


#define portINT_LEVEL_SENSITIVE  0
#define portPIT_ENABLE      	( ( unsigned portSHORT ) 0x1 << 24 )
#define portPIT_INT_ENABLE     	( ( unsigned portSHORT ) 0x1 << 25 )

/* Constants required to setup the VIC for the tick ISR. */
#define portTIMER_VIC_CHANNEL		( ( unsigned portLONG ) 0x0004 )
#define portTIMER_VIC_CHANNEL_BIT	( ( unsigned portLONG ) 0x0010 )
#define portTIMER_VIC_ENABLE		( ( unsigned portLONG ) 0x0020 )

/*-----------------------------------------------------------*/

/* Setup the PIT to generate the tick interrupts. */
static void prvSetupTimerInterrupt( void );

/* ulCriticalNesting will get set to zero when the first task starts.  It
cannot be initialised to 0 as this will cause interrupts to be enabled
during the kernel initialisation process. */
unsigned portLONG ulCriticalNesting = ( unsigned portLONG ) 9999;

/*-----------------------------------------------------------*/

/*
 * Initialise the stack of a task to look exactly as if a call to
 * portSAVE_CONTEXT had been called.
 *
 * See header file for description.
 */
portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
{
portSTACK_TYPE *pxOriginalTOS;

	pxOriginalTOS = pxTopOfStack;

	/* Setup the initial stack of the task.  The stack is set exactly as
	expected by the portRESTORE_CONTEXT() macro. */

	/* First on the stack is the return address - which in this case is the
	start of the task.  The offset is added to make the return address appear
	as it would within an IRQ ISR. */
	*pxTopOfStack = ( portSTACK_TYPE ) pxCode + portINSTRUCTION_SIZE;		
	pxTopOfStack--;

	*pxTopOfStack = ( portSTACK_TYPE ) 0xaaaaaaaa;	/* R14 */
	pxTopOfStack--;	
	*pxTopOfStack = ( portSTACK_TYPE ) pxOriginalTOS; /* Stack used when task starts goes in R13. */
	pxTopOfStack--;
	*pxTopOfStack = ( portSTACK_TYPE ) 0x12121212;	/* R12 */
	pxTopOfStack--;	
	*pxTopOfStack = ( portSTACK_TYPE ) 0x11111111;	/* R11 */
	pxTopOfStack--;	
	*pxTopOfStack = ( portSTACK_TYPE ) 0x10101010;	/* R10 */
	pxTopOfStack--;	
	*pxTopOfStack = ( portSTACK_TYPE ) 0x09090909;	/* R9 */
	pxTopOfStack--;	
	*pxTopOfStack = ( portSTACK_TYPE ) 0x08080808;	/* R8 */
	pxTopOfStack--;	
	*pxTopOfStack = ( portSTACK_TYPE ) 0x07070707;	/* R7 */
	pxTopOfStack--;	
	*pxTopOfStack = ( portSTACK_TYPE ) 0x06060606;	/* R6 */
	pxTopOfStack--;	
	*pxTopOfStack = ( portSTACK_TYPE ) 0x05050505;	/* R5 */
	pxTopOfStack--;	
	*pxTopOfStack = ( portSTACK_TYPE ) 0x04040404;	/* R4 */
	pxTopOfStack--;	
	*pxTopOfStack = ( portSTACK_TYPE ) 0x03030303;	/* R3 */
	pxTopOfStack--;	
	*pxTopOfStack = ( portSTACK_TYPE ) 0x02020202;	/* R2 */
	pxTopOfStack--;	
	*pxTopOfStack = ( portSTACK_TYPE ) 0x01010101;	/* R1 */
	pxTopOfStack--;	

	/* When the task starts is will expect to find the function parameter in
	R0. */
	*pxTopOfStack = ( portSTACK_TYPE ) pvParameters; /* R0 */
	pxTopOfStack--;

	/* The status register is set for system mode, with interrupts enabled. */
	*pxTopOfStack = ( portSTACK_TYPE ) portINITIAL_SPSR;
	pxTopOfStack--;

	/* Interrupt flags cannot always be stored on the stack and will
	instead be stored in a variable, which is then saved as part of the
	tasks context. */
	*pxTopOfStack = portNO_CRITICAL_NESTING;

	return pxTopOfStack;	
}
/*-----------------------------------------------------------*/

portBASE_TYPE xPortStartScheduler( void )
{
extern void vPortStartFirstTask( void );

	/* Start the timer that generates the tick ISR.  Interrupts are disabled
	here already. */
	prvSetupTimerInterrupt();

	/* Start the first task. */
	vPortStartFirstTask();	

	/* Should not get here! */
	return 0;
}
/*-----------------------------------------------------------*/

void vPortEndScheduler( void )
{
	/* It is unlikely that the ARM port will require this function as there
	is nothing to return to.  */
}
/*-----------------------------------------------------------*/

#if configUSE_PREEMPTION == 0

	/* The cooperative scheduler requires a normal IRQ service routine to
	simply increment the system tick. */
	static __arm __irq void vPortNonPreemptiveTick( void );
	static __arm __irq void vPortNonPreemptiveTick( void )
	{
		/* Increment the tick count - which may wake some tasks but as the
		preemptive scheduler is not being used any woken task is not given
		processor time no matter what its priority. */
		vTaskIncrementTick();
		
		/* Ready for the next interrupt. */
		T0IR = portTIMER_MATCH_ISR_BIT;
		VICVectAddr = portCLEAR_VIC_INTERRUPT;
	}

#else

	/* This function is called from an asm wrapper, so does not require the __irq
	keyword. */
	void vPortPreemptiveTick( void );
	void vPortPreemptiveTick( void )
	{
		/* Increment the tick counter. */
		vTaskIncrementTick();
	
		/* The new tick value might unblock a task.  Ensure the highest task that
		is ready to execute is the task that will execute when the tick ISR
		exits. */
		vTaskSwitchContext();
	
		/* Ready for the next interrupt. */
		T0IR = portTIMER_MATCH_ISR_BIT;
		VICVectAddr = portCLEAR_VIC_INTERRUPT;
	}

#endif

/*-----------------------------------------------------------*/

static void prvSetupTimerInterrupt( void )
{
unsigned portLONG ulCompareMatch;

	/* A 1ms tick does not require the use of the timer prescale.  This is
	defaulted to zero but can be used if necessary. */
	T0PR = portPRESCALE_VALUE;

	/* Calculate the match value required for our wanted tick rate. */
	ulCompareMatch = configCPU_CLOCK_HZ / configTICK_RATE_HZ;

	/* Protect against divide by zero.  Using an if() statement still results
	in a warning - hence the #if. */
	#if portPRESCALE_VALUE != 0
	{
		ulCompareMatch /= ( portPRESCALE_VALUE + 1 );
	}
	#endif

	T0MR0 = ulCompareMatch;

	/* Generate tick with timer 0 compare match. */
	T0MCR = portRESET_COUNT_ON_MATCH | portINTERRUPT_ON_MATCH;

	/* Setup the VIC for the timer. */
	VICIntSelect &= ~( portTIMER_VIC_CHANNEL_BIT );
	VICIntEnable |= portTIMER_VIC_CHANNEL_BIT;
	
	/* The ISR installed depends on whether the preemptive or cooperative
	scheduler is being used. */
	#if configUSE_PREEMPTION == 1
	{	
		extern void ( vPortPreemptiveTickEntry )( void );

		VICVectAddr0 = ( unsigned portLONG ) vPortPreemptiveTickEntry;
	}
	#else
	{
		extern void ( vNonPreemptiveTick )( void );

		VICVectAddr0 = ( portLONG ) vPortNonPreemptiveTick;
	}
	#endif

	VICVectCntl0 = portTIMER_VIC_CHANNEL | portTIMER_VIC_ENABLE;

	/* Start the timer - interrupts are disabled when this function is called
	so it is okay to do this here. */
	T0TCR = portENABLE_TIMER;
}
/*-----------------------------------------------------------*/

void vPortEnterCritical( void )
{
	/* Disable interrupts first! */
	__disable_interrupt();

	/* Now interrupts are disabled ulCriticalNesting can be accessed
	directly.  Increment ulCriticalNesting to keep a count of how many times
	portENTER_CRITICAL() has been called. */
	ulCriticalNesting++;
}
/*-----------------------------------------------------------*/

void vPortExitCritical( void )
{
	if( ulCriticalNesting > portNO_CRITICAL_NESTING )
	{
		/* Decrement the nesting count as we are leaving a critical section. */
		ulCriticalNesting--;

		/* If the nesting level has reached zero then interrupts should be
		re-enabled. */
		if( ulCriticalNesting == portNO_CRITICAL_NESTING )
		{
			__enable_interrupt();
		}
	}
}
/*-----------------------------------------------------------*/






?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久久久久久久97黄色工厂| 欧美精品自拍偷拍| 中日韩免费视频中文字幕| 国产最新精品免费| 欧美国产激情二区三区| eeuss鲁片一区二区三区在线看| 国产三区在线成人av| 国产成人免费av在线| 亚洲欧美在线视频| 欧美日韩国产123区| 国产成人亚洲综合a∨猫咪| 久久久99精品免费观看| jlzzjlzz国产精品久久| 亚洲综合精品久久| 日韩一本二本av| 国产一区不卡精品| 中文字幕亚洲欧美在线不卡| 欧洲激情一区二区| 久久99精品久久久久久国产越南| 久久综合久久鬼色| 99re视频精品| 免费看欧美美女黄的网站| 国产欧美一区二区在线| 91福利国产精品| 免费欧美日韩国产三级电影| 久久久一区二区| 色吊一区二区三区| 激情丁香综合五月| 亚洲久草在线视频| 精品电影一区二区| 在线中文字幕一区| 国产激情一区二区三区四区| 亚洲精品少妇30p| 欧美电影免费观看高清完整版在 | 五月婷婷久久综合| 久久久久高清精品| 欧美乱妇15p| 91亚洲国产成人精品一区二区三 | 日本成人在线网站| 综合激情网...| 久久久午夜电影| 欧美性大战久久| av一区二区不卡| 麻豆成人久久精品二区三区红 | 亚洲1区2区3区4区| 久久女同互慰一区二区三区| www.av精品| 青椒成人免费视频| 亚洲免费在线播放| 日韩欧美精品在线| 色一情一伦一子一伦一区| 日韩va亚洲va欧美va久久| 亚洲欧美日韩国产一区二区三区| 91精品啪在线观看国产60岁| 成人免费福利片| 另类小说图片综合网| 亚洲日本丝袜连裤袜办公室| 日韩精品一区二区三区视频在线观看| 国产一区美女在线| 日韩国产欧美三级| 亚洲免费三区一区二区| 久久综合九色综合97婷婷女人| 色综合一区二区| 狠狠色丁香婷婷综合久久片| 亚洲综合在线第一页| 欧美高清一级片在线观看| 日韩欧美的一区二区| 91国偷自产一区二区使用方法| 国产一区美女在线| 日本视频一区二区| 亚洲成人精品一区| 亚洲激情图片小说视频| 中国av一区二区三区| 精品国产一区二区国模嫣然| 欧美日韩精品欧美日韩精品一 | 成人a级免费电影| 日韩精品乱码免费| 三级精品在线观看| 性久久久久久久| 亚洲精品国产精华液| 中文字幕日本不卡| 国产欧美1区2区3区| 久久综合资源网| 久久综合九色欧美综合狠狠| 欧美一区二区三区视频| 欧美精品一卡两卡| 色婷婷亚洲婷婷| 欧美视频一区二区三区在线观看 | 精品国产乱码久久久久久久久| 在线成人av网站| 久久久国产精华| 欧美mv日韩mv亚洲| 欧美成人r级一区二区三区| 欧美在线观看视频一区二区| 成人午夜电影小说| 欧美性欧美巨大黑白大战| 日本福利一区二区| 在线视频亚洲一区| 欧美系列亚洲系列| 欧美一区二区三区四区视频| 欧美v国产在线一区二区三区| 精品国产精品一区二区夜夜嗨| 久久综合av免费| 国产精品久久午夜| 日韩理论片中文av| 一区二区三区在线视频免费观看| 亚洲影院免费观看| 三级成人在线视频| 国产成人综合在线观看| aaa欧美日韩| 91久久精品网| 欧美精品一二三| 精品精品国产高清一毛片一天堂| 国产欧美一区二区精品性色超碰| 亚洲欧洲日韩在线| 日韩在线一区二区三区| 精品写真视频在线观看| 成人福利视频在线| 欧美揉bbbbb揉bbbbb| 欧美一级日韩免费不卡| 亚洲国产精品成人综合色在线婷婷 | 国产中文字幕一区| 岛国一区二区三区| 欧美日韩在线观看一区二区| 日韩亚洲电影在线| 久久久不卡网国产精品一区| 久久―日本道色综合久久| 国产精品无人区| 亚洲v中文字幕| 国产精品18久久久久| 在线免费观看不卡av| 日韩欧美一级片| 亚洲国产精品黑人久久久| 一区二区三区四区在线| 激情小说欧美图片| 色播五月激情综合网| xfplay精品久久| 亚洲一区视频在线| 国产精品888| 欧美精品少妇一区二区三区| 精品国产精品网麻豆系列| 亚洲欧美日韩在线播放| 蜜桃av噜噜一区二区三区小说| 成人三级伦理片| 91精品国产综合久久香蕉的特点| 欧美国产日韩a欧美在线观看| 日韩一区日韩二区| 亚洲图片欧美色图| 色哟哟国产精品| 国产婷婷精品av在线| 午夜电影久久久| 国产成人精品综合在线观看 | 国产精品资源在线观看| 精品视频在线免费观看| 久久免费精品国产久精品久久久久 | 午夜日韩在线观看| 懂色av一区二区夜夜嗨| 欧美一区二区三区电影| 一区二区三区中文在线| 国产呦精品一区二区三区网站| 在线播放一区二区三区| 日韩理论片在线| 成人丝袜18视频在线观看| 4438x成人网最大色成网站| 无吗不卡中文字幕| 在线免费精品视频| 亚洲欧美日韩一区二区| 成人av网站在线| 国产精品少妇自拍| 国产河南妇女毛片精品久久久 | 91视频你懂的| 国产欧美日韩精品一区| 粉嫩aⅴ一区二区三区四区五区| 26uuu亚洲综合色欧美 | 亚洲国产成人一区二区三区| 日本中文字幕一区| 欧美不卡一区二区三区| 久久精品国产**网站演员| 91精品国产91久久综合桃花| 同产精品九九九| 欧美日韩亚洲国产综合| 亚洲高清三级视频| 欧美美女直播网站| 秋霞成人午夜伦在线观看| 制服丝袜中文字幕亚洲| 日韩精品电影在线观看| 国产精品美女久久久久久| 国产电影精品久久禁18| 国产色产综合色产在线视频| 国产精品一区2区| 国产欧美一区视频| eeuss鲁片一区二区三区在线看| 欧美国产日韩亚洲一区| 99久久久久久| 亚洲国产精品天堂| 欧美一区二区三区喷汁尤物| 久久成人免费网站| 精品国产成人系列| 99久久精品久久久久久清纯| 椎名由奈av一区二区三区|