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

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

?? serial.c

?? freertosV4.40 是一種small的嵌入式系統。利于嵌入式開好者入門學習嵌入式操作系統。通過對于源碼的學習可以很好的掌握freertos的運行機制。
?? C
字號:
/*
	FreeRTOS.org V4.4.0 - 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.
	***************************************************************************
*/

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


/*-----------------------------------------------------------
 * Components that can be compiled to either ARM or THUMB mode are
 * contained in this file.c  The ISR routines, which can only be compiled
 * to ARM mode, are contained in serialISR.c.
 *----------------------------------------------------------*/



/* Library includes. */
#include "75x_uart.h"
#include "75x_gpio.h"
#include "75x_eic.h"
#include "75x_mrcc.h"

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

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

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

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

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

static volatile portBASE_TYPE xQueueEmpty = pdTRUE;

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

/* The interrupt service routine - called from the assembly entry point. */
void vSerialISR( void );
void vConfigureQueues( xQueueHandle xQForRx, xQueueHandle xQForTx, volatile portBASE_TYPE *pxEmptyFlag );

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

/*
 * See the serial2.h header file.
 */
xComPortHandle xSerialPortInitMinimal( unsigned portLONG ulWantedBaud, unsigned portBASE_TYPE uxQueueLength )
{
xComPortHandle xReturn;
UART_InitTypeDef UART_InitStructure;
GPIO_InitTypeDef GPIO_InitStructure;
EIC_IRQInitTypeDef  EIC_IRQInitStructure;	

	/* 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 ) )
	{
	
		vConfigureQueues( xRxedChars, xCharsForTx, &xQueueEmpty );
	
		portENTER_CRITICAL();
		{
			/* Enable the UART0 Clock. */
			MRCC_PeripheralClockConfig( MRCC_Peripheral_UART0, ENABLE );
			
			/* Configure the UART0_Tx as alternate function */
			GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
			GPIO_InitStructure.GPIO_Pin =  GPIO_Pin_11;
			GPIO_Init(GPIO0, &GPIO_InitStructure);
			
			/* Configure the UART0_Rx as input floating */
			GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
			GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10;
			GPIO_Init(GPIO0, &GPIO_InitStructure);
			
			/* Configure UART0. */
			UART_InitStructure.UART_WordLength = UART_WordLength_8D;
			UART_InitStructure.UART_StopBits = UART_StopBits_1;
			UART_InitStructure.UART_Parity = UART_Parity_No;
			UART_InitStructure.UART_BaudRate = ulWantedBaud;
			UART_InitStructure.UART_HardwareFlowControl = UART_HardwareFlowControl_None;
			UART_InitStructure.UART_Mode = UART_Mode_Tx_Rx;
			UART_InitStructure.UART_TxFIFOLevel = UART_FIFOLevel_1_2; /* FIFO size 16 bytes, FIFO level 8 bytes */
			UART_InitStructure.UART_RxFIFOLevel = UART_FIFOLevel_1_2; /* FIFO size 16 bytes, FIFO level 8 bytes */
			UART_Init(UART0, &UART_InitStructure);

			/* Enable the UART0 */
			UART_Cmd(UART0, ENABLE);

			/* Configure the IEC for the UART interrupts. */			
			EIC_IRQInitStructure.EIC_IRQChannelCmd = ENABLE;
			EIC_IRQInitStructure.EIC_IRQChannel = UART0_IRQChannel;
			EIC_IRQInitStructure.EIC_IRQChannelPriority = 1;
			EIC_IRQInit(&EIC_IRQInitStructure);
			
			xQueueEmpty = pdTRUE;
			UART_ITConfig( UART0, UART_IT_Transmit | UART_IT_Receive, 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 )
{
portBASE_TYPE xReturn;

	/* Place the character in the queue of characters to be transmitted. */
	portENTER_CRITICAL();
	{
		if( xQueueEmpty == pdTRUE )
		{
			UART0->DR = cOutChar;
			xReturn = pdPASS;
		}
		else
		{
			if( xQueueSend( xCharsForTx, &cOutChar, xBlockTime ) != pdPASS )
			{
				xReturn = pdFAIL;
			}			
			else
			{
				xReturn = pdPASS;				
			}
		}
		
		xQueueEmpty = pdFALSE;
	}
	portEXIT_CRITICAL();

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

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





	

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
六月婷婷色综合| 亚洲午夜精品网| 一区二区三区在线视频观看58| 亚洲一区二区三区精品在线| 狠狠色狠狠色合久久伊人| 欧美最新大片在线看| 久久久久久久久97黄色工厂| 天堂av在线一区| 99久久久免费精品国产一区二区| 欧美v国产在线一区二区三区| 亚洲高清视频中文字幕| 不卡电影免费在线播放一区| 欧美不卡123| 日本午夜精品视频在线观看| 欧美激情中文字幕| 麻豆国产欧美日韩综合精品二区| 欧美国产精品v| 亚洲精品老司机| 国产成人一级电影| 久久青草国产手机看片福利盒子| 午夜国产不卡在线观看视频| 91视视频在线直接观看在线看网页在线看| 欧美大度的电影原声| 丝袜a∨在线一区二区三区不卡| 在线免费观看视频一区| 亚洲精品中文字幕在线观看| 99热国产精品| 久久精品水蜜桃av综合天堂| 国产中文字幕一区| 久久免费视频色| 国产又粗又猛又爽又黄91精品| 在线播放国产精品二区一二区四区| 成人欧美一区二区三区白人| a级高清视频欧美日韩| 午夜视频一区二区三区| 26uuuu精品一区二区| 久久久久高清精品| 日韩理论片一区二区| 国产suv一区二区三区88区| 久久久久久免费网| 福利一区二区在线| 久久精品视频一区| 成人精品免费网站| 久久久久亚洲蜜桃| 成人午夜私人影院| 一区二区三区四区av| 欧洲视频一区二区| 日av在线不卡| 欧美国产成人精品| 色噜噜久久综合| 三级欧美韩日大片在线看| 欧美一区二区三区视频| 国产乱人伦偷精品视频免下载| 国产亚洲精久久久久久| av网站免费线看精品| 亚洲国产精品人人做人人爽| 久久综合九色综合97_久久久| 欧美成人一区二区三区片免费| 中文字幕一区在线观看视频| 亚洲成人免费在线观看| 7777精品伊人久久久大香线蕉超级流畅 | 在线观看一区二区视频| 日韩精品福利网| 久久你懂得1024| 91性感美女视频| 日韩电影在线看| 国产日韩精品一区二区三区在线| 91在线国产福利| 毛片不卡一区二区| 国产精品女人毛片| 国产精品一区二区久久不卡| 九色综合国产一区二区三区| 不卡av电影在线播放| 亚洲精品免费在线播放| 88在线观看91蜜桃国自产| 国产真实乱偷精品视频免| 亚洲免费毛片网站| 精品福利在线导航| 在线观看不卡视频| 国产成人免费视频网站高清观看视频| 亚洲精品国产成人久久av盗摄| 日韩女优av电影在线观看| 91在线porny国产在线看| 国产一区二区福利视频| 午夜精品久久久久久| 最近中文字幕一区二区三区| 日韩免费一区二区三区在线播放| 在线一区二区三区| 成人性生交大片免费看中文| 免费成人在线观看| 亚瑟在线精品视频| 有码一区二区三区| 国产精品久久精品日日| 国产人久久人人人人爽| 欧美mv日韩mv国产网站| 国内久久精品视频| 欧美精品久久久久久久多人混战 | 国产精品午夜久久| 精品日韩成人av| 9191久久久久久久久久久| 91福利在线观看| 色综合久久中文综合久久97| 国产一区高清在线| 日韩1区2区3区| 亚洲香肠在线观看| 玉米视频成人免费看| 亚洲精品综合在线| 一区二区三区免费观看| 亚洲欧美日韩小说| 亚洲日本va午夜在线电影| 国产精品网站一区| 亚洲国产成人午夜在线一区 | 综合欧美一区二区三区| 国产欧美一区二区精品忘忧草 | 精品卡一卡二卡三卡四在线| 日韩一区二区高清| 欧美精品一区二区三区久久久| 在线不卡a资源高清| 欧美一级黄色大片| 精品国产精品一区二区夜夜嗨| 欧美一级艳片视频免费观看| 欧美一区二区三区四区视频| 日韩欧美你懂的| 精品福利一二区| 中文字幕av免费专区久久| 国产精品国产三级国产普通话蜜臀| 国产精品视频一二| 亚洲精品乱码久久久久久| 亚洲国产va精品久久久不卡综合| 性感美女久久精品| 六月丁香综合在线视频| 成人午夜激情影院| 日本精品一级二级| 91精品国产色综合久久| 精品国产伦理网| 中文字幕亚洲区| 日本午夜精品视频在线观看| 国产乱码精品一区二区三区av| 粉嫩嫩av羞羞动漫久久久| 91视频一区二区| 制服丝袜一区二区三区| 国产日韩精品一区二区三区在线| 亚洲精品成人a在线观看| 日本中文字幕不卡| 国产91高潮流白浆在线麻豆| 91老师国产黑色丝袜在线| 国产成人精品三级麻豆| 日韩精品一区二区在线观看| 欧美图区在线视频| 国产精品蜜臀av| 日本女优在线视频一区二区| 蜜臀av性久久久久蜜臀aⅴ四虎| 国产精品综合一区二区| 91福利社在线观看| 精品国产一区二区三区久久久蜜月| 国产亚洲va综合人人澡精品| 一区二区三区鲁丝不卡| 久久成人羞羞网站| 日本高清不卡视频| 久久久五月婷婷| 日韩中文字幕亚洲一区二区va在线| 国产成人亚洲综合a∨婷婷| 欧美日韩一区在线观看| 国产精品久久久久影院| 久久99精品国产麻豆婷婷| 欧洲色大大久久| 国产精品美女视频| 精品一区二区影视| 欧美嫩在线观看| 亚洲人妖av一区二区| 精品成人免费观看| 国产一区二区三区日韩 | 欧美mv日韩mv国产| 亚洲午夜一区二区| 国产iv一区二区三区| 日韩一区二区三区高清免费看看| 亚洲精品成人少妇| 99精品国产视频| 久久久久久**毛片大全| 日韩av午夜在线观看| 欧美色综合网站| 亚洲女人****多毛耸耸8| 久久精品国产色蜜蜜麻豆| 色欧美乱欧美15图片| 亚洲婷婷在线视频| 成人精品亚洲人成在线| 久久久五月婷婷| 国产在线看一区| 精品国产一区二区三区四区四| 免费成人av资源网| 91精品国产综合久久久久久 | 欧美日韩另类一区| 一区二区三区精品| 91成人在线精品| 亚洲一区二区三区中文字幕 | 成人午夜在线视频| 国产精品传媒视频| 色呦呦网站一区| 亚洲制服丝袜在线| 欧美日韩成人综合在线一区二区|