rk3399_mcu.h 904 Bytes
Newer Older
1
2
3
/*
 * Copyright (c) 2016, ARM Limited and Contributors. All rights reserved.
 *
dp-arm's avatar
dp-arm committed
4
 * SPDX-License-Identifier: BSD-3-Clause
5
6
 */

7
8
#ifndef RK3399_MCU_H
#define RK3399_MCU_H
9

10
11
#include <addressmap.h>

12
13
typedef unsigned int uint32_t;

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
19
20
21
22
23
24
#define mmio_clrbits_32(addr, clear) \
		mmio_write_32(addr, (mmio_read_32(addr) & ~(clear)))
#define mmio_setbits_32(addr, set) \
		mmio_write_32(addr, (mmio_read_32(addr)) | (set))
#define mmio_clrsetbits_32(addr, clear, set) \
		mmio_write_32(addr, (mmio_read_32(addr) & ~(clear)) | (set))

25
26
27
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))

28
29
30
void stopwatch_init_usecs_expire(unsigned int usecs);
int stopwatch_expired(void);
void stopwatch_reset(void);
31

32
#endif /* RK3399_MCU_H */