ab32vgx.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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 BYTE0(n) ((unsigned char)(n))
  21. #define BYTE1(n) ((unsigned char)((n)>>8))
  22. #define BYTE2(n) ((unsigned char)((n)>>16))
  23. #define BYTE3(n) ((unsigned char)((n)>>24))
  24. #define GET_LE16(ptr) (uint16_t)(*(uint16_t*)(uint8_t*)(ptr))
  25. #define GET_LE32(ptr) (uint32_t)(*(uint32_t*)(uint8_t*)(ptr))
  26. #define PUT_LE16(ptr, val) *(uint16_t*)(uint8_t*)(ptr) = (uint16_t)(val)
  27. #define PUT_LE32(ptr, val) *(uint32_t*)(uint8_t*)(ptr) = (uint32_t)(val)
  28. #define GET_BE16(ptr) get_be16(ptr)
  29. #define GET_BE32(ptr) get_be32(ptr)
  30. #define PUT_BE16(ptr, val) put_be16(ptr, val)
  31. #define PUT_BE32(ptr, val) put_be32(ptr, val)
  32. #include "ab32vg1_hal.h"
  33. #endif