亚洲欧美第一页_禁久久精品乱码_粉嫩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.
	***************************************************************************
*/

/*
Changes from V3.2.1
	+ CallReturn Depth increased from 8 to 10 levels to accomodate wizC/fedC V12.
	
Changes from V3.2.0
	+ TBLPTRU is now initialised to zero during the initial stack creation of a new task. This solves
	an error on devices with more than 64kB ROM.

Changes from V3.0.0
	+ ucCriticalNesting is now initialised to 0x7F to prevent interrupts from being
          handled before the scheduler is started.

Changes from V3.0.1
*/

/* Scheduler include files. */
#include <FreeRTOS.h>
#include <task.h>

#include <malloc.h>

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

/*
 * 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;

/*
 * Define minimal-stack constants
 * -----
 * FSR's:
 *		STATUS, WREG, BSR, PRODH, PRODL, FSR0H, FSR0L,
 *		FSR1H, FSR1L,TABLAT, (TBLPTRU), TBLPTRH, TBLPTRL,
 *		(PCLATU), PCLATH
 *		sfr's within parenthesis only on devices > 64kB
 * -----
 * Call/Return stack:
 *		 2 bytes per entry on devices <= 64kB
 *		 3 bytes per entry on devices >  64kB
 * -----
 * Other bytes:
 *		 2 bytes: FunctionParameter for initial taskcode
 *		 1 byte : Number of entries on call/return stack
 *		 1 byte : ucCriticalNesting
 *		16 bytes: Free space on stack
 */
#if _ROMSIZE > 0x8000
	#define portSTACK_FSR_BYTES				( 15 )
	#define portSTACK_CALLRETURN_ENTRY_SIZE	(  3 )
#else
	#define portSTACK_FSR_BYTES				( 13 )
	#define portSTACK_CALLRETURN_ENTRY_SIZE	(  2 )
#endif

#define portSTACK_MINIMAL_CALLRETURN_DEPTH	( 10 )
#define portSTACK_OTHER_BYTES				( 20 )

unsigned portSHORT usCalcMinStackSize		= 0;

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

/*
 * We initialise ucCriticalNesting to the middle value an 
 * unsigned char can contain. This way portENTER_CRITICAL()
 * and portEXIT_CRITICAL() can be called without interrupts
 * being enabled before the scheduler starts.
 */
register unsigned portCHAR ucCriticalNesting = 0x7F;

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

/* 
 * Initialise the stack of a new task.
 * See portSAVE_CONTEXT macro for description. 
 */
portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
{
unsigned portCHAR ucScratch;
	/*
	 * Get the size of the RAMarea in page 0 used by the compiler
	 * We do this here already to avoid W-register conflicts.
	 */
	_Pragma("asm")
		movlw	OVERHEADPAGE0-LOCOPTSIZE+MAXLOCOPTSIZE
		movwf	PRODL,ACCESS		; PRODL is used as temp register
	_Pragma("asmend")
	ucScratch = PRODL;

	/*
	 * Place a few bytes of known values on the bottom of the stack. 
	 * This is just useful for debugging.
	 */
//	*pxTopOfStack--	= 0x11;
//	*pxTopOfStack-- = 0x22;
//	*pxTopOfStack-- = 0x33;

	/*
	 * Simulate how the stack would look after a call to vPortYield()
	 * generated by the compiler.
	 */

	/*
	 * First store the function parameters.  This is where the task expects
	 * to find them when it starts running.
	 */
	*pxTopOfStack-- = ( portSTACK_TYPE ) ( (( unsigned portSHORT ) pvParameters >> 8) & 0x00ff );
	*pxTopOfStack-- = ( portSTACK_TYPE ) (  ( unsigned portSHORT ) pvParameters       & 0x00ff );

	/*
	 * Next are all the registers that form part of the task context.
	 */
	*pxTopOfStack-- = ( portSTACK_TYPE ) 0x11; /* STATUS. */
	*pxTopOfStack-- = ( portSTACK_TYPE ) 0x22; /* WREG. */
	*pxTopOfStack-- = ( portSTACK_TYPE ) 0x33; /* BSR. */
	*pxTopOfStack-- = ( portSTACK_TYPE ) 0x44; /* PRODH. */
	*pxTopOfStack-- = ( portSTACK_TYPE ) 0x55; /* PRODL. */
	*pxTopOfStack-- = ( portSTACK_TYPE ) 0x66; /* FSR0H. */
	*pxTopOfStack-- = ( portSTACK_TYPE ) 0x77; /* FSR0L. */
	*pxTopOfStack-- = ( portSTACK_TYPE ) 0x88; /* FSR1H. */
	*pxTopOfStack-- = ( portSTACK_TYPE ) 0x99; /* FSR1L. */
	*pxTopOfStack-- = ( portSTACK_TYPE ) 0xAA; /* TABLAT. */
#if _ROMSIZE > 0x8000
	*pxTopOfStack-- = ( portSTACK_TYPE ) 0x00; /* TBLPTRU. */
#endif
	*pxTopOfStack-- = ( portSTACK_TYPE ) 0xCC; /* TBLPTRH. */
	*pxTopOfStack-- = ( portSTACK_TYPE ) 0xDD; /* TBLPTRL. */
#if _ROMSIZE > 0x8000
	*pxTopOfStack-- = ( portSTACK_TYPE ) 0xEE; /* PCLATU. */
#endif
	*pxTopOfStack-- = ( portSTACK_TYPE ) 0xFF; /* PCLATH. */

	/*
	 * Next the compiler's scratchspace.
	 */
	while(ucScratch-- > 0)
	{
		*pxTopOfStack-- = ( portSTACK_TYPE ) 0;
	}
	
	/*
	 * The only function return address so far is the address of the task entry.
	 * The order is TOSU/TOSH/TOSL. For devices > 64kB, TOSU is put on the 
	 * stack, too. TOSU is always written as zero here because wizC does not allow
	 * functionpointers to point above 64kB in ROM.
	 */
#if _ROMSIZE > 0x8000
	*pxTopOfStack-- = ( portSTACK_TYPE ) 0;
#endif
	*pxTopOfStack-- = ( portSTACK_TYPE ) ( ( ( unsigned portSHORT ) pxCode >> 8 ) & 0x00ff );
	*pxTopOfStack-- = ( portSTACK_TYPE ) ( (   unsigned portSHORT ) pxCode        & 0x00ff );

	/*
	 * Store the number of return addresses on the hardware stack.
	 * So far only the address of the task entry point.
	 */
	*pxTopOfStack-- = ( portSTACK_TYPE ) 1;

	/*
	 * The code generated by wizC does not maintain separate
	 * stack and frame pointers. Therefore the portENTER_CRITICAL macro cannot 
	 * 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 pxTopOfStack;
}
/*-----------------------------------------------------------*/

unsigned portSHORT usPortCALCULATE_MINIMAL_STACK_SIZE( void )
{
	/*
	 * Fetch the size of compiler's scratchspace.
	 */
	_Pragma("asm")
		movlw	OVERHEADPAGE0-LOCOPTSIZE+MAXLOCOPTSIZE
		movlb	usCalcMinStackSize>>8
		movwf	usCalcMinStackSize,BANKED
	_Pragma("asmend")

	/*
	 * Add minimum needed stackspace
	 */
	usCalcMinStackSize	+=	( portSTACK_FSR_BYTES )
		+	( portSTACK_MINIMAL_CALLRETURN_DEPTH * portSTACK_CALLRETURN_ENTRY_SIZE )
		+	( portSTACK_OTHER_BYTES );

	return(usCalcMinStackSize);
}

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

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

	/*
	 * Setup a timer for the tick ISR for the preemptive scheduler.
	 */
	portSetupTick(); 

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

	/*
	 * This point should never be reached during execution.
	 */
	return pdTRUE;
}

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

void vPortEndScheduler( void )
{
	/*
	 * It is unlikely that the scheduler for the PIC port will get stopped
	 * once running. When called a reset is done which is probably the
	 * most valid action.
	 */
	_Pragma(asmline reset);
}

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

/*
 * Manual context switch.  This is similar to the tick context switch,
 * but does not increment the tick count.  It must be identical to the
 * tick context switch in how it stores the stack of a task.
 */
void vPortYield( void )
{
	/*
	 * Save the context of the current task.
	 */
	portSAVE_CONTEXT( portINTERRUPTS_UNCHANGED );

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

	/*
	 * Start executing the task we have just switched to.
	 */
	portRESTORE_CONTEXT();
}

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

void *pvPortMalloc( unsigned portSHORT usWantedSize )
{
void *pvReturn;

	vTaskSuspendAll();
	{
		pvReturn = malloc( ( malloc_t ) usWantedSize );
	}
	xTaskResumeAll();

	return pvReturn;
}

void vPortFree( void *pv )
{
	if( pv )
	{
		vTaskSuspendAll();
		{
			free( pv );
		}
		xTaskResumeAll();
	}
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲高清视频在线| 国产电影一区二区三区| 国产欧美一区二区三区在线看蜜臀| 成人动漫一区二区三区| 麻豆精品国产传媒mv男同| 亚洲人成人一区二区在线观看| 337p粉嫩大胆色噜噜噜噜亚洲| 欧美日韩一区三区| 99热精品国产| 国产v日产∨综合v精品视频| 日韩中文字幕亚洲一区二区va在线| 亚洲天堂2014| 中文字幕成人网| 久久综合色8888| 欧美日韩色一区| 色欧美88888久久久久久影院| 激情综合网激情| 日韩av一级电影| 视频一区中文字幕| 亚洲一区av在线| 亚洲色图都市小说| 国产精品私房写真福利视频| 久久久亚洲综合| 欧美电视剧在线看免费| 欧美一区三区四区| 欧美日韩久久久一区| 色综合天天综合狠狠| 国产伦精品一区二区三区免费迷 | 91香蕉视频黄| 丁香六月综合激情| 国产精品影音先锋| 国产精品一区二区黑丝| 6080yy午夜一二三区久久| 在线精品视频免费播放| 色婷婷激情久久| 日本高清不卡aⅴ免费网站| 91欧美一区二区| 色94色欧美sute亚洲线路二| 色婷婷亚洲综合| 欧美亚洲一区二区在线观看| 欧洲色大大久久| 欧美在线不卡视频| 在线观看av一区二区| 欧美在线观看一二区| 欧美三级日韩三级| 91精品国产欧美日韩| 日韩免费观看高清完整版| 精品1区2区在线观看| 久久久久久亚洲综合影院红桃| 欧美精品一区二区在线观看| 欧美韩国日本一区| 亚洲欧美日韩系列| 午夜精品视频一区| 久久国内精品视频| 国产精品羞羞答答xxdd| 成人av片在线观看| 色狠狠色噜噜噜综合网| 宅男在线国产精品| 久久综合久久99| 中文字幕一区二区三| 一区二区三区**美女毛片| 日本欧美久久久久免费播放网| 久久精品噜噜噜成人av农村| 丁香亚洲综合激情啪啪综合| 99riav一区二区三区| 欧美高清视频在线高清观看mv色露露十八| 欧美一区二区视频网站| 欧美国产一区在线| 天堂资源在线中文精品| 国产精品白丝av| 91福利在线看| 日韩欧美在线网站| 亚洲同性同志一二三专区| 日本三级韩国三级欧美三级| 国产成人av电影在线观看| 在线影视一区二区三区| 精品国产伦理网| 亚洲精品乱码久久久久久日本蜜臀| 三级在线观看一区二区| 成人激情视频网站| 6080yy午夜一二三区久久| 国产精品女同一区二区三区| 日韩激情在线观看| 久久久av毛片精品| 亚洲一区二区三区在线看| 精品亚洲欧美一区| 欧美日韩中文字幕一区| 国产视频一区不卡| 同产精品九九九| 99国产精品久久久久久久久久 | 99久久精品国产观看| 日韩一区二区三区免费看 | 久久99精品久久只有精品| 成人国产电影网| 日韩欧美专区在线| 亚洲免费av高清| 国产剧情av麻豆香蕉精品| 欧美日韩国产系列| 亚洲精品国产精品乱码不99| 国产激情精品久久久第一区二区 | 亚洲国产精品ⅴa在线观看| 性久久久久久久久| 成人一区二区三区视频在线观看 | 国产盗摄一区二区| 欧美一区二区三区在线观看视频| 亚洲欧洲日韩一区二区三区| 韩国三级中文字幕hd久久精品| 在线观看日韩一区| 一色桃子久久精品亚洲| 国模无码大尺度一区二区三区| 欧美午夜电影网| 亚洲欧洲综合另类| www.欧美亚洲| 国产精品久久久久一区二区三区| 久久av资源网| 日韩无一区二区| 视频在线观看91| 欧美日韩大陆一区二区| 夜夜嗨av一区二区三区中文字幕 | 另类调教123区| 4438x亚洲最大成人网| 亚洲国产精品一区二区www| 色菇凉天天综合网| 亚洲欧美另类小说视频| 91一区二区三区在线观看| 国产精品久久久久久久岛一牛影视 | 在线免费一区三区| 中文字幕欧美一| 91免费看`日韩一区二区| 欧美激情一区二区三区全黄| 国产成人夜色高潮福利影视| 久久综合九色综合97婷婷女人 | 麻豆成人免费电影| 日韩一区二区高清| 精品中文字幕一区二区| 日韩免费在线观看| 美女视频一区二区三区| 欧美r级在线观看| 国产精品一区二区久激情瑜伽| 国产亚洲一本大道中文在线| 国产91丝袜在线18| 亚洲啪啪综合av一区二区三区| 色香蕉成人二区免费| 亚洲一区二区四区蜜桃| 在线电影欧美成精品| 美女视频黄 久久| 国产亚洲成年网址在线观看| 波波电影院一区二区三区| 成人午夜激情影院| 中文字幕色av一区二区三区| 91女厕偷拍女厕偷拍高清| 亚洲va在线va天堂| 欧美成人官网二区| 国产成人精品一区二区三区网站观看| 国产欧美一区二区精品性色| av不卡免费电影| 亚洲成人一区在线| 精品久久久久久久久久久久久久久| 国产成人欧美日韩在线电影| 自拍偷拍欧美精品| 欧美人xxxx| 国产乱人伦偷精品视频不卡| 国产精品青草综合久久久久99| 99综合影院在线| 五月天亚洲精品| 国产三级精品视频| 一本高清dvd不卡在线观看| 婷婷成人激情在线网| 久久久久国产精品厨房| 日本韩国精品在线| 久久成人18免费观看| 最新热久久免费视频| 欧美剧在线免费观看网站| 国内欧美视频一区二区| 亚洲欧美另类小说| 欧美mv日韩mv国产| 91色视频在线| 精品无码三级在线观看视频| 亚洲男帅同性gay1069| 日韩午夜激情视频| 色呦呦国产精品| 国产在线精品一区在线观看麻豆| 一级女性全黄久久生活片免费| 欧美va日韩va| 欧美日韩一级大片网址| 国产福利一区二区三区视频在线| 亚洲综合成人在线视频| 国产日韩高清在线| 日韩无一区二区| 欧美伊人久久大香线蕉综合69| 国产伦精品一区二区三区免费迷| 色94色欧美sute亚洲线路一久| 国产一区二区电影| 日本中文在线一区| 亚洲日韩欧美一区二区在线| 久久久不卡网国产精品一区| 制服视频三区第一页精品| 97精品久久久久中文字幕| 国产综合久久久久久鬼色| 日一区二区三区|