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

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

?? serial.c

?? FreeRTOS V4.2.1,增加了AVR32 UC3 和 LPC2368 的支持
?? C
字號:
/*
	FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 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.

	Also see http://www.SafeRTOS.com for an IEC 61508 compliant version along
	with commercial development and support options.
	***************************************************************************
*/

/*
	Changes from V2.4.0

		+ Made serial ISR handling more complete and robust.

	Changes from V2.4.1

		+ Split serial.c into serial.c and serialISR.c.  serial.c can be 
		  compiled using ARM or THUMB modes.  serialISR.c must always be
		  compiled in ARM mode.
		+ Another small change to cSerialPutChar().

	Changed from V2.5.1

		+ In cSerialPutChar() an extra check is made to ensure the post to
		  the queue was successful if then attempting to retrieve the posted
		  character.

*/

/* 
	BASIC INTERRUPT DRIVEN SERIAL PORT DRIVER FOR UART0. 

	This file contains all the serial port components that can be compiled to
	either ARM or THUMB mode.  Components that must be compiled to ARM mode are
	contained in serialISR.c.
*/

/* Standard includes. */
#include <stdlib.h>

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

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

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

/* Constants to setup and access the UART. */
#define serDLAB							( ( unsigned portCHAR ) 0x80 )
#define serENABLE_INTERRUPTS			( ( unsigned portCHAR ) 0x03 )
#define serNO_PARITY					( ( unsigned portCHAR ) 0x00 )
#define ser1_STOP_BIT					( ( unsigned portCHAR ) 0x00 )
#define ser8_BIT_CHARS					( ( unsigned portCHAR ) 0x03 )
#define serFIFO_ON						( ( unsigned portCHAR ) 0x01 )
#define serCLEAR_FIFO					( ( unsigned portCHAR ) 0x06 )
#define serWANTED_CLOCK_SCALING			( ( unsigned portLONG ) 16 )

/* Constants to setup and access the VIC. */
#define serUART0_VIC_CHANNEL			( ( unsigned portLONG ) 0x0006 )
#define serUART0_VIC_CHANNEL_BIT		( ( unsigned portLONG ) 0x0040 )
#define serUART0_VIC_ENABLE				( ( unsigned portLONG ) 0x0020 )
#define serCLEAR_VIC_INTERRUPT			( ( unsigned portLONG ) 0 )

#define serINVALID_QUEUE				( ( xQueueHandle ) 0 )
#define serHANDLE						( ( xComPortHandle ) 1 )
#define serNO_BLOCK						( ( portTickType ) 0 )

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

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

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

/* Communication flag between the interrupt service routine and serial API. */
static volatile portLONG *plTHREEmpty;

/* 
 * The queues are created in serialISR.c as they are used from the ISR.
 * Obtain references to the queues and THRE Empty flag. 
 */
extern void vSerialISRCreateQueues(	unsigned portBASE_TYPE uxQueueLength, xQueueHandle *pxRxedChars, xQueueHandle *pxCharsForTx, portLONG volatile **pplTHREEmptyFlag );

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

xComPortHandle xSerialPortInitMinimal( unsigned portLONG ulWantedBaud, unsigned portBASE_TYPE uxQueueLength )
{
unsigned portLONG ulDivisor, ulWantedClock;
xComPortHandle xReturn = serHANDLE;
extern void ( vUART_ISR )( void );

	/* The queues are used in the serial ISR routine, so are created from
	serialISR.c (which is always compiled to ARM mode. */
	vSerialISRCreateQueues( uxQueueLength, &xRxedChars, &xCharsForTx, &plTHREEmpty );

	if( 
		( xRxedChars != serINVALID_QUEUE ) && 
		( xCharsForTx != serINVALID_QUEUE ) && 
		( ulWantedBaud != ( unsigned portLONG ) 0 ) 
	  )
	{
		portENTER_CRITICAL();
		{
			/* Setup the baud rate:  Calculate the divisor value. */
			ulWantedClock = ulWantedBaud * serWANTED_CLOCK_SCALING;
			ulDivisor = configCPU_CLOCK_HZ / ulWantedClock;

			/* Set the DLAB bit so we can access the divisor. */
			UART0_LCR |= serDLAB;

			/* Setup the divisor. */
			UART0_DLL = ( unsigned portCHAR ) ( ulDivisor & ( unsigned portLONG ) 0xff );
			ulDivisor >>= 8;
			UART0_DLM = ( unsigned portCHAR ) ( ulDivisor & ( unsigned portLONG ) 0xff );

			/* Turn on the FIFO's and clear the buffers. */
			UART0_FCR = ( serFIFO_ON | serCLEAR_FIFO );

			/* Setup transmission format. */
			UART0_LCR = serNO_PARITY | ser1_STOP_BIT | ser8_BIT_CHARS;

			/* Setup the VIC for the UART. */
			VICIntSelect &= ~( serUART0_VIC_CHANNEL_BIT );
			VICIntEnable |= serUART0_VIC_CHANNEL_BIT;
			VICVectAddr1 = ( portLONG ) vUART_ISR;
			VICVectCntl1 = serUART0_VIC_CHANNEL | serUART0_VIC_ENABLE;

			/* Enable UART0 interrupts. */
			UART0_IER |= serENABLE_INTERRUPTS;
		}
		portEXIT_CRITICAL();
	}
	else
	{
		xReturn = ( xComPortHandle ) 0;
	}

	return xReturn;
}
/*-----------------------------------------------------------*/

signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed portCHAR *pcRxedChar, portTickType xBlockTime )
{
	/* The port handle is not required as this driver only supports UART0. */
	( 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;

	/* 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;
	( void ) usStringLength;

	/* 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 )
{
signed portBASE_TYPE xReturn;

	/* This demo driver only supports one port so the parameter is not used. */
	( void ) pxPort;

	portENTER_CRITICAL();
	{
		/* Is there space to write directly to the UART? */
		if( *plTHREEmpty == ( portLONG ) pdTRUE )
		{
			/* We wrote the character directly to the UART, so was 
			successful. */
			*plTHREEmpty = pdFALSE;
			UART0_THR = cOutChar;
			xReturn = pdPASS;
		}
		else 
		{
			/* We cannot write directly to the UART, so queue the character.
			Block for a maximum of xBlockTime if there is no space in the
			queue. */
			xReturn = xQueueSend( xCharsForTx, &cOutChar, xBlockTime );

			/* Depending on queue sizing and task prioritisation:  While we 
			were blocked waiting to post interrupts were not disabled.  It is 
			possible that the serial ISR has emptied the Tx queue, in which
			case we need to start the Tx off again. */
			if( ( *plTHREEmpty == ( portLONG ) pdTRUE ) && ( xReturn == pdPASS ) )
			{
				xQueueReceive( xCharsForTx, &cOutChar, serNO_BLOCK );
				*plTHREEmpty = pdFALSE;
				UART0_THR = cOutChar;
			}
		}
	}
	portEXIT_CRITICAL();

	return xReturn;
}
/*-----------------------------------------------------------*/

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





	

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国内精品久久久久影院一蜜桃| 国产成人免费在线观看不卡| 日韩精品一区二区三区视频| av在线播放成人| 久久爱www久久做| 亚洲精品第一国产综合野| 久久蜜桃香蕉精品一区二区三区| 91福利精品视频| 国产激情91久久精品导航 | 麻豆91精品91久久久的内涵| 国产精品二区一区二区aⅴ污介绍| 日韩一卡二卡三卡| 91麻豆.com| 成人激情校园春色| 国产曰批免费观看久久久| 午夜精品久久久| 亚洲伦理在线免费看| 国产日韩一级二级三级| 欧美va日韩va| 制服丝袜亚洲网站| 欧美日韩专区在线| 日本久久一区二区| 99精品视频在线免费观看| 国产精品亚洲专一区二区三区 | 91福利精品视频| 成人黄色综合网站| 高清在线成人网| 国产麻豆精品在线| 国模少妇一区二区三区| 久久99九九99精品| 奇米精品一区二区三区四区 | 亚洲精品久久久蜜桃| 国产精品成人免费精品自在线观看| 久久综合给合久久狠狠狠97色69| 日韩亚洲国产中文字幕欧美| 欧美区视频在线观看| 欧美二区三区的天堂| 欧美日韩免费一区二区三区视频| 在线视频亚洲一区| 欧日韩精品视频| 色老汉av一区二区三区| 91麻豆国产福利在线观看| 日本乱码高清不卡字幕| 欧美三区免费完整视频在线观看| 在线观看亚洲a| 欧美精品乱码久久久久久按摩| 欧洲国内综合视频| 欧美精品在欧美一区二区少妇| 欧美日韩色综合| 日韩欧美精品在线| 久久综合九色综合欧美98 | 蜜臀va亚洲va欧美va天堂 | 91片黄在线观看| 日本道色综合久久| 欧美猛男超大videosgay| 欧美高清精品3d| 精品国产人成亚洲区| 久久久久久99久久久精品网站| 国产视频一区在线播放| 国产精品理论片在线观看| 一区二区日韩av| 青青草一区二区三区| 国产另类ts人妖一区二区| av电影天堂一区二区在线| 欧美亚洲综合色| 欧美成人免费网站| 国产精品久久久久久亚洲伦| 亚洲一区二区四区蜜桃| 日韩高清一区二区| 粉嫩一区二区三区性色av| 一本一道久久a久久精品 | 国产精品婷婷午夜在线观看| 最新久久zyz资源站| 午夜久久久久久电影| 久久99精品久久久久久国产越南| 国产.精品.日韩.另类.中文.在线.播放| 成人福利视频在线| 欧美日韩国产区一| 国产女人18毛片水真多成人如厕 | 激情图片小说一区| 99久久亚洲一区二区三区青草| 中文字幕在线观看不卡视频| 一区二区三区日韩欧美| 久久爱www久久做| 91福利精品视频| 久久免费美女视频| 亚洲第一综合色| 国产成人日日夜夜| 欧美日产在线观看| 国产精品丝袜久久久久久app| 亚洲香肠在线观看| 国产成人精品亚洲午夜麻豆| 在线观看国产精品网站| 久久久久久久精| 性欧美疯狂xxxxbbbb| 成人开心网精品视频| 91麻豆精品国产91久久久久| 中文字幕一区二区三区在线播放 | 国产精品国模大尺度视频| 午夜精品视频一区| 91丨九色丨国产丨porny| 精品欧美乱码久久久久久| 亚洲一区二区三区四区不卡| 国产毛片精品一区| 欧美一级免费大片| 亚洲综合丁香婷婷六月香| 懂色av一区二区三区蜜臀| 欧美成人a∨高清免费观看| 夜色激情一区二区| 99视频热这里只有精品免费| 精品久久久久久久人人人人传媒 | 日韩精品最新网址| 亚洲午夜在线电影| 91婷婷韩国欧美一区二区| 久久久精品免费网站| 九九九久久久精品| 欧美疯狂做受xxxx富婆| 99久久亚洲一区二区三区青草| 久久夜色精品国产噜噜av | 午夜视频一区二区三区| 91网站视频在线观看| 中文字幕 久热精品 视频在线 | 日韩视频在线永久播放| 亚洲电影第三页| 欧美亚洲国产bt| 夜色激情一区二区| 在线观看国产91| 一区2区3区在线看| 欧美性受xxxx黑人xyx性爽| 亚洲蜜桃精久久久久久久| 99免费精品视频| 一区在线观看免费| 91亚洲大成网污www| 亚洲欧美韩国综合色| 91麻豆视频网站| 有码一区二区三区| 欧美综合一区二区| 亚洲国产精品久久艾草纯爱| 欧美影院一区二区| 亚洲成人免费av| 欧美一三区三区四区免费在线看| 丝袜脚交一区二区| 欧美一级精品在线| 久久99精品国产麻豆不卡| 精品第一国产综合精品aⅴ| 国产一区三区三区| 国产精品免费人成网站| 95精品视频在线| 亚洲大尺度视频在线观看| 欧美精品一二三| 黄色资源网久久资源365| 欧美精品一区二区高清在线观看| 国产一区二区h| 国产精品成人一区二区艾草| 91久久一区二区| 日韩 欧美一区二区三区| wwwwww.欧美系列| av电影天堂一区二区在线| 一区二区三区精品久久久| 欧美日本高清视频在线观看| 麻豆国产91在线播放| 久久精品人人做人人爽97| 91在线小视频| 天堂久久久久va久久久久| 亚洲精品在线电影| 99久久免费精品高清特色大片| 亚洲成人手机在线| 精品人在线二区三区| 北条麻妃一区二区三区| 亚洲电影激情视频网站| 亚洲精品在线免费观看视频| 99精品视频在线观看| 午夜精品久久久久久久久久| 精品国产1区2区3区| 91免费观看在线| 麻豆成人久久精品二区三区小说| 亚洲国产成人私人影院tom| 欧美午夜一区二区三区免费大片| 精品亚洲porn| 亚洲精品成人精品456| 精品国产乱码久久久久久闺蜜 | 精品国产乱码久久久久久影片| 成人午夜av在线| 天堂久久一区二区三区| 亚洲国产精品av| 欧美一区二区福利在线| 91在线视频播放地址| 另类综合日韩欧美亚洲| 有坂深雪av一区二区精品| 久久色视频免费观看| 欧美疯狂做受xxxx富婆| 国产suv一区二区三区88区| 婷婷中文字幕综合| 国产精品久久三| 精品国产伦理网| 欧美二区乱c少妇| 色www精品视频在线观看| 国产麻豆91精品| 日韩 欧美一区二区三区| 亚洲激情自拍偷拍|