-
Notifications
You must be signed in to change notification settings - Fork 1
/
regmem.h
190 lines (154 loc) · 4.79 KB
/
regmem.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
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
/*
* regmem.h
*
* Created on: 26.05.2012
*****************************************************************************
* MCmega - Firmware for the Motorola MC micro radio
* to use it as an Amateur-Radio transceiver
*
* Copyright (C) 2013 Felix Erckenbrecht, DG1YFE
*
* ( AVR port of "MC70"
* Copyright (C) 2004 - 2013 Felix Erckenbrecht, DG1YFE)
*
* This file is part of MCmega.
*
* MCmega 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 3 of the License, or
* (at your option) any later version.
*
* MCmega 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 MCmega. If not, see <http://www.gnu.org/licenses/>.
*
****************************************************************************
*/
#ifndef REGMEM_H_
#define REGMEM_H_
#include <stdint.h>
#include "config.h"
//
// Port Function Macros
//
#define PORT_PTT PORTD
#define PIN_PTT PIND
#define BIT_PTT (1 << 1)
//Squelch Modes
//
#define SQM_OFF 0
#define SQM_CARRIER 1
#define SQM_RSSI 2
#define SQM_CTCSS 3
// Power Switch (0 = Power On)
#define PORT_SWB PORTD
#define PIN_SWB PIND
#define BIT_SWB (1 << 0)
// Interface to shift register
#define PORT_SBUS_CLK PORTD
#define DDR_SBUS_CLK DDRD
#define BIT_SBUS_CLK (1 << 5)
#define PORT_SR_LATCH PORTG
#define BIT_SR_LATCH (1 << 3)
#define DDR_SBUS_DATA DDRE
#define PORT_SBUS_DATA PORTE
#define PIN_SBUS_DATA PINE
#define BIT_SBUS_DATA (1 << 2)
#define PORT_PLL_LATCH PORTB
#define BIT_PLL_LATCH (1 << 7)
//PLL Lock Input
#define PIN_PLL_LOCK PINE
#define BIT_PLL_LOCK (1 << 6)
// Shift register output
// 0 - Audio PA enable (1=enable) (PIN 4 ) *
// 1 - STBY&9,6V (1=enable) (PIN 5 )
// 2 - T/R Shift (0=RX, 1=TX) (PIN 6 ) *
// 3 - Hi/Lo Power (1=Lo Power) (PIN 7 ) *
// 4 - Ext. Alarm (PIN 14) *
// 5 - Sel.5 ATT (1=Attenuated Tones)(PIN 13) *
// 6 - Mic enable (1=enable) (PIN 12) *
// 7 - Rx Audio enable (1=enable) (PIN 11)
// EXT ALARM is controlled via SR in EZA9
#define SR_AUDIOPA UINT8_C(1 << 0)
#define SR_9V6 UINT8_C(1 << 1)
#define SR_TXVCOSEL UINT8_C(1 << 2)
#define SR_TXPWRLO UINT8_C(1 << 3)
#define SR_nCLKSHIFT UINT8_C(1 << 3)
#define SR_EXTALARM UINT8_C(1 << 4)
#define SR_SELATT UINT8_C(1 << 5)
#define SR_MICEN UINT8_C(1 << 6)
#define SR_RXAUDIOEN UINT8_C(1 << 7)
#define SR_AND_NONE UINT8_C(0xff)
#define SQEXTBIT SR_EXTALARM
//*******************
// R E G I S T E R S
//*******************
extern char SR_data_buf;
extern void * oci_vec;
extern char tasksw;
extern char last_tasksw;
extern char tasksw_en;
extern int start_task;
extern char pcc_cdiff_flag; // Flag
extern char led_buf; // Bit 0 (1) - gelb
// Bit 1 (2) - gelb blink
// Bit 2 (4) - gr�n
// Bit 3 (8) - gr�n blink
// Bit 4 (16) - rot
// Bit 5 (32) - rot blink
// Bit 6 (64) - unused
// Bit 7 (128)- change flag
extern char led_dbuf;
extern uint16_t arrow_buf; // Bit 0 - Arrow 0
// Bit 1 - Arrow 1
// ...
// Bit 8 - Arrow 0 blink
// ...
// Bit 14 - Arrow 6 blink
extern char dbuf[8]; // Main Display Buffer
extern uint8_t cpos; // Cursorposition
extern char dbuf2[8]; // Display Buffer2 + Byte f�r CPOS
extern uint8_t cpos2;
extern char f_in_buf[9]; // 9 byte buffer
extern int oci_int_ctr;
extern int tick_ms; // 1ms Increment
extern int s_tick_ms; // Software timer
extern int tick_hms; // 100ms Increment
extern int8_t next_hms;
extern char gp_timer; // General Purpose Timer, 1ms Decrement
extern char ui_timer;
extern uint8_t lcd_timer; // 1ms
extern char lcd_timer_en;
//trx_state .db
extern long txshift;
extern long channel; // aktuell in der PLL gesetzter Kanal
extern char rxtx_state; // 0=RX
extern char ptt_debounce;
extern char ui_ptt_req; //
extern char m_state;
extern int m_timer; // 100ms
extern char m_timer_en;
extern char mem_bank;
extern char pll_locked_flag; // Bit 0 - PLL not locked
extern char pll_timer;
extern char tone_timer;
extern char tone_index;
extern char oci_ctr;
extern int ts_count;
//*****************************
// I O R I N G B U F F E R
//*****************************
extern volatile char tx_buf;
extern volatile char rx_char_buf;
extern volatile char rx_ack_buf;
extern volatile char rx_key_buf;
//****************
// E X T R A M
//****************
#define SUBAUDIOBUF_LEN 24
extern char subaudiobuf[SUBAUDIOBUF_LEN];
#endif /* REGMEM_H_ */