I2CWFF3.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2023, 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  * @file I2CWFF3.h
34  *
35  * @brief I2C driver implementation for a WiFi F3 device I2C
36  * controller.
37  *
38  * # Driver Include #
39  * The I2C header file should be included in an application as follows:
40  * @code
41  * #include <ti/drivers/I2C.h>
42  * #include <ti/drivers/i2c/I2CWFPF3.h>
43  * @endcode
44  *
45  * # Overview #
46  * Refer to @ref I2C.h for a complete description of APIs.
47  *
48  * ## General Behavior ##
49  * Before using the I2C in WFF3:
50  * - The I2C driver is initialized by calling #I2C_init().
51  * - The I2C HW is configured and system dependencies are declared (e.g. IOs,
52  * power, etc.) by calling #I2C_open().
53  * .
54  * The following is true for receive operation:
55  * - RX is enabled by calling #I2C_transfer().
56  * The readCount of the #I2C_Transaction must be set to a non-zero value.
57  * - If the #I2C_transfer() succeeds, the I2C remains enabled.
58  * - The application must check the return value from I2C_transfer()
59  * to verify that the transfer succeeded.
60  * .
61  * The following apply for transmit operation:
62  * - TX is enabled by calling #I2C_transfer().
63  * The writeCount of the #I2C_Transaction must be set to a non-zero value.
64  * - If the #I2C_transfer() succeeds, the I2C remains enabled.
65  * - The application must check the return value from #I2C_transfer()
66  * to verify that the transfer succeeded.
67  * .
68  * After I2C operation has ended:
69  * - Release system dependencies for I2C by calling I2C_close().
70  *
71  * ## Error handling ##
72  * If an error occurs during operation:
73  * - The I2C Controller transmits a stop bit and remains enabled.
74  *
75  * ## Power Management ##
76  * The I2CWFF3 driver sets a power constraint during transactions to keep
77  * the device out of sleep; so when all tasks are blocked, the device will
78  * enter idle mode instead of sleep. When the transactions have finished,
79  * the power constraint to prohibit sleep is released.
80  * The following statements are valid:
81  * - After I2C_open() call: I2C is enabled, there are no active I2C
82  * transactions, the device can enter sleep.
83  * - After I2C_transfer() call: active I2C transactions exist, the device
84  * might enter idle, but not sleep.
85  * - When I2C_transfer() completes, either after success or error, I2C
86  * remains enabled, and the device can enter sleep.
87  * - After I2C_close() call: I2C is disabled
88  *
89  * ## Supported Functions ##
90  * | Generic API Function | Description |
91  * |------------------------------|---------------------------------------------------|
92  * | #I2C_init() | Initialize I2C driver |
93  * | #I2C_Params_init() | Initialize an #I2C_Params structure |
94  * | #I2C_open() | Initialize I2C HW and set system dependencies |
95  * | #I2C_close() | Disable I2C HW and release system dependencies |
96  * | #I2C_setAddressMode() | Set the address mode to be used in I2C transfers |
97  * | #I2C_transfer() | Start I2C transfer |
98  * | #I2C_transferTimeout() | Start I2C transfer with a timeout |
99  * | #I2C_cancel() | Cancels all I2C transfers |
100  *
101  * ## Supported Bit Rates ##
102  * - #I2C_100kHz
103  * - #I2C_400kHz
104  * - #I2C_1000kHz
105  *
106  * ## Supported Address Modes ##
107  * - #I2C_ADDRESS_MODE_7_BIT
108  * - #I2C_ADDRESS_MODE_10_BIT
109  *
110  * ## Unsupported Functionality ##
111  * The WFF3 I2C driver currently does not support:
112  * - Multi-controller mode
113  * - I2C target mode
114  * - DMA operation
115  *
116  ******************************************************************************
117  */
118 
119 #ifndef ti_drivers_i2c_I2CWFF3__include
120 #define ti_drivers_i2c_I2CWFF3__include
121 
122 #include <stdint.h>
123 #include <stdbool.h>
124 
125 #include <ti/drivers/I2C.h>
126 #include <ti/drivers/Power.h>
127 
128 #include <ti/drivers/dpl/SwiP.h>
129 
130 #ifdef __cplusplus
131 extern "C" {
132 #endif
133 
180 typedef struct
181 {
182  I2C_BASE_HWATTRS
183 
184  /* I2C peripheral's Power driver ID */
185  unsigned long powerMngrId;
186 
187  /*
188  * I2C Swi priority.
189  * The higher the number, the higher the priority.
190  */
191  uint32_t swiPriority;
192  /* SDA pin index and mux */
193  uint8_t sdaPin;
194  uint8_t sdaPinMux;
195  /* SCL pin index and mux */
196  uint8_t sclPin;
197  uint8_t sclPinMux;
199 
205 typedef struct
206 {
207  I2C_BASE_OBJECT
208 
209  /* Swi object */
210 
212  /* Bitrate of the I2C module */
214 
215  /* Address mode of the I2C module.
216  * Note, this is the driverlib definition of address mode and not of the type
217  * I2C_AddressMode.
218  */
219  uint32_t addressMode;
220 
221  /* I2C power notification */
222  void *i2cPostFxn;
225 
226 #ifdef __cplusplus
227 }
228 #endif
229 
230 #endif /* ti_drivers_i2c_I2CWFF3__include */
I2C_BitRate bitRate
Definition: I2CWFF3.h:213
uint32_t addressMode
Definition: I2CWFF3.h:219
I2C_BASE_HWATTRS unsigned long powerMngrId
Definition: I2CWFF3.h:185
I2C_BitRate
Bit rate for an I2C driver instance specified in the I2C_Params.
Definition: I2C.h:575
Power Manager.
uint8_t sdaPin
Definition: I2CWFF3.h:193
Power_NotifyObj i2cPostObj
Definition: I2CWFF3.h:223
uint32_t swiPriority
Definition: I2CWFF3.h:191
uint8_t sdaPinMux
Definition: I2CWFF3.h:194
I2CWFF3 Object.
Definition: I2CWFF3.h:205
uint8_t sclPinMux
Definition: I2CWFF3.h:197
void * i2cPostFxn
Definition: I2CWFF3.h:222
Software Interrupt module for the RTOS Porting Interface.
Power notify object structure.
Definition: Power.h:441
I2CWFF3 Hardware attributes.
Definition: I2CWFF3.h:180
uint8_t sclPin
Definition: I2CWFF3.h:196
I2C_BASE_OBJECT SwiP_Struct swi
Definition: I2CWFF3.h:211
SemaphoreP structure.
Definition: SwiP.h:68
Inter-Integrated Circuit (I2C) Controller Driver.
© Copyright 1995-2026, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale