14 #include <epicsThread.h> 17 #define epicsExportSharedSymbols 19 #include <epicsExport.h> 23 #define U32_SPIDData 0x0 24 #define U32_SPIDCtrl 0x4 25 #define SPIDCtrl_Overrun 0x80 26 #define SPIDCtrl_RecvRdy 0x40 27 #define SPIDCtrl_SendRdy 0x20 28 #define SPIDCtrl_SendEpt 0x10 29 #define SPIDCtrl_TxOver 0x08 30 #define SPIDCtrl_RxOver 0x04 31 #define SPIDCtrl_OE 0x02 32 #define SPIDCtrl_SS 0x01 46 printf(
"SPI: select %u\n",
id);
52 epicsThreadSleep(0.001);
59 epicsThreadSleep(0.001);
70 printf(
"SPI %02x ",
int(in));
76 epicsThreadSleep(T.
inc());
78 throw std::runtime_error(
"SPI cycle timeout2");
81 printf(
"(%f) ", T.
sofar());
93 epicsThreadSleep(T.
inc());
95 throw std::runtime_error(
"SPI cycle timeout2");
98 printf(
"(%f) ", T.
sofar());
101 epicsUInt8 ret =
READ32(base, SPIDData)&0xff;
104 printf(
"%02x\n",
int(ret));
#define READ32(base, offset)
virtual epicsUInt8 cycle(epicsUInt8 in) OVERRIDE FINAL
MRMSPI(volatile unsigned char *base)
double timeout() const
timeout in seconds for an individual cycle()
epicsExportAddress(int, mrmSPIDebug)
virtual void select(unsigned id) OVERRIDE FINAL
Select numbered device. 0 clears selection.
#define WRITE32(base, offset, value)