ab32vgx.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * Copyright (c) 2020-2020, BLUETRUM Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. #ifndef PROUGENGX_H__
  7. #define PROUGENGX_H__
  8. #include "ab32vg1.h"
  9. #ifndef UINT_MAX
  10. #define UINT_MAX 0xffffffff
  11. #endif // UINT_MAX
  12. #define BIT(n) (1ul << (n))
  13. #define AT(x) __attribute__((section(#x)))
  14. #define ALIGNED(n) __attribute__((aligned(n)))
  15. #define DMA_ADR(x) ((uint32_t)x)
  16. #define ALWAYS_INLINE __attribute__((always_inline)) inline
  17. #define NO_INLINE __attribute__((noinline))
  18. #define WEAK __attribute__((weak))
  19. #define PACKED __attribute__((packed))
  20. // #define WDT_CLR() WDTCON = 0xa
  21. // #define WDT_EN() WDTCON = 0x110
  22. // #define WDT_DIS() WDTCON = 0xaa0
  23. // #define WDT_RST() WDTCON = 0xa000110; while (1)
  24. // #define WDT_RST_DELAY() WDTCON = 0xa100110; while (1)
  25. #define BYTE0(n) ((unsigned char)(n))
  26. #define BYTE1(n) ((unsigned char)((n)>>8))
  27. #define BYTE2(n) ((unsigned char)((n)>>16))
  28. #define BYTE3(n) ((unsigned char)((n)>>24))
  29. #define GET_LE16(ptr) (uint16_t)(*(uint16_t*)(uint8_t*)(ptr))
  30. #define GET_LE32(ptr) (uint32_t)(*(uint32_t*)(uint8_t*)(ptr))
  31. #define PUT_LE16(ptr, val) *(uint16_t*)(uint8_t*)(ptr) = (uint16_t)(val)
  32. #define PUT_LE32(ptr, val) *(uint32_t*)(uint8_t*)(ptr) = (uint32_t)(val)
  33. #define GET_BE16(ptr) get_be16(ptr)
  34. #define GET_BE32(ptr) get_be32(ptr)
  35. #define PUT_BE16(ptr, val) put_be16(ptr, val)
  36. #define PUT_BE32(ptr, val) put_be32(ptr, val)
  37. #include "ab32vg1_hal.h"
  38. #endif