Contiki 3.x
dbg.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2012, Texas Instruments Incorporated - http://www.ti.com/
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
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  *
14  * 3. Neither the name of the copyright holder nor the names of its
15  * contributors may be used to endorse or promote products derived
16  * from this software without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
23  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
27  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29  * OF THE POSSIBILITY OF SUCH DAMAGE.
30  */
31 /**
32  * \addtogroup cc2538
33  * @{
34  *
35  * \defgroup cc2538-char-io cc2538 Character I/O
36  *
37  * cc2538 CPU-specific functions for debugging and SLIP I/O
38  *
39  * On the cc2538, character I/O can be directed over USB or UART. This is
40  * controlled by a series of configuration directives:
41  * - SLIP_ARCH_CONF_USB: Controls the operation of slip-arch.
42  * - CC2538_RF_CONF_SNIFFER_USB: Controls the output of the RF driver when
43  * operating as a sniffer
44  * - DBG_CONF_USB: Controls all debugging output
45  *
46  * Defaults for those defines are set in contiki-conf.h
47  * @{
48  *
49  * \file
50  * Header file for the cc2538 Debug I/O module
51  */
52 #ifndef DBG_H_
53 #define DBG_H_
54 
55 #include "contiki-conf.h"
56 
57 #include "usb/usb-serial.h"
58 /**
59  * \brief Print a stream of bytes
60  * \param seq A pointer to the stream
61  * \param len The number of bytes to print
62  * \return The number of printed bytes
63  *
64  * This function is an arch-specific implementation required by the dbg-io
65  * API in cpu/arm/common/dbg-io. It prints a stream of bytes over the
66  * peripheral used by the platform.
67  */
68 unsigned int dbg_send_bytes(const unsigned char *seq, unsigned int len);
69 
70 /**
71  * \brief Flushes character output
72  *
73  * When debugging is sent over USB, this functions causes the USB
74  * driver to immediately TX the content of output buffers. When
75  * debugging is over UART, this function does nothing.
76  *
77  * There is nothing stopping you from using this macro in your code but
78  * normally, you won't have to.
79  */
80 #if DBG_CONF_USB
81 #define dbg_flush() usb_serial_flush()
82 #else
83 #define dbg_flush()
84 #endif
85 
86 #endif /* DBG_H_ */
87 
88 /**
89  * @}
90  * @}
91  */
unsigned int dbg_send_bytes(const unsigned char *seq, unsigned int len)
Print a stream of bytes.
Definition: debug-uart.c:71
Header file for cc2538's UART-like I/O over USB.