10 #define TEMU_BUS_SPI_H
15 #include "temu-c/Memory/Memory.h"
16 #include "temu-c/Models/Device.h"
17 #include "temu-c/Support/Logging.h"
18 #include "temu-c/Support/Objsys.h"
20 #define teSPI_WRSR 0x01
21 #define teSPI_WRITE 0x02
22 #define teSPI_READ 0x03
23 #define teSPI_WDI 0x04
24 #define teSPI_STAT 0x05
25 #define teSPI_WEN 0x06
44 } temu_SpiSlaveDevice;
50 } temu_SpiMasterDeviceIface;
51 TEMU_IFACE_REFERENCE_TYPE(temu_SpiMasterDevice)
52 #define TEMU_SPI_MASTER_IFACE_TYPE "temu::SpiMasterDeviceIface"
56 uint32_t responseSize);
57 } temu_SpiSlaveDeviceIface;
58 TEMU_IFACE_REFERENCE_TYPE(temu_SpiSlaveDevice)
59 #define TEMU_SPI_SLAVE_DEV_IFACE_TYPE "temu::SpiSlaveDeviceIface"
73 uint32_t configSize, uint8_t chipNum,
74 uint32_t responseSize);
76 TEMU_IFACE_REFERENCE_TYPE(temu_SpiBus)
77 #define TEMU_SPI_BUS_IFACE_TYPE "temu::SpiBusIface"
80 temu_spiDeviceRegister(temu_Class *C)
82 temu_addProperty(C,
"chipNumber",
83 offsetof(temu_SpiSlaveDevice, DevParams.chipNum), teTY_U8,
85 NULL, NULL,
"eSPI device chip id");
86 temu_addProperty(C,
"charLength",
87 offsetof(temu_SpiSlaveDevice, DevParams.charLength), teTY_U8,
89 NULL, NULL,
"Character length in bits per character.");
93 temu_spiBusRegister(temu_Class *C)
95 temu_addProperty(C,
"spiMasterDevice", offsetof(temu_SpiBus, SpiMasterDevice),
98 NULL, NULL,
"eSpi master communication Iface");
101 temu_addProperty(C,
"spiSlaveDevices", offsetof(temu_SpiBus, SpiSlaveDevices),
102 teTY_IfaceRefArray, 1, NULL, NULL,
"eSPI slave devices");
104 temu_addProperty(C,
"currentChipNumber",
105 offsetof(temu_SpiBus, CurrentChipNum), teTY_U8,
107 NULL, NULL,
"Last chosen chip");
111 void (*
getData)(
void *obj, uint64_t offset, size_t *length, uint8_t **data);
113 TEMU_IFACE_REFERENCE_TYPE(temu_SpiRom);
114 #define TEMU_SPI_ROM_IFACE_TYPE "temu::SpiRomIface"