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

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

?? port.c

?? MCS-51的一個Free小型操作系統,在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.
	***************************************************************************
*/

/*
Changes from V1.00:
	
	+ Call to taskYIELD() from within tick ISR has been replaced by the more
	  efficient portSWITCH_CONTEXT().
	+ ISR function definitions renamed to include the prv prefix.

Changes from V1.2.0:

	+ portRESET_PIC() is now called last thing before the end of the preemptive
	  tick routine.

Changes from V2.6.1

	+ Replaced the sUsingPreemption variable with the configUSE_PREEMPTION
	  macro to be consistent with the later ports.
*/

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

#include <stdlib.h>
#include <i86.h>
#include <dos.h>
#include <setjmp.h>

#include "FreeRTOS.h"
#include "task.h"
#include "portasm.h"

/*lint -e950 Non ANSI reserved words okay in this file only. */

#define portTIMER_EOI_TYPE		( 8 )
#define portRESET_PIC()			portOUTPUT_WORD( ( unsigned portSHORT ) 0xff22, portTIMER_EOI_TYPE )
#define portTIMER_INT_NUMBER	0x12

#define portTIMER_1_CONTROL_REGISTER	( ( unsigned portSHORT ) 0xff5e )
#define portTIMER_0_CONTROL_REGISTER	( ( unsigned portSHORT ) 0xff56 )
#define portTIMER_INTERRUPT_ENABLE		( ( unsigned portSHORT ) 0x2000 )

/* Setup the hardware to generate the required tick frequency. */
static void prvSetTickFrequency( unsigned portLONG ulTickRateHz );

/* Set the hardware back to the state as per before the scheduler started. */
static void prvExitFunction( void );

#if configUSE_PREEMPTION == 1
	/* Tick service routine used by the scheduler when preemptive scheduling is
	being used. */
	static void __interrupt __far prvPreemptiveTick( void );
#else
	/* Tick service routine used by the scheduler when cooperative scheduling is 
	being used. */
	static void __interrupt __far prvNonPreemptiveTick( void );
#endif

/* Trap routine used by taskYIELD() to manually cause a context switch. */
static void __interrupt __far prvYieldProcessor( void );

/*lint -e956 File scopes necessary here. */

/* Set true when the vectors are set so the scheduler will service the tick. */
static portSHORT sSchedulerRunning = pdFALSE;

/* Points to the original routine installed on the vector we use for manual context switches.  This is then used to restore the original routine during prvExitFunction(). */
static void ( __interrupt __far *pxOldSwitchISR )();

/* Used to restore the original DOS context when the scheduler is ended. */
static jmp_buf xJumpBuf;

/*lint +e956 */

/*-----------------------------------------------------------*/
portBASE_TYPE xPortStartScheduler( void )
{
	/* This is called with interrupts already disabled. */

	/* Remember what was on the interrupts we are going to use
	so we can put them back later if required. */
	pxOldSwitchISR = _dos_getvect( portSWITCH_INT_NUMBER );

	/* Put our manual switch (yield) function on a known
	vector. */
	_dos_setvect( portSWITCH_INT_NUMBER, prvYieldProcessor );

	#if configUSE_PREEMPTION == 1
	{		
		/* Put our tick switch function on the timer interrupt. */
		_dos_setvect( portTIMER_INT_NUMBER, prvPreemptiveTick );
	}
	#else
	{
		/* We want the timer interrupt to just increment the tick count. */
		_dos_setvect( portTIMER_INT_NUMBER, prvNonPreemptiveTick );
	}
	#endif

	prvSetTickFrequency( configTICK_RATE_HZ );

	/* Clean up function if we want to return to DOS. */
	if( setjmp( xJumpBuf ) != 0 )
	{
		prvExitFunction();
		sSchedulerRunning = pdFALSE;
	}
	else
	{
		sSchedulerRunning = pdTRUE;

		/* Kick off the scheduler by setting up the context of the first task. */
		portFIRST_CONTEXT();
	}

	return sSchedulerRunning;
}
/*-----------------------------------------------------------*/

/* The tick ISR used depend on whether or not the preemptive or cooperative
kernel is being used. */
#if configUSE_PREEMPTION == 1
	static void __interrupt __far prvPreemptiveTick( void )
	{
		/* Get the scheduler to update the task states following the tick. */
		vTaskIncrementTick();

		/* Switch in the context of the next task to be run. */
		portSWITCH_CONTEXT();

		/* Reset the PIC ready for the next time. */
		portRESET_PIC();
	}
#else
	static void __interrupt __far prvNonPreemptiveTick( void )
	{
		/* Same as preemptive tick, but the cooperative scheduler is being used
		so we don't have to switch in the context of the next task. */
		vTaskIncrementTick();
		portRESET_PIC();
	}
#endif
/*-----------------------------------------------------------*/

static void __interrupt __far prvYieldProcessor( void )
{
	/* Switch in the context of the next task to be run. */
	portSWITCH_CONTEXT();
}
/*-----------------------------------------------------------*/

void vPortEndScheduler( void )
{
	/* Jump back to the processor state prior to starting the
	scheduler.  This means we are not going to be using a
	task stack frame so the task can be deleted. */
	longjmp( xJumpBuf, 1 );
}
/*-----------------------------------------------------------*/

static void prvExitFunction( void )
{
const unsigned portSHORT usTimerDisable = 0x0000;
unsigned portSHORT usTimer0Control;

	/* Interrupts should be disabled here anyway - but no 
	harm in making sure. */
	portDISABLE_INTERRUPTS();
	if( sSchedulerRunning == pdTRUE )
	{
		/* Put back the switch interrupt routines that was in place
		before the scheduler started. */
		_dos_setvect( portSWITCH_INT_NUMBER, pxOldSwitchISR );
	}

	/* Disable the timer used for the tick to ensure the scheduler is
	not called before restoring interrupts.  There was previously nothing
	on this timer so there is no old ISR to restore. */
	portOUTPUT_WORD( portTIMER_1_CONTROL_REGISTER, usTimerDisable );

	/* Restart the DOS tick. */
	usTimer0Control = portINPUT_WORD( portTIMER_0_CONTROL_REGISTER );
	usTimer0Control |= portTIMER_INTERRUPT_ENABLE;
	portOUTPUT_WORD( portTIMER_0_CONTROL_REGISTER, usTimer0Control );


	portENABLE_INTERRUPTS();

	/* This will free up all the memory used by the scheduler.
	exiting back to dos with INT21 AH=4CH will do this anyway so
	it is not necessary to call this. */
	vTaskCleanUpResources(); 
}
/*-----------------------------------------------------------*/

static void prvSetTickFrequency( unsigned portLONG ulTickRateHz )
{
const unsigned portSHORT usMaxCountRegister = 0xff5a;
const unsigned portSHORT usTimerPriorityRegister = 0xff32;
const unsigned portSHORT usTimerEnable = 0xC000;
const unsigned portSHORT usRetrigger = 0x0001;
const unsigned portSHORT usTimerHighPriority = 0x0000;
unsigned portSHORT usTimer0Control;

/* ( CPU frequency / 4 ) / clock 2 max count [inpw( 0xff62 ) = 7] */

const unsigned portLONG ulClockFrequency = 0x7f31a0;

unsigned portLONG ulTimerCount = ulClockFrequency / ulTickRateHz;

	portOUTPUT_WORD( portTIMER_1_CONTROL_REGISTER, usTimerEnable | portTIMER_INTERRUPT_ENABLE | usRetrigger );
	portOUTPUT_WORD( usMaxCountRegister, ( unsigned portSHORT ) ulTimerCount );
	portOUTPUT_WORD( usTimerPriorityRegister, usTimerHighPriority );

	/* Stop the DOS tick - don't do this if you want to maintain a TOD clock. */
	usTimer0Control = portINPUT_WORD( portTIMER_0_CONTROL_REGISTER );
	usTimer0Control &= ~portTIMER_INTERRUPT_ENABLE;
	portOUTPUT_WORD( portTIMER_0_CONTROL_REGISTER, usTimer0Control );
}


/*lint +e950 */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日本亚洲欧美天堂免费| 成人蜜臀av电影| 成人h动漫精品一区二区| 欧美午夜电影在线播放| 久久亚洲一级片| 视频一区视频二区中文| 99久久精品情趣| 精品久久久久久最新网址| 亚洲五码中文字幕| heyzo一本久久综合| 久久综合狠狠综合久久综合88| 一级做a爱片久久| 国产69精品久久久久777| 日韩欧美一区在线| 亚洲高清三级视频| 在线亚洲+欧美+日本专区| 久久一区二区三区国产精品| 欧美日韩高清影院| 国产91精品免费| 韩国在线一区二区| 日韩一区二区免费在线观看| 欧美一级午夜免费电影| 成人免费视频视频| 在线播放欧美女士性生活| 国产精品一区二区免费不卡| 欧美经典一区二区| 欧美日韩国产成人在线91| 精品一区二区三区欧美| 一二三区精品视频| 日韩午夜电影在线观看| 91精品国产综合久久精品麻豆| 国模无码大尺度一区二区三区| 免费国产亚洲视频| 亚洲午夜精品在线| 亚洲女同一区二区| 性做久久久久久免费观看| 91在线小视频| 日韩午夜在线观看| 国产精品久久久久久久久果冻传媒| 国产乱码一区二区三区| 精品国产91乱码一区二区三区| 激情综合五月天| 久久久无码精品亚洲日韩按摩| 国产91清纯白嫩初高中在线观看 | 国产日韩三级在线| 国产成人在线视频免费播放| 国产日韩欧美a| av成人老司机| 亚洲成年人影院| 欧美一卡二卡三卡| 国产精品一品视频| 国产精品久久一卡二卡| 国内精品伊人久久久久av影院| 国产裸体歌舞团一区二区| 国产精品一区二区91| 色哟哟国产精品| 日韩欧美二区三区| 亚洲精品高清视频在线观看| 亚洲日本电影在线| 美腿丝袜亚洲色图| 本田岬高潮一区二区三区| 欧美在线播放高清精品| 精品国产一区二区亚洲人成毛片| 最好看的中文字幕久久| 亚洲高清一区二区三区| 国产主播一区二区| 欧美精品丝袜久久久中文字幕| 日韩欧美国产成人一区二区| 韩国女主播一区二区三区| 欧美性色aⅴ视频一区日韩精品| 色综合久久久网| 91九色最新地址| 精品久久久久香蕉网| 一区二区免费看| 欧美精品一区二区三区在线| 91福利在线观看| 亚洲国产日韩av| 欧美日韩欧美一区二区| 国产精品一区久久久久| 欧美国产综合一区二区| 国产人伦精品一区二区| 国产精品主播直播| 国产夜色精品一区二区av| 亚洲精品免费看| 欧洲人成人精品| 国产精品久久看| 国产裸体歌舞团一区二区| 久久奇米777| 成人黄色av网站在线| 亚洲欧美偷拍另类a∨色屁股| 国产精品一区久久久久| 中文欧美字幕免费| 日韩色视频在线观看| 国产在线精品一区在线观看麻豆| 欧美白人最猛性xxxxx69交| 亚洲国产精品精华液网站| 91蜜桃婷婷狠狠久久综合9色| 亚洲一区中文在线| a级精品国产片在线观看| 午夜精品福利在线| 久久精品人人做人人爽人人| 国产精品自在在线| 亚洲成人一区在线| 91美女片黄在线观看91美女| 亚洲愉拍自拍另类高清精品| 欧美性一级生活| 亚洲综合一区在线| 日韩视频一区二区在线观看| 精品一区二区三区免费毛片爱| 51久久夜色精品国产麻豆| 国产精品99久久久久| 久久欧美一区二区| 99久久精品99国产精品| www.亚洲在线| 风间由美一区二区三区在线观看 | 日韩电影免费一区| 久久久午夜精品| 亚洲一区成人在线| 亚洲日穴在线视频| 欧美成人一区二区三区| 欧美精品三级在线观看| 欧美私人免费视频| 欧美系列亚洲系列| 欧美日韩一级视频| 久久女同互慰一区二区三区| 国产精品国产三级国产aⅴ中文 | 欧美一级国产精品| 亚洲小说欧美激情另类| 日韩电影一二三区| 久久久午夜电影| 国产日本欧美一区二区| 国产日产精品1区| 99久久777色| 亚洲女同ⅹxx女同tv| 久久青草欧美一区二区三区| 国产偷国产偷精品高清尤物| 国产日产欧美一区| 亚洲蜜臀av乱码久久精品| 亚洲第四色夜色| 国产乱淫av一区二区三区| 国产成人aaaa| 色综合天天做天天爱| 欧美性一二三区| 欧美精品在线观看一区二区| 欧美一级欧美一级在线播放| 久久综合九色综合久久久精品综合| 国产精品午夜电影| 亚洲午夜精品在线| 国产精品一区二区男女羞羞无遮挡| 99久久久久久99| 日韩欧美一区二区视频| 国产精品天干天干在线综合| 亚洲线精品一区二区三区 | 国产精品毛片久久久久久| 亚洲综合免费观看高清在线观看| 日韩和欧美一区二区| 成人午夜激情在线| 欧美日韩成人激情| 国产欧美日韩不卡| 日本欧美在线观看| av高清不卡在线| 精品福利一二区| 亚洲制服丝袜av| 国产不卡视频在线播放| 欧美精品成人一区二区三区四区| 国产亚洲自拍一区| 日本aⅴ免费视频一区二区三区| 粉嫩在线一区二区三区视频| 欧美精品视频www在线观看| 亚洲欧洲日韩在线| 国产一区二区三区综合| 91精选在线观看| 亚洲美女视频在线| 成人一区二区视频| 精品欧美久久久| 视频一区视频二区在线观看| 99re8在线精品视频免费播放| 日韩午夜电影av| 亚洲成人资源在线| 色综合久久66| 中文字幕一区二区三区在线播放 | 欧美探花视频资源| 最新中文字幕一区二区三区| 狠狠久久亚洲欧美| 91精品婷婷国产综合久久竹菊| 亚洲精品菠萝久久久久久久| 国产成人h网站| 久久久一区二区三区| 极品美女销魂一区二区三区| 欧美一区二区在线不卡| 亚洲成人在线网站| 欧美日韩你懂的| 日日欢夜夜爽一区| 91麻豆精品国产91久久久| 日韩福利电影在线观看| 欧美一区二区三区在线| 全国精品久久少妇| 欧美xfplay| 国产一区二区三区视频在线播放| 日韩欧美在线不卡|