Subversion Repositories pentevo

Rev

Rev 685 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
112 chrv 1
#ifndef __MAIN_H__
2
#define __MAIN_H__
3
 
4
/**
5
 * @mainpage  General program for ATMEGA128 ZX Evolution.
6
 *
7
 * @section history Revision history
8
 *
9
 * @subsection current Current version.
562 chrv 10
 *
685 lvd 11
 * - Add any (left or right) Ctrl,Alt keys and exclude mapped Ctrl,Alt keys from Ctrl-Alt-Del functionality (reset).
12
 * - Add reading state of LCTRL,RCTRL,LALT,RALT,LSHIFT,RSHIFT,F12 keyboard states from RTC register D (bits 0-6).
13
 * - Add reading state of NUM LOCK LED from RTC register C (bit 0).
667 chrv 14
 * - Fix update_keys function.
656 chrv 15
 * - Add EEPROM access via RTC interface.
667 chrv 16
 * - Add reset PS2 keyboard after error.
656 chrv 17
 * - Fix change resolution command (need for some PS2 mouses).
567 chrv 18
 *
656 chrv 19
 * @subsection ver_2014_04_13 Version 13.04.2014.
667 chrv 20
 *
656 chrv 21
 * - Fix access to users keyboard map.
22
 *
23
 * @subsection ver_2013_11_08 Version 08.11.2013.
24
 *
25
 * - Add mode 60Hz;
26
 * - Fix RS232 (clear overrun error flag).
27
 *
562 chrv 28
 * @subsection ver_2012_02_13 Version 13.02.2011.
29
 *
30
 * - Add SD WRP and SD DET to C gluk's register.
536 chrv 31
 * - Fix PS2 keyboard hangup.
505 chrv 32
 * - Add some controls to C gluk's register.
494 chrv 33
 * - Add access to PS2 keyboards log via gluk extensions.
34
 *
35
 * @subsection ver_2011_09_29 Version 29.09.2011.
36
 *
486 chrv 37
 *  - Add support BCD or HEX format in emulation Gluk clock.
478 chrv 38
 *  - Fix RTS line control.
39
 *
40
 * @subsection ver_2011_06_11 Version 11.06.2011.
41
 *
437 chrv 42
 *  - Add NMI button supporting.
43
 *  - Fix PS/2 mouse initialization.
44
 *
45
 * @subsection ver_2011_05_11 Version 11.05.2011
46
 *
478 chrv 47
 * - Direct load UBRR on RS232 mode [if (DLM&0x80)!=0 ].
382 chrv 48
 * - Control PLL (ICS501M) via PE2,PE3. Set it to 2X.
49
 *
50
 * @subsection ver_2011_04_26 Version 26.04.2011
51
 *
374 chrv 52
 * - Add RS232 supporting.
53
 * - Increase delay for reset FPGA (nCONFIG pin) before download it.
54
 *
55
 * @subsection ver_2011_04_02 Version 02.04.2011
56
 *
364 chrv 57
 * - Add access to 0..EF cells of PC8583.
359 chrv 58
 * - Fix RTC PC8583 dayweek 0..6 convert to DS12788 dayweek 1..7 and vice versa.
59
 *
60
 * @subsection ver_2010_12_07 Version 07.12.2010
61
 *
299 chrv 62
 * - Keyboard mapping without using RAM.
478 chrv 63
 * - Add setting resolution for PS/2 mouse [1..4].
299 chrv 64
 *   (left and right mouse buttons and pad'*' - default [1], pad'+' - increment, pad'-' - decrement).
65
 * - Add PS/2 mouse resolution saving to RTC register.
66
 *
67
 * @subsection ver_2010_11_29 Version 29.11.2010
68
 *
292 chrv 69
 * - "NumLock" switch mode to beeper/pwm or tapeout ("NumLock" led light on tapeout mode).
70
 * - Create full translation map (0x00-0x7f for extended scan codes).
71
 *
72
 * @subsection ver_2010_10_17 Version 17.10.2010
73
 *
219 chrv 74
 * - "F9","F10","F11" on PS/2 keyboard not used for reset function.
240 chrv 75
 * - "F12" on PS/2 keyboard soft/hard reset. Short press (<5sec) - soft reset, long press (5sec) - hard reset.
219 chrv 76
 * - "Ctrl-Alt-Del" on PS/2 keyboard reset ZX (hard reset). If all keys is mapped to ZX keyboard - function not work.
292 chrv 77
 * - Create translation map (PS/2 to ZX keyboard) in eeprom (default in progmem).
217 lvd 78
 * - Fix PS/2 mouse and keyboard send mode (without 'delay' function).
219 chrv 79
 * - Support load from tape input.
217 lvd 80
 *
81
 * @subsection ver_2010_03_30 Version 30.03.2010
82
 *
186 chrv 83
 * - Fix fpga load and ZX part init (optimize).
84
 *
85
 * @subsection ver_2010_03_28 Version 28.03.2010
86
 *
182 chrv 87
 * - Fix PS/2 mouse error handler (analize error and reinit mouse if need it).
179 chrv 88
 * - Add support for get version info (via Gluk cmos extra registers 0xF0..0xFF).
89
 * - Optimize sources, some correction (log, fpga load).
176 chrv 90
 * - Fix PS/2 timeout error handler.
91
 *
92
 * @subsection ver_2010_03_24 Version 24.03.2010
93
 *
172 chrv 94
 * - Fix Power Led behavior (it off while atx power off).
163 chrv 95
 * - "Print Screen" PS2 keyboard key set NMI on ZX.
96
 * - Soft reset (Z80 only) to service (0) page if pressed "softreset" key <5 seconds.
97
 *
98
 * @subsection ver_2010_03_10 Version 10.03.2010
99
 *
149 chrv 100
 * - Add PS2 keyboard led controlling: "Scroll Lock" led equal VGA mode.
135 chrv 101
 * - Fix mapping gluk (DS12887) nvram to PCF8583.
129 chrv 102
 * - Fix Update Flag in register C (emulation Gluk clock).
126 chrv 103
 * - Add modes register and save/restore it to RTC NVRAM.
104
 * - Add support for zx (mechanical) keyboard.
105
 * - Add support for Kempston joystick.
112 chrv 106
 *
163 chrv 107
 * @subsection ver_2010_02_04 Version 04.02.2010 - base version (1.00 in SVN).
112 chrv 108
 *
109
 */
110
 
126 chrv 111
/**
112
 * @file
113
 * @brief Main module.
114
 * @author http://www.nedopc.com
115
 */
116
 
117
/** Common flag register. */
118
extern volatile UBYTE flags_register;
119
/** Direction for ps2 mouse data (0 - Receive/1 - Send). */
120
#define FLAG_PS2MOUSE_DIRECTION 0x01
121
/** Type of ps2 mouse (0 - classical [3bytes in packet]/1 - msoft [4bytes in packet]). */
122
#define FLAG_PS2MOUSE_TYPE      0x02
123
/** Ps2 mouse data for zx (0 - not ready/1 - ready). */
124
#define FLAG_PS2MOUSE_ZX_READY  0x04
125
/** Spi interrupt detected (0 - not received/1 - received). */
126
#define FLAG_SPI_INT            0x08
149 chrv 127
/** Direction for ps2 keyboard data (0 - Receive/1 - Send). */
128
#define FLAG_PS2KEYBOARD_DIRECTION  0x10
179 chrv 129
/** Version type (0 - BaseConf /1 - BootLoader). */
494 chrv 130
//#define FLAG_VERSION_TYPE       0x20
217 lvd 131
/** Last tape in bit value. */
132
#define FLAG_LAST_TAPE_VALUE    0x40
219 chrv 133
/** Hard reset flag (1 - enable hard reset). */
134
#define FLAG_HARD_RESET         0x80
126 chrv 135
 
437 chrv 136
/** Common extension flag register. */
299 chrv 137
extern volatile UBYTE flags_ex_register;
138
/** Ps2 mouse command (0 - not/1 - process). */
139
#define FLAG_EX_PS2MOUSE_CMD    0x01
140
/** Ps2 keyboard map (0 - default/1 - user). */
141
#define FLAG_EX_PS2KEYBOARD_MAP 0x02
437 chrv 142
/** NMI interrupt set (0 - not/1 - set). */
143
#define FLAG_EX_NMI             0x04
299 chrv 144
 
126 chrv 145
/** Common modes register. */
146
extern volatile UBYTE modes_register;
147
/** VGA mode (0 - not set/1 - set). */
148
#define MODE_VGA 0x01
292 chrv 149
/** Tapeout mode (0 - beeper or pwm mode/1 - tapeout). */
150
#define MODE_TAPEOUT 0x02
505 chrv 151
/** CAPS LED mode (0 - off/1 - on). */
152
#define MODE_CAPSLED 0x04
686 lvd 153
/** pentagon/60Hz/48k/128k modes */
154
#define MODES_RASTER 0x30
155
#define MODE_VIDEO_MASK (MODE_VGA|MODES_RASTER)
126 chrv 156
 
494 chrv 157
/** Type extensions of gluk registers. */
158
extern volatile UBYTE ext_type_gluk;
159
/** Type is baseconfiguration version. */
160
#define EXT_TYPE_BASECONF_VERSION     0
161
/** Type is bootloader version. */
162
#define EXT_TYPE_BOOTLOADER_VERSION   1
163
/** Type is PS2 keyboards log. */
164
#define EXT_TYPE_PS2KEYBOARDS_LOG     2
658 lvd 165
/** Type is reading some config bytes. */
166
#define EXT_TYPE_RDCFG                3
494 chrv 167
 
129 chrv 168
/** Data buffer. */
169
extern UBYTE dbuf[];
170
 
179 chrv 171
/** FPGA data index. */
186 chrv 172
extern volatile ULONG curFpga;
129 chrv 173
 
174
/**
175
 * Writes specified length of buffer to SPI.
176
 * @param size [in] - size of buffer.
177
 */
178
void put_buffer(UWORD size);
179
 
112 chrv 180
#endif //__MAIN_H__