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

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

?? port.c

?? FreeRTOSV3.2.0 經典嵌入式操作系統
?? C
字號:
/*
	FreeRTOS V3.2.0 - Copyright (C) 2003 - 2005 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 "FreeRTOS.h"
#include "task.h"

/*-----------------------------------------------------------
 * Implementation of functions defined in portable.h for the AVR/IAR 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_64							( ( unsigned portCHAR ) 0x03 )
#define portCLOCK_PRESCALER						( ( unsigned portLONG ) 64 )
#define portCOMPARE_MATCH_A_INTERRUPT_ENABLE	( ( unsigned portCHAR ) 0x10 )

/* The number of bytes used on the hardware stack by the task start address. */
#define portBYTES_USED_BY_RETURN_ADDRESS		( 2 )
/*-----------------------------------------------------------*/

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

/*
 * The IAR compiler does not have full support for inline assembler, so
 * these are defined in the portmacro assembler file.
 */
extern void vPortYieldFromTick( void );
extern void vPortStart( void );

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

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

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

	/* Remember where the top of the hardware stack is - this is required
	below. */
	pxTopOfHardwareStack = pxTopOfStack;


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

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



	/* The IAR compiler requires two stacks per task.  First there is the
	hardware call stack which uses the AVR stack pointer.  Second there is the
	software stack (local variables, parameter passing, etc.) which uses the
	AVR Y register.
	
	This function places both stacks within the memory block passed in as the
	first parameter.  The hardware stack is placed at the bottom of the memory
	block.  A gap is then left for the hardware stack to grow.  Next the software
	stack is placed.  The amount of space between the software and hardware
	stacks is defined by configCALL_STACK_SIZE.



	The first part of the stack is the hardware stack.  Place the start
	address of the task on the hardware stack. */
	usAddress = ( unsigned portSHORT ) pxCode;
	*pxTopOfStack = ( portSTACK_TYPE ) ( usAddress & ( unsigned portSHORT ) 0x00ff );
	pxTopOfStack--;

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


	/* Leave enough space for the hardware stack before starting the software
	stack.  The '- 2' is because we have already used two spaces for the
	address of the start of the task. */
	pxTopOfStack -= ( configCALL_STACK_SIZE - 2 );



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

	/* Next place the address of the hardware stack.  This is required so
	the AVR stack pointer can be restored to point to the hardware stack. */
	pxTopOfHardwareStack -= portBYTES_USED_BY_RETURN_ADDRESS;
	usAddress = ( unsigned portSHORT ) pxTopOfHardwareStack;

	/* SPL */
	*pxTopOfStack = ( portSTACK_TYPE ) ( usAddress & ( unsigned portSHORT ) 0x00ff );
	pxTopOfStack--;

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




	/* Now the remaining registers. */
	*pxTopOfStack = ( portSTACK_TYPE ) 0x01;	/* 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--;

	/* 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 ) 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--;
	*pxTopOfStack = ( portSTACK_TYPE ) 0x24;	/* R24 */
	pxTopOfStack--;
	*pxTopOfStack = ( portSTACK_TYPE ) 0x25;	/* R25 */
	pxTopOfStack--;
	*pxTopOfStack = ( portSTACK_TYPE ) 0x26;	/* R26 X */
	pxTopOfStack--;
	*pxTopOfStack = ( portSTACK_TYPE ) 0x27;	/* R27 */
	pxTopOfStack--;

	/* The Y register is not stored as it is used as the software stack and
	gets saved into the task control block. */

	*pxTopOfStack = ( portSTACK_TYPE ) 0x30;	/* R30 Z */
	pxTopOfStack--;
	*pxTopOfStack = ( portSTACK_TYPE ) 0x031;	/* R31 */

	/*lint +e950 +e611 +e923 */

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

portBASE_TYPE xPortStartScheduler( void )
{
	/* Setup the hardware to generate the tick. */
	prvSetupTimerInterrupt();

	/* Restore the context of the first task that is going to run.
	Normally we would just call portRESTORE_CONTEXT() here, but as the IAR
	compiler does not fully support inline assembler we have to make a call.*/
	vPortStart();


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

/*
 * 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 configCPU_CLOCK_HZ clock. */

	ulCompareMatch = configCPU_CLOCK_HZ / configTICK_RATE_HZ;

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

	/* Adjust for correct value. */
	ulCompareMatch -= ( unsigned portLONG ) 1;

	/* 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 );
	OCR1AH = ucHighByte;
	OCR1AL = ucLowByte;

	/* Setup clock source and compare match behaviour. */
	ucLowByte = portCLEAR_COUNTER_ON_MATCH | portPRESCALE_64;
	TCCR1B = ucLowByte;

	/* Enable the interrupt - this is okay as interrupt are currently globally
	disabled. */
	TIMSK |= portCOMPARE_MATCH_A_INTERRUPT_ENABLE;
}
/*-----------------------------------------------------------*/

#if configUSE_PREEMPTION == 1

	/*
	 * Tick ISR for preemptive scheduler.  We can use a __task attribute as
	 * the context is saved at the start of vPortYieldFromTick().  The tick
	 * count is incremented after the context is saved.
	 */
	__task void SIG_OUTPUT_COMPARE1A( void )
	{
		vPortYieldFromTick();
		asm( "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();
	 *
	 * THE INTERRUPT VECTOR IS POPULATED IN portmacro.s90.  DO NOT INSTALL
	 * IT HERE USING THE USUAL PRAGMA.
	 */		
	__interrupt void SIG_OUTPUT_COMPARE1A( void )
	{
		vTaskIncrementTick();
	}
#endif


	

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
五月婷婷综合在线| 国产一区二区三区电影在线观看| 亚洲综合在线视频| 久久99热狠狠色一区二区| av成人免费在线观看| 日韩免费成人网| 最新日韩在线视频| 国产精品中文字幕欧美| 在线综合视频播放| 亚洲激情校园春色| 成人高清av在线| 欧美精品一区二区三区在线| 樱桃视频在线观看一区| 国产suv精品一区二区三区| 777午夜精品免费视频| 亚洲嫩草精品久久| www.一区二区| 欧美韩国日本不卡| 国产精品一区不卡| 精品1区2区在线观看| 日本亚洲天堂网| 欧美日韩精品二区第二页| 最新不卡av在线| eeuss鲁片一区二区三区 | 久久国产欧美日韩精品| 欧美在线一区二区三区| 亚洲精品国产无天堂网2021 | 欧美日韩国产高清一区二区| 亚洲精品成人a在线观看| 成人动漫一区二区三区| 中文乱码免费一区二区| 国产99久久久国产精品| 国产欧美一区二区精品性色超碰| 国模无码大尺度一区二区三区| 制服丝袜一区二区三区| 免费精品视频最新在线| 91精品午夜视频| 日本不卡一区二区三区高清视频| 91精品在线免费| 蜜臀a∨国产成人精品| 日韩欧美一级二级三级久久久| 蜜臀av一区二区三区| 26uuu亚洲综合色欧美| 国产一区在线不卡| 国产精品乱码妇女bbbb| 92国产精品观看| 亚洲综合图片区| 91精品福利在线一区二区三区 | 国产精品久久久久精k8 | 色婷婷亚洲综合| 亚洲制服丝袜在线| 777奇米成人网| 国产自产2019最新不卡| 亚洲最快最全在线视频| 久久精品国产一区二区三 | 精品少妇一区二区三区在线视频| 免费在线视频一区| 国产色爱av资源综合区| av在线不卡观看免费观看| 亚洲综合视频在线观看| 91精品国产综合久久精品 | 七七婷婷婷婷精品国产| 国产精品少妇自拍| 欧美日韩国产精选| 国内不卡的二区三区中文字幕| 国产精品三级av| 欧美精品一二三区| 国产成人在线视频免费播放| 亚洲六月丁香色婷婷综合久久| 欧美夫妻性生活| 福利一区二区在线| 五月综合激情婷婷六月色窝| 国产午夜精品一区二区三区视频| 欧美亚洲高清一区二区三区不卡| 蜜桃一区二区三区在线| 国产精品久久久久久久第一福利| 欧美日韩成人在线| 成人爱爱电影网址| 免费成人性网站| 亚洲男同性视频| 久久婷婷综合激情| 欧美日韩国产综合一区二区三区 | 一区二区三区精品久久久| 欧美大片在线观看一区| 色狠狠色噜噜噜综合网| 国产东北露脸精品视频| 天堂影院一区二区| 亚洲精品国产无套在线观| 精品国产乱码久久久久久图片 | 国产精品水嫩水嫩| 日韩欧美专区在线| 一本色道久久综合亚洲aⅴ蜜桃| 另类的小说在线视频另类成人小视频在线| 国产精品成人免费在线| 精品国产一二三| 精品日韩欧美一区二区| 欧美色精品在线视频| 成人综合在线视频| 精品综合久久久久久8888| 天天综合网 天天综合色| 亚洲你懂的在线视频| 国产精品伦理在线| 欧美精彩视频一区二区三区| 精品久久国产老人久久综合| 欧美喷潮久久久xxxxx| 在线观看91精品国产入口| 91同城在线观看| av激情综合网| 不卡免费追剧大全电视剧网站| 国产精品一级黄| 国产精品中文字幕日韩精品| 国产麻豆视频精品| 国产资源精品在线观看| 精品综合久久久久久8888| 久久激情五月激情| 久久99久国产精品黄毛片色诱| 蜜桃av一区二区三区| 免费观看日韩av| 久久不见久久见免费视频7| 免费成人你懂的| 精品一区二区三区久久| 精品一区二区三区不卡| 国产精品资源网| 成人app软件下载大全免费| 风流少妇一区二区| 91香蕉视频污| 欧美日韩专区在线| 欧美一区二区精品久久911| 日韩视频在线一区二区| 久久婷婷国产综合国色天香| www欧美成人18+| 国产精品国产自产拍高清av| 亚洲激情第一区| 日韩精品一二三区| 国产精品综合二区| 91美女片黄在线| 欧美高清dvd| 久久精品一区二区三区不卡| 成人欧美一区二区三区白人 | 国产宾馆实践打屁股91| av中文字幕不卡| 欧美日韩国产天堂| 日韩视频在线你懂得| 欧美国产精品中文字幕| 国产精品成人一区二区艾草| 亚洲国产精品人人做人人爽| 日韩国产一二三区| 国产黄色91视频| 欧美色图片你懂的| 欧美sm极限捆绑bd| 亚洲欧洲日产国码二区| 日韩精品一二区| 99久久婷婷国产精品综合| 欧美日韩三级在线| 久久九九久久九九| 夜夜操天天操亚洲| 狠狠色狠狠色综合日日91app| 99re热这里只有精品免费视频| 欧美日本国产一区| 国产精品三级电影| 久久国产成人午夜av影院| 99久久久久久| 欧美成人一级视频| 亚洲一二三四区不卡| 国产91富婆露脸刺激对白| 欧美日韩电影一区| 国产精品夫妻自拍| 久久99久久精品| 精品视频一区二区不卡| 国产精品美女www爽爽爽| 美国一区二区三区在线播放| 色婷婷综合在线| 亚洲国产精品成人综合色在线婷婷| 亚洲香肠在线观看| 99re视频精品| 国产欧美中文在线| 久久激情综合网| 在线91免费看| 亚洲精品伦理在线| 成人禁用看黄a在线| 精品国产乱码久久久久久图片| 午夜欧美在线一二页| 一本久久精品一区二区| 国产日韩欧美一区二区三区乱码| 日本不卡的三区四区五区| 欧美性猛交xxxx黑人交| 亚洲乱码日产精品bd| 成人毛片在线观看| 国产日韩欧美综合在线| 精品一区二区三区在线观看国产| 欧美三区在线观看| 亚洲愉拍自拍另类高清精品| 99这里只有久久精品视频| 国产蜜臀av在线一区二区三区| 韩国精品久久久| 26uuu成人网一区二区三区| 久久se这里有精品| 日韩美一区二区三区| 麻豆国产精品官网| 精品国产麻豆免费人成网站|