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