summaryrefslogtreecommitdiff
path: root/include/i2c_bitbang.h
blob: d550f1a5826a4d8820083eae66d80c3589de3933 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/* Copyright 2019 The Chromium OS Authors. All rights reserved.
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */
#ifndef __CROS_EC_I2C_BITBANG_H
#define __CROS_EC_I2C_BITBANG_H

#include "i2c.h"

extern const struct i2c_drv bitbang_drv;

extern const struct i2c_port_t i2c_bitbang_ports[];
extern const unsigned int i2c_bitbang_ports_used;

/**
 * Enable I2C raw mode for the ports which need pre-task
 * I2C transactions in bitbang mode.
 *
 * @param enable Enable/disable the I2C raw mode
 */
void enable_i2c_raw_mode(bool enable);

/* expose static functions for testing */
#ifdef TEST_BUILD
int bitbang_start_cond(const struct i2c_port_t *i2c_port);
void bitbang_stop_cond(const struct i2c_port_t *i2c_port);
int bitbang_write_byte(const struct i2c_port_t *i2c_port, uint8_t byte);
void bitbang_set_started(int val);
#endif

#endif /* __CROS_EC_I2C_BITBANG_H */