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

	+ Introduced the configKERNEL_INTERRUPT_PRIORITY definition.
*/

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

/* Defined for backward compatability with project created prior to 
FreeRTOS.org V4.3.0. */
#ifndef configKERNEL_INTERRUPT_PRIORITY
	#define configKERNEL_INTERRUPT_PRIORITY 1
#endif

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

#if configKERNEL_INTERRUPT_PRIORITY != 1
	#error If configKERNEL_INTERRUPT_PRIORITY is not 1 then the #32 in the following macros needs changing to equal the portINTERRUPT_BITS value, which is ( configKERNEL_INTERRUPT_PRIORITY << 5 )
#endif

#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	#32, 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	#32, 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 = configKERNEL_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__, auto_psv)) _T1Interrupt( void )
{
	vTaskIncrementTick();

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

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

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美国产精品一区二区三区| 久久久久久亚洲综合影院红桃| 精品国产一区二区三区久久影院| 亚洲另类在线制服丝袜| 国产成人精品影院| 欧美精品一区二| 免费看欧美女人艹b| 欧美日韩国产色站一区二区三区| **性色生活片久久毛片| 波多野结衣在线一区| 91免费国产在线观看| 亚洲综合区在线| 一本色道久久综合亚洲91| 中文字幕第一区第二区| 日韩一级片在线播放| 日日夜夜免费精品| 欧美精品日韩一区| 精品一区二区精品| 久久久不卡网国产精品一区| 欧美精品在线观看播放| 91免费国产视频网站| 国产在线不卡视频| 日本一二三不卡| 精品久久一区二区三区| av在线一区二区| 国产激情一区二区三区桃花岛亚洲| 日韩激情视频网站| 亚洲精品免费视频| 国产精品国产成人国产三级| 欧美日韩精品系列| 一本一道久久a久久精品综合蜜臀| 国产成人av影院| 国产真实乱对白精彩久久| 成人欧美一区二区三区1314| 久久久久久久久99精品| 日韩精品一区二区三区视频播放| 国产成人免费视频网站高清观看视频 | 欧美性极品少妇| 日韩精品一二三区| 亚洲国产美国国产综合一区二区| 91精品国产综合久久福利| 国产精品一区二区在线看| 亚洲美女视频在线| 欧美电视剧在线观看完整版| 51午夜精品国产| 国产福利不卡视频| 国产成人综合在线播放| 国产精品99久久久久久久女警| 国产综合色产在线精品| 国产一区二区不卡在线| 国产精品资源站在线| 成人午夜免费视频| 免费的成人av| 久久69国产一区二区蜜臀 | 99久久精品国产一区二区三区| 日韩影院免费视频| 美女精品一区二区| 亚洲视频综合在线| 精品久久国产老人久久综合| 精品国产伦一区二区三区免费| 精品91自产拍在线观看一区| 久久久久久久电影| 欧美国产综合色视频| 亚洲欧美色综合| 日日噜噜夜夜狠狠视频欧美人| 青草av.久久免费一区| 国产综合久久久久久鬼色| 成人激情视频网站| 欧美亚洲一区二区在线| 日韩免费一区二区三区在线播放| 欧美成人乱码一区二区三区| 国产日韩欧美在线一区| 欧美电影一区二区三区| 欧美变态凌虐bdsm| 国产精品无人区| 久久蜜桃一区二区| 中文字幕一区二区在线播放| 亚洲综合免费观看高清完整版在线| 婷婷久久综合九色国产成人| 亚洲永久精品大片| 久久66热偷产精品| 日本久久电影网| 97精品久久久久中文字幕| 精品视频一区三区九区| 欧美日韩一级视频| 久久久一区二区三区| 亚洲男人天堂av| 蜜臀av性久久久久蜜臀aⅴ四虎 | 亚洲福利电影网| 国产在线日韩欧美| 欧美在线|欧美| 在线观看国产日韩| 2021国产精品久久精品| 亚洲激情网站免费观看| 精品一二三四区| 欧美午夜不卡在线观看免费| xnxx国产精品| 午夜成人在线视频| 9人人澡人人爽人人精品| 91精品国产综合久久国产大片| 中文字幕一区二区在线观看| 免费黄网站欧美| 色拍拍在线精品视频8848| 久久综合九色综合久久久精品综合 | 亚洲欧美日韩国产成人精品影院 | 国产成人综合亚洲网站| 欧美美女直播网站| 国产精品视频第一区| 日韩成人av影视| 国产剧情在线观看一区二区| 欧美性淫爽ww久久久久无| 国产亚洲成av人在线观看导航 | 91在线国产观看| 久久久一区二区三区捆绑**| 日韩高清国产一区在线| 色婷婷综合久久| 专区另类欧美日韩| 成人午夜视频在线| 2021中文字幕一区亚洲| 日韩精品福利网| 欧美三级视频在线观看| 国产精品美女一区二区| 国产一区二区网址| 日韩一二三四区| 天天综合天天综合色| 欧美系列在线观看| 亚洲男人的天堂一区二区| 丁香天五香天堂综合| 99久久国产综合精品色伊| 国产清纯美女被跳蛋高潮一区二区久久w | 91原创在线视频| 国产精品你懂的在线欣赏| 国产成人在线免费| 久久精品视频在线看| 国内成人精品2018免费看| 日韩欧美激情四射| 丝袜美腿高跟呻吟高潮一区| 91成人免费在线| 一区二区在线看| 欧美综合欧美视频| 亚洲自拍偷拍综合| 欧美日韩国产首页| 日本免费在线视频不卡一不卡二| 777午夜精品免费视频| 天天综合天天综合色| 欧美一区二区成人6969| 免费观看一级特黄欧美大片| 日韩视频在线一区二区| 久久99精品国产麻豆婷婷洗澡| 欧美tickling挠脚心丨vk| 久久精品久久久精品美女| 91一区二区三区在线观看| 亚洲精品亚洲人成人网| 欧美午夜不卡视频| 美腿丝袜一区二区三区| 久久女同性恋中文字幕| 成人小视频在线观看| 亚洲青青青在线视频| 欧美美女黄视频| 久久66热偷产精品| 国产精品超碰97尤物18| 在线中文字幕不卡| 蜜臀精品久久久久久蜜臀| 精品久久久久香蕉网| 99久久国产综合精品女不卡| 又紧又大又爽精品一区二区| 欧美三区在线观看| 精品伊人久久久久7777人| 中文字幕av资源一区| 欧美在线观看一区二区| 免费成人在线观看| 欧美激情一区二区在线| 色94色欧美sute亚洲线路一久| 三级不卡在线观看| 久久久久久久综合日本| 色网站国产精品| 玖玖九九国产精品| 国产精品乱码人人做人人爱| 欧美视频一区二| 国产又黄又大久久| 一区二区免费在线播放| 白白色 亚洲乱淫| 婷婷六月综合亚洲| 一区二区中文视频| 91精品一区二区三区在线观看| 风间由美一区二区av101| 亚洲国产日韩精品| 欧美国产成人精品| 91精品午夜视频| 97久久人人超碰| 精品亚洲免费视频| 亚洲综合一区二区三区| 国产区在线观看成人精品| 在线成人免费观看| 不卡高清视频专区| 国产尤物一区二区| 天天av天天翘天天综合网| 欧美国产综合一区二区| 精品奇米国产一区二区三区| 色综合激情五月|