Board.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015-2018, Texas Instruments Incorporated
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  *
9  * * Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  *
12  * * Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution.
15  *
16  * * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 /*!****************************************************************************
34  * @file Board.h
35  * @brief Portable board-specific symbols
36  *
37  * The Board header file should be included in an application as follows:
38  * @code
39  * #include "Board.h"
40  * @endcode
41  *
42  * This header serves as device-independent interface for applications using
43  * peripherals connected to the device via standard digital interfaces; e.g,
44  * GPIO, SPI, I2C, UART, etc. Its purpose is to enable application code that
45  * references a peripheral to be portable to any device and board that
46  * supports the peripheral.
47  *
48  * ## Usage ##
49  *
50  * @anchor ti_drivers_Board_Synopsis
51  * ### Synopsis #
52  * @anchor ti_drivers_Board_Synopsis_Code
53  * @code
54  * #include "Board.h"
55  *
56  * void main(void)
57  * {
58  * Board_init();
59  * :
60  * }
61  * @endcode
62  *
63  * ## Initializing the hardware ##
64  *
65  * \p Board_init() must be called before any other driver API. This function
66  * calls the device specific initialization code that is required to as soon
67  * as possible after a device reset; e.g., to initialize clocks and power
68  * management functionality.
69  *
70  * ## Portable peripheral usage
71  *
72  * Each driver module declares symbols in \p Board.h that, if used, will
73  * improve code portability between both different devices and boards.
74  *
75  * @anchor ti_drivers_I2C_Example_portable
76  * For example, the I2C driver adds \p Board.h symbol definitions of the form
77  * * <I>bus_name</I> - the I2C bus instance ID,
78  * * <I>bus_name</I>_MAXBITRATE - the maximum supported BITRATE for the bus
79  * <I>bus_name</I>, and
80  * * Board_I2C_<I>comp_name</I>_ADDR - the slave address for the named I2C
81  * component
82  * where <I>comp_name</I> is the name given to an I2C peripheral by the
83  * board manufacturer, and <I>bus_name</I> is the user defined name of the
84  * I2C bus instance. These symbols enable applications to portably acquire
85  * an I2C bus handle and control an I2C slave on that bus.
86  * @code
87  * #include <ti/drivers/I2C.h>
88  * #include "Board.h"
89  *
90  * // portably open an I2C bus instance
91  * I2C_Params i2cParams;
92  * I2C_Params_init(&i2cParams);
93  * i2cParams.bitRate = Board_I2C0_MAXBITRATE; // bus name == Board_I2C0
94  * i2cHandle = I2C_open(Board_I2C0, &i2cParams);
95  *
96  * // portably read from an I2C slave
97  * I2C_Transaction trans;
98  * trans.slaveAddress = Board_I2C_TMP006_ADDR; // component name = TMP006
99  * trans.readBuf = ...;
100  * trans.readCount = ...;
101  * trans.writeCount = 0;
102  * I2C_transfer(i2cHandle, &trans);
103  * @endcode
104  ******************************************************************************
105  */
106 
107 #ifndef ti_boards_Board__include
108 #define ti_boards_Board__include
109 
110 #ifdef __cplusplus
111 extern "C" {
112 #endif
113 
128 extern void Board_init(void);
129 
130 #ifdef __cplusplus
131 }
132 #endif
133 
134 #endif /* ti_boards_Board_include */
void Board_init(void)
Performs "early" board-level initialization required by TI-DRIVERS.
© Copyright 1995-2019, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale