2 * FreeRTOS Kernel V10.2.0
\r
3 * Copyright (C) 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
\r
5 * Permission is hereby granted, free of charge, to any person obtaining a copy of
\r
6 * this software and associated documentation files (the "Software"), to deal in
\r
7 * the Software without restriction, including without limitation the rights to
\r
8 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
\r
9 * the Software, and to permit persons to whom the Software is furnished to do so,
\r
10 * subject to the following conditions:
\r
12 * The above copyright notice and this permission notice shall be included in all
\r
13 * copies or substantial portions of the Software.
\r
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
\r
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
\r
17 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
\r
18 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
\r
19 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
\r
20 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\r
22 * http://www.FreeRTOS.org
\r
23 * http://aws.amazon.com/freertos
\r
25 * 1 tab == 4 spaces!
\r
29 BASIC SERIAL PORT DRIVER.
\r
31 This file just maps generic functions used by FreeRTOS example code to the
\r
32 simple UART drivers provided by Altera.
\r
35 /* Scheduler includes. */
\r
36 #include "FreeRTOS.h"
\r
41 /* Demo application includes. */
\r
44 /* Altera library includes. */
\r
45 #include "uart0_support.h"
\r
47 /*-----------------------------------------------------------*/
\r
50 * See the serial2.h header file.
\r
52 xComPortHandle xSerialPortInitMinimal( uint32_t ulWantedBaud, UBaseType_t uxQueueLength )
\r
54 /* Just call into the Altera support function, which has its own parameters,
\r
55 so the parameters passed in here are not used. */
\r
56 ( void ) ulWantedBaud;
\r
57 ( void ) uxQueueLength;
\r
60 return ( xComPortHandle ) 0;
\r
62 /*-----------------------------------------------------------*/
\r
64 BaseType_t xSerialGetChar( xComPortHandle pxPort, signed char *pcRxedChar, TickType_t xBlockTime )
\r
68 /* Just call into the Altera support function, which has its own parameters,
\r
69 so the parameters passed in here are not used. */
\r
71 ( void ) xBlockTime;
\r
73 *pcRxedChar = uart0_getc();
\r
75 if( *pcRxedChar != -1 )
\r
86 /*-----------------------------------------------------------*/
\r
88 void vSerialPutString( xComPortHandle pxPort, const signed char * const pcString, unsigned short usStringLength )
\r
90 /* Just call into the Altera support function, which has its own parameters,
\r
91 so the parameters passed in here are not used. */
\r
94 uart0_print( ( char * ) pcString );
\r
96 /*-----------------------------------------------------------*/
\r
98 signed portBASE_TYPE xSerialPutChar( xComPortHandle pxPort, signed char cOutChar, TickType_t xBlockTime )
\r
100 char cOutBytes[ 2 ];
\r
102 /* Just call into the Altera support function, which has its own parameters,
\r
103 so the parameters passed in here are not used. */
\r
106 cOutBytes[ 0 ] = cOutChar;
\r
107 cOutBytes[ 1 ] = 0x00;
\r
108 uart0_print( cOutBytes );
\r
112 /*-----------------------------------------------------------*/
\r
114 void vSerialClose(xComPortHandle xPort)
\r
116 /* Not supported as not required by the demo application. */
\r
119 /*-----------------------------------------------------------*/
\r