20 #ifndef MyHwLinuxGeneric_h
21 #define MyHwLinuxGeneric_h
25 #include "SerialPort.h"
26 #include "StdInOutStream.h"
34 #include "SoftEeprom.h"
38 #define CRYPTO_LITTLE_ENDIAN
40 #ifdef MY_LINUX_SERIAL_PORT
41 #ifdef MY_LINUX_SERIAL_IS_PTY
50 #ifndef MY_SERIALDEVICE
51 #define MY_SERIALDEVICE Serial
55 #define hwWatchdogReset()
57 #define hwGetSleepRemaining() (0ul)
59 inline void hwDigitalWrite(uint8_t, uint8_t);
60 inline int hwDigitalRead(uint8_t);
61 inline void hwPinMode(uint8_t, uint8_t);
64 inline void hwReadConfigBlock(
void *buf,
void *addr,
size_t length);
65 inline void hwWriteConfigBlock(
void *buf,
void *addr,
size_t length);
66 inline uint8_t hwReadConfig(
const int addr);
67 inline void hwWriteConfig(
const int addr, uint8_t value);
68 inline void hwRandomNumberInit(
void);
69 ssize_t hwGetentropy(
void *__buffer,
size_t __length);
70 #define MY_HW_HAS_GETENTROPY
71 inline uint32_t hwMillis(
void);
75 #error Soft SPI is not available on this architecture!
79 #ifdef MY_RF24_IRQ_PIN
80 static pthread_mutex_t hw_mutex = PTHREAD_MUTEX_INITIALIZER;
82 static __inline__
void __hwUnlock(
const uint8_t *__s)
84 pthread_mutex_unlock(&hw_mutex);
88 static __inline__
void __hwLock()
90 pthread_mutex_lock(&hw_mutex);
95 #define ATOMIC_BLOCK_CLEANUP
96 #elif defined(MY_RF24_IRQ_PIN)
97 #define ATOMIC_BLOCK_CLEANUP uint8_t __atomic_loop \
98 __attribute__((__cleanup__( __hwUnlock ))) = 1
100 #define ATOMIC_BLOCK_CLEANUP
105 #elif defined(MY_RF24_IRQ_PIN)
106 #define ATOMIC_BLOCK for ( ATOMIC_BLOCK_CLEANUP, __hwLock(); \
107 __atomic_loop ; __atomic_loop = 0 )
113 #define MY_CRITICAL_SECTION ATOMIC_BLOCK