libpynq (release 5EWC0-2023 version 0.2.6 of 2023-10-24 17:28)
Loading...
Searching...
No Matches
iic.h
Go to the documentation of this file.
1/*
2Copyright (c) 2023 Eindhoven University of Technology
3
4Permission is hereby granted, free of charge, to any person obtaining a copy
5of this software and associated documentation files (the "Software"), to deal
6in the Software without restriction, including without limitation the rights
7to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8copies of the Software, and to permit persons to whom the Software is
9furnished to do so, subject to the following conditions:
10
11The above copyright notice and this permission notice shall be included in all
12copies or substantial portions of the Software.
13
14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20SOFTWARE.
21*/
22#ifndef IIC_H
23#define IIC_H
24#include <stdbool.h>
25#include <stdint.h>
26
104typedef enum { IIC0 = 0, IIC1 = 1, NUM_IICS = 2 } iic_index_t;
105
113extern void iic_init(const iic_index_t iic);
114
120extern void iic_destroy(const iic_index_t iic);
121
133extern bool iic_read_register(const iic_index_t iic, const uint8_t addr,
134 const uint8_t reg, uint8_t *data,
135 uint16_t length);
136
148extern bool iic_write_register(const iic_index_t iic, const uint8_t addr,
149 const uint8_t reg, uint8_t *data,
150 uint16_t length);
151
152extern bool iic_set_slave_mode(const iic_index_t iic, const uint8_t addr,
153 uint32_t *register_map,
154 const uint32_t rm_length);
155
162extern void iic_slave_mode_handler(const iic_index_t iic);
163
169extern void iic_reset(const iic_index_t iic);
173#endif
iic_index_t
Enum of IICs. Functions use a switch numbered from 0..NUM_IICS-1.
Definition iic.h:104
void iic_destroy(const iic_index_t iic)
Close the shared memory handle for the specified IIC index.
Definition iic.c:124
bool iic_set_slave_mode(const iic_index_t iic, const uint8_t addr, uint32_t *register_map, const uint32_t rm_length)
Definition iic.c:135
bool iic_write_register(const iic_index_t iic, const uint8_t addr, const uint8_t reg, uint8_t *data, uint16_t length)
Definition iic.c:344
bool iic_read_register(const iic_index_t iic, const uint8_t addr, const uint8_t reg, uint8_t *data, uint16_t length)
Definition iic.c:327
void iic_reset(const iic_index_t iic)
Definition iic.c:314
void iic_slave_mode_handler(const iic_index_t iic)
Definition iic.c:302
void iic_init(const iic_index_t iic)
Initialize the IIC specified by the index with a shared memory handle and a buffer size of 4096 bytes...
Definition iic.c:108
@ IIC1
Definition iic.h:104
@ IIC0
Definition iic.h:104
@ NUM_IICS
Definition iic.h:104