]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - apps/tidep0084.git/blob - tutorials/generic_sensor_tutorial/tutorial/SensorToCloud/components/common/inc/hexline.h
Added Support for Generic Sensor Tutorial which provides instructions on how to add...
[apps/tidep0084.git] / tutorials / generic_sensor_tutorial / tutorial / SensorToCloud / components / common / inc / hexline.h
1 /******************************************************************************
2  @file hexline.h
4  @brief TIMAC 2.0 API Debug hex dump helper functions
6  Group: WCS LPC
7  $Target Devices: Linux: AM335x, Embedded Devices: CC1310, CC1350$
9  ******************************************************************************
10  $License: BSD3 2016 $
11   
12    Copyright (c) 2015, Texas Instruments Incorporated
13    All rights reserved.
14   
15    Redistribution and use in source and binary forms, with or without
16    modification, are permitted provided that the following conditions
17    are met:
18   
19    *  Redistributions of source code must retain the above copyright
20       notice, this list of conditions and the following disclaimer.
21   
22    *  Redistributions in binary form must reproduce the above copyright
23       notice, this list of conditions and the following disclaimer in the
24       documentation and/or other materials provided with the distribution.
25   
26    *  Neither the name of Texas Instruments Incorporated nor the names of
27       its contributors may be used to endorse or promote products derived
28       from this software without specific prior written permission.
29   
30    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
31    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
32    THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
33    PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
34    CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
35    EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
36    PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
37    OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
38    WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
39    OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
40    EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
41  ******************************************************************************
42  $Release Name: TI-15.4Stack Linux x64 SDK$
43  $Release Date: Jun 28, 2017 (2.02.00.03)$
44  *****************************************************************************/
46 #if !defined(HEXLINE_H)
47 #define HEXLINE_H
49 #include <stddef.h>
50 #include <stdint.h>
52 /*!
53  * @brief HEXLINE_working variables
54  */
55 struct hexline {
56     /*! Address to be printed */
57     uint64_t    addr;
59     /*! Pointer to the data to be printed */
60     const void *pBytes;
62     /*! How many bytes to print */
63     size_t      nbytes;
65     /*! How many are complete */
66     size_t      ndone;
68     /* ! Working buffer (your text will be put here) */
69     char buf[90];
70 };
72 /*!
73  * @brief Initialize a HEXLINE Working buffer
74  *
75  * @param pH - pointer to the hexline structure
76  * @param addr - address field initializer
77  * @param pBytes - pointer to the data bytes to dump
78  * @param nbytes - count of bytes to dump
79  *
80  */
81 void HEXLINE_init(struct hexline *pH,
82                    uint64_t addr,
83                    const void *pBytes,
84                    size_t nbytes);
86 /*!
87  * @brief Format one line (up to 16 bytes) of hex dump data.
88  *
89  * @param pHexLine - structure initalized by HEXLINE_Init()
90  *
91  * Example
92  * \code
93  *
94  *    HEXLINE_Init(&h, 0x1234000, buffer, 1000);
95  *
96  *    while(h.ndone < h.nbyes){
97  *        HEXLINE_format(&h);
98  *        printf("%s\n", h.buf);
99  *   }
100  * \endcode
101  */
102 void HEXLINE_format(struct hexline *pHexLine);
104 #endif
106 /*
107  *  ========================================
108  *  Texas Instruments Micro Controller Style
109  *  ========================================
110  *  Local Variables:
111  *  mode: c
112  *  c-file-style: "bsd"
113  *  tab-width: 4
114  *  c-basic-offset: 4
115  *  indent-tabs-mode: nil
116  *  End:
117  *  vim:set  filetype=c tabstop=4 shiftwidth=4 expandtab=true
118  */