ioregs.h 664 B

1234567891011121314151617181920212223242526
  1. // (C) 2024 Victor Suarez Rovere <suarezvictor@gmail.com>
  2. // SPDX-License-Identifier: AGPL-3.0-only
  3. #ifndef __IOREGS_H__
  4. #define __IOREGS_H__
  5. #include <stdint.h>
  6. typedef int gpio_pin_t;
  7. //Register defintions generated from d1_ioregs.svd using custom tool, based on:
  8. //see http://github.com/postspectacular/cmsis-svd-srcgen (or custom fork)
  9. #include "d1_ioregs.h"
  10. static inline __attribute__((__always_inline__)) uint32_t io_read32(uintptr_t addr)
  11. {
  12. return (*((volatile uint32_t *)(addr)));
  13. }
  14. static inline __attribute__((__always_inline__)) void io_write32(uintptr_t addr, uint32_t value)
  15. {
  16. *((volatile uint32_t *)(addr)) = value;
  17. }
  18. #endif //__IOREGS_H__