| eMD IIM4265x Driver API 1.0.0

Ixm42xxxTransport.h
Go to the documentation of this file.
1 /*
2 * ________________________________________________________________________________________________________
3 * Copyright (c) 2015-2015 InvenSense Inc. All rights reserved.
4 *
5 * This software, related documentation and any modifications thereto (collectively “Software”) is subject
6 * to InvenSense and its licensors' intellectual property rights under U.S. and international copyright
7 * and other intellectual property rights laws.
8 *
9 * InvenSense and its licensors retain all intellectual property and proprietary rights in and to the Software
10 * and any use, reproduction, disclosure or distribution of the Software without an express license agreement
11 * from InvenSense is strictly prohibited.
12 *
13 * EXCEPT AS OTHERWISE PROVIDED IN A LICENSE AGREEMENT BETWEEN THE PARTIES, THE SOFTWARE IS
14 * PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
15 * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
16 * EXCEPT AS OTHERWISE PROVIDED IN A LICENSE AGREEMENT BETWEEN THE PARTIES, IN NO EVENT SHALL
17 * INVENSENSE BE LIABLE FOR ANY DIRECT, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
18 * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
19 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
20 * OF THE SOFTWARE.
21 * ________________________________________________________________________________________________________
22 */
23
34 #ifndef _INV_IXM42XXX_TRANSPORT_H_
35 #define _INV_IXM42XXX_TRANSPORT_H_
36
37
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41
42 #include <stdint.h>
43
44 /* forward declaration */
45 struct inv_ixm42xxx;
46
47
49 typedef enum
50 {
51 IXM42XXX_UI_I2C,
52 IXM42XXX_UI_SPI4,
53 IXM42XXX_UI_I3C,
54 IXM42XXX_AUX1_SPI3,
55 IXM42XXX_AUX2_SPI3
56
57 } IXM42XXX_SERIAL_IF_TYPE_t;
58
61 struct inv_ixm42xxx_serif {
62 void * context;
63 int (*read_reg)(struct inv_ixm42xxx_serif * serif, uint8_t reg, uint8_t * buf, uint32_t len);
64 int (*write_reg)(struct inv_ixm42xxx_serif * serif, uint8_t reg, const uint8_t * buf, uint32_t len);
65 int (*configure)(struct inv_ixm42xxx_serif * serif);
66 uint32_t max_read;
67 uint32_t max_write;
68 IXM42XXX_SERIAL_IF_TYPE_t serif_type;
69 };
70
73 struct inv_ixm42xxx_transport {
74 struct inv_ixm42xxx_serif serif;
77 struct register_cache {
78 uint8_t intf_cfg_1_reg;
79 uint8_t pwr_mngt_0_reg;
80 uint8_t gyro_cfg_0_reg;
81 uint8_t accel_cfg_0_reg;
82 uint8_t tmst_cfg_reg;
83 uint8_t bank_sel_reg;
84 } register_cache;
90 };
91
95 int inv_ixm42xxx_init_transport(struct inv_ixm42xxx * s);
96
103 int inv_ixm42xxx_read_reg(struct inv_ixm42xxx * s, uint8_t reg, uint32_t len, uint8_t * buf);
104
111 int inv_ixm42xxx_write_reg(struct inv_ixm42xxx * s, uint8_t reg, uint32_t len, const uint8_t * buf);
112
118 #ifdef __cplusplus
119 }
120 #endif
121
122 #endif /* _INV_IXM42XXX_TRANSPORT_H_ */
123
inv_ixm42xxx
Ixm42xxx driver states definition.
Definition: Ixm42xxxDriver_HL.h:164
inv_ixm42xxx_init_transport
int inv_ixm42xxx_init_transport(struct inv_ixm42xxx *s)
Init cache variable.
Definition: Ixm42xxxTransport.c:35
inv_ixm42xxx_serif::context
void * context
Definition: Ixm42xxxTransport.h:62
inv_ixm42xxx_transport::register_cache::tmst_cfg_reg
uint8_t tmst_cfg_reg
Definition: Ixm42xxxTransport.h:82
inv_ixm42xxx_serif::read_reg
int(* read_reg)(struct inv_ixm42xxx_serif *serif, uint8_t reg, uint8_t *buf, uint32_t len)
Definition: Ixm42xxxTransport.h:63
inv_ixm42xxx_serif::max_write
uint32_t max_write
Definition: Ixm42xxxTransport.h:67
inv_ixm42xxx_transport
transport interface
Definition: Ixm42xxxTransport.h:73
inv_ixm42xxx_transport::register_cache
struct inv_ixm42xxx_transport::register_cache register_cache
inv_ixm42xxx_transport::register_cache::pwr_mngt_0_reg
uint8_t pwr_mngt_0_reg
Definition: Ixm42xxxTransport.h:79
inv_ixm42xxx_transport::register_cache::accel_cfg_0_reg
uint8_t accel_cfg_0_reg
Definition: Ixm42xxxTransport.h:81
inv_ixm42xxx_serif
basesensor serial interface
Definition: Ixm42xxxTransport.h:61
IXM42XXX_AUX1_SPI3
@ IXM42XXX_AUX1_SPI3
Definition: Ixm42xxxTransport.h:54
inv_ixm42xxx_serif::max_read
uint32_t max_read
Definition: Ixm42xxxTransport.h:66
inv_ixm42xxx_transport::register_cache::intf_cfg_1_reg
uint8_t intf_cfg_1_reg
Definition: Ixm42xxxTransport.h:78
inv_ixm42xxx_transport::serif
struct inv_ixm42xxx_serif serif
Definition: Ixm42xxxTransport.h:74
inv_ixm42xxx_transport::register_cache::gyro_cfg_0_reg
uint8_t gyro_cfg_0_reg
Definition: Ixm42xxxTransport.h:80
inv_ixm42xxx_serif::write_reg
int(* write_reg)(struct inv_ixm42xxx_serif *serif, uint8_t reg, const uint8_t *buf, uint32_t len)
Definition: Ixm42xxxTransport.h:64
inv_ixm42xxx_serif::configure
int(* configure)(struct inv_ixm42xxx_serif *serif)
Definition: Ixm42xxxTransport.h:65
IXM42XXX_UI_SPI4
@ IXM42XXX_UI_SPI4
Definition: Ixm42xxxTransport.h:52
IXM42XXX_UI_I3C
@ IXM42XXX_UI_I3C
Definition: Ixm42xxxTransport.h:53
inv_ixm42xxx_write_reg
int inv_ixm42xxx_write_reg(struct inv_ixm42xxx *s, uint8_t reg, uint32_t len, const uint8_t *buf)
Writes data to a register on Ixm42xxx.
Definition: Ixm42xxxTransport.c:86
IXM42XXX_SERIAL_IF_TYPE_t
IXM42XXX_SERIAL_IF_TYPE_t
enumeration of serial interfaces available on ixm42xxx
Definition: Ixm42xxxTransport.h:50
IXM42XXX_AUX2_SPI3
@ IXM42XXX_AUX2_SPI3
Definition: Ixm42xxxTransport.h:55
inv_ixm42xxx_read_reg
int inv_ixm42xxx_read_reg(struct inv_ixm42xxx *s, uint8_t reg, uint32_t len, uint8_t *buf)
Reads data from a register on Ixm42xxx.
Definition: Ixm42xxxTransport.c:54
inv_ixm42xxx_serif::serif_type
IXM42XXX_SERIAL_IF_TYPE_t serif_type
Definition: Ixm42xxxTransport.h:68
inv_ixm42xxx_transport::register_cache
Contains mirrored values of some IP registers.
Definition: Ixm42xxxTransport.h:77
IXM42XXX_UI_I2C
@ IXM42XXX_UI_I2C
Definition: Ixm42xxxTransport.h:51
inv_ixm42xxx_transport::register_cache::bank_sel_reg
uint8_t bank_sel_reg
Definition: Ixm42xxxTransport.h:83