VSF Documented
vsf_i2c_util.h
Go to the documentation of this file.
1/*****************************************************************************
2 * Copyright(C)2009-2022 by VSF Team *
3 * *
4 * Licensed under the Apache License, Version 2.0 (the "License"); *
5 * you may not use this file except in compliance with the License. *
6 * You may obtain a copy of the License at *
7 * *
8 * http://www.apache.org/licenses/LICENSE-2.0 *
9 * *
10 * Unless required by applicable law or agreed to in writing, software *
11 * distributed under the License is distributed on an "AS IS" BASIS, *
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
13 * See the License for the specific language governing permissions and *
14 * limitations under the License. *
15 * *
16 ****************************************************************************/
17
18#ifndef __HAL_I2C_UTIL_H__
19#define __HAL_I2C_UTIL_H__
20
21/* Utilities for i2c: reg access utility, etc */
22
23/*============================ INCLUDES ======================================*/
24
25#if VSF_HAL_USE_I2C == ENABLED
26
27#if defined(__VSF_I2C_UTIL_CLASS_IMPLEMENT)
28# undef __VSF_I2C_UTIL_CLASS_IMPLEMENT
29# define __VSF_CLASS_IMPLEMENT__
30#elif defined(__VSF_I2C_UTIL_CLASS_INHERIT__)
31# undef __VSF_I2C_UTIL_CLASS_INHERIT__
32# define __VSF_CLASS_INHERIT__
33#endif
34
35#include "utilities/ooc_class.h"
36
37/*============================ MACROS ========================================*/
38/*============================ MACROFIED FUNCTIONS ===========================*/
39/*============================ INCLUDES ======================================*/
40/*============================ TYPES =========================================*/
41
43 public_member(
44 vsf_i2c_t *i2c_ptr;
45 uint8_t i2c_addr;
46 )
47 protected_member(
49 uint16_t datalen;
50 void *data;
51 )
52 private_member(
53 uint8_t is_busy : 1;
54 uint8_t is_read : 1;
55 uint8_t is_regaddr : 1;
56 )
57};
58
59/*============================ GLOBAL VARIABLES ==============================*/
60/*============================ LOCAL VARIABLES ===============================*/
61/*============================ PROTOTYPES ====================================*/
62/*============================ IMPLEMENTATION ================================*/
63
67 bool is_read, uint8_t *data, uint_fast16_t datalen);
68
69#endif // VSF_HAL_USE_I2C
70#endif // __HAL_I2C_UTIL_H__
vsf_err_t
Definition __type.h:42
Definition vsf_i2c_util.h:42
struct ieee80211_ext_chansw_ie data
Definition ieee80211.h:80
#define vsf_class(__name)
Definition ooc_class.h:48
const i_spi_t vsf_spi_irq_mask_t irq_mask
Definition spi_interface.h:38
unsigned short uint16_t
Definition stdint.h:7
unsigned char uint_fast8_t
Definition stdint.h:23
unsigned short uint_fast16_t
Definition stdint.h:25
unsigned char uint8_t
Definition stdint.h:5
Definition vsf_template_i2c.h:334
class vsf_$ * reg
vsf_err_t vsf_i2c_regacc_irqhandler(vsf_i2c_regacc_t *i2c_regacc, vsf_i2c_irq_mask_t irq_mask)
Definition vsf_i2c_util.c:33
vsf_err_t vsf_i2c_regacc(vsf_i2c_regacc_t *i2c_regacc, uint_fast8_t reg, bool is_read, uint8_t *data, uint_fast16_t datalen)
Definition vsf_i2c_util.c:57
vsf_i2c_irq_mask_t
Definition vsf_template_i2c.h:194