flatUSB/usb_common.h
Epagris 6edf06c2ca - polling with delay added
- H7xx initialization code corrected
2024-10-29 16:43:18 +01:00

21 lines
683 B
C

#ifndef CORE_USB_USB_COMMON
#define CORE_USB_USB_COMMON
#include "usb_common_types.h"
#include "usb_common_defs.h"
#include "usb_device_types.h"
#define READ_FIELD(r,f) (((r) & (f##_Msk)) >> (f##_Pos))
#define WRITE_FIELD(r,f,v) ((r) = ((r) & ~(f##_Msk)) | (v << (f##_Pos)))
#define WAIT_FOR_BIT(r,b) while ((r) & (b)) {}
#define WAIT_FOR_BIT_DELAY(r,b,d) while ((r) & (b)) { HAL_Delay((d)); }
#define WAIT_FOR_nBIT(r,b) while (!((r) & (b))) {}
#define WAIT_FOR_nBIT_DELAY(r,b,d) while (!((r) & (b))) { HAL_Delay((d)); }
#define DWORD_ALIGN __attribute__((aligned(4)))
#define CEILDIV4(x) (((x) + 3) >> 2)
#define CEIL4(x) (((x) + 3) & (~0b11))
#endif /* CORE_USB_USB_COMMON */