]> git.sur5r.net Git - freertos/blob - FreeRTOS-Plus/Demo/FreeRTOS_Plus_UDP_and_CLI_LPC1830_GCC/ThirdParty/LPCOpen/lpc_core/lpc_board/board_common/board_api.h
Update LPC18xx FreeRTOS+UDP demo to use LPCOpen USB and Ethernet drivers.
[freertos] / FreeRTOS-Plus / Demo / FreeRTOS_Plus_UDP_and_CLI_LPC1830_GCC / ThirdParty / LPCOpen / lpc_core / lpc_board / board_common / board_api.h
1 /*\r
2  * @brief Common board API functions\r
3  *\r
4  * @note\r
5  * Copyright(C) NXP Semiconductors, 2012\r
6  * All rights reserved.\r
7  *\r
8  * @par\r
9  * Software that is described herein is for illustrative purposes only\r
10  * which provides customers with programming information regarding the\r
11  * LPC products.  This software is supplied "AS IS" without any warranties of\r
12  * any kind, and NXP Semiconductors and its licensor disclaim any and\r
13  * all warranties, express or implied, including all implied warranties of\r
14  * merchantability, fitness for a particular purpose and non-infringement of\r
15  * intellectual property rights.  NXP Semiconductors assumes no responsibility\r
16  * or liability for the use of the software, conveys no license or rights under any\r
17  * patent, copyright, mask work right, or any other intellectual property rights in\r
18  * or to any products. NXP Semiconductors reserves the right to make changes\r
19  * in the software without notification. NXP Semiconductors also makes no\r
20  * representation or warranty that such application will be suitable for the\r
21  * specified use without further testing or modification.\r
22  *\r
23  * @par\r
24  * Permission to use, copy, modify, and distribute this software and its\r
25  * documentation is hereby granted, under NXP Semiconductors' and its\r
26  * licensor's relevant copyrights in the software, without fee, provided that it\r
27  * is used in conjunction with NXP Semiconductors microcontrollers.  This\r
28  * copyright, permission, and disclaimer notice must appear in all copies of\r
29  * this code.\r
30  */\r
31 \r
32 #ifndef __BOARD_API_H_\r
33 #define __BOARD_API_H_\r
34 \r
35 #include "lpc_types.h"\r
36 #include <stdio.h>\r
37 \r
38 #ifdef __cplusplus\r
39 extern "C" {\r
40 #endif\r
41 \r
42 /** @defgroup BOARD_COMMON_API BOARD: Common board functions\r
43  * @ingroup BOARD_Common\r
44  * This file contains common board definitions that are shared across\r
45  * boards and devices. All of these functions do not need to be\r
46  * impemented for a specific board, but if they are implemented, they\r
47  * should use this API standard.\r
48  * @{\r
49  */\r
50 \r
51 /**\r
52  * @brief       Set up and initialize all required blocks and functions related to the board hardware.\r
53  * @return      None\r
54  */\r
55 void Board_Init(void);\r
56 \r
57 /**\r
58  * @brief       Initializes board UART for output, required for printf redirection\r
59  * @return      None\r
60  */\r
61 void Board_Debug_Init(void);\r
62 \r
63 /**\r
64  * @brief       Sends a single character on the UART, required for printf redirection\r
65  * @param       ch      : character to send\r
66  * @return      None\r
67  */\r
68 void Board_UARTPutChar(char ch);\r
69 \r
70 /**\r
71  * @brief       Get a single character from the UART, required for scanf input\r
72  * @return      EOF if not character was received, or character value\r
73  */\r
74 int Board_UARTGetChar(void);\r
75 \r
76 /**\r
77  * @brief       Prints a string to the UART\r
78  * @param       str     : Terminated string to output\r
79  * @return      None\r
80  */\r
81 void Board_UARTPutSTR(char *str);\r
82 \r
83 /**\r
84  * @brief       Sets the state of a board LED to on or off\r
85  * @param       LEDNumber       : LED number to set state for\r
86  * @param       State           : true for on, false for off\r
87  * @return      None\r
88  */\r
89 void Board_LED_Set(uint8_t LEDNumber, bool State);\r
90 \r
91 /**\r
92  * @brief       Returns the current state of a board LED\r
93  * @param       LEDNumber       : LED number to set state for\r
94  * @return      true if the LED is on, otherwise false\r
95  */\r
96 bool Board_LED_Test(uint8_t LEDNumber);\r
97 \r
98 /**\r
99  * @brief       Toggles the current state of a board LED\r
100  * @param       LEDNumber       : LED number to change state for\r
101  * @return      None\r
102  */\r
103 STATIC INLINE void Board_LED_Toggle(uint8_t LEDNumber)\r
104 {\r
105         Board_LED_Set(LEDNumber, !Board_LED_Test(LEDNumber));\r
106 }\r
107 \r
108 /**\r
109  * @brief       Current system clock rate, mainly used for sysTick\r
110  */\r
111 extern uint32_t SystemCoreClock;\r
112 \r
113 /**\r
114  * @brief       Update system core clock rate, should be called if the\r
115  *                      system has a clock rate change\r
116  * @return      None\r
117  */\r
118 void SystemCoreClockUpdate(void);\r
119 \r
120 /**\r
121  * @brief       Turn on Board LCD Backlight\r
122  * @param       Intensity       : Backlight intensity (0 = off, >=1 = on)\r
123  * @return      None\r
124  * @note        On boards where a GPIO is used to control backlight on/off state, a '0' or '1'\r
125  * value will turn off or on the backlight. On some boards, a non-0 value will\r
126  * control backlight intensity via a PWN. For PWM systems, the intensity value\r
127  * is a percentage value between 0 and 100%.\r
128  */\r
129 void Board_SetLCDBacklight(uint8_t Intensity);\r
130 \r
131 /**\r
132  * @brief Function prototype for a MS delay function. Board layers or example code may\r
133  *        define this function as needed.\r
134  */\r
135 typedef void (*p_msDelay_func_t)(uint32_t);\r
136 \r
137 /* The DEBUG* functions are selected based on system configuration.\r
138    Code that uses the DEBUG* functions will have their I/O routed to\r
139    the UART, semihosting, or nowhere. */\r
140 #if defined(DEBUG_ENABLE)\r
141 #if defined(DEBUG_SEMIHOSTING)\r
142 #define DEBUGINIT()\r
143 #define DEBUGOUT(...) printf(__VA_ARGS__)\r
144 #define DEBUGSTR(str) printf(str)\r
145 #define DEBUGIN() (int) EOF\r
146 \r
147 #else\r
148 #define DEBUGINIT() Board_Debug_Init()\r
149 #define DEBUGOUT(...) printf(__VA_ARGS__)\r
150 #define DEBUGSTR(str) Board_UARTPutSTR(str)\r
151 #define DEBUGIN() Board_UARTGetChar()\r
152 #endif /* defined(DEBUG_SEMIHOSTING) */\r
153 \r
154 #else\r
155 #define DEBUGINIT()\r
156 #define DEBUGOUT(...)\r
157 #define DEBUGSTR(str)\r
158 #define DEBUGIN() (int) EOF\r
159 #endif /* defined(DEBUG_ENABLE) */\r
160 \r
161 /**\r
162  * @}\r
163  */\r
164 \r
165 #ifdef __cplusplus\r
166 }\r
167 #endif\r
168 \r
169 #endif /* __BOARD_API_H_ */\r