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

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

?? port.c

?? FreeRTOS V4.2.1,增加了AVR32 UC3 和 LPC2368 的支持
?? C
字號:
/*
	FreeRTOS.org V4.2.1 - 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.
	***************************************************************************
*/

/*
	Changes from V2.5.2
		
	+ usCriticalNesting now has a volatile qualifier.
*/

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

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

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

/* Constants required for hardware setup.  The tick ISR runs off the ACLK, 
not the MCLK. */
#define portACLK_FREQUENCY_HZ			( ( portTickType ) 32768 )
#define portINITIAL_CRITICAL_NESTING	( ( unsigned portSHORT ) 10 )
#define portFLAGS_INT_ENABLED	( ( portSTACK_TYPE ) 0x08 )

/* We require the address of the pxCurrentTCB variable, but don't want to know
any details of its type. */
typedef void tskTCB;
extern volatile tskTCB * volatile pxCurrentTCB;

/* Most ports implement critical sections by placing the interrupt flags on
the stack before disabling interrupts.  Exiting the critical section is then
simply a case of popping the flags from the stack.  As mspgcc does not use
a frame pointer this cannot be done as modifying the stack will clobber all
the stack variables.  Instead each task maintains a count of the critical
section nesting depth.  Each time a critical section is entered the count is
incremented.  Each time a critical section is left the count is decremented -
with interrupts only being re-enabled if the count is zero.

usCriticalNesting will get set to zero when the scheduler starts, but must
not be initialised to zero as this will cause problems during the startup
sequence. */
volatile unsigned portSHORT usCriticalNesting = portINITIAL_CRITICAL_NESTING;
/*-----------------------------------------------------------*/

/* 
 * Macro to save a task context to the task stack.  This simply pushes all the 
 * general purpose msp430 registers onto the stack, followed by the 
 * usCriticalNesting value used by the task.  Finally the resultant stack 
 * pointer value is saved into the task control block so it can be retrieved 
 * the next time the task executes.
 */
#define portSAVE_CONTEXT()									\
	asm volatile (	"push	r4						\n\t"	\
					"push	r5						\n\t"	\
					"push	r6						\n\t"	\
					"push	r7						\n\t"	\
					"push	r8						\n\t"	\
					"push	r9						\n\t"	\
					"push	r10						\n\t"	\
					"push	r11						\n\t"	\
					"push	r12						\n\t"	\
					"push	r13						\n\t"	\
					"push	r14						\n\t"	\
					"push	r15						\n\t"	\
					"mov.w	usCriticalNesting, r14	\n\t"	\
					"push	r14						\n\t"	\
					"mov.w	pxCurrentTCB, r12		\n\t"	\
					"mov.w	r1, @r12				\n\t"	\
				);

/* 
 * Macro to restore a task context from the task stack.  This is effectively
 * the reverse of portSAVE_CONTEXT().  First the stack pointer value is
 * loaded from the task control block.  Next the value for usCriticalNesting
 * used by the task is retrieved from the stack - followed by the value of all
 * the general purpose msp430 registers.
 */
#define portRESTORE_CONTEXT()								\
	asm volatile (	"mov.w	pxCurrentTCB, r12		\n\t"	\
					"mov.w	@r12, r1				\n\t"	\
					"pop	r15						\n\t"	\
					"mov.w	r15, usCriticalNesting	\n\t"	\
					"pop	r15						\n\t"	\
					"pop	r14						\n\t"	\
					"pop	r13						\n\t"	\
					"pop	r12						\n\t"	\
					"pop	r11						\n\t"	\
					"pop	r10						\n\t"	\
					"pop	r9						\n\t"	\
					"pop	r8						\n\t"	\
					"pop	r7						\n\t"	\
					"pop	r6						\n\t"	\
					"pop	r5						\n\t"	\
					"pop	r4						\n\t"	\
					"reti							\n\t"	\
				);
/*-----------------------------------------------------------*/

/*
 * Sets up the periodic ISR used for the RTOS tick.  This uses timer 0, but
 * could have alternatively used the watchdog timer or timer 1.
 */
static void prvSetupTimerInterrupt( void );
/*-----------------------------------------------------------*/

/* 
 * Initialise the stack of a task to look exactly as if a call to 
 * portSAVE_CONTEXT had been called.
 * 
 * See the header file portable.h.
 */
portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
{
	/* 
		Place a few bytes of known values on the bottom of the stack. 
		This is just useful for debugging and can be included if required.

		*pxTopOfStack = ( portSTACK_TYPE ) 0x1111;
		pxTopOfStack--;
		*pxTopOfStack = ( portSTACK_TYPE ) 0x2222;
		pxTopOfStack--;
		*pxTopOfStack = ( portSTACK_TYPE ) 0x3333;
		pxTopOfStack--; 
	*/

	/* The msp430 automatically pushes the PC then SR onto the stack before 
	executing an ISR.  We want the stack to look just as if this has happened
	so place a pointer to the start of the task on the stack first - followed
	by the flags we want the task to use when it starts up. */
	*pxTopOfStack = ( portSTACK_TYPE ) pxCode;
	pxTopOfStack--;
	*pxTopOfStack = portFLAGS_INT_ENABLED;
	pxTopOfStack--;

	/* Next the general purpose registers. */
	*pxTopOfStack = ( portSTACK_TYPE ) 0x4444;
	pxTopOfStack--;
	*pxTopOfStack = ( portSTACK_TYPE ) 0x5555;
	pxTopOfStack--;
	*pxTopOfStack = ( portSTACK_TYPE ) 0x6666;
	pxTopOfStack--;
	*pxTopOfStack = ( portSTACK_TYPE ) 0x7777;
	pxTopOfStack--;
	*pxTopOfStack = ( portSTACK_TYPE ) 0x8888;
	pxTopOfStack--;
	*pxTopOfStack = ( portSTACK_TYPE ) 0x9999;
	pxTopOfStack--;
	*pxTopOfStack = ( portSTACK_TYPE ) 0xaaaa;
	pxTopOfStack--;
	*pxTopOfStack = ( portSTACK_TYPE ) 0xbbbb;
	pxTopOfStack--;
	*pxTopOfStack = ( portSTACK_TYPE ) 0xcccc;
	pxTopOfStack--;
	*pxTopOfStack = ( portSTACK_TYPE ) 0xdddd;
	pxTopOfStack--;
	*pxTopOfStack = ( portSTACK_TYPE ) 0xeeee;
	pxTopOfStack--;

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

	/* The code generated by the mspgcc compiler does not maintain separate
	stack and frame pointers. The portENTER_CRITICAL macro cannot therefore
	use the stack as per other ports.  Instead a variable is used to keep
	track of the critical section nesting.  This variable has to be stored
	as part of the task context and is initially set to zero. */
	*pxTopOfStack = ( portSTACK_TYPE ) portNO_CRITICAL_SECTION_NESTING;	

	/* Return a pointer to the top of the stack we have generated so this can
	be stored in the task control block for the task. */
	return pxTopOfStack;
}
/*-----------------------------------------------------------*/

portBASE_TYPE xPortStartScheduler( void )
{
	/* Setup the hardware to generate the tick.  Interrupts are disabled when
	this function is called. */
	prvSetupTimerInterrupt();

	/* Restore the context of the first task that is going to run. */
	portRESTORE_CONTEXT();

	/* Should not get here as the tasks are now running! */
	return pdTRUE;
}
/*-----------------------------------------------------------*/

void vPortEndScheduler( void )
{
	/* It is unlikely that the MSP430 port will get stopped.  If required simply
	disable the tick interrupt here. */
}
/*-----------------------------------------------------------*/

/*
 * Manual context switch called by portYIELD or taskYIELD.  
 *
 * The first thing we do is save the registers so we can use a naked attribute.
 */
void vPortYield( void ) __attribute__ ( ( naked ) );
void vPortYield( void )
{
	/* We want the stack of the task being saved to look exactly as if the task
	was saved during a pre-emptive RTOS tick ISR.  Before calling an ISR the 
	msp430 places the status register onto the stack.  As this is a function 
	call and not an ISR we have to do this manually. */
	asm volatile ( "push	r2" );
	_DINT();

	/* Save the context of the current task. */
	portSAVE_CONTEXT();

	/* Switch to the highest priority task that is ready to run. */
	vTaskSwitchContext();

	/* Restore the context of the new task. */
	portRESTORE_CONTEXT();
}
/*-----------------------------------------------------------*/

/*
 * Hardware initialisation to generate the RTOS tick.  This uses timer 0
 * but could alternatively use the watchdog timer or timer 1. 
 */
static void prvSetupTimerInterrupt( void )
{
	/* Ensure the timer is stopped. */
	TACTL = 0;

	/* Run the timer of the ACLK. */
	TACTL = TASSEL_1;

	/* Clear everything to start with. */
	TACTL |= TACLR;

	/* Set the compare match value according to the tick rate we want. */
	TACCR0 = portACLK_FREQUENCY_HZ / configTICK_RATE_HZ;

	/* Enable the interrupts. */
	TACCTL0 = CCIE;

	/* Start up clean. */
	TACTL |= TACLR;

	/* Up mode. */
	TACTL |= MC_1;
}
/*-----------------------------------------------------------*/

/* 
 * The interrupt service routine used depends on whether the pre-emptive
 * scheduler is being used or not.
 */

#if configUSE_PREEMPTION == 1

	/*
	 * Tick ISR for preemptive scheduler.  We can use a naked attribute as
	 * the context is saved at the start of vPortYieldFromTick().  The tick
	 * count is incremented after the context is saved.
	 */
	interrupt (TIMERA0_VECTOR) prvTickISR( void ) __attribute__ ( ( naked ) );
	interrupt (TIMERA0_VECTOR) prvTickISR( void )
	{
		/* Save the context of the interrupted task. */
		portSAVE_CONTEXT();

		/* Increment the tick count then switch to the highest priority task
		that is ready to run. */
		vTaskIncrementTick();
		vTaskSwitchContext();

		/* Restore the context of the new task. */
		portRESTORE_CONTEXT();
	}

#else

	/*
	 * Tick ISR for the cooperative scheduler.  All this does is increment the
	 * tick count.  We don't need to switch context, this can only be done by
	 * manual calls to taskYIELD();
	 */
	interrupt (TIMERA0_VECTOR) prvTickISR( void );
	interrupt (TIMERA0_VECTOR) prvTickISR( void )
	{
		vTaskIncrementTick();
	}
#endif


	

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲欧洲三级电影| 欧美精三区欧美精三区| 久久久久久久性| 精久久久久久久久久久| 久久综合色一综合色88| 国产一区二区三区在线观看免费视频 | 亚洲精品视频在线| 一本大道久久a久久综合| 国产精品电影院| 91麻豆免费观看| 亚洲午夜久久久久中文字幕久| 欧美性大战久久久| 日韩电影一区二区三区| 日韩欧美国产一区二区三区| 国产在线不卡一区| 国产精品电影一区二区三区| 在线一区二区三区做爰视频网站| 亚洲国产日韩在线一区模特| 日韩视频免费观看高清在线视频| 国产主播一区二区三区| 国产精品欧美极品| 欧美色综合网站| 久久99最新地址| 国产精品卡一卡二卡三| 精品视频在线视频| 国内精品伊人久久久久影院对白| 中文子幕无线码一区tr| 在线一区二区三区四区| 麻豆国产精品官网| 中文字幕一区二区三区在线观看| 欧美视频日韩视频在线观看| 精品一区免费av| 亚洲人成亚洲人成在线观看图片 | 亚洲va欧美va人人爽午夜| 日韩亚洲电影在线| 成人h精品动漫一区二区三区| 一区二区三区欧美| 欧美一区二区三区免费在线看| 国产精品911| 亚洲成av人片一区二区梦乃| 久久亚洲综合色| 欧美亚洲日本一区| 国产精品影音先锋| 午夜在线成人av| 国产精品美女久久久久aⅴ国产馆| 欧美丝袜丝交足nylons图片| 国内不卡的二区三区中文字幕| 一区二区三区在线免费视频| 精品国内片67194| 在线观看日韩精品| 大胆亚洲人体视频| 麻豆成人久久精品二区三区小说| 亚洲欧美一区二区三区国产精品| 欧美电视剧在线观看完整版| 色88888久久久久久影院按摩| 国产一区二区在线免费观看| 天天综合色天天| 亚洲蜜臀av乱码久久精品| 国产午夜精品理论片a级大结局| 欧美精品高清视频| 日本韩国欧美国产| 99视频在线精品| 国产盗摄女厕一区二区三区| 日韩制服丝袜av| 一区二区三区四区在线免费观看| 国产日产亚洲精品系列| 欧美成人综合网站| 欧美日本一区二区三区| 色噜噜狠狠成人中文综合| av不卡在线观看| 555www色欧美视频| 91捆绑美女网站| 成人av在线电影| 国产成人综合网站| 国内成人免费视频| 精品中文字幕一区二区| 美女一区二区视频| 奇米精品一区二区三区在线观看 | 国产精品狼人久久影院观看方式| 久久久欧美精品sm网站| 日韩免费高清电影| 日韩欧美亚洲国产另类| 欧美一级生活片| 日韩一级片网站| 日韩免费观看2025年上映的电影 | 欧美系列亚洲系列| 欧美影院午夜播放| 欧美三级日韩在线| 精品视频色一区| 在线电影一区二区三区| 欧美高清hd18日本| 日韩视频一区二区三区 | 偷拍自拍另类欧美| 日韩av在线发布| 麻豆精品新av中文字幕| 久久国产精品99精品国产| 麻豆91小视频| 国产综合色产在线精品| 国内精品久久久久影院色| 国产不卡一区视频| 91麻豆蜜桃一区二区三区| 欧美综合天天夜夜久久| 欧美肥妇bbw| 欧美成人在线直播| 中文字幕不卡三区| 亚洲欧美日韩一区| 丝袜美腿亚洲综合| 国产在线精品一区在线观看麻豆| 国产精品亚洲综合一区在线观看| 成人永久免费视频| 色婷婷综合久久久久中文| 在线观看一区日韩| 日韩女优制服丝袜电影| 国产片一区二区三区| 亚洲黄色免费电影| 日韩福利视频网| 丁香五精品蜜臀久久久久99网站| 9i在线看片成人免费| 欧美日韩中文字幕精品| 欧美精品一区二区三| 国产精品久久久久久久久晋中| 亚洲一区二区欧美日韩| 精品在线播放免费| 日本精品一区二区三区四区的功能| 欧美最猛性xxxxx直播| 2024国产精品| 亚洲精品视频免费看| 韩日欧美一区二区三区| 色屁屁一区二区| 26uuu精品一区二区三区四区在线| 国产精品久久久爽爽爽麻豆色哟哟| 亚洲丰满少妇videoshd| 国产99久久久久久免费看农村| 欧美最新大片在线看| 国产免费久久精品| 免费高清在线一区| 日本高清不卡一区| 久久免费午夜影院| 亚洲电影激情视频网站| 成人av午夜电影| 久久综合久久综合久久综合| 一区二区三区日韩欧美精品| 国产成人免费在线观看不卡| 欧美人xxxx| 亚洲免费观看视频| 国产福利一区二区三区视频在线| 欧美午夜宅男影院| 亚洲品质自拍视频| 国产v综合v亚洲欧| 日韩精品一区二区三区中文精品| 国产精品一区二区免费不卡 | 国产一区在线不卡| 9191成人精品久久| 一区二区三区鲁丝不卡| 成人一道本在线| 精品理论电影在线观看| 午夜视频在线观看一区二区三区| 不卡一区在线观看| 国产人成亚洲第一网站在线播放 | 一区二区在线看| 成人精品一区二区三区中文字幕| 久久综合五月天婷婷伊人| 免费久久99精品国产| 51精品国自产在线| 性做久久久久久久免费看| 在线观看日产精品| 艳妇臀荡乳欲伦亚洲一区| 一本大道av伊人久久综合| 中文字幕亚洲一区二区av在线| 国产成a人无v码亚洲福利| 久久久久成人黄色影片| 国产麻豆视频一区二区| 久久久久久久久免费| 国产精品99久久久久久有的能看| 日韩精品专区在线影院观看| 日本一区中文字幕| 欧美一区二区三区在线看| 日韩国产一区二| 欧美一区永久视频免费观看| 日本v片在线高清不卡在线观看| 欧美精品 日韩| 奇米一区二区三区| 精品国产乱码久久久久久夜甘婷婷| 久久99精品久久久久| 久久久久久久久久久久久久久99| 精品一区二区三区日韩| 久久久久久黄色| 国产91高潮流白浆在线麻豆| 国产精品久久久久久久裸模| 色综合久久中文综合久久97| 亚洲一区二区免费视频| 91精品国产91久久久久久一区二区 | 欧美一区二区国产| 蜜臀av一区二区在线免费观看 | 精品国产免费一区二区三区四区 | 91福利小视频| 肉肉av福利一精品导航| 日韩精品资源二区在线| 成人免费视频国产在线观看| 亚洲精品成人a在线观看|