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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? port.c

?? MCS-51的一個Free小型操作系統(tǒng),在KeilC中下編譯工作
?? C
字號:
/*
	FreeRTOS.org V4.1.3 - Copyright (C) 2003-2006 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.
	***************************************************************************
*/

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

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

/* Hardware specifics. */
#define portBIT_SET 1
#define portTIMER_PRESCALE 8
#define portINITIAL_SR	0

/* The program counter is only 23 bits. */
#define portUNUSED_PR_BITS	0x7f

/* Records the nesting depth of calls to portENTER_CRITICAL(). */
unsigned portBASE_TYPE uxCriticalNesting = 0xef;

#ifdef MPLAB_PIC24_PORT

	#define portRESTORE_CONTEXT()																						\
		asm volatile(	"MOV	_pxCurrentTCB, W0		\n"	/* Restore the stack pointer for the task. */				\
						"MOV	[W0], W15				\n"																\
						"POP	W0						\n"	/* Restore the critical nesting counter for the task. */	\
						"MOV	W0, _uxCriticalNesting	\n"																\
						"POP	PSVPAG					\n"																\
						"POP	CORCON					\n"																\
						"POP	TBLPAG					\n"																\
						"POP	RCOUNT					\n"	/* Restore the registers from the stack. */					\
						"POP	W14						\n"																\
						"POP.D	W12						\n"																\
						"POP.D	W10						\n"																\
						"POP.D	W8						\n"																\
						"POP.D	W6						\n"																\
						"POP.D	W4						\n"																\
						"POP.D	W2						\n"																\
						"POP.D	W0						\n"																\
						"POP	SR						  " );


	#define portSAVE_CONTEXT()																							\
		asm volatile(	"PUSH	SR						\n"	/* Save the SR used by the task.... */						\
						"PUSH	W0						\n"	/* ....then disable interrupts. */							\
						"MOV	#224, W0				\n"																\
						"MOV	W0, SR					\n"																\
						"PUSH	W1						\n"	/* Save registers to the stack. */							\
						"PUSH.D	W2						\n"																\
						"PUSH.D	W4						\n"																\
						"PUSH.D	W6						\n"																\
						"PUSH.D W8						\n"																\
						"PUSH.D W10						\n"																\
						"PUSH.D	W12						\n"																\
						"PUSH	W14						\n"																\
						"PUSH	RCOUNT					\n"																\
						"PUSH	TBLPAG					\n"																\
						"PUSH	CORCON					\n"																\
						"PUSH	PSVPAG					\n"																\
						"MOV	_uxCriticalNesting, W0	\n"	/* Save the critical nesting counter for the task. */		\
						"PUSH	W0						\n"																\
						"MOV	_pxCurrentTCB, W0		\n"	/* Save the new top of stack into the TCB. */				\
						"MOV	W15, [W0]				  ");

#endif /* MPLAB_PIC24_PORT */

#ifdef MPLAB_DSPIC_PORT

	#define portRESTORE_CONTEXT()																						\
		asm volatile(	"MOV	_pxCurrentTCB, W0		\n"	/* Restore the stack pointer for the task. */				\
						"MOV	[W0], W15				\n"																\
						"POP	W0						\n"	/* Restore the critical nesting counter for the task. */	\
						"MOV	W0, _uxCriticalNesting	\n"																\
						"POP	PSVPAG					\n"																\
						"POP	CORCON					\n"																\
						"POP	DOENDH					\n"																\
						"POP	DOENDL					\n"																\
						"POP	DOSTARTH				\n"																\
						"POP	DOSTARTL				\n"																\
						"POP	DCOUNT					\n"																\
						"POP	ACCBU					\n"																\
						"POP	ACCBH					\n"																\
						"POP	ACCBL					\n"																\
						"POP	ACCAU					\n"																\
						"POP	ACCAH					\n"																\
						"POP	ACCAL					\n"																\
						"POP	TBLPAG					\n"																\
						"POP	RCOUNT					\n"	/* Restore the registers from the stack. */					\
						"POP	W14						\n"																\
						"POP.D	W12						\n"																\
						"POP.D	W10						\n"																\
						"POP.D	W8						\n"																\
						"POP.D	W6						\n"																\
						"POP.D	W4						\n"																\
						"POP.D	W2						\n"																\
						"POP.D	W0						\n"																\
						"POP	SR						  " );


	#define portSAVE_CONTEXT()																							\
		asm volatile(	"PUSH	SR						\n"	/* Save the SR used by the task.... */						\
						"PUSH	W0						\n"	/* ....then disable interrupts. */							\
						"MOV	#224, W0				\n"																\
						"MOV	W0, SR					\n"																\
						"PUSH	W1						\n"	/* Save registers to the stack. */							\
						"PUSH.D	W2						\n"																\
						"PUSH.D	W4						\n"																\
						"PUSH.D	W6						\n"																\
						"PUSH.D W8						\n"																\
						"PUSH.D W10						\n"																\
						"PUSH.D	W12						\n"																\
						"PUSH	W14						\n"																\
						"PUSH	RCOUNT					\n"																\
						"PUSH	TBLPAG					\n"																\
						"PUSH	ACCAL					\n"																\
						"PUSH	ACCAH					\n"																\
						"PUSH	ACCAU					\n"																\
						"PUSH	ACCBL					\n"																\
						"PUSH	ACCBH					\n"																\
						"PUSH	ACCBU					\n"																\
						"PUSH	DCOUNT					\n"																\
						"PUSH	DOSTARTL				\n"																\
						"PUSH	DOSTARTH				\n"																\
						"PUSH	DOENDL					\n"																\
						"PUSH	DOENDH					\n"																\
						"PUSH	CORCON					\n"																\
						"PUSH	PSVPAG					\n"																\
						"MOV	_uxCriticalNesting, W0	\n"	/* Save the critical nesting counter for the task. */		\
						"PUSH	W0						\n"																\
						"MOV	_pxCurrentTCB, W0		\n"	/* Save the new top of stack into the TCB. */				\
						"MOV	W15, [W0]				  " );

#endif /* MPLAB_DSPIC_PORT */

/*
 * Setup the timer used to generate the tick interrupt.
 */
static void prvSetupTimerInterrupt( void );

/* 
 * See header file for description. 
 */
portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
{
unsigned portSHORT usCode;
portBASE_TYPE i;

const portSTACK_TYPE xInitialStack[] = 
{
	0x1111,	/* W1 */
	0x2222, /* W2 */
	0x3333, /* W3 */
	0x4444, /* W4 */
	0x5555, /* W5 */
	0x6666, /* W6 */
	0x7777, /* W7 */
	0x8888, /* W8 */
	0x9999, /* W9 */
	0xaaaa, /* W10 */
	0xbbbb, /* W11 */
	0xcccc, /* W12 */
	0xdddd, /* W13 */
	0xeeee, /* W14 */
	0xcdce, /* RCOUNT */
	0xabac, /* TBLPAG */

	/* dsPIC specific registers. */
	#ifdef MPLAB_DSPIC_PORT
		0x0202, /* ACCAL */
		0x0303, /* ACCAH */
		0x0404, /* ACCAU */
		0x0505, /* ACCBL */
		0x0606, /* ACCBH */
		0x0707, /* ACCBU */
		0x0808, /* DCOUNT */
		0x090a, /* DOSTARTL */
		0x1010, /* DOSTARTH */
		0x1110, /* DOENDL */
		0x1212, /* DOENDH */
	#endif
};

	/* Setup the stack as if a yield had occurred.

	Save the low bytes of the program counter. */
	usCode = ( unsigned portSHORT ) pxCode;
	*pxTopOfStack = ( portSTACK_TYPE ) usCode;
	pxTopOfStack++;

	/* Save the high byte of the program counter.  This will always be zero
	here as it is passed in a 16bit pointer.  If the address is greater than
	16 bits then the pointer will point to a jump table. */
	*pxTopOfStack = ( portSTACK_TYPE ) 0;
	pxTopOfStack++;

	/* Status register with interrupts enabled. */
	*pxTopOfStack = portINITIAL_SR;
	pxTopOfStack++;

	/* Parameters are passed in W0. */
	*pxTopOfStack = ( portSTACK_TYPE ) pvParameters;
	pxTopOfStack++;

	for( i = 0; i < ( sizeof( xInitialStack ) / sizeof( portSTACK_TYPE ) ); i++ )
	{
		*pxTopOfStack = xInitialStack[ i ];
		pxTopOfStack++;
	}

	*pxTopOfStack = CORCON;
	pxTopOfStack++;
	*pxTopOfStack = PSVPAG;
	pxTopOfStack++;

	/* Finally the critical nesting depth. */
	*pxTopOfStack = 0x00;
	pxTopOfStack++;

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

portBASE_TYPE xPortStartScheduler( void )
{
	/* Setup a timer for the tick ISR. */
	prvSetupTimerInterrupt(); 

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

	/* Simulate the end of the yield function. */
	asm volatile ( "return" );

	/* Should not reach here. */
	return pdTRUE;
}
/*-----------------------------------------------------------*/

void vPortEndScheduler( void )
{
	/* It is unlikely that the scheduler for the PIC port will get stopped
	once running.  If required disable the tick interrupt here, then return 
	to xPortStartScheduler(). */
}
/*-----------------------------------------------------------*/

/*
 * 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 )
{
	portSAVE_CONTEXT();
	vTaskSwitchContext();
	portRESTORE_CONTEXT();
}
/*-----------------------------------------------------------*/

/*
 * Setup a timer for a regular tick.
 */
static void prvSetupTimerInterrupt( void )
{
const unsigned portLONG ulCompareMatch = ( configCPU_CLOCK_HZ / portTIMER_PRESCALE ) / configTICK_RATE_HZ;

	/* Prescale of 8. */
	T1CON = 0;
	TMR1 = 0;

	PR1 = ( unsigned portSHORT ) ulCompareMatch;

	/* Setup timer 1 interrupt priority. */
	IPC0bits.T1IP = portKERNEL_INTERRUPT_PRIORITY;

	/* Clear the interrupt as a starting condition. */
	IFS0bits.T1IF = 0;

	/* Enable the interrupt. */
	IEC0bits.T1IE = 1;

	/* Setup the prescale value. */
	T1CONbits.TCKPS0 = 1;
	T1CONbits.TCKPS1 = 0;

	/* Start the timer. */
	T1CONbits.TON = 1;
}
/*-----------------------------------------------------------*/

void vPortEnterCritical( void )
{
	portDISABLE_INTERRUPTS();
	uxCriticalNesting++;
}
/*-----------------------------------------------------------*/

void vPortExitCritical( void )
{
	uxCriticalNesting--;
	if( uxCriticalNesting == 0 )
	{
		portENABLE_INTERRUPTS();
	}
}
/*-----------------------------------------------------------*/

void __attribute__((__interrupt__)) _T1Interrupt( void )
{
	vTaskIncrementTick();

	/* Clear the timer interrupt. */
	IFS0bits.T1IF = 0;

	#if configUSE_PREEMPTION == 1
		portYIELD();
	#endif
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
岛国精品在线观看| 精品国产一区二区三区忘忧草| 日韩免费成人网| 中文字幕亚洲精品在线观看| 激情综合一区二区三区| 欧美日韩大陆一区二区| 亚洲欧美日韩一区二区 | 国产福利一区二区三区视频| 欧美日韩国产综合久久| 亚洲天堂精品视频| 国产激情一区二区三区四区 | 日韩免费视频一区二区| 亚洲精品成人a在线观看| 成人一区二区三区| 久久影院午夜片一区| 亚洲成人777| av在线播放成人| 精品国产乱码久久久久久夜甘婷婷 | 欧美视频你懂的| 欧美激情资源网| 国产福利一区在线观看| 欧美一区二区三区播放老司机| 亚洲综合精品自拍| 成人视屏免费看| 精品久久久久av影院| 石原莉奈在线亚洲二区| 日本韩国一区二区三区| 亚洲婷婷在线视频| 国产成人精品综合在线观看| 久久综合资源网| 免费成人av在线| 91福利在线观看| ...xxx性欧美| 成人动漫视频在线| 国产精品对白交换视频 | 综合欧美亚洲日本| voyeur盗摄精品| 国产日韩欧美a| 国产精品亚洲第一区在线暖暖韩国| 欧美日韩成人综合| 日韩中文字幕av电影| 欧美日韩一二三区| 午夜视频在线观看一区| 91电影在线观看| 亚洲一区二区三区免费视频| 91年精品国产| |精品福利一区二区三区| 一本大道综合伊人精品热热| 综合久久久久久久| 欧美在线制服丝袜| 亚洲一卡二卡三卡四卡无卡久久| 欧美日韩一区二区电影| 亚洲成人av一区二区| 91精品国产乱码久久蜜臀| 亚洲v日本v欧美v久久精品| 91精品国产综合久久福利| 日韩国产精品久久| 欧美一级电影网站| 国产精品456| 国产清纯在线一区二区www| 99久久99久久精品国产片果冻| 国产精品视频麻豆| 国产成人精品三级麻豆| 国产精品免费av| 成人av电影免费观看| 日韩一区在线免费观看| 在线亚洲高清视频| 日本中文字幕一区二区视频| 91精品国产91热久久久做人人| 秋霞成人午夜伦在线观看| 欧美一级日韩不卡播放免费| 麻豆免费看一区二区三区| 精品日韩一区二区| 麻豆freexxxx性91精品| 久久亚洲精华国产精华液| 成人黄色一级视频| 亚洲天堂久久久久久久| 欧美一区二区三区婷婷月色| 日本sm残虐另类| 中文字幕国产一区二区| 97se亚洲国产综合自在线 | 2020国产精品自拍| 成人午夜伦理影院| 亚洲一级二级在线| 日韩一级片网站| 成人av网址在线观看| 亚洲三级在线播放| 日韩一区二区电影| 国产精品亚洲视频| 亚洲香蕉伊在人在线观| 欧美电影免费观看高清完整版在 | 亚洲人123区| 欧美午夜宅男影院| 激情另类小说区图片区视频区| 国产女主播视频一区二区| 91免费版在线| 热久久久久久久| 国产精品三级视频| 日韩亚洲欧美中文三级| 懂色av中文字幕一区二区三区| 婷婷丁香久久五月婷婷| 久久亚洲欧美国产精品乐播| 在线日韩av片| 国产精品中文有码| 亚洲福利视频一区二区| 久久综合五月天婷婷伊人| 在线免费观看日韩欧美| 九九久久精品视频| 亚洲一级二级在线| 国产性天天综合网| 在线电影院国产精品| 国产成人一级电影| 麻豆精品精品国产自在97香蕉| 国产精品不卡一区二区三区| 日韩一区二区三区av| 91丝袜美女网| 日本欧美在线观看| 亚洲日本一区二区| 久久久久久久久伊人| 欧美日韩成人激情| 91丨九色丨黑人外教| 国产精品一级片在线观看| 日日夜夜免费精品| 亚洲图片你懂的| 亚洲国产精品精华液ab| 91精品国产色综合久久不卡电影 | 国产亚洲综合av| 日韩精品一区二区三区视频播放| 91久久国产综合久久| 99精品视频中文字幕| 精彩视频一区二区| 久久国产人妖系列| 婷婷六月综合亚洲| 午夜一区二区三区视频| 亚洲色图一区二区三区| 中文乱码免费一区二区| 26uuu久久天堂性欧美| 精品免费国产二区三区| 在线综合视频播放| 欧美日韩卡一卡二| 99国内精品久久| 成人av资源站| 国产成a人亚洲| 国产成人在线色| 激情六月婷婷久久| 紧缚奴在线一区二区三区| 天天射综合影视| 日韩黄色片在线观看| 亚洲午夜免费视频| 午夜一区二区三区视频| 亚洲欧美国产毛片在线| 亚洲免费av观看| 亚洲欧洲日韩综合一区二区| 国产精品久久久久久久久免费桃花| 久久午夜老司机| 久久精品视频一区| 久久综合给合久久狠狠狠97色69| 精品捆绑美女sm三区| 欧美一区二区视频网站| 91麻豆精品91久久久久久清纯| 成人av在线资源网站| 粉嫩在线一区二区三区视频| 国产乱码精品一区二区三区忘忧草 | 亚洲一区二区欧美日韩| 2021国产精品久久精品| 国产午夜亚洲精品理论片色戒| 久久这里只精品最新地址| 精品国产乱码久久久久久久| wwww国产精品欧美| 久久老女人爱爱| 国产精品久久久久精k8 | 精品播放一区二区| 欧美电影免费观看高清完整版在 | 91视频一区二区三区| 97久久精品人人做人人爽| 在线国产亚洲欧美| 欧美亚男人的天堂| 91精品国产综合久久久久| 91精品国产全国免费观看| 精品sm在线观看| 欧美国产亚洲另类动漫| 樱桃国产成人精品视频| 中文字幕国产一区| 亚洲一区免费视频| 亚洲成人av在线电影| 天堂av在线一区| 久久国产尿小便嘘嘘| 国产精品亚洲人在线观看| 国产91丝袜在线观看| hitomi一区二区三区精品| 在线视频你懂得一区| 日韩精品一区二| 国产亚洲制服色| 亚洲一区二区黄色| 青青草伊人久久| 成人免费黄色大片| 欧美伊人久久久久久久久影院| 日韩精品在线一区二区| 国产精品美女久久久久av爽李琼 | 国产三级欧美三级日产三级99|