]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/RX100_RX113-RSK_GCC_e2studio_IAR/src/Renesas_Code/r_rsk_async.c
Baseline new RX projects before refining and tidying them up.
[freertos] / FreeRTOS / Demo / RX100_RX113-RSK_GCC_e2studio_IAR / src / Renesas_Code / r_rsk_async.c
1 /*******************************************************************************\r
2  * DISCLAIMER\r
3  * This software is supplied by Renesas Electronics Corporation and is only\r
4  * intended for use with Renesas products. No other uses are authorized. This\r
5  * software is owned by Renesas Electronics Corporation and is protected under\r
6  * all applicable laws, including copyright laws.\r
7  * THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING\r
8  * THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT\r
9  * LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE\r
10  * AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.\r
11  * TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS\r
12  * ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE\r
13  * FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR\r
14  * ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE\r
15  * BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.\r
16  * Renesas reserves the right, without notice, to make changes to this software\r
17  * and to discontinue the availability of this software. By using this software,\r
18  * you agree to the additional terms and conditions found by accessing the\r
19  * following link:\r
20  * http://www.renesas.com/disclaimer\r
21  *******************************************************************************/\r
22 /* Copyright (C) 2014 Renesas Electronics Corporation. All rights reserved.   */\r
23 /*******************************************************************************\r
24  * File Name     : r_rsk_async.c\r
25  * Version       : 1.00\r
26  * Device(s)     : R5F51138AxFP\r
27  * Tool-Chain    : CCRX\r
28  * H/W Platform  : RSKRX113\r
29  * Description   : Functions used to send data via the SCI in asynchronous mode\r
30  *******************************************************************************/\r
31 /*******************************************************************************\r
32  * History       : 26.08.2014  Ver. 1.00 First Release\r
33  *******************************************************************************/\r
34 \r
35 /*******************************************************************************\r
36  System Includes\r
37  *******************************************************************************/\r
38 /* Following header file provides string type definitions. */\r
39 #include <string.h>\r
40 \r
41 /*******************************************************************************\r
42  User Includes (Project Level Includes)\r
43  *******************************************************************************/\r
44 /* Defines port registers */\r
45 #include "r_cg_macrodriver.h"\r
46 #include "r_cg_sci.h"\r
47 #include "r_rsk_async.h"\r
48 \r
49 /*******************************************************************************\r
50  User Defines\r
51  *******************************************************************************/\r
52 \r
53 /*******************************************************************************\r
54  * Global Variables\r
55  *******************************************************************************/\r
56 \r
57 /* Declaration of the command string to clear the terminal screen */\r
58 static const char cmd_clr_scr[] =\r
59 { 27, 91, 50, 74, 0, 27, 91, 72, 0 };\r
60 \r
61 /*******************************************************************************\r
62  * Function Prototypes\r
63  *******************************************************************************/\r
64 \r
65 /* text_write function prototype */\r
66 static void text_write (const char * const msg_string);\r
67 \r
68 /*******************************************************************************\r
69  * Function Name: R_ASYNC_Init\r
70  * Description  : This function initialises the SCI channel connected to the\r
71  *                RS232 connector on the RSK. The channel is configured for\r
72  *                transmission and reception, and instructions are sent to the\r
73  *                terminal.\r
74  * Argument     : none\r
75  * Return value : none\r
76  *******************************************************************************/\r
77 void R_ASYNC_Init (void)\r
78 {\r
79 \r
80     /* Set up SCI1 receive buffer */\r
81     R_SCI1_Serial_Receive((uint8_t *) &g_rx_char, 1);\r
82 \r
83     /* Enable SCI1 operations */\r
84     R_SCI1_Start();\r
85 \r
86     /* Clear the text on terminal window */\r
87     text_write(cmd_clr_scr);\r
88 \r
89     /* Display splash screen on terminal window */\r
90     text_write("Renesas RSKRX113 Async Serial \r\n");\r
91 \r
92     /* Inform user on how to stop transmission */\r
93     text_write("Press 'z' to stop and any key to resume\r\n\n");\r
94 }\r
95 /*******************************************************************************\r
96  * End of function R_ASYNC_Init\r
97  *******************************************************************************/\r
98 \r
99 /*******************************************************************************\r
100  * Function Name : text_write\r
101  * Description   : Transmits null-terminated string.\r
102  * Argument      : (char*) msg_string - null terminated string\r
103  * Return value  : None\r
104  *******************************************************************************/\r
105 static void text_write (const char * const msg_string)\r
106 {\r
107     R_SCI1_AsyncTransmit((uint8_t *) msg_string, (uint16_t) strlen(msg_string));\r
108 }\r
109 /*******************************************************************************\r
110  * End of function text_write\r
111  *******************************************************************************/\r
112 \r