SWILIB API (NSG)    
Loading...
Searching...
No Matches
pmb887x.h
Go to the documentation of this file.
1#pragma once
2
3#include <stdint.h>
4#include <stdbool.h>
5#include <stddef.h>
6
7#ifdef __cplusplus
8extern "C" {
9#endif
10
11#define CPU_OSC_FREQ 26000000
12
13#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
14#define MIN(a, b) ((a) < (b) ? (a) : (b))
15#define MAX(a, b) ((a) > (b) ? (a) : (b))
16
17#define MMIO8(addr) (*(volatile uint8_t *)(addr))
18#define MMIO16(addr) (*(volatile uint16_t *)(addr))
19#define MMIO32(addr) (*(volatile uint32_t *)(addr))
20#define MMIO64(addr) (*(volatile uint64_t *)(addr))
21
22#define BITS_PER_LONG 32
23
24#define BIT(n) (1 << (n))
25
26#define __AC(X,Y) (X##Y)
27#define _AC(X,Y) __AC(X,Y)
28#define _AT(T,X) ((T)(X))
29#define UL(x) (_AC(x, UL))
30#define ULL(x) (_AC(x, ULL))
31
32#define GENMASK(h, l) \
33 (((~UL(0)) - (UL(1) << (l)) + 1) & \
34 (~UL(0) >> (BITS_PER_LONG - 1 - (h))))
35
36#define GENMASK_ULL(h, l) \
37 (((~ULL(0)) - (ULL(1) << (l)) + 1) & \
38 (~ULL(0) >> (BITS_PER_LONG_LONG - 1 - (h))))
39
40#define SET_BIT(value, v, shift, mask) (value) = (((value) & ~(mask << shift)) | ((v & mask) << shift))
41#define GET_BIT(value, shift, mask) (((value) >> shift) & mask)
42
43#ifdef NEWSGOLD
44#include "pmb8876_regs.h"
45#else
46#include "pmb8875_regs.h"
47#endif
48
49#ifdef __cplusplus
50}
51#endif