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

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

?? serial.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.
	***************************************************************************
*/

/*
	BASIC INTERRUPT DRIVEN SERIAL PORT DRIVER FOR UART0.
*/

/* Library includes. */
#include "uart.h"
#include "gpio.h"
#include "eic.h"

/* Scheduler includes. */
#include "FreeRTOS.h"
#include "queue.h"

/* Demo application includes. */
#include "serial.h"

#define UART0_Rx_Pin 					( 0x0001<< 8 )
#define UART0_Tx_Pin 					( 0x0001<< 9 )

#define serINVALID_QUEUE				( ( xQueueHandle ) 0 )
#define serNO_BLOCK						( ( portTickType ) 0 )

/* Macros to turn on and off the Tx empty interrupt. */
#define serINTERRUPT_ON()				UART0->IER |= UART_TxHalfEmpty
#define serINTERRUPT_OFF()				UART0->IER &= ~UART_TxHalfEmpty

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

/* Queues used to hold received characters, and characters waiting to be
transmitted. */
static xQueueHandle xRxedChars;
static xQueueHandle xCharsForTx;

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

/* Interrupt entry point written in the assembler file serialISR.s79. */
extern void vSerialISREntry( void );

/* The interrupt service routine - called from the assembly entry point. */
__arm void vSerialISR( void );

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

/*
 * See the serial2.h header file.
 */
xComPortHandle xSerialPortInitMinimal( unsigned portLONG ulWantedBaud, unsigned portBASE_TYPE uxQueueLength )
{
xComPortHandle xReturn;
	
	/* Create the queues used to hold Rx and Tx characters. */
	xRxedChars = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed portCHAR ) );
	xCharsForTx = xQueueCreate( uxQueueLength + 1, ( unsigned portBASE_TYPE ) sizeof( signed portCHAR ) );

	/* If the queues were created correctly then setup the serial port
	hardware. */
	if( ( xRxedChars != serINVALID_QUEUE ) && ( xCharsForTx != serINVALID_QUEUE ) )
	{
		portENTER_CRITICAL();
		{
			/* Setup the UART port pins. */
			GPIO_Config( GPIO0, UART0_Tx_Pin, GPIO_AF_PP );
			GPIO_Config( GPIO0, UART0_Rx_Pin, GPIO_IN_TRI_CMOS );

			/* Configure the UART. */
			UART_OnOffConfig( UART0, ENABLE );
			UART_FifoConfig( UART0, DISABLE );
			UART_FifoReset( UART0, UART_RxFIFO );
			UART_FifoReset( UART0, UART_TxFIFO );
			UART_LoopBackConfig(UART0, DISABLE );
			UART_Config( UART0, ulWantedBaud, UART_NO_PARITY, UART_1_StopBits, UARTM_8D );
			UART_RxConfig( UART0, ENABLE );

			/* Configure the IEC for the UART interrupts. */
			EIC_IRQChannelPriorityConfig( UART0_IRQChannel, 1 );
			EIC_IRQChannelConfig( UART0_IRQChannel, ENABLE );
			EIC_IRQConfig( ENABLE );
			UART_ItConfig( UART0, UART_RxBufFull, ENABLE );
		}
		portEXIT_CRITICAL();
	}
	else
	{
		xReturn = ( xComPortHandle ) 0;
	}

	/* This demo file only supports a single port but we have to return
	something to comply with the standard demo header file. */
	return xReturn;
}
/*-----------------------------------------------------------*/

signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed portCHAR *pcRxedChar, portTickType xBlockTime )
{
	/* The port handle is not required as this driver only supports one port. */
	( void ) pxPort;

	/* Get the next character from the buffer.  Return false if no characters
	are available, or arrive before xBlockTime expires. */
	if( xQueueReceive( xRxedChars, pcRxedChar, xBlockTime ) )
	{
		return pdTRUE;
	}
	else
	{
		return pdFALSE;
	}
}
/*-----------------------------------------------------------*/

void vSerialPutString( xComPortHandle pxPort, const signed portCHAR * const pcString, unsigned portSHORT usStringLength )
{
signed portCHAR *pxNext;

	/* A couple of parameters that this port does not use. */
	( void ) usStringLength;
	( void ) pxPort;

	/* NOTE: This implementation does not handle the queue being full as no
	block time is used! */

	/* The port handle is not required as this driver only supports UART0. */
	( void ) pxPort;

	/* Send each character in the string, one at a time. */
	pxNext = ( signed portCHAR * ) pcString;
	while( *pxNext )
	{
		xSerialPutChar( pxPort, *pxNext, serNO_BLOCK );
		pxNext++;
	}
}
/*-----------------------------------------------------------*/

signed portBASE_TYPE xSerialPutChar( xComPortHandle pxPort, signed portCHAR cOutChar, portTickType xBlockTime )
{
	/* Place the character in the queue of characters to be transmitted. */
	if( xQueueSend( xCharsForTx, &cOutChar, xBlockTime ) != pdPASS )
	{
		return pdFAIL;
	}

	/* Turn on the Tx interrupt so the ISR will remove the character from the
	queue and send it.   This does not need to be in a critical section as
	if the interrupt has already removed the character the next interrupt
	will simply turn off the Tx interrupt again. */
	serINTERRUPT_ON();

	return pdPASS;
}
/*-----------------------------------------------------------*/

void vSerialClose( xComPortHandle xPort )
{
	/* Not supported as not required by the demo application. */
}
/*-----------------------------------------------------------*/

/* Serial port ISR.  This can cause a context switch so is not defined as a
standard ISR using the __irq keyword.  Instead a wrapper function is defined
within serialISR.s79 which in turn calls this function.  See the port
documentation on the FreeRTOS.org website for more information. */
__arm void vSerialISR( void )
{
unsigned portSHORT usStatus;
signed portCHAR cChar;
portBASE_TYPE xTaskWokenByTx = pdFALSE, xTaskWokenByPost = pdFALSE;

	/* What caused the interrupt? */
	usStatus = UART_FlagStatus( UART0 );

	if( usStatus & UART_TxHalfEmpty )
	{
		/* The interrupt was caused by the THR becoming empty.  Are there any
		more characters to transmit? */
		if( xQueueReceiveFromISR( xCharsForTx, &cChar, &xTaskWokenByTx ) == pdTRUE )
		{
			/* A character was retrieved from the queue so can be sent to the
			THR now. */
			UART0->TxBUFR = cChar;
		}
		else
		{
			/* Queue empty, nothing to send so turn off the Tx interrupt. */
			serINTERRUPT_OFF();
		}		
	}

	if( usStatus & 	UART_RxBufFull )
	{
		/* The interrupt was caused by a character being received.  Grab the
		character from the RHR and place it in the queue of received
		characters. */
		cChar = UART0->RxBUFR;
		xTaskWokenByPost = xQueueSendFromISR( xRxedChars, &cChar, xTaskWokenByPost );
	}

	/* If a task was woken by either a character being received or a character
	being transmitted then we may need to switch to another task. */
	portEND_SWITCHING_ISR( ( xTaskWokenByPost || xTaskWokenByTx ) );

	/* End the interrupt in the EIC. */
	portCLEAR_EIC();
}





	

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲精品免费电影| 在线播放视频一区| 五月天激情综合| 国产欧美日韩三区| 欧美伊人久久久久久久久影院 | 69av一区二区三区| 暴力调教一区二区三区| 裸体在线国模精品偷拍| 在线视频你懂得一区| 国产一区二区三区久久悠悠色av| 亚洲人成人一区二区在线观看| 欧美不卡123| 欧美高清视频不卡网| 色综合中文字幕| 成人精品高清在线| 国产精品一区二区免费不卡| 三级一区在线视频先锋| 欧美国产禁国产网站cc| 久久这里都是精品| 日韩你懂的在线观看| 69av一区二区三区| 欧亚一区二区三区| 色偷偷成人一区二区三区91 | 日本欧美一区二区三区| 亚洲最大成人网4388xx| 国产精品久久久久久福利一牛影视 | 成人毛片视频在线观看| 精品一区二区综合| 蜜桃精品在线观看| 蜜臀久久99精品久久久画质超高清| 亚洲永久精品国产| 怡红院av一区二区三区| 亚洲精品国产第一综合99久久 | 亚洲欧美国产高清| 亚洲视频在线一区观看| 亚洲欧洲精品一区二区三区不卡| 国产亚洲成年网址在线观看| 久久久午夜电影| 久久亚洲综合色一区二区三区| 精品免费视频.| 精品欧美黑人一区二区三区| 欧美精品一区视频| 久久精品这里都是精品| 国产女主播视频一区二区| 久久久精品国产免费观看同学| 久久综合av免费| 久久久久久久国产精品影院| 欧美国产日韩在线观看| 国产精品成人免费精品自在线观看| 国产精品三级av| 亚洲视频在线一区| 亚洲国产另类av| 日韩国产精品大片| 久久99最新地址| 国产成人精品网址| av在线一区二区三区| 91免费观看视频在线| 欧美在线视频你懂得| 欧美精品久久天天躁| 91精品国模一区二区三区| 精品日韩在线观看| 中文字幕av在线一区二区三区| 亚洲欧美自拍偷拍色图| 亚洲综合偷拍欧美一区色| 午夜亚洲福利老司机| 日本成人在线电影网| 国产精品99久久久久久久女警 | 亚洲成人免费电影| 激情综合五月天| 波多野结衣91| 欧美人与性动xxxx| 久久久综合视频| 亚洲欧美日韩系列| 美女视频黄 久久| 不卡电影免费在线播放一区| 91电影在线观看| 欧美精品一区二区三区久久久 | 欧美高清视频不卡网| 欧美精品一区二区三区视频| 国产精品久久精品日日| 五月天激情小说综合| 国产99久久精品| 欧美伊人精品成人久久综合97| 欧美r级电影在线观看| 中文字幕字幕中文在线中不卡视频| 亚洲一卡二卡三卡四卡无卡久久 | 欧美亚洲综合色| 精品国产乱码久久久久久影片| 国产精品剧情在线亚洲| 日精品一区二区| 成人av在线播放网址| 欧美精品v日韩精品v韩国精品v| 国产亚洲一区二区三区| 亚洲高清在线视频| 成人久久久精品乱码一区二区三区| 欧美最猛性xxxxx直播| 国产亚洲精品福利| 日韩和的一区二区| 91国偷自产一区二区开放时间 | 91精品国产综合久久久久| 国产精品拍天天在线| 蓝色福利精品导航| 欧美天堂亚洲电影院在线播放| 国产亚洲成av人在线观看导航| 青青草国产精品97视觉盛宴| 在线观看国产日韩| 国产精品伦理在线| 国产精品一区二区久久不卡| 91精品国产高清一区二区三区蜜臀 | 欧美三级电影网站| 18成人在线视频| 国产成人亚洲综合色影视| 555www色欧美视频| 亚洲国产美国国产综合一区二区| voyeur盗摄精品| 国产人妖乱国产精品人妖| 久久精品二区亚洲w码| 欧美精品亚洲二区| 亚洲成人av中文| 在线欧美一区二区| 亚洲美腿欧美偷拍| www.激情成人| 日韩理论在线观看| eeuss鲁片一区二区三区 | 久久久天堂av| 精品一区二区免费| 欧美一级午夜免费电影| 亚洲超碰精品一区二区| 色999日韩国产欧美一区二区| 国产精品网站在线| 国产精品一级片| 久久久一区二区三区捆绑**| 紧缚捆绑精品一区二区| 亚洲精品一区在线观看| 极品少妇xxxx偷拍精品少妇| 日韩一区二区在线播放| 麻豆国产精品官网| 日韩三级在线观看| 久久精品国产精品亚洲精品| 日韩欧美久久久| 久久av老司机精品网站导航| 久久天天做天天爱综合色| 国产一区二区三区在线观看免费| 精品久久久久一区| 国产精品一区二区在线看| 国产精品乱人伦中文| 一本大道av伊人久久综合| 亚洲一区在线播放| 777a∨成人精品桃花网| 久久99久久精品欧美| 久久久久综合网| 99精品国产视频| 亚洲午夜精品一区二区三区他趣| 欧美日韩激情在线| 久久er99热精品一区二区| 国产亚洲一区二区三区| 色综合天天综合| 五月婷婷另类国产| 久久综合国产精品| 91美女片黄在线观看| 午夜影视日本亚洲欧洲精品| 日韩视频在线你懂得| 国产精品888| 一区二区免费看| 日韩欧美国产综合| av在线播放一区二区三区| 亚洲国产一区二区在线播放| 日韩一区二区麻豆国产| 国产sm精品调教视频网站| 一区二区三区欧美亚洲| 日韩视频一区二区三区在线播放| 粉嫩在线一区二区三区视频| 亚洲一区二区免费视频| 久久综合狠狠综合| 色又黄又爽网站www久久| 日本不卡的三区四区五区| 国产精品丝袜黑色高跟| 欧美日韩国产成人在线91| 国产91高潮流白浆在线麻豆| 亚洲午夜精品在线| 精品国产99国产精品| 色偷偷久久一区二区三区| 国产一区二区三区最好精华液| 亚洲女厕所小便bbb| 亚洲精品一区二区在线观看| 在线免费视频一区二区| 激情综合色丁香一区二区| 一区二区三区久久久| 久久久久久久久久看片| 欧美日韩精品一二三区| 成人手机在线视频| 天天亚洲美女在线视频| 国产精品久久午夜夜伦鲁鲁| 欧美一区二区视频观看视频| 一本久道久久综合中文字幕| 国内精品写真在线观看| 天天色图综合网| 亚洲视频小说图片| 国产亚洲精久久久久久| 欧美成人r级一区二区三区|