Subversion Repositories pentevo

Rev

Rev 656 | Rev 672 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

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