BSP430  20141115
Board Support Package for MSP430 microcontrollers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
console.h
Go to the documentation of this file.
1 /* Copyright 2012-2014, Peter A. Bigot
2  *
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * * Redistributions of source code must retain the above copyright notice,
9  * this list of conditions and the following disclaimer.
10  *
11  * * Redistributions in binary form must reproduce the above copyright notice,
12  * this list of conditions and the following disclaimer in the documentation
13  * and/or other materials provided with the distribution.
14  *
15  * * Neither the name of the software nor the names of its contributors may be
16  * used to endorse or promote products derived from this software without
17  * specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  * POSSIBILITY OF SUCH DAMAGE.
30  */
31 
88 #ifndef BSP430_UTILITY_CONSOLE_H
89 #define BSP430_UTILITY_CONSOLE_H
90 
91 #include <bsp430/serial.h>
92 #include <stdarg.h>
93 
104 #ifndef configBSP430_CONSOLE
105 #define configBSP430_CONSOLE 0
106 #endif /* configBSP430_CONSOLE */
107 
114 #if defined(BSP430_DOXYGEN)
115 #define BSP430_CONSOLE include <bsp430/platform.h>
116 #endif /* BSP430_DOXYGEN */
117 
130 #if defined(BSP430_DOXYGEN)
131 #define BSP430_CONSOLE_SERIAL_PERIPH_CPPID include <bsp430/platform.h>
132 #endif /* BSP430_DOXYGEN */
133 
145 #if defined(BSP430_DOXYGEN)
146 #define BSP430_CONSOLE_SERIAL_PERIPH_HANDLE include <bsp430/platform.h>
147 #endif /* BSP430_CONSOLE_SERIAL_PERIPH_HANDLE */
148 
153 #ifndef BSP430_CONSOLE_BAUD_RATE
154 #define BSP430_CONSOLE_BAUD_RATE 9600
155 #endif /* BSP430_CONSOLE_BAUD_RATE */
156 
166 #ifndef BSP430_CONSOLE_RX_BUFFER_SIZE
167 #define BSP430_CONSOLE_RX_BUFFER_SIZE 0
168 #endif /* BSP430_CONSOLE_RX_BUFFER_SIZE */
169 
183 #ifndef BSP430_CONSOLE_TX_BUFFER_SIZE
184 #define BSP430_CONSOLE_TX_BUFFER_SIZE 0
185 #endif /* BSP430_CONSOLE_TX_BUFFER_SIZE */
186 
200 #ifndef BSP430_CONSOLE_USE_EMBTEXTF
201 #define BSP430_CONSOLE_USE_EMBTEXTF 0
202 #endif /* BSP430_CONSOLE_USE_EMBTEXTF */
203 
212 int cgetchar (void);
213 
214 
215 #if defined(BSP430_DOXYGEN) || (0 < BSP430_CONSOLE_RX_BUFFER_SIZE)
216 
223 typedef int (* iBSP430consoleRxCallback_ni) (void);
224 
237 int cpeekchar (void);
238 
266 
267 #endif /* BSP430_CONSOLE_RX_BUFFER_SIZE */
268 
280 #ifndef configBSP430_CONSOLE_PROVIDES_PUTCHAR
281 #define configBSP430_CONSOLE_PROVIDES_PUTCHAR 1
282 #endif /* configBSP430_CONSOLE_PROVIDES_PUTCHAR */
283 
292 #ifndef configBSP430_CONSOLE_PROVIDES_STDIO
293 #define configBSP430_CONSOLE_PROVIDES_STDIO (BSP430_CORE_TOOLCHAIN_LIBC_NEWLIB - 0)
294 #endif /* configBSP430_CONSOLE_PROVIDES_STDIO */
295 
302 #ifndef configBSP430_CONSOLE_USE_ONLCR
303 #define configBSP430_CONSOLE_USE_ONLCR 1
304 #endif /* configBSP430_CONSOLE_USE_ONLCR */
305 
320 int cputs (const char * s);
321 
329 int cputchar (int c);
330 
341 int cputtext (const char * s);
342 
357 int cputchars (const char * cp, size_t len);
358 
359 #if (defined(BSP430_DOXYGEN) \
360  || (BSP430_CONSOLE_USE_EMBTEXTF - 0) \
361  || (BSP430_CORE_TOOLCHAIN_LIBC_MSP430_LIBC - 0) \
362  || (BSP430_CORE_TOOLCHAIN_LIBC_NEWLIB - 0))
363 
382 int cprintf (const char * format, ...)
383 #if (__GNUC__ - 0)
384 __attribute__((__format__(printf, 1, 2)))
385 #endif /* __GNUC__ */
386 ;
387 
397 int vcprintf (const char * format, va_list ap);
398 
410 int cputi (int n, int radix);
411 
427 int cputu (unsigned int n, int radix);
428 
442 int cputl (long n, int radix);
443 
457 int cputul (unsigned long n, int radix);
458 
459 #endif /* BSP430_CONSOLE_USE_EMBTEXTF */
460 
482 int iBSP430consoleInitialize (void);
483 
495 int iBSP430consoleDeconfigure (void);
496 
503 
529 
560 int iBSP430consoleWaitForTxSpace_ni (int want_available);
561 
578 int iBSP430consoleFlush (void);
579 
593 void vBSP430consoleDisplayMemory (const uint8_t * dp,
594  size_t len,
595  unsigned long base);
596 
607 void vBSP430consoleDisplayOctets (const uint8_t * dp,
608  size_t len);
609 
610 #endif /* BSP430_UTILITY_CONSOLE_H */
int iBSP430consoleInitialize(void)
void vBSP430consoleDisplayOctets(const uint8_t *dp, size_t len)
int cgetchar(void)
void vBSP430consoleSetRxCallback_ni(iBSP430consoleRxCallback_ni cb)
int vcprintf(const char *format, va_list ap)
int cputl(long n, int radix)
int iBSP430consoleFlush(void)
int cputtext(const char *s)
int cputs(const char *s)
Definition: serial_.h:193
int cputchars(const char *cp, size_t len)
int iBSP430consoleWaitForTxSpace_ni(int want_available)
int cpeekchar(void)
int(* iBSP430consoleRxCallback_ni)(void)
Definition: console.h:223
int cputu(unsigned int n, int radix)
int cputchar(int c)
int iBSP430consoleTransmitUseInterrupts_ni(int enablep)
Declarations for abstracted serial interface.
void vBSP430consoleDisplayMemory(const uint8_t *dp, size_t len, unsigned long base)
hBSP430halSERIAL hBSP430console(void)
int cprintf(const char *format,...)
int iBSP430consoleDeconfigure(void)
int cputi(int n, int radix)
int cputul(unsigned long n, int radix)