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

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

?? port.c

?? STM32 FreeRTOS v5.2移植源代碼
?? C
字號:
/*
	FreeRTOS.org V5.2.0 - Copyright (C) 2003-2009 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 (version 2) as published
	by the Free Software Foundation and modified by the FreeRTOS exception.

	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 is included to allow you 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.


	***************************************************************************
	*                                                                         *
	* Get the FreeRTOS eBook!  See http://www.FreeRTOS.org/Documentation      *
	*                                                                         *
	* This is a concise, step by step, 'hands on' guide that describes both   *
	* general multitasking concepts and FreeRTOS specifics. It presents and   *
	* explains numerous examples that are written using the FreeRTOS API.     *
	* Full source code for all the examples is provided in an accompanying    *
	* .zip file.                                                              *
	*                                                                         *
	***************************************************************************

	1 tab == 4 spaces!

	Please ensure to read the configuration and relevant port sections of the
	online documentation.

	http://www.FreeRTOS.org - Documentation, latest information, license and
	contact details.

	http://www.SafeRTOS.com - A version that is certified for use in safety
	critical systems.

	http://www.OpenRTOS.com - Commercial support, development, porting,
	licensing and training services.
*/

/*
	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.
 *
 * The bic instruction ensures there are no low power bits set in the status
 * register that is about to be popped from the stack.
 */
#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"	\
					"bic	#(0xf0),0(r1)			\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一区二区三区免费野_久草精品视频
国产成人在线免费观看| 波多野结衣的一区二区三区| 国产一区不卡视频| 精品视频一区三区九区| 国产免费久久精品| 男女视频一区二区| 91久久精品日日躁夜夜躁欧美| 精品欧美一区二区久久| 亚洲国产精品久久艾草纯爱| 粉嫩aⅴ一区二区三区四区| 日韩欧美中文一区| 一区二区三区免费网站| www.爱久久.com| 久久精品人人做人人综合| 蜜臀久久99精品久久久久宅男| 色综合久久88色综合天天免费| 久久久久九九视频| 黄色成人免费在线| 日韩亚洲国产中文字幕欧美| 亚洲成人综合视频| 精品国产凹凸成av人网站| 亚洲午夜精品一区二区三区他趣| thepron国产精品| 欧美国产精品劲爆| 国产黄人亚洲片| 26uuuu精品一区二区| 日韩黄色免费电影| 欧美一区二区免费视频| 视频一区欧美精品| 日韩一区二区在线播放| 日本中文在线一区| 日韩欧美激情四射| 老司机精品视频线观看86| 日韩一区二区视频在线观看| 日韩在线一区二区三区| 欧美日韩国产小视频在线观看| 一区二区欧美精品| 欧美日韩另类一区| 日本视频一区二区三区| 日韩欧美一区二区三区在线| 麻豆成人免费电影| 国产欧美一区二区三区鸳鸯浴| 国产suv一区二区三区88区| 国产欧美一区二区在线观看| 顶级嫩模精品视频在线看| 国产精品免费视频网站| 99精品桃花视频在线观看| 亚洲精品国产无天堂网2021 | 日本一二三不卡| 成人小视频免费在线观看| 1区2区3区欧美| 欧美日韩国产一级| 国产自产视频一区二区三区| 亚洲一区在线播放| 欧美日韩一卡二卡三卡| 老司机午夜精品| 中文字幕欧美三区| 欧洲国内综合视频| 久久精品噜噜噜成人88aⅴ| 久久婷婷色综合| 色香蕉成人二区免费| 爽好久久久欧美精品| 久久久久综合网| 日本韩国欧美在线| 韩国欧美国产1区| 亚洲丝袜自拍清纯另类| 欧美一区二区三区播放老司机| 国内外成人在线视频| 亚洲免费视频中文字幕| 日韩一级片网址| 99re这里只有精品6| 日本vs亚洲vs韩国一区三区 | 国产欧美日本一区二区三区| 91丨九色丨蝌蚪丨老版| 日本视频在线一区| 国产精品免费人成网站| 欧美一区二区私人影院日本| 丰满亚洲少妇av| 奇米精品一区二区三区在线观看 | 黄色成人免费在线| 尤物视频一区二区| 亚洲国产精品成人综合色在线婷婷 | 一区二区三区国产精品| 久久久久久久久久美女| 欧美日本高清视频在线观看| 成人动漫精品一区二区| 免费成人深夜小野草| 一区二区在线观看视频| 久久久久久电影| 日韩一区二区视频| 欧美日高清视频| 91香蕉视频污| 国产成人久久精品77777最新版本| 午夜精品久久久久久久久| 亚洲欧洲av在线| 国产三级精品三级| 精品国产3级a| 日韩精品一区二区三区视频| 欧洲亚洲精品在线| 一本久道久久综合中文字幕| 国产99一区视频免费| 开心九九激情九九欧美日韩精美视频电影| 亚洲图片欧美激情| 综合在线观看色| 国产精品国产三级国产普通话99| 26uuu另类欧美| 日韩欧美国产三级| 91精品国产91热久久久做人人| 欧美在线色视频| 欧美视频日韩视频| 欧美亚洲一区二区在线| 色综合久久88色综合天天6| 99国产精品一区| 91丝袜美腿高跟国产极品老师| 91在线porny国产在线看| va亚洲va日韩不卡在线观看| 成人黄色综合网站| 成人动漫中文字幕| 成人午夜电影久久影院| 不卡高清视频专区| 成人国产在线观看| 91亚洲国产成人精品一区二区三| 99久久er热在这里只有精品66| www.在线成人| 色噜噜久久综合| 欧美日韩免费不卡视频一区二区三区 | 综合色天天鬼久久鬼色| 久久久久久久久久久久电影 | 5566中文字幕一区二区电影| 欧美日韩你懂的| 日韩一级黄色片| 欧美精品一区二区三区一线天视频 | 一本色道久久综合亚洲91| 91在线观看成人| 91麻豆精品国产| 久久久久久久久一| 亚洲精品乱码久久久久久 | 图片区小说区国产精品视频| 午夜久久电影网| 寂寞少妇一区二区三区| 成人国产精品免费网站| 在线一区二区视频| 日韩精品一区二区三区视频在线观看| 久久久久成人黄色影片| 综合色中文字幕| 麻豆91免费看| 成人av资源下载| 欧美精品久久一区| 久久久久99精品国产片| 亚洲色图制服诱惑| 麻豆成人在线观看| 99国产精品一区| 欧美成人bangbros| 亚洲欧美日韩成人高清在线一区| 日本成人中文字幕| 99精品国产91久久久久久| 欧美一区二区视频免费观看| 中文字幕不卡的av| 奇米色一区二区三区四区| jlzzjlzz亚洲女人18| 欧美一区二区福利在线| 亚洲欧洲另类国产综合| 久久草av在线| 色噜噜狠狠成人中文综合| 精品日韩在线观看| 亚洲午夜久久久久久久久久久| 国产精品一二三区在线| 欧美日韩三级视频| 中文字幕中文乱码欧美一区二区| 午夜精品久久久久| 91免费精品国自产拍在线不卡| 精品国产91洋老外米糕| 日韩和的一区二区| 在线观看不卡一区| 国产精品短视频| 国产精品一区二区在线看| 91麻豆精品久久久久蜜臀| 亚洲柠檬福利资源导航| 国产精品2024| 精品国产91久久久久久久妲己| 天天综合色天天| 在线看国产一区| 亚洲天堂av一区| av电影在线不卡| 国产精品国产三级国产aⅴ无密码| 老司机午夜精品| 日韩午夜激情电影| 日本不卡123| 4438x亚洲最大成人网| 亚洲高清免费观看高清完整版在线观看| 欧美午夜一区二区三区| 日韩伦理免费电影| aa级大片欧美| 亚洲欧洲日产国产综合网| 成人午夜激情在线| 中文字幕在线免费不卡| 成人免费三级在线| 国产精品不卡一区| 一本色道久久综合亚洲aⅴ蜜桃| 国产精品免费视频观看|