-
Notifications
You must be signed in to change notification settings - Fork 0
/
hw-llorri.fr
109 lines (83 loc) · 3.29 KB
/
hw-llorri.fr
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
\ (c) 2013 Johns Hopkins University / Applied Physics Laboratory
\ SPP common instrument (i.e. EPI-Lo & WISPR) hardware interfaces
hex
\ ------------------------------------------------------------------------
\ Memory map
\ RAM
\ 01 constant macro-mem# \ macro database
02 constant tlm-mem# \ telemetry frame buffer
\ I/O
\ 10 constant io-mem# \ memory-mapped I/O
\ 0000 constant uart-a# \ RW: UART
h# 0002 constant wd-a# \ R: ping watchdog
\ 0004 constant int-a# \ R: interrupt vector W: mode/mask set
\ 0006 constant parin-a# \ R: reset cause, jumpers, polled ints
h# 000a constant comm-a# \ R/W: S/C UART
h# 000c constant sccfg-a#
h# 000e constant sccfg-clr-a#
h# 001a constant control-a# \ W: instrument control
h# 001c constant strobe-s-a# \ W: instrument strobe set bit
h# 001e constant strobe-r-a# \ W: instrument strobe reset bit
\ MRAM
\ 40 constant eeprom-prog-mem# \ default program
\ 41 - 42 \ and backups
\ Address space
\ Note: RAM0 appears twice in the this space
h# 60 constant total-mem# \ total memory (address space) size
\ ------------------------------------------------------------------------
\ Interrupts and interrupt mask register
\ Interrupts
\ d# 0 constant uart-rx-int# \ TP receive
\ d# 1 constant uart-tx-int# \ TP transmit
d# 2 constant 1pps-a-int# \ 1PPS side A interrupt
d# 3 constant 1pps-b-int# \ 1PPS side B interrupt
d# 4 constant timer-int# \ timing interrupt
d# 10 constant comm-rx-int# \ S/C comm. input interrupt
d# 11 constant comm-tx-int# \ S/C comm. output interrupt
\ ------------------------------------------------------------------------
\ Memory-mapped I/O access functions
: io@ \ ( addr -- x ) Fetch x from given address in io-mem#.
get-mem >r io-mem# set-mem far \ remote memory-mapped I/O
@ \ fetch
r> set-mem ;
: io! \ ( x addr -- ) Store x to given address in io-mem#.
get-mem >r io-mem# set-mem far \ remote memory-mapped I/O
! \ store
r> set-mem ;
: set-io-cfg \ ( mask -- ) Set given bits in DPU configuration register.
sccfg-a# io! ; \ set given bits
: clr-io-cfg \ ( mask -- ) Clear given bits in DPU configuration register.
sccfg-a# 2 + io! ; \ clear given bits
\ S/C configuration register masks
1 d# 3 lshift constant uart-ena-mask#
1 d# 2 lshift constant iemb-sel-mask#
1 d# 1 lshift constant iemb-enb-mask#
1 d# 0 lshift constant iema-enb-mask#
\ Time
: seconds \ ( seconds -- ticks ) Given a time in seconds, compute
\ corresponding number of 'ticks' of hardwareclock.
|| ; inline
h# 200 constant #rcv-buffer
\ NOP ... for now, no registers need refreshing.
: refresh-regs ;
\
h# 8000 constant dog-enb-mask#
\ RAM
7 constant boot-mem# \ default RAM page to copy to
h# 4000 constant #boot-words \ size of boot ROM (16-bit words)
\ MRAM
40 constant eeprom-prog-mem# \ default program
\ 41 - 42 \ and backups
0000 constant eeprom-prog-addr \ address of source program header
\ I/O (formerly G-bus)
\ 10 constant io-mem# \ memory-mapped I/O
\ 6 constant stat-a# \ R: interrupt (and cause) status
1 d# 5 lshift constant cause-msk# \ reset cause mask
[ifdef] __DEBUG__
: EMIT ( byte -- )
get-mem >r
io-mem# set-mem
h# 0 far!
r> set-mem
;
[then]