-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy paths3c2410.h
76 lines (60 loc) · 1.99 KB
/
s3c2410.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/* S3C2410 register manipulating module
Copyright (C) 2016 Arnie97
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef _S3C2410_H
#define _S3C2410_H
#define delay(t) { volatile int i = (t); while (i--); }
struct mpllcon {
unsigned sdiv: 2;
unsigned : 2;
unsigned pdiv: 6;
unsigned : 2;
unsigned mdiv: 8;
unsigned : 12;
};
struct clkslow {
unsigned slow_val: 3;
unsigned : 1;
unsigned slow_bit: 1;
unsigned mpll_off: 1;
unsigned : 1;
unsigned uclk_on : 1;
};
struct bankcon {
unsigned pmc: 2;
unsigned tacp: 2;
unsigned tcah: 2;
unsigned tcoh: 2;
unsigned tacc: 3;
unsigned tcos: 2;
unsigned tacs: 2;
unsigned : 17;
};
// remapped addresses of registers
#define MPLLCON ((unsigned *)0x07200004)
#define CLKSLOW ((unsigned *)0x07200010)
#define CLKDIVN ((unsigned *)0x07200014)
#define BANKCON0 ((struct bankcon *)0x07000004)
#define BANKCON1 ((struct bankcon *)0x07000008)
#define GPFDAT ((unsigned *)0x07A00054)
#define GPGCON ((unsigned *)0x07A00060)
#define GPGDAT ((unsigned *)0x07A00064)
// frequency of external oscillator
#define FIN 12
extern const unsigned valid_mpllcon_values[];
float mpllcon_to_freq(struct mpllcon *reg, unsigned fin);
int is_valid_mpllcon(unsigned *reg);
float clkslow_to_freq(struct clkslow *reg, unsigned fin);
unsigned freq_to_access_cycle(unsigned freq);
#endif