OpenCores
URL https://opencores.org/ocsvn/riscv_vhdl/riscv_vhdl/trunk

Subversion Repositories riscv_vhdl

[/] [riscv_vhdl/] [trunk/] [debugger/] [src/] [common/] [coreservices/] [ii2c.h] - Blame information for rev 5

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 5 sergeykhbr
/**
2
 * @file
3
 * @copyright  Copyright 2017 GNSS Sensor Ltd. All right reserved.
4
 * @author     Sergey Khabarov - sergeykhbr@gmail.com
5
 * @brief      I2C interface description.
6
 */
7
 
8
#ifndef __DEBUGGER_COMMON_CORESERVICES_II2C_H__
9
#define __DEBUGGER_COMMON_CORESERVICES_II2C_H__
10
 
11
#include <inttypes.h>
12
#include <iface.h>
13
 
14
namespace debugger {
15
 
16
enum EStatusI2C {
17
    I2C_ACK   = 0,
18
    I2C_NACK  = 1
19
};
20
 
21
static const char *const IFACE_I2C_MASTER = "IMasterI2C";
22
 
23
class IMasterI2C : public IFace {
24
 public:
25
    IMasterI2C() : IFace(IFACE_I2C_MASTER) {}
26
 
27
    virtual void registerI2CListener(IFace *iface) = 0;
28
    virtual void unregisterI2CListener(IFace *iface) = 0;
29
};
30
 
31
static const char *const IFACE_I2C_SLAVE = "ISlaveI2C";
32
 
33
class ISlaveI2C : public IFace {
34
 public:
35
    ISlaveI2C() : IFace(IFACE_I2C_SLAVE) {}
36
 
37
    virtual uint8_t getPhysAddress() = 0;
38
    virtual uint8_t getAddressLen() = 0;
39
    virtual void setAddress(uint32_t addr) = 0;
40
    virtual EStatusI2C writeNext(uint8_t byte) = 0;
41
    virtual EStatusI2C readNext(uint8_t *byte) = 0;
42
};
43
 
44
}  // namespace debugger
45
 
46
#endif  // __DEBUGGER_COMMON_CORESERVICES_II2C_H__

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.