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

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

?? serial.c

?? 最新版FreeRTOS, 包擴多種開發(fā)平臺的移植
?? C
字號:
/*
	FreeRTOS.org V4.1.1 - 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.2.3

	+ The function xPortInitMinimal() has been renamed to 
	  xSerialPortInitMinimal() and the function xPortInit() has been renamed
	  to xSerialPortInit().

Changes from V2.0.0

	+ Delay periods are now specified using variables and constants of
	  portTickType rather than unsigned portLONG.
	+ xQueueReceiveFromISR() used in place of xQueueReceive() within the ISR.

Changes from V2.6.0

	+ Replaced the inb() and outb() functions with direct memory
	  access.  This allows the port to be built with the 20050414 build of
	  WinAVR.
*/

/* BASIC INTERRUPT DRIVEN SERIAL PORT DRIVER. */


#include <stdlib.h>
#include <avr/interrupt.h>
#include "FreeRTOS.h"
#include "queue.h"
#include "task.h"
#include "serial.h"

#define serBAUD_DIV_CONSTANT			( ( unsigned portLONG ) 16 )

/* Constants for writing to UCSRB. */
#define serRX_INT_ENABLE				( ( unsigned portCHAR ) 0x80 )
#define serRX_ENABLE					( ( unsigned portCHAR ) 0x10 )
#define serTX_ENABLE					( ( unsigned portCHAR ) 0x08 )
#define serTX_INT_ENABLE				( ( unsigned portCHAR ) 0x20 )

/* Constants for writing to UCSRC. */
#define serUCSRC_SELECT					( ( unsigned portCHAR ) 0x80 )
#define serEIGHT_DATA_BITS				( ( unsigned portCHAR ) 0x06 )

static xQueueHandle xRxedChars; 
static xQueueHandle xCharsForTx; 

#define vInterruptOn()										\
{															\
	unsigned portCHAR ucByte;								\
															\
	ucByte = UCSRB;											\
	ucByte |= serTX_INT_ENABLE;								\
	UCSRB = ucByte;											\
}																				
/*-----------------------------------------------------------*/

#define vInterruptOff()										\
{															\
	unsigned portCHAR ucInByte;								\
															\
	ucInByte = UCSRB;										\
	ucInByte &= ~serTX_INT_ENABLE;							\
	UCSRB = ucInByte;										\
}
/*-----------------------------------------------------------*/

xComPortHandle xSerialPortInitMinimal( unsigned portLONG ulWantedBaud, unsigned portBASE_TYPE uxQueueLength )
{
unsigned portLONG ulBaudRateCounter;
unsigned portCHAR ucByte;

	portENTER_CRITICAL();
	{
		/* Create the queues used by the com test task. */
		xRxedChars = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed portCHAR ) );
		xCharsForTx = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed portCHAR ) );

		/* Calculate the baud rate register value from the equation in the
		data sheet. */
		ulBaudRateCounter = ( configCPU_CLOCK_HZ / ( serBAUD_DIV_CONSTANT * ulWantedBaud ) ) - ( unsigned portLONG ) 1;

		/* Set the baud rate. */	
		ucByte = ( unsigned portCHAR ) ( ulBaudRateCounter & ( unsigned portLONG ) 0xff );	
		UBRRL = ucByte;

		ulBaudRateCounter >>= ( unsigned portLONG ) 8;
		ucByte = ( unsigned portCHAR ) ( ulBaudRateCounter & ( unsigned portLONG ) 0xff );	
		UBRRH = ucByte;

		/* Enable the Rx interrupt.  The Tx interrupt will get enabled
		later. Also enable the Rx and Tx. */
		UCSRB = ( serRX_INT_ENABLE | serRX_ENABLE | serTX_ENABLE );

		/* Set the data bits to 8. */
		UCSRC = ( serUCSRC_SELECT | serEIGHT_DATA_BITS );
	}
	portEXIT_CRITICAL();
	
	/* Unlike other ports, this serial code does not allow for more than one
	com port.  We therefore don't return a pointer to a port structure and can
	instead just return NULL. */
	return NULL;
}
/*-----------------------------------------------------------*/

signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed portCHAR *pcRxedChar, portTickType xBlockTime )
{
	/* Only one port is supported. */
	( 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;
	}
}
/*-----------------------------------------------------------*/

signed portBASE_TYPE xSerialPutChar( xComPortHandle pxPort, signed portCHAR cOutChar, portTickType xBlockTime )
{
	/* Only one port is supported. */
	( void ) pxPort;

	/* Return false if after the block time there is no room on the Tx queue. */
	if( xQueueSend( xCharsForTx, &cOutChar, xBlockTime ) != pdPASS )
	{
		return pdFAIL;
	}

	vInterruptOn();

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

void vSerialClose( xComPortHandle xPort )
{
unsigned portCHAR ucByte;

	/* The parameter is not used. */
	( void ) xPort;

	/* Turn off the interrupts.  We may also want to delete the queues and/or
	re-install the original ISR. */

	portENTER_CRITICAL();
	{
		vInterruptOff();
		ucByte = UCSRB;
		ucByte &= ~serRX_INT_ENABLE;
		UCSRB = ucByte;
	}
	portEXIT_CRITICAL();
}
/*-----------------------------------------------------------*/

SIGNAL( SIG_UART_RECV )
{
signed portCHAR cChar;

	/* Get the character and post it on the queue of Rxed characters.
	If the post causes a task to wake force a context switch as the woken task
	may have a higher priority than the task we have interrupted. */
	cChar = UDR;

	if( xQueueSendFromISR( xRxedChars, &cChar, pdFALSE ) )
	{
		taskYIELD();
	}
}
/*-----------------------------------------------------------*/

SIGNAL( SIG_UART_DATA )
{
signed portCHAR cChar, cTaskWoken;

	if( xQueueReceiveFromISR( xCharsForTx, &cChar, &cTaskWoken ) == pdTRUE )
	{
		/* Send the next character queued for Tx. */
		UDR = cChar;
	}
	else
	{
		/* Queue empty, nothing to send. */
		vInterruptOff();
	}
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩国产欧美视频| 欧美一区2区视频在线观看| 色综合天天综合在线视频| 欧美一卡二卡在线| 亚洲日本一区二区三区| 麻豆精品久久久| 日本精品一级二级| 国产清纯白嫩初高生在线观看91| 亚洲国产成人91porn| 成人黄色电影在线| 精品成人免费观看| 日韩有码一区二区三区| 91亚洲国产成人精品一区二三| 欧美变态凌虐bdsm| 日韩精品色哟哟| 欧美视频一区二区三区| 中文字幕佐山爱一区二区免费| 国产精品 欧美精品| 日韩一级免费一区| 五月天久久比比资源色| 91久久精品一区二区| 国产精品久久久久一区二区三区共| 看电视剧不卡顿的网站| 欧美曰成人黄网| 一区二区三区精品视频| 99国产精品一区| 亚洲激情第一区| 色av一区二区| 伊人开心综合网| 在线看日本不卡| 一区二区三区欧美| 欧美丝袜丝交足nylons图片| 亚洲乱码国产乱码精品精可以看 | 色综合久久久久| 国产日韩精品一区二区三区在线| 国产一区二区美女| 久久久久久97三级| 成熟亚洲日本毛茸茸凸凹| 国产精品欧美精品| av综合在线播放| 玉足女爽爽91| 欧美日本不卡视频| 久久国产免费看| 国产三区在线成人av| 福利视频网站一区二区三区| 国产精品私人影院| 91久久精品午夜一区二区| 亚洲二区在线观看| 欧美不卡一区二区三区四区| 国产福利精品导航| 亚洲男人电影天堂| 7777精品伊人久久久大香线蕉超级流畅| 亚洲高清不卡在线| 久久影院午夜论| 91在线丨porny丨国产| 一区二区三区欧美在线观看| 欧美日韩国产a| 国产精品一区二区你懂的| 综合久久综合久久| 欧美一区二区三区在线观看 | 亚洲黄一区二区三区| 91.成人天堂一区| 国产毛片精品视频| 亚洲免费看黄网站| 久久久久久久久久看片| 一道本成人在线| 国产一区二区三区在线观看免费 | 午夜电影一区二区三区| 中文字幕中文乱码欧美一区二区| 日本道色综合久久| 国产主播一区二区三区| 亚洲欧美日韩国产一区二区三区| 欧美一区在线视频| 北条麻妃国产九九精品视频| 日本午夜一区二区| 中文字幕视频一区二区三区久| 在线播放一区二区三区| 丰满白嫩尤物一区二区| 亚洲自拍偷拍av| 中文字幕乱码一区二区免费| 9191成人精品久久| 91小视频在线免费看| 国产一区免费电影| 天天免费综合色| 亚洲区小说区图片区qvod| 337p粉嫩大胆色噜噜噜噜亚洲| 欧美午夜精品一区二区三区| 国产高清在线精品| 日韩二区三区在线观看| 一区二区在线观看不卡| 中文字幕 久热精品 视频在线| 69堂成人精品免费视频| 色先锋aa成人| 丁香婷婷综合色啪| 国产综合色精品一区二区三区| 午夜精品久久久久久久99樱桃| 亚洲天堂久久久久久久| 久久免费看少妇高潮| 在线成人免费视频| 欧美日韩国产天堂| 色8久久精品久久久久久蜜| 99久久精品国产精品久久| 国产成人综合亚洲网站| 久久精品国产精品亚洲红杏| 亚洲第一久久影院| 亚洲午夜日本在线观看| 亚洲三级电影全部在线观看高清| 亚洲国产精品自拍| 亚洲精品免费在线| 亚洲免费观看高清完整版在线观看| 久久日一线二线三线suv| 日韩精品专区在线| 日韩欧美在线不卡| 精品欧美一区二区在线观看 | 国产日产欧美一区二区视频| 欧美精品一区二区三区在线 | 一区二区三区电影在线播| 亚洲人成在线观看一区二区| 亚洲人成7777| 亚洲国产精品久久艾草纯爱| 亚洲成年人网站在线观看| 五月天精品一区二区三区| 奇米影视一区二区三区小说| 免费视频最近日韩| 激情综合网激情| 国产成人在线视频播放| 成人高清视频在线| 91免费小视频| 欧美日韩一区二区三区不卡| 欧美精品日日鲁夜夜添| 69久久夜色精品国产69蝌蚪网| 欧美videos大乳护士334| 国产日韩欧美在线一区| 亚洲精品欧美综合四区| 天堂蜜桃91精品| 国产在线视频不卡二| 99在线精品观看| 在线看国产一区二区| 欧美videofree性高清杂交| 国产亚洲精品aa| 一区二区三区欧美亚洲| 蜜臀91精品一区二区三区 | 青青草97国产精品免费观看| 韩国欧美一区二区| 一本久道久久综合中文字幕| 欧美日韩成人一区二区| 久久综合久久久久88| 亚洲视频一区二区在线观看| 日韩二区在线观看| 成人av在线看| 欧美精品自拍偷拍动漫精品| 国产亚洲成年网址在线观看| 美美哒免费高清在线观看视频一区二区| 美女网站在线免费欧美精品| 国产成人8x视频一区二区| 欧美日韩国产乱码电影| 国产精品婷婷午夜在线观看| 天天综合网 天天综合色| 成人夜色视频网站在线观看| 欧美日韩精品专区| 国产精品久久久久久久久久免费看 | 欧美一区二区三区免费大片| 久久影院午夜片一区| 亚洲成人动漫在线观看| 国产宾馆实践打屁股91| 欧美日韩成人高清| 亚洲欧美日韩国产手机在线| 精品中文字幕一区二区小辣椒| 色偷偷成人一区二区三区91| 久久网站最新地址| 丝袜亚洲另类欧美| 91在线国内视频| 久久亚洲二区三区| 免费欧美在线视频| 欧美日韩精品高清| 亚洲欧美日韩一区二区三区在线观看| 老司机精品视频线观看86| 欧美日韩国产乱码电影| 亚洲视频免费在线| 丰满放荡岳乱妇91ww| 精品成人在线观看| 免费视频最近日韩| 91精品国产欧美一区二区| 一区二区三区在线免费播放| 成人网男人的天堂| 亚洲精品在线观看网站| 免费精品视频最新在线| 欧美在线影院一区二区| 亚洲视频你懂的| 91丨porny丨国产入口| 中文字幕电影一区| 成人精品在线视频观看| 久久精品一二三| 欧美精品自拍偷拍| 亚洲午夜久久久久久久久电影院 | 国产精品护士白丝一区av| 国产成+人+日韩+欧美+亚洲| 午夜欧美大尺度福利影院在线看| 99久久精品国产麻豆演员表| 亚洲国产成人精品视频|