no-OS
maxim_i2c.h
Go to the documentation of this file.
1 /*******************************************************************************
2  * @file maxim_i2c.h
3  * @brief Header containing types used in the i2c driver.
4  * @author Andrei Drimbarean (andrei.drimbarean@analog.com)
5  * @author Ciprian Regus (ciprian.regus@analog.com)
6 ********************************************************************************
7  * Copyright 2022(c) Analog Devices, Inc.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions are met:
11  *
12  * 1. Redistributions of source code must retain the above copyright notice,
13  * this list of conditions and the following disclaimer.
14  *
15  * 2. Redistributions in binary form must reproduce the above copyright notice,
16  * this list of conditions and the following disclaimer in the documentation
17  * and/or other materials provided with the distribution.
18  *
19  * 3. Neither the name of Analog Devices, Inc. nor the names of its
20  * contributors may be used to endorse or promote products derived from this
21  * software without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. “AS IS” AND ANY EXPRESS OR
24  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
25  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
26  * EVENT SHALL ANALOG DEVICES, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
27  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
29  * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
30  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
31  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
32  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 *******************************************************************************/
34 
35 #ifndef MAXIM_I2C_H_
36 #define MAXIM_I2C_H_
37 
38 #include <stdint.h>
39 #include "i2c_regs.h"
40 #include "mxc_pins.h"
41 #include "no_os_i2c.h"
42 
47 struct max_i2c_extra {
49  mxc_i2c_regs_t *handler;
52  uint8_t *prologue_data;
55  uint8_t prologue_size;
56 };
57 
59  mxc_gpio_vssel_t vssel;
60 };
61 
67  MAX_I2C_STD_MODE = 100000,
70  MAX_I2C_HS_MODE = 3400000
71 };
72 
76 extern const struct no_os_i2c_platform_ops max_i2c_ops;
77 
78 #endif /* MAXIM_I2C_H_ */
maxim_i2c.h
no_os_alloc.h
maxim_i2c.h
max_i2c_ops
const struct no_os_i2c_platform_ops max_i2c_ops
MAXIM platform specific I2C platform ops structure.
Definition: maxim_i2c.c:322
I2C_MASTER_MODE
#define I2C_MASTER_MODE
Definition: maxim_i2c.c:47
I2C_MASTER_MODE
#define I2C_MASTER_MODE
Definition: maxim_i2c.c:47
max_i2c_ops
const struct no_os_i2c_platform_ops max_i2c_ops
MAXIM specific I2C platform ops structure.
Definition: maxim_i2c.c:322
no_os_i2c_init_param::slave_address
uint8_t slave_address
Definition: no_os_i2c.h:70
max_i2c_init_param
Definition: maxim_i2c.h:58
max_i2c_extra::handler
mxc_i2c_regs_t * handler
Definition: maxim_i2c.h:49
maxim_i2c.h
max_i2c_init_param::vssel
mxc_gpio_vssel_t vssel
Definition: maxim_i2c.h:59
I2C_MASTER_MODE
#define I2C_MASTER_MODE
Definition: maxim_i2c.c:45
I2C_MASTER_MODE
#define I2C_MASTER_MODE
Definition: maxim_i2c.c:48
I2C_MASTER_MODE
#define I2C_MASTER_MODE
Definition: maxim_i2c.c:47
no_os_i2c_desc::device_id
uint32_t device_id
Definition: no_os_i2c.h:105
I2C_MASTER_MODE
#define I2C_MASTER_MODE
Definition: maxim_i2c.c:47
no_os_calloc
void * no_os_calloc(size_t nitems, size_t size)
Allocate memory and return a pointer to it, set memory to 0.
Definition: chibios_alloc.c:54
max_i2c_extra
MAXIM specific I2C handler structure.
Definition: maxim_i2c.h:47
no_os_i2c_init_param::extra
void * extra
Definition: no_os_i2c.h:74
MXC_I2C_GET_I2C
#define MXC_I2C_GET_I2C(i)
Definition: maxim_i2c.h:44
maxim_i2c.h
MAX_I2C_FAST_MODE
@ MAX_I2C_FAST_MODE
Definition: maxim_i2c.h:68
no_os_i2c_desc::slave_address
uint8_t slave_address
Definition: no_os_i2c.h:109
no_os_min
#define no_os_min(x, y)
Definition: no_os_util.h:59
no_os_error.h
Error codes definition.
no_os_i2c_init_param::max_speed_hz
uint32_t max_speed_hz
Definition: no_os_i2c.h:68
maxim_i2c.h
MAX_I2C_STD_MODE
@ MAX_I2C_STD_MODE
Definition: maxim_i2c.h:67
no_os_i2c_platform_ops
Structure holding I2C function pointers that point to the platform specific function.
Definition: no_os_i2c.h:121
no_os_i2c_platform_ops::i2c_ops_init
int32_t(* i2c_ops_init)(struct no_os_i2c_desc **, const struct no_os_i2c_init_param *)
Definition: no_os_i2c.h:123
no_os_i2c_desc
Structure holding I2C address descriptor.
Definition: no_os_i2c.h:101
max_i2c_speed
max_i2c_speed
MAXIM I2C SCL frequency options.
Definition: maxim_i2c.h:66
no_os_malloc
void * no_os_malloc(size_t size)
Allocate memory and return a pointer to it.
Definition: chibios_alloc.c:43
no_os_i2c.h
Header file of I2C Interface.
maxim_i2c.h
MAX_I2C_FAST_PLUS_MODE
@ MAX_I2C_FAST_PLUS_MODE
Definition: maxim_i2c.h:69
no_os_free
void no_os_free(void *ptr)
Deallocate memory previously allocated by a call to no_os_calloc or no_os_malloc.
Definition: chibios_alloc.c:69
maxim_i2c.h
no_os_i2c_init_param
Structure holding the parameters for I2C initialization.
Definition: no_os_i2c.h:64
NULL
#define NULL
Definition: wrapper.h:64
I2C1_IRQHandler
void I2C1_IRQHandler(void)
I2C1 interrupt handler.
Definition: maxim_i2c.c:65
I2C0_IRQHandler
void I2C0_IRQHandler(void)
I2C0 interrupt handler.
Definition: maxim_i2c.c:56
MAX_I2C_HS_MODE
@ MAX_I2C_HS_MODE
Definition: maxim_i2c.h:70
max_i2c_extra::prologue_data
uint8_t * prologue_data
Definition: maxim_i2c.h:52
max_i2c_extra::prologue_size
uint8_t prologue_size
Definition: maxim_i2c.h:55
I2C_MASTER_MODE
#define I2C_MASTER_MODE
Definition: maxim_i2c.c:46
no_os_util.h
Header file of utility functions.
no_os_i2c_desc::extra
void * extra
Definition: no_os_i2c.h:113
no_os_i2c_init_param::device_id
uint32_t device_id
Definition: no_os_i2c.h:66