rk3399_mcu.h 904 B

1234567891011121314151617181920212223242526272829303132
  1. /*
  2. * Copyright (c) 2016, ARM Limited and Contributors. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #ifndef RK3399_MCU_H
  7. #define RK3399_MCU_H
  8. #include <addressmap.h>
  9. typedef unsigned int uint32_t;
  10. #define mmio_read_32(c) ({unsigned int __v = \
  11. (*(volatile unsigned int *)(c)); __v; })
  12. #define mmio_write_32(c, v) ((*(volatile unsigned int *)(c)) = (v))
  13. #define mmio_clrbits_32(addr, clear) \
  14. mmio_write_32(addr, (mmio_read_32(addr) & ~(clear)))
  15. #define mmio_setbits_32(addr, set) \
  16. mmio_write_32(addr, (mmio_read_32(addr)) | (set))
  17. #define mmio_clrsetbits_32(addr, clear, set) \
  18. mmio_write_32(addr, (mmio_read_32(addr) & ~(clear)) | (set))
  19. #define MIN(a, b) ((a) < (b) ? (a) : (b))
  20. #define MAX(a, b) ((a) > (b) ? (a) : (b))
  21. void stopwatch_init_usecs_expire(unsigned int usecs);
  22. int stopwatch_expired(void);
  23. void stopwatch_reset(void);
  24. #endif /* RK3399_MCU_H */