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

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

?? port.c

?? FreeRTOS 2.5源碼
?? C
字號(hào):
/*
	FreeRTOS V2.5.0 - Copyright (C) 2003, 2004 Richard Barry.

	This file is part of the FreeRTOS distribution.

	FreeRTOS 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 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; 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, 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.
	***************************************************************************
*/

#include <stdlib.h>
#include <avr/interrupt.h>
#include <avr/signal.h>

#include "projdefs.h"
#include "portable.h"
#include "task.h"

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

/* Start tasks with interrupts enables. */
#define portFLAGS_INT_ENABLED					( ( portSTACK_TYPE ) 0x80 )

/* Hardware constants for timer 1. */
#define portCLEAR_COUNTER_ON_MATCH				( ( unsigned portCHAR ) 0x08 )
#define portPRESCALE_256						( ( unsigned portCHAR ) 0x04 )
#define portCLOCK_PRESCALER						( ( unsigned portLONG ) 256 )
#define portCOMPARE_MATCH_A_INTERRUPT_ENABLE	( ( unsigned portCHAR ) 0x10 )

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

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

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

/* 
 * Macro to save all the general purpose registers, the save the stack pointer
 * into the TCB.  
 * 
 * The first thing we do is save the flags then disable interrupts.  This is to 
 * guard our stack against having a context switch interrupt after we have already 
 * pushed the registers onto the stack - causing the 32 registers to be on the 
 * stack twice. 
 * 
 * r1 is set to zero as the compiler expects it to be thus, however some
 * of the math routines make use of R1. 
 * 
 * The interrupts will have been disabled during the call to portSAVE_CONTEXT()
 * so we need not worry about reading/writing to the stack pointer. 
 */

#define portSAVE_CONTEXT()									\
	asm volatile (	"push	r0						\n\t"	\
					"in		r0, __SREG__			\n\t"	\
					"cli							\n\t"	\
					"push	r0						\n\t"	\
					"push	r1						\n\t"	\
					"clr	r1						\n\t"	\
					"push	r2						\n\t"	\
					"push	r3						\n\t"	\
					"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"	\
					"push	r16						\n\t"	\
					"push	r17						\n\t"	\
					"push	r18						\n\t"	\
					"push	r19						\n\t"	\
					"push	r20						\n\t"	\
					"push	r21						\n\t"	\
					"push	r22						\n\t"	\
					"push	r23						\n\t"	\
					"push	r24						\n\t"	\
					"push	r25						\n\t"	\
					"push	r26						\n\t"	\
					"push	r27						\n\t"	\
					"push	r28						\n\t"	\
					"push	r29						\n\t"	\
					"push	r30						\n\t"	\
					"push	r31						\n\t"	\
					"lds	r26, pxCurrentTCB		\n\t"	\
					"lds	r27, pxCurrentTCB + 1	\n\t"	\
					"in		r0, 0x3d				\n\t"	\
					"st		x+, r0					\n\t"	\
					"in		r0, 0x3e				\n\t"	\
					"st		x+, r0					\n\t"	\
				);

/* 
 * Opposite to portSAVE_CONTEXT().  Interrupts will have been disabled during
 * the context save so we can write to the stack pointer. 
 */

#define portRESTORE_CONTEXT()								\
	asm volatile (	"lds	r26, pxCurrentTCB		\n\t"	\
					"lds	r27, pxCurrentTCB + 1	\n\t"	\
					"ld		r28, x+					\n\t"	\
					"out	__SP_L__, r28			\n\t"	\
					"ld		r29, x+					\n\t"	\
					"out	__SP_H__, r29			\n\t"	\
					"pop	r31						\n\t"	\
					"pop	r30						\n\t"	\
					"pop	r29						\n\t"	\
					"pop	r28						\n\t"	\
					"pop	r27						\n\t"	\
					"pop	r26						\n\t"	\
					"pop	r25						\n\t"	\
					"pop	r24						\n\t"	\
					"pop	r23						\n\t"	\
					"pop	r22						\n\t"	\
					"pop	r21						\n\t"	\
					"pop	r20						\n\t"	\
					"pop	r19						\n\t"	\
					"pop	r18						\n\t"	\
					"pop	r17						\n\t"	\
					"pop	r16						\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"	\
					"pop	r3						\n\t"	\
					"pop	r2						\n\t"	\
					"pop	r1						\n\t"	\
					"pop	r0						\n\t"	\
					"out	__SREG__, r0			\n\t"	\
					"pop	r0						\n\t"	\
				);

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

/*
 * Perform hardware setup to enable ticks from timer 1, compare match A.
 */
static void prvSetupTimerInterrupt( void );
/*-----------------------------------------------------------*/

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

	/* Place a few bytes of known values on the bottom of the stack. 
	This is just useful for debugging. */

	*pxTopOfStack = 0x11;
	pxTopOfStack--;
	*pxTopOfStack = 0x22;
	pxTopOfStack--;
	*pxTopOfStack = 0x33;
	pxTopOfStack--;

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

	/*lint -e950 -e611 -e923 Lint doesn't like this much - but nothing I can do about it. */

	/* The start of the task code will be popped off the stack last, so place
	it on first. */
	usAddress = ( unsigned portSHORT ) pxCode;
	*pxTopOfStack = ( portSTACK_TYPE ) ( usAddress & ( unsigned portSHORT ) 0x00ff );
	pxTopOfStack--;

	usAddress >>= 8;
	*pxTopOfStack = ( portSTACK_TYPE ) ( usAddress & ( unsigned portSHORT ) 0x00ff );
	pxTopOfStack--;

	/* Next simulate the stack as if after a call to portSAVE_CONTEXT().  
	portSAVE_CONTEXT places the flags on the stack immediately after r0
	to ensure the interrupts get disabled as soon as possible, and so ensuring
	the stack use is minimal should a context switch interrupt occur. */
	*pxTopOfStack = ( portSTACK_TYPE ) 0x00;	/* R0 */
	pxTopOfStack--;
	*pxTopOfStack = portFLAGS_INT_ENABLED;
	pxTopOfStack--;


	/* Now the remaining registers.   The compiler expects R1 to be 0. */
	*pxTopOfStack = ( portSTACK_TYPE ) 0x00;	/* R1 */
	pxTopOfStack--;
	*pxTopOfStack = ( portSTACK_TYPE ) 0x02;	/* R2 */
	pxTopOfStack--;
	*pxTopOfStack = ( portSTACK_TYPE ) 0x03;	/* R3 */
	pxTopOfStack--;
	*pxTopOfStack = ( portSTACK_TYPE ) 0x04;	/* R4 */
	pxTopOfStack--;
	*pxTopOfStack = ( portSTACK_TYPE ) 0x05;	/* R5 */
	pxTopOfStack--;
	*pxTopOfStack = ( portSTACK_TYPE ) 0x06;	/* R6 */
	pxTopOfStack--;
	*pxTopOfStack = ( portSTACK_TYPE ) 0x07;	/* R7 */
	pxTopOfStack--;
	*pxTopOfStack = ( portSTACK_TYPE ) 0x08;	/* R8 */
	pxTopOfStack--;
	*pxTopOfStack = ( portSTACK_TYPE ) 0x09;	/* R9 */
	pxTopOfStack--;
	*pxTopOfStack = ( portSTACK_TYPE ) 0x10;	/* R10 */
	pxTopOfStack--;
	*pxTopOfStack = ( portSTACK_TYPE ) 0x11;	/* R11 */
	pxTopOfStack--;
	*pxTopOfStack = ( portSTACK_TYPE ) 0x12;	/* R12 */
	pxTopOfStack--;
	*pxTopOfStack = ( portSTACK_TYPE ) 0x13;	/* R13 */
	pxTopOfStack--;
	*pxTopOfStack = ( portSTACK_TYPE ) 0x14;	/* R14 */
	pxTopOfStack--;
	*pxTopOfStack = ( portSTACK_TYPE ) 0x15;	/* R15 */
	pxTopOfStack--;
	*pxTopOfStack = ( portSTACK_TYPE ) 0x16;	/* R16 */
	pxTopOfStack--;
	*pxTopOfStack = ( portSTACK_TYPE ) 0x17;	/* R17 */
	pxTopOfStack--;
	*pxTopOfStack = ( portSTACK_TYPE ) 0x18;	/* R18 */
	pxTopOfStack--;
	*pxTopOfStack = ( portSTACK_TYPE ) 0x19;	/* R19 */
	pxTopOfStack--;
	*pxTopOfStack = ( portSTACK_TYPE ) 0x20;	/* R20 */
	pxTopOfStack--;
	*pxTopOfStack = ( portSTACK_TYPE ) 0x21;	/* R21 */
	pxTopOfStack--;
	*pxTopOfStack = ( portSTACK_TYPE ) 0x22;	/* R22 */
	pxTopOfStack--;
	*pxTopOfStack = ( portSTACK_TYPE ) 0x23;	/* R23 */
	pxTopOfStack--;

	/* Place the parameter on the stack in the expected location. */
	usAddress = ( unsigned portSHORT ) pvParameters;
	*pxTopOfStack = ( portSTACK_TYPE ) ( usAddress & ( unsigned portSHORT ) 0x00ff );
	pxTopOfStack--;

	usAddress >>= 8;
	*pxTopOfStack = ( portSTACK_TYPE ) ( usAddress & ( unsigned portSHORT ) 0x00ff );
	pxTopOfStack--;

	*pxTopOfStack = ( portSTACK_TYPE ) 0x26;	/* R26 X */
	pxTopOfStack--;
	*pxTopOfStack = ( portSTACK_TYPE ) 0x27;	/* R27 */
	pxTopOfStack--;
	*pxTopOfStack = ( portSTACK_TYPE ) 0x28;	/* R28 Y */
	pxTopOfStack--;
	*pxTopOfStack = ( portSTACK_TYPE ) 0x29;	/* R29 */
	pxTopOfStack--;
	*pxTopOfStack = ( portSTACK_TYPE ) 0x30;	/* R30 Z */
	pxTopOfStack--;
	*pxTopOfStack = ( portSTACK_TYPE ) 0x031;	/* R31 */
	pxTopOfStack--;

	/*lint +e950 +e611 +e923 */

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

portSHORT sPortStartScheduler( portSHORT sUsePreemption )
{
	/* In this port we ignore the parameter and use the portUSE_PREEMPTION
	definition instead. */

	/* Setup the hardware to generate the tick. */
	prvSetupTimerInterrupt();

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

	/* Simulate a function call end as generated by the compiler.  We will now
	jump to the start of the task the context of which we have just restored. */
	asm volatile ( "ret" );

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

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

/*
 * Manual context switch.  The first thing we do is save the registers so we
 * can use a naked attribute.
 */
void vPortYield( void ) __attribute__ ( ( naked ) );
void vPortYield( void )
{
	portSAVE_CONTEXT();
	vTaskSwitchContext();
	portRESTORE_CONTEXT();

	asm volatile ( "ret" );
}
/*-----------------------------------------------------------*/

/*
 * Context switch function used by the tick.  This must be identical to 
 * vPortYield() from the call to vTaskSwitchContext() onwards.  The only
 * difference from vPortYield() is the tick count is incremented as the
 * call comes from the tick ISR.
 */
void vPortYieldFromTick( void ) __attribute__ ( ( naked ) );
void vPortYieldFromTick( void )
{
	portSAVE_CONTEXT();
	vTaskIncrementTick();
	vTaskSwitchContext();
	portRESTORE_CONTEXT();

	asm volatile ( "ret" );
}
/*-----------------------------------------------------------*/

/*
 * Setup timer 1 compare match A to generate a tick interrupt.
 */
static void prvSetupTimerInterrupt( void )
{
unsigned portLONG ulCompareMatch;
unsigned portCHAR ucHighByte, ucLowByte;

	/* Using 16bit timer 1 to generate the tick.  Correct fuses must be
	selected for the portCPU_CLOCK_HZ clock. */

	ulCompareMatch = portCPU_CLOCK_HZ / portTICK_RATE_HZ;

	/* We only have 16 bits so have to scale to get our required tick rate. */
	ulCompareMatch /= portCLOCK_PRESCALER;

	/* Setup compare match value for compare match A.  Interrupts are disabled 
	before this is called so we need not worry here. */
	ucLowByte = ( unsigned portCHAR ) ( ulCompareMatch & ( unsigned portLONG ) 0xff );
	ulCompareMatch >>= 8;
	ucHighByte = ( unsigned portCHAR ) ( ulCompareMatch & ( unsigned portLONG ) 0xff );
	outb( OCR1AH, ucHighByte );
	outb( OCR1AL, ucLowByte );

	/* Setup clock source and compare match behaviour. */
	ucLowByte = portCLEAR_COUNTER_ON_MATCH | portPRESCALE_256;
	outb( TCCR1B, ucLowByte );

	/* Enable the interrupt - this is okay as interrupt are currently globally
	disabled. */
	ucLowByte = inb( TIMSK );
	ucLowByte |= portCOMPARE_MATCH_A_INTERRUPT_ENABLE;
	outb( TIMSK, ucLowByte );
}
/*-----------------------------------------------------------*/

#if portUSE_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.
	 */
	void SIG_OUTPUT_COMPARE1A( void ) __attribute__ ( ( signal, naked ) );
	void SIG_OUTPUT_COMPARE1A( void )
	{
		vPortYieldFromTick();
		asm volatile ( "reti" );
	}
#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();
	 */
	void SIG_OUTPUT_COMPARE1A( void ) __attribute__ ( ( signal ) );
	void SIG_OUTPUT_COMPARE1A( void )
	{
		vTaskIncrementTick();
	}
#endif


	

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美日韩情趣电影| 欧美成人一区二区三区在线观看| 午夜精品一区二区三区电影天堂 | 欧美久久久久久久久| 国产麻豆91精品| 午夜日韩在线观看| 亚洲人成精品久久久久久| 日韩欧美国产精品一区| 色综合久久综合中文综合网| 国产综合色产在线精品| 婷婷国产在线综合| 亚洲精品中文字幕乱码三区| 久久综合九色综合97婷婷| 欧美性猛交xxxx乱大交退制版 | 国产欧美一区二区三区沐欲| 欧美在线你懂的| 成人av网在线| 国产一区二区三区在线看麻豆| 日韩中文字幕区一区有砖一区| 玉足女爽爽91| 18欧美乱大交hd1984| 国产精品污www在线观看| 欧美va亚洲va香蕉在线| 欧美日本一区二区三区| 欧美在线制服丝袜| 91精彩视频在线| 91在线观看视频| 99re热视频这里只精品| bt7086福利一区国产| 床上的激情91.| 国产精品一区二区在线观看不卡 | 国产一区二区不卡老阿姨| 美女免费视频一区二区| 免费在线看一区| 日韩成人av影视| 日韩av午夜在线观看| 亚洲成av人片在线| 舔着乳尖日韩一区| 日韩精品久久理论片| 免费人成黄页网站在线一区二区| 午夜成人免费视频| 亚洲第一二三四区| 婷婷国产在线综合| 美洲天堂一区二卡三卡四卡视频| 全国精品久久少妇| 极品美女销魂一区二区三区| 精品亚洲国内自在自线福利| 国内精品在线播放| 国产剧情av麻豆香蕉精品| 国产尤物一区二区在线| 国产精品亚洲专一区二区三区| 粉嫩av一区二区三区在线播放| 国产大陆精品国产| www.成人在线| 欧美三片在线视频观看| 91精品国产综合久久小美女| 91精品国产综合久久香蕉麻豆| 日韩一区二区三区四区五区六区| 91麻豆精品91久久久久同性| 欧美一区二区三级| 精品国免费一区二区三区| 久久―日本道色综合久久| 欧美精彩视频一区二区三区| 亚洲欧洲成人精品av97| 亚洲图片一区二区| 奇米精品一区二区三区四区| 国产精品资源在线看| 99精品视频在线免费观看| 欧美午夜免费电影| 精品三级av在线| 国产精品天天看| 亚洲一区在线视频观看| 蜜桃一区二区三区四区| 国产91对白在线观看九色| 欧美专区亚洲专区| 精品久久国产字幕高潮| 国产精品另类一区| 午夜伦欧美伦电影理论片| 国产丶欧美丶日本不卡视频| 欧美在线短视频| 日韩三级免费观看| 亚洲天堂免费看| 久久电影网电视剧免费观看| 成人av在线资源网站| 欧美日韩国产在线观看| 国产日本一区二区| 成人网男人的天堂| 欧美另类z0zxhd电影| 国产免费观看久久| 午夜在线成人av| zzijzzij亚洲日本少妇熟睡| 欧美嫩在线观看| 国产精品久久久久影院色老大| 肉色丝袜一区二区| 北条麻妃一区二区三区| 日韩一级视频免费观看在线| 亚洲免费看黄网站| 久久精品噜噜噜成人av农村| 色哟哟一区二区三区| 久久综合给合久久狠狠狠97色69| 亚洲欧美偷拍三级| 国产精品69毛片高清亚洲| 7777精品伊人久久久大香线蕉的 | 成人av在线观| 日韩欧美一级二级| 亚洲精品国产无套在线观| 国产曰批免费观看久久久| 欧美三区在线视频| 亚洲乱码精品一二三四区日韩在线| 久久www免费人成看片高清| 91黄色免费版| 亚洲欧美经典视频| 成人一区在线看| 久久网这里都是精品| 日韩和欧美的一区| 欧美日韩一区在线| 一区二区三区在线免费观看| 成人综合日日夜夜| 久久久精品日韩欧美| 另类中文字幕网| 91精品国产综合久久福利| 亚洲高清视频中文字幕| 日本精品视频一区二区三区| ...中文天堂在线一区| 不卡一区在线观看| 国产欧美精品日韩区二区麻豆天美| 日韩av不卡在线观看| 欧美精品成人一区二区三区四区| 亚洲综合成人在线视频| 色婷婷久久综合| 一级女性全黄久久生活片免费| 99国产精品久久久| 最新中文字幕一区二区三区| av一区二区三区在线| 国产精品久久久久久久久动漫| 成人黄色免费短视频| 1区2区3区欧美| 色综合久久中文综合久久牛| 自拍偷拍欧美精品| 在线免费不卡视频| 香蕉加勒比综合久久| 欧美精品视频www在线观看| 日韩高清不卡一区二区三区| 欧美精品v日韩精品v韩国精品v| 日韩高清在线不卡| 精品免费一区二区三区| 国产一区不卡精品| 中文字幕制服丝袜一区二区三区 | 欧美一级高清片| 美国十次了思思久久精品导航| 精品不卡在线视频| 国产成人一区在线| 亚洲乱码精品一二三四区日韩在线| 欧美系列在线观看| 日韩国产欧美三级| 久久久久国产成人精品亚洲午夜| 成人理论电影网| 亚洲精品成人在线| 欧美一区二区三区免费大片 | 欧美自拍丝袜亚洲| 免费精品99久久国产综合精品| 久久久久久麻豆| 91欧美激情一区二区三区成人| 亚洲综合999| 日韩欧美一级二级| 99国产精品久久久久久久久久久| 一区二区高清视频在线观看| 欧美一级艳片视频免费观看| 国产一区二区免费视频| 亚洲色图欧洲色图婷婷| 欧美一区二区三区在线看| 风流少妇一区二区| 一区二区三区免费看视频| 日韩一区二区三区观看| 成人国产精品免费观看动漫| 午夜电影网一区| 日本一区二区免费在线观看视频| 欧美午夜精品久久久久久超碰| 久久国内精品视频| 亚洲美女视频在线| 久久一二三国产| 色欧美片视频在线观看| 黄色小说综合网站| 亚洲国产一区二区三区青草影视| 2023国产精品视频| 欧美在线免费观看亚洲| 国产精品亚洲专一区二区三区 | 99视频超级精品| 人禽交欧美网站| 亚洲免费资源在线播放| 日韩精品中文字幕在线一区| 99vv1com这只有精品| 紧缚捆绑精品一区二区| 亚洲午夜精品17c| 国产精品毛片久久久久久| 日韩欧美在线一区二区三区| 色av一区二区| 成人在线综合网| 久久97超碰国产精品超碰| 亚洲成人中文在线|