Subversion Repositories pentevo

Rev

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