diff options
author | Nao Pross <naopross@thearcway.org> | 2017-03-23 20:42:26 +0100 |
---|---|---|
committer | Nao Pross <naopross@thearcway.org> | 2017-03-23 20:42:26 +0100 |
commit | 70b8b7f2d766f4ca131f9fa299546eb3697db8d4 (patch) | |
tree | 12db7c7402f06409cef1828ee49748c70b8e3325 /res | |
parent | hardware nearly finished (diff) | |
download | z80uPC-70b8b7f2d766f4ca131f9fa299546eb3697db8d4.tar.gz z80uPC-70b8b7f2d766f4ca131f9fa299546eb3697db8d4.zip |
changed scheme layout
hw: changed scheme and annotated components
doc: added build script for windows
sw: added res/ folder with blaster and created jedec document for
address decoder pld
Diffstat (limited to '')
24 files changed, 2065 insertions, 0 deletions
diff --git a/res/ATFBlast_ALL/ATFblast.TIF b/res/ATFBlast_ALL/ATFblast.TIF Binary files differnew file mode 100644 index 0000000..b582a5b --- /dev/null +++ b/res/ATFBlast_ALL/ATFblast.TIF diff --git a/res/ATFBlast_ALL/ATFblast.pcb b/res/ATFBlast_ALL/ATFblast.pcb Binary files differnew file mode 100644 index 0000000..21e6f17 --- /dev/null +++ b/res/ATFBlast_ALL/ATFblast.pcb diff --git a/res/ATFBlast_ALL/AtfBlast.exe b/res/ATFBlast_ALL/AtfBlast.exe Binary files differnew file mode 100644 index 0000000..e4582fa --- /dev/null +++ b/res/ATFBlast_ALL/AtfBlast.exe diff --git a/res/ATFBlast_ALL/AtfBlast_board_bottom.pdf b/res/ATFBlast_ALL/AtfBlast_board_bottom.pdf Binary files differnew file mode 100644 index 0000000..f08d5ec --- /dev/null +++ b/res/ATFBlast_ALL/AtfBlast_board_bottom.pdf diff --git a/res/ATFBlast_ALL/AtfBlast_board_top.pdf b/res/ATFBlast_ALL/AtfBlast_board_top.pdf Binary files differnew file mode 100644 index 0000000..2ae18a2 --- /dev/null +++ b/res/ATFBlast_ALL/AtfBlast_board_top.pdf diff --git a/res/ATFBlast_ALL/AtfBlast_sch.pdf b/res/ATFBlast_ALL/AtfBlast_sch.pdf Binary files differnew file mode 100644 index 0000000..f8705ff --- /dev/null +++ b/res/ATFBlast_ALL/AtfBlast_sch.pdf diff --git a/res/ATFBlast_ALL/direct.gif b/res/ATFBlast_ALL/direct.gif Binary files differnew file mode 100644 index 0000000..7d4fcca --- /dev/null +++ b/res/ATFBlast_ALL/direct.gif diff --git a/res/ATFBlast_ALL/program.htm b/res/ATFBlast_ALL/program.htm new file mode 100644 index 0000000..b91db8d --- /dev/null +++ b/res/ATFBlast_ALL/program.htm @@ -0,0 +1,636 @@ +<HTML> +<HEAD> +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252"> +<META NAME="Generator" CONTENT="Microsoft Word 97"> +<TITLE>Minimum effort GAL programming</TITLE> +<META NAME="Template" CONTENT="C:\PROGRAMME\MICROSOFT OFFICE\OFFICE\html.dot"> +</HEAD> +<BODY LINK="#0000ff" VLINK="#800080"> + +<B><P><A NAME="Programming"></A>Minimum effort GAL programming</P> +</B><P>This document describes how to program the GAL chips 16V8/A/B/C/D/Z/ZD, 18V10/B, 20V8/A/B/Z, 20RA10/B, 20XV10/B, 22V10/B/C/Z, 26CV12/B, 6001/B, and 6002B from Lattice, National Semiconductors and STMicrosystems with minimal effort.</P> +<B><I><P>You need</P> +</B></I><BLOCKQUOTE>IC socket matching GAL</BLOCKQUOTE> +<BLOCKQUOTE>some 4k7 resistors 0.25W</BLOCKQUOTE> +<BLOCKQUOTE>100nF ceramic capacitor</BLOCKQUOTE> +<BLOCKQUOTE>SubD 25 pin male connector</BLOCKQUOTE> +<BLOCKQUOTE>some 4" short patch cables</BLOCKQUOTE> +<BLOCKQUOTE>5V/250mA and adjustable 8.5-16.5V/20mA laboratory power supply </BLOCKQUOTE> +<B><I><P>Pin assignment of the different GAL chips during programming</P></B></I> +<TABLE CELLSPACING=0 BORDER=0 CELLPADDING=4 WIDTH=474> +<TR><TD WIDTH="5%" VALIGN="TOP"> +<P> </TD> +<TD WIDTH="13%" VALIGN="TOP"> +<P>GAL<BR> +<BR> +Pin</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>16V8</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>18V10</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>20V8</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>22V10<BR> +20XV10<BR> +20RA10</TD> +<TD WIDTH="13%" VALIGN="TOP"> +<P>6001<BR> +6002 </TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>26CV12</TD> +</TR> +<TR><TD WIDTH="5%" VALIGN="TOP"> +<P> </TD> +<TD WIDTH="13%" VALIGN="TOP"> +<P>1(2) </TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>VIL</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>VIL</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>VIL</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>VIL</TD> +<TD WIDTH="13%" VALIGN="TOP"> +<P>VIL</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>VIL</TD> +</TR> +<TR><TD WIDTH="5%" VALIGN="TOP"> +<P> </TD> +<TD WIDTH="13%" VALIGN="TOP"> +<P>2(3)</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>EDIT</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>EDIT</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>EDIT</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>EDIT</TD> +<TD WIDTH="13%" VALIGN="TOP"> +<P>EDIT</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>EDIT</TD> +</TR> +<TR><TD WIDTH="5%" VALIGN="TOP"> +<P> </TD> +<TD WIDTH="13%" VALIGN="TOP"> +<P>3(4)</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>RA1</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>RA3</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>RA1</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>P/V-</TD> +<TD WIDTH="13%" VALIGN="TOP"> +<P>VIL</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>P/V-</TD> +</TR> +<TR><TD WIDTH="5%" VALIGN="TOP"> +<P> </TD> +<TD WIDTH="13%" VALIGN="TOP"> +<P>4(5)</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>RA2</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>RA4</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>RA2</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>RA0</TD> +<TD WIDTH="13%" VALIGN="TOP"> +<P>RA0</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>RA0</TD> +</TR> +<TR><TD WIDTH="5%" VALIGN="TOP"> +<P> </TD> +<TD WIDTH="13%" VALIGN="TOP"> +<P>5(6)</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>RA3</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>RA5</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>RA3</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>RA1</TD> +<TD WIDTH="13%" VALIGN="TOP"> +<P>RA1</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>RA1</TD> +</TR> +<TR><TD WIDTH="5%" VALIGN="TOP"> +<P> </TD> +<TD WIDTH="13%" VALIGN="TOP"> +<P>6(7)</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>RA4</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>SCLK</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>VIL</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>RA2</TD> +<TD WIDTH="13%" VALIGN="TOP"> +<P>RA2</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>RA2</TD> +</TR> +<TR><TD WIDTH="5%" VALIGN="TOP"> +<P> </TD> +<TD WIDTH="13%" VALIGN="TOP"> +<P>7(9)</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>RA5</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>SDIN</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>VIL</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>RA3</TD> +<TD WIDTH="13%" VALIGN="TOP"> +<P>RA3</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>VCC</TD> +</TR> +<TR><TD WIDTH="5%" VALIGN="TOP"> +<P> </TD> +<TD WIDTH="13%" VALIGN="TOP"> +<P>8(10)</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>SCLK</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>STB-</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>RA4</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>RA4</TD> +<TD WIDTH="13%" VALIGN="TOP"> +<P>RA4</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>VIL</TD> +</TR> +<TR><TD WIDTH="5%" VALIGN="TOP"> +<P> </TD> +<TD WIDTH="13%" VALIGN="TOP"> +<P>9(11)</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>SDIN</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>SDOUT</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>RA5</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>RA5</TD> +<TD WIDTH="13%" VALIGN="TOP"> +<P>RA5</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>RA3</TD> +</TR> +<TR><TD WIDTH="5%" VALIGN="TOP"> +<P> </TD> +<TD WIDTH="13%" VALIGN="TOP"> +<P>10(12)</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>GND</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>GND</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>SCLK</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>SCLK</TD> +<TD WIDTH="13%" VALIGN="TOP"> +<P>SCLK</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>RA4</TD> +</TR> +<TR><TD WIDTH="5%" VALIGN="TOP"> +<P> </TD> +<TD WIDTH="13%" VALIGN="TOP"> +<P>11(13)</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>STB-</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>VIL</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>SDIN</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>SDIN</TD> +<TD WIDTH="13%" VALIGN="TOP"> +<P>SDIN</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>RA5</TD> +</TR> +<TR><TD WIDTH="5%" VALIGN="TOP"> +<P> </TD> +<TD WIDTH="13%" VALIGN="TOP"> +<P>12(14)</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>SDOUT</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>VIL</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>GND</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>GND</TD> +<TD WIDTH="13%" VALIGN="TOP"> +<P>GND</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>SCLK</TD> +</TR> +<TR><TD WIDTH="5%" VALIGN="TOP"> +<P> </TD> +<TD WIDTH="13%" VALIGN="TOP"> +<P>13(16)</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>VIL</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>VIL</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>STB-</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>STB-</TD> +<TD WIDTH="13%" VALIGN="TOP"> +<P>STB-</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>SDIN</TD> +</TR> +<TR><TD WIDTH="5%" VALIGN="TOP"> +<P> </TD> +<TD WIDTH="13%" VALIGN="TOP"> +<P>14(17)</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>VIL</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>VIL</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>VIL</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>SDOUT</TD> +<TD WIDTH="13%" VALIGN="TOP"> +<P>SDOUT</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>STB-</TD> +</TR> +<TR><TD WIDTH="5%" VALIGN="TOP"> +<P> </TD> +<TD WIDTH="13%" VALIGN="TOP"> +<P>15(18)</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>VIL</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>VIL</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>SDOUT</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>VIL</TD> +<TD WIDTH="13%" VALIGN="TOP"> +<P>VIL</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>SDOUT</TD> +</TR> +<TR><TD WIDTH="5%" VALIGN="TOP"> +<P> </TD> +<TD WIDTH="13%" VALIGN="TOP"> +<P>16(19)</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>VIL</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>RA2</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>VIL</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>VIL</TD> +<TD WIDTH="13%" VALIGN="TOP"> +<P>VIL</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>VIL</TD> +</TR> +<TR><TD WIDTH="5%" VALIGN="TOP"> +<P> </TD> +<TD WIDTH="13%" VALIGN="TOP"> +<P>17(20)</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>VIL</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>RA1</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>VIL</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>VIL</TD> +<TD WIDTH="13%" VALIGN="TOP"> +<P>VIL</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>VIL</TD> +</TR> +<TR><TD WIDTH="5%" VALIGN="TOP"> +<P> </TD> +<TD WIDTH="13%" VALIGN="TOP"> +<P>18(21)</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>RA0</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>RA0</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>VIL</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>VIL</TD> +<TD WIDTH="13%" VALIGN="TOP"> +<P>VIL</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>VIL</TD> +</TR> +<TR><TD WIDTH="5%" VALIGN="TOP"> +<P> </TD> +<TD WIDTH="13%" VALIGN="TOP"> +<P>19(23)</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>P/V-</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>P/V-</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>VIL</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>VIL</TD> +<TD WIDTH="13%" VALIGN="TOP"> +<P>VIL</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>VIL</TD> +</TR> +<TR><TD WIDTH="5%" VALIGN="TOP"> +<P> </TD> +<TD WIDTH="13%" VALIGN="TOP"> +<P>20(24)</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>VCC</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>VCC</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>VIL</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>VIL</TD> +<TD WIDTH="13%" VALIGN="TOP"> +<P>VIL</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>VIL</TD> +</TR> +<TR><TD WIDTH="5%" VALIGN="TOP"> +<P> </TD> +<TD WIDTH="13%" VALIGN="TOP"> +<P>21(25)</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P> </TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P> </TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>RA0</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>VIL</TD> +<TD WIDTH="13%" VALIGN="TOP"> +<P>VIL</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>GND</TD> +</TR> +<TR><TD WIDTH="5%" VALIGN="TOP"> +<P> </TD> +<TD WIDTH="13%" VALIGN="TOP"> +<P>22(26)</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P> </TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P> </TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>P/V-</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>VIL</TD> +<TD WIDTH="13%" VALIGN="TOP"> +<P>VIL</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>VIL</TD> +</TR> +<TR><TD WIDTH="5%" VALIGN="TOP"> +<P> </TD> +<TD WIDTH="13%" VALIGN="TOP"> +<P>23(27)</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P> </TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P> </TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>VIL</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>VIL</TD> +<TD WIDTH="13%" VALIGN="TOP"> +<P>P/V-</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>VIL</TD> +</TR> +<TR><TD WIDTH="5%" VALIGN="TOP"> +<P> </TD> +<TD WIDTH="13%" VALIGN="TOP"> +<P>24(28)</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P> </TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P> </TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>VCC</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>VCC</TD> +<TD WIDTH="13%" VALIGN="TOP"> +<P>VCC</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>VIL</TD> +</TR> +<TR><TD WIDTH="5%" VALIGN="TOP"> +<P> </TD> +<TD WIDTH="13%" VALIGN="TOP"> +<P>25</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P> </TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P> </TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P> </TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P> </TD> +<TD WIDTH="13%" VALIGN="TOP"> +<P> </TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>VIL</TD> +</TR> +<TR><TD WIDTH="5%" VALIGN="TOP"> +<P> </TD> +<TD WIDTH="13%" VALIGN="TOP"> +<P>26</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P> </TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P> </TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P> </TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P> </TD> +<TD WIDTH="13%" VALIGN="TOP"> +<P> </TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>VIL</TD> +</TR> +<TR><TD WIDTH="5%" VALIGN="TOP"> +<P> </TD> +<TD WIDTH="13%" VALIGN="TOP"> +<P>27</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P> </TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P> </TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P> </TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P> </TD> +<TD WIDTH="13%" VALIGN="TOP"> +<P> </TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>VIL</TD> +</TR> +<TR><TD WIDTH="5%" VALIGN="TOP"> +<P> </TD> +<TD WIDTH="13%" VALIGN="TOP"> +<P>28</TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P> </TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P> </TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P> </TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P> </TD> +<TD WIDTH="13%" VALIGN="TOP"> +<P> </TD> +<TD WIDTH="14%" VALIGN="TOP"> +<P>VIL</TD> +</TR> +</TABLE> + +<P>PLCC28 pin numbers of DIL24 chips in paranthesis</P> +<B><I><P>Wiring</P> +</B></I><P>Use 4k7 resistors to connect all VIL pins to the GND pin (we use 4k7 instead of the 10k mentioned in other documents, because some GALs have internal pull-ups of only 50k and illegal input states would occur using 10k resistors). Use 4k7 resistors to connect all other pins (including GND and EDIT) to the VCC pin to prevent open inputs during programming. Connect a 100nF ceramic capacitor between GND and VCC. If you use a GAL with built-in pull-ups, it is possible to go without the resistors, but I would not spare the 100nF capacitor and the pull-up on STB-. Do not try to program Normal GALs without the pull-ups on SCLK, SDIN, P/V, SDOUT, as the pulse rise time would be too slow without pull-ups to cope with the speed of the GALBlast program handling the LPT port.</P> +<P><IMG SRC="direct.gif" WIDTH=291 HEIGHT=193></P> +<P>Use short (max. length 4") wires to connect all pins mentioned below to the SubD 25 parallel printer port connector.</P> +<TABLE CELLSPACING=0 BORDER=0 CELLPADDING=4 WIDTH=192> +<TR><TD WIDTH="13%" VALIGN="TOP"> +<P> </TD> +<TD WIDTH="50%" VALIGN="TOP"> +<P>SubD25 pin</TD> +<TD WIDTH="38%" VALIGN="TOP"> +<P>GAL</TD> +</TR> +<TR><TD WIDTH="13%" VALIGN="TOP"> +<P> </TD> +<TD WIDTH="50%" VALIGN="TOP"> +<P>1 (/STB):</TD> +<TD WIDTH="38%" VALIGN="TOP"> +<P>STB-</TD> +</TR> +<TR><TD WIDTH="13%" VALIGN="TOP"> +<P> </TD> +<TD WIDTH="50%" VALIGN="TOP"> +<P>2 (D0):</TD> +<TD WIDTH="38%" VALIGN="TOP"> +<P>SDIN</TD> +</TR> +<TR><TD WIDTH="13%" VALIGN="TOP"> +<P> </TD> +<TD WIDTH="50%" VALIGN="TOP"> +<P>3 (D1):</TD> +<TD WIDTH="38%" VALIGN="TOP"> +<P>RA0</TD> +</TR> +<TR><TD WIDTH="13%" VALIGN="TOP"> +<P> </TD> +<TD WIDTH="50%" VALIGN="TOP"> +<P>4 (D2):</TD> +<TD WIDTH="38%" VALIGN="TOP"> +<P>RA1</TD> +</TR> +<TR><TD WIDTH="13%" VALIGN="TOP"> +<P> </TD> +<TD WIDTH="50%" VALIGN="TOP"> +<P>5 (D3):</TD> +<TD WIDTH="38%" VALIGN="TOP"> +<P>RA2</TD> +</TR> +<TR><TD WIDTH="13%" VALIGN="TOP"> +<P> </TD> +<TD WIDTH="50%" VALIGN="TOP"> +<P>6 (D4):</TD> +<TD WIDTH="38%" VALIGN="TOP"> +<P>RA3</TD> +</TR> +<TR><TD WIDTH="13%" VALIGN="TOP"> +<P> </TD> +<TD WIDTH="50%" VALIGN="TOP"> +<P>7 (D5):</TD> +<TD WIDTH="38%" VALIGN="TOP"> +<P>RA4</TD> +</TR> +<TR><TD WIDTH="13%" VALIGN="TOP"> +<P> </TD> +<TD WIDTH="50%" VALIGN="TOP"> +<P>8 (D6):</TD> +<TD WIDTH="38%" VALIGN="TOP"> +<P>RA5</TD> +</TR> +<TR><TD WIDTH="13%" VALIGN="TOP"> +<P> </TD> +<TD WIDTH="50%" VALIGN="TOP"> +<P>9 (D7):</TD> +<TD WIDTH="38%" VALIGN="TOP"> +<P>SCLK</TD> +</TR> +<TR><TD WIDTH="13%" VALIGN="TOP"> +<P> </TD> +<TD WIDTH="50%" VALIGN="TOP"> +<P>10 (/ACK):</TD> +<TD WIDTH="38%" VALIGN="TOP"> +<P>SDOUT</TD> +</TR> +<TR><TD WIDTH="13%" VALIGN="TOP"> +<P> </TD> +<TD WIDTH="50%" VALIGN="TOP"> +<P>17 (/SELIN):</TD> +<TD WIDTH="38%" VALIGN="TOP"> +<P>P/V-</TD> +</TR> +<TR><TD WIDTH="13%" VALIGN="TOP"> +<P> </TD> +<TD WIDTH="50%" VALIGN="TOP"> +<P>25 (GND):</TD> +<TD WIDTH="38%" VALIGN="TOP"> +<P>GND</TD> +</TR> +</TABLE> + +<P>This arrangement was choosen so that an uninitialized port cannot affect the GAL.</P> +<B><I><P>Programming</P> +</B></I><P>Insert the GAL into the socket. Connect GND and VCC to the +5V output of a laboratory power supply. Connect GND and EDIT to an output of the power supply adjusted to +12V.</P> +<P>Launch the GALBlast program and select the parallel printer port used. Load the JEDEC file, the required GAL type should be automatically selected. Plug the SubD25 connector into the printer port, and issue the 'Write GAL' command. The PES of the GAL is read out and the required programming voltage will be displayed. Adjust the power supply to the required programming voltage (without overshoot, or disconnect first the SubD25, than the programming voltage, while adjusting) and continue with 'Write GAL'. Remove the SubD25 plug, turn off the programming voltage, turn off the power supply and remove the GAL from the socket.</P> +<P>--That's all --</P> +<B><I><P>Alternatives</P> +</B></I><P>If this method appears to risky, you may buffer the signals SCLK,RA0..RA5,STB-,P/V-,SDIN using two hex open collector driver ICs 7417 and 4k7 pull ups to VCC, and buffer SDOUT (4k7 pull up to VCC required) using the same chip before it connects to pin 17 (ACK-) of the parallel connector (4k7 pull up to +5V required). This way all GAL pins are electrically disconnected from the PC parallel port and the GAL may be turned off by removing VCC. Furthermore a D/A converter like the AD7524 can be used to select the programming voltage, if its inputs DB0..DB7 are connected to d0..d7 of the parallel port and WR- connects to pin 16 (FEED-), because the GALBlast program will output the required programming voltage (in 0.09375 volt increments if uncalibrated) to d0..d7 and pulls FEED- for a short time to L before ist starts talking to the GAL. Use an op-amp like the CA3140 to amplify the small output voltage (0 to 2.5V) to the required range (0 to 24V). The VCC power supply of the GAL may be controlled by a 5V SPST reed relay driven by INIT- of the parallel port, because the GALBlast program will take this line to L when it talks to the GAL.</P> +<B><I><P>AD7524</P> +</B></I><P>The AD7524 8 bit D/A converter from Analog Devices has been selected because it is wildely available and second sourced (MX7524 from Maxim, TLC7524 from Texas Instruments). The data sheet is available at <A HREF="http://www.analog.com/">http://www.analog.com/</A>. The required reference voltage is generated using a 2.5V voltage reference like the LM336Z2.5 (data sheet at <A HREF="http://www.nsc.com/">http://www.nsc.com</A>). A 4n7 capacitor is used to filter spikes durings changes in the voltage setup completely to prevent the destruction of the GAL chip. You may use an other 8 bit latched DAC like the ZN428 (data sheet at <A HREF="http://www.mitelsemi.com/">http://www.mitelsemi.com/</A> under obsolete parts) which already contains the required voltage reference.</P> +<B><I><P>Power supply</P> +</B></I><P>The least number of parts are required if you use a regulated power supply delivering 24V at 250mA. The voltage only needs to be filtered using an electrolytic capacitor at the PCB. The op-amp will be powered directly from this voltage, a 7805 will regulate the +5V required for the remaining parts including VCC of the GAL. The 7805 will have to dissipate up to 5 watts and requires a heat sink to prevent overheating.</P> +<P>If you have no regulated power supply, you may supply unregulated +27..+35V, as are generated by using a 18V transformer, a bridge B40C250 (or 4 * 1N4004 diodes) and a filter capacitor of 1000uF/40V, and regulate the voltage at the PCB using a 7824. A 1N4004 series diode to protect the circuit from applying power in wrong polarity is not a bad idea.</P> +<P>If you don't want to dissipate 5 watts at the 7805, you may use a power supply of only 9V..12V, 250mA. The +24V programming voltage than has to be generated using a step up switching regulator.</P> +<B><I><P>LM78S40</P> +</B></I><P>Use a LM78S40 (or uA78S40) switching regulator with a 10nF timing capacitor and a 470uH/300mA storage coil suitable for switch mode converters and a 1R2 current limiting resistor. You will find the circuit and hints on construction in the data sheet available at <A HREF="http://www.nsc.com/">http://www.nsc.com/</A>. The LM78S40 is a good choice, because it already contains the required op-amp, but you may use a TL497 or other switching regulator and a separate op-amp (like the CA3140) instead.</P> +<P>If you want to use my predesigned circuit, look <A HREF="hardware.htm">here</A></P></BODY> +</HTML> diff --git a/res/ATFBlast_ALL/userport/UserPort/Examples/IOPort.c b/res/ATFBlast_ALL/userport/UserPort/Examples/IOPort.c new file mode 100644 index 0000000..7cef182 --- /dev/null +++ b/res/ATFBlast_ALL/userport/UserPort/Examples/IOPort.c @@ -0,0 +1,76 @@ +#include <windows.h> +static BOOL bPrivException = FALSE; + +void outport(UINT portid, UINT value) +{ + __asm mov edx,portid; + __asm mov eax,value; + __asm out dx,ax; +} +void outportb(UINT portid, BYTE value) +{ + __asm mov edx,portid + __asm mov al,value + __asm out dx,al +} + +BYTE inportb(UINT portid) +{ + unsigned char value; + + __asm mov edx,portid + __asm in al,dx + __asm mov value,al + return value; +} + +UINT inport(UINT portid) +{ + int value=0; + __asm mov edx,portid + __asm in ax,dx + __asm mov value,eax + return value; +} + +LONG WINAPI HandlerExceptionFilter ( EXCEPTION_POINTERS *pExPtrs ) +{ + + if (pExPtrs->ExceptionRecord->ExceptionCode == EXCEPTION_PRIV_INSTRUCTION) + { + pExPtrs->ContextRecord->Eip ++; // Skip the OUT or IN instruction that caused the exception + bPrivException = TRUE; + return EXCEPTION_CONTINUE_EXECUTION; + } + else + return EXCEPTION_CONTINUE_SEARCH; +} + +BOOL StartUpIoPorts(UINT PortToAccess, BOOL bShowMessageBox, HWND hParentWnd) +{ + HANDLE hUserPort; + + hUserPort = CreateFile("\\\\.\\UserPort", GENERIC_READ, 0, NULL,OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + CloseHandle(hUserPort); // Activate the driver + Sleep(100); // We must make a process switch + + SetUnhandledExceptionFilter(HandlerExceptionFilter); + + bPrivException = FALSE; + inportb(PortToAccess); // Try to access the given port address + + if (bPrivException) + { + if (bShowMessageBox) + { + MessageBox(hParentWnd,"Privileged instruction exception has occured!\r\n\r\n" + "To use this program under Windows NT or Windows 2000\r\n" + "you need to install the driver 'UserPort.SYS' and grant\r\n" + "access to the ports used by this program.", + NULL,MB_OK); + } + return FALSE; + } + return TRUE; +} + diff --git a/res/ATFBlast_ALL/userport/UserPort/Examples/IOPort.h b/res/ATFBlast_ALL/userport/UserPort/Examples/IOPort.h new file mode 100644 index 0000000..2fd3bf9 --- /dev/null +++ b/res/ATFBlast_ALL/userport/UserPort/Examples/IOPort.h @@ -0,0 +1,18 @@ +#ifndef IOPORTH +#define IOPORTH + +#ifdef __cplusplus +extern "C" { +#endif + +void outport(UINT portid, UINT value); +void outportb(UINT portid, BYTE value); +BYTE inportb(UINT portid); +UINT inport(UINT portid); +BOOL StartUpIoPorts(UINT PortToAccess, BOOL bShowMessageBox, HWND hParentWnd); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/res/ATFBlast_ALL/userport/UserPort/Examples/IOPort.pas b/res/ATFBlast_ALL/userport/UserPort/Examples/IOPort.pas new file mode 100644 index 0000000..941240c --- /dev/null +++ b/res/ATFBlast_ALL/userport/UserPort/Examples/IOPort.pas @@ -0,0 +1,72 @@ +unit IOPort; + +interface +uses windows; + +procedure outport(portid : integer; value : integer); +procedure outportb(portid : integer; value : BYTE); +function inportb(portid : integer) : byte; +function inport(portid : integer) : integer; +function StartUpIoPorts(PortToAccess : integer) : boolean; + +implementation + +var + bPrivException : boolean; + +procedure outport(portid : integer; value : integer); +Begin + asm + mov edx,portid; + mov eax,value; + out dx,ax; + end; +end; + +procedure outportb(portid : integer; value : BYTE); +Begin + asm + mov edx,portid + mov al,value + out dx,al + end; +end; + +function inportb(portid : integer) : byte; +Var value : byte; +Begin + asm + mov edx,portid + in al,dx + mov value,al + end; + inportb := value; +end; + +function inport(portid : integer) : integer; +Var value : integer; +Begin + value := 0; + asm + mov edx,portid + in ax,dx + mov value,eax + end; + inport := value; +end; + +function StartUpIoPorts(PortToAccess : integer) : boolean; +Var hUserPort : THandle; +Begin + hUserPort := CreateFile('\\.\UserPort', GENERIC_READ, 0, nil,OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); + CloseHandle(hUserPort); // Activate the driver + Sleep(100); // We must make a process switch + + try + inportb(PortToAccess); // Try to access the given port address + except + MessageBox(0,'fel','fel',MB_OK); + end; +end; + +end.
\ No newline at end of file diff --git a/res/ATFBlast_ALL/userport/UserPort/UserPort.exe b/res/ATFBlast_ALL/userport/UserPort/UserPort.exe Binary files differnew file mode 100644 index 0000000..ff018b1 --- /dev/null +++ b/res/ATFBlast_ALL/userport/UserPort/UserPort.exe diff --git a/res/ATFBlast_ALL/userport/UserPort/UserPort.pdf b/res/ATFBlast_ALL/userport/UserPort/UserPort.pdf Binary files differnew file mode 100644 index 0000000..590b378 --- /dev/null +++ b/res/ATFBlast_ALL/userport/UserPort/UserPort.pdf diff --git a/res/ATFBlast_ALL/userport/UserPort/UserPort.sys b/res/ATFBlast_ALL/userport/UserPort/UserPort.sys Binary files differnew file mode 100644 index 0000000..30ad74f --- /dev/null +++ b/res/ATFBlast_ALL/userport/UserPort/UserPort.sys diff --git a/res/ATFBlast_ALL/userport/UserPort/UserPort_EXE/Resource.h b/res/ATFBlast_ALL/userport/UserPort/UserPort_EXE/Resource.h new file mode 100644 index 0000000..46cfc3f --- /dev/null +++ b/res/ATFBlast_ALL/userport/UserPort/UserPort_EXE/Resource.h @@ -0,0 +1,30 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by UserPort.rc +// +#define IDD_USERPORT 101 +#define IDI_APP 102 +#define IDC_AUMP_LIST_GRANTS 1000 +#define IDC_AUMP_EDIT_ADD 1001 +#define IDC_AUMP_BUTTON_ADD 1002 +#define IDC_AUMP_BUTTON_REMOVE 1003 +#define IDC_TCF_EDIT_ADD 1004 +#define IDC_BUTTON_UPDATE 1009 +#define IDC_BUTTON_START 1010 +#define IDC_TCF_LIST_GRANTS 1011 +#define IDC_TCF_BUTTON_ADD 1012 +#define IDC_BUTTON_STOP 1013 +#define IDC_AUMP_BUTTON_DEFAULTS 1016 +#define IDC_TCF_BUTTON_REMOVE 1017 +#define IDC_TCF_BUTTON_DEFAULTS 1018 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 103 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1017 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/res/ATFBlast_ALL/userport/UserPort/UserPort_EXE/UserPort.c b/res/ATFBlast_ALL/userport/UserPort/UserPort_EXE/UserPort.c new file mode 100644 index 0000000..5129ae5 --- /dev/null +++ b/res/ATFBlast_ALL/userport/UserPort/UserPort_EXE/UserPort.c @@ -0,0 +1,512 @@ +#include <windows.h> +#include <string.h> +#include "resource.h" + +char szDriverFileName[MAX_PATH]; +char DriverName[]="UserPort"; +HWND hDlg; + +unsigned Chars2Hex (char ch, unsigned oldval) +{ + int nHex; + + if ((ch>='0') && (ch<='9')) + nHex=ch-'0'; + else if ((ch>='a') && (ch<='f')) + nHex=ch-'a'+10; + else if ((ch>='A') && (ch<='F')) + nHex=ch-'A'+10; + else + return oldval; + return oldval*16+nHex; +} + +void UpperString(char *Str) +{ + int i,Len; + + Len=strlen(Str); + for (i=0;i<Len;i++) + if (Str[i]>'Z') + Str[i]-=32; +} + +BOOL StopDriver() +{ + SC_HANDLE schService; + SC_HANDLE schSCManager; + SERVICE_STATUS serviceStatus; + + + schSCManager = OpenSCManager (NULL, // machine (NULL == local) + NULL, // database (NULL == default) + SC_MANAGER_ALL_ACCESS // access required + ); + if (schSCManager == NULL) + { + return FALSE; + } + + schService = OpenService (schSCManager, + DriverName, + SERVICE_ALL_ACCESS + ); + + if (schService == NULL) + { + CloseServiceHandle (schSCManager); + return FALSE; + } + + ControlService (schService, SERVICE_CONTROL_STOP, &serviceStatus); + + DeleteService (schService); + + CloseServiceHandle (schService); + CloseServiceHandle (schSCManager); + return TRUE; +} + +BOOL StartDriver() +{ + SC_HANDLE schService = NULL; + SC_HANDLE schSCManager; + HANDLE hDriver; + DWORD LastError; + char szMess[300]; + char szTmp[MAX_PATH]; + + lstrcpy(szTmp,szDriverFileName); + szTmp[12] = '\0'; + if (lstrcmpi(szTmp,"\\SystemRoot\\")==0) + { + GetWindowsDirectory(szTmp,sizeof(szTmp)); + lstrcat(szTmp,szDriverFileName+11); + } + else + lstrcpy(szTmp,szDriverFileName); + + + hDriver = CreateFile (szTmp, + GENERIC_READ, + 0, + NULL, + OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL, + NULL + ); + if (hDriver==INVALID_HANDLE_VALUE) + { + wsprintf(szMess,"Driver does not exist:\r\n%s",szTmp); + MessageBox(hDlg,szMess,"UserPort",MB_OK); + return FALSE; + } + + CloseHandle(hDriver); + + schSCManager = OpenSCManager (NULL, // machine (NULL == local) + NULL, // database (NULL == default) + SC_MANAGER_ALL_ACCESS // access required + ); + + if (schSCManager == NULL) + { + if (GetLastError() == ERROR_ACCESS_DENIED) + MessageBox(hDlg,"You are not authorized to install drivers.\r\nPlase contact your administrator.","UserPort",MB_OK); + else + MessageBox(hDlg,"Unable to start driver!","UserPort",MB_OK); + + return FALSE; + } + + schService = CreateService (schSCManager, // SCManager database + DriverName, // name of service + DriverName, // name to display + SERVICE_START,//SERVICE_ALL_ACCESS, // desired access + SERVICE_KERNEL_DRIVER, // service type + SERVICE_SYSTEM_START, // start type + SERVICE_ERROR_NORMAL, // error control type + szDriverFileName, // service's binary + NULL, // no load ordering group + NULL, // no tag identifier + NULL, // no dependencies + NULL, // LocalSystem account + NULL // no password + ); + + if (schService == NULL) + { + LastError = GetLastError(); + if (LastError == ERROR_SERVICE_EXISTS) + MessageBox(hDlg,"Driver already started!","UserPort",MB_OK); + else if (LastError == ERROR_ACCESS_DENIED) + MessageBox(hDlg,"You are not authorized to install drivers.\r\nPlase contact your administrator.","UserPort",MB_OK); + else + MessageBox(hDlg,"Unable to start driver!","UserPort",MB_OK); + + CloseServiceHandle (schSCManager); + return FALSE; + } + + StartService (schService, // service identifier + 0, // number of arguments + NULL // pointer to arguments + ); + + CloseServiceHandle (schService); + CloseServiceHandle (schSCManager); + return TRUE; +} + +BOOL GetStartAndStopAddress(char *szStr, unsigned *nStartAddress, unsigned *nStopAddress) +{ + unsigned i, nStart = 0, nStop = 0; + + for (i=0;(szStr[i]!='\0')&&(szStr[i]!='-');i++) + nStart = Chars2Hex(szStr[i], nStart); + + if (szStr[i]=='\0') + return FALSE; + + for (i++;(szStr[i]!='\0')&&(szStr[i]!='-');i++) + nStop = Chars2Hex(szStr[i], nStop); + + *nStartAddress = nStart; + *nStopAddress = nStop; + + if (nStop < nStart) + return FALSE; + if (nStop > 0x3ff) + return FALSE; + + return TRUE; +} + +BOOL AddAUMPBtn() +{ + char szTemp[256]; + char szTemp2[256]; + unsigned nStartAddress,nStopAddress; + + GetDlgItemText(hDlg,IDC_AUMP_EDIT_ADD,szTemp,sizeof(szTemp)); + + if (!GetStartAndStopAddress(szTemp, &nStartAddress, &nStopAddress)) + { + MessageBox(hDlg,"Wrong syntax. Use: \"startadress - stopaddress\" (000 - 3ff)","UserPort",MB_OK); + return FALSE; + } + + wsprintf(szTemp2,"%X - %X",nStartAddress,nStopAddress); + SendDlgItemMessage(hDlg, IDC_AUMP_LIST_GRANTS,LB_ADDSTRING, 0,(LPARAM)szTemp2); + SetDlgItemText(hDlg,IDC_AUMP_EDIT_ADD,""); + return TRUE; +} + +BOOL AddTCFBtn() +{ + char szTemp[256]; + char szTemp2[256]; + unsigned nStartAddress,nStopAddress; + + GetDlgItemText(hDlg,IDC_TCF_EDIT_ADD,szTemp,sizeof(szTemp)); + + if (!GetStartAndStopAddress(szTemp, &nStartAddress, &nStopAddress)) + { + MessageBox(hDlg,"Wrong syntax. Use: \"startadress - stopaddress\" (000 - 3ff)","UserPort",MB_OK); + return FALSE; + } + + wsprintf(szTemp2,"%X - %X",nStartAddress,nStopAddress); + SendDlgItemMessage(hDlg, IDC_TCF_LIST_GRANTS,LB_ADDSTRING, 0,(LPARAM)szTemp2); + SetDlgItemText(hDlg,IDC_TCF_EDIT_ADD,""); + return TRUE; +} + +BOOL UpdateBtn() +{ + HKEY hKey; + DWORD wType; + UCHAR AllProcessesIOPM[0x80]; + UCHAR ThroughCreateFileIOPM[0x80]; + unsigned nCount,i,j; + char szTemp[256]; + unsigned nStartAddress,nStopAddress; + + for (i=0;i<sizeof(AllProcessesIOPM);i++) + AllProcessesIOPM[i] = 0xff; + + nCount = SendDlgItemMessage(hDlg, IDC_AUMP_LIST_GRANTS,LB_GETCOUNT, 0,0); + + for (i=0;i<nCount;i++) + { + SendDlgItemMessage(hDlg, IDC_AUMP_LIST_GRANTS,LB_GETTEXT, i,(LPARAM)szTemp); + if (GetStartAndStopAddress(szTemp, &nStartAddress, &nStopAddress)) + { + for (j=nStartAddress;j<=nStopAddress;j++) + AllProcessesIOPM[j>>3] &= ~(1 << (j&7)); + } + } + + for (i=0;i<sizeof(ThroughCreateFileIOPM);i++) + ThroughCreateFileIOPM[i] = 0xff; + + nCount = SendDlgItemMessage(hDlg, IDC_TCF_LIST_GRANTS,LB_GETCOUNT, 0,0); + + for (i=0;i<nCount;i++) + { + SendDlgItemMessage(hDlg, IDC_TCF_LIST_GRANTS,LB_GETTEXT, i,(LPARAM)szTemp); + if (GetStartAndStopAddress(szTemp, &nStartAddress, &nStopAddress)) + { + for (j=nStartAddress;j<=nStopAddress;j++) + ThroughCreateFileIOPM[j>>3] &= ~(1 << (j&7)); + } + } + + if (RegCreateKeyEx(HKEY_LOCAL_MACHINE, + "Software\\UserPort",0,"", + REG_OPTION_NON_VOLATILE,KEY_ALL_ACCESS, + NULL,&hKey,&wType) == ERROR_SUCCESS) + { + RegSetValueEx(hKey, + "AllProcessesIOPM",0,REG_BINARY, + (BYTE *)AllProcessesIOPM,sizeof(AllProcessesIOPM)); + RegSetValueEx(hKey, + "ThroughCreateFileIOPM",0,REG_BINARY, + (BYTE *)ThroughCreateFileIOPM,sizeof(ThroughCreateFileIOPM)); + + RegCloseKey(hKey); + if (StopDriver()) + { + Sleep(200); + StartDriver(); + } + return TRUE; + } + + return FALSE; +} + +BOOL ReadRegistry() +{ + UCHAR AllProcessesIOPM[0x80]; + UCHAR ThroughCreateFileIOPM[0x80]; + char szTemp[256]; + unsigned i,nStartAddress,nStopAddress; + + DWORD cb,wType, bResult1 = FALSE, bResult2 = FALSE; + HKEY hKey; + + if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, + "Software\\UserPort",0,KEY_READ, + &hKey) == ERROR_SUCCESS) + { + cb = sizeof(AllProcessesIOPM); + if (RegQueryValueEx(hKey,"AllProcessesIOPM",0,&wType,(BYTE *)AllProcessesIOPM,&cb) == ERROR_SUCCESS) + bResult1 = TRUE; + cb = sizeof(ThroughCreateFileIOPM); + if (RegQueryValueEx(hKey,"ThroughCreateFileIOPM",0,&wType,(BYTE *)ThroughCreateFileIOPM,&cb) == ERROR_SUCCESS) + bResult2 = TRUE; + RegCloseKey(hKey); + } + + if ((bResult1 == FALSE) || (bResult2 == FALSE)) + return FALSE; + + for (i=0;i <sizeof(AllProcessesIOPM)<<3;i++) + { + if ((AllProcessesIOPM[i>>3] & (1 << (i&7))) == 0) + { + nStartAddress = i; + do + { + nStopAddress = i; + i++; + } while ((i < sizeof(AllProcessesIOPM)<<3) && ((AllProcessesIOPM[i>>3] & (1 << (i&7))) == 0)); + wsprintf(szTemp,"%X - %X",nStartAddress,nStopAddress); + SendDlgItemMessage(hDlg, IDC_AUMP_LIST_GRANTS,LB_ADDSTRING, 0,(LPARAM)szTemp); + } + } + + for (i=0;i <sizeof(ThroughCreateFileIOPM)<<3;i++) + { + if ((ThroughCreateFileIOPM[i>>3] & (1 << (i&7))) == 0) + { + nStartAddress = i; + do + { + nStopAddress = i; + i++; + } while ((i < sizeof(ThroughCreateFileIOPM)<<3) && ((ThroughCreateFileIOPM[i>>3] & (1 << (i&7))) == 0)); + wsprintf(szTemp,"%X - %X",nStartAddress,nStopAddress); + SendDlgItemMessage(hDlg, IDC_TCF_LIST_GRANTS,LB_ADDSTRING, 0,(LPARAM)szTemp); + } + } + + return TRUE; +} + +BOOL AddAUMPDefaults() +{ + int nCount,i; + + nCount = SendDlgItemMessage(hDlg, IDC_AUMP_LIST_GRANTS,LB_GETCOUNT, 0,0); + + for (i=0;i<nCount;i++) + SendDlgItemMessage(hDlg, IDC_AUMP_LIST_GRANTS,LB_DELETESTRING, 0,0); + + SendDlgItemMessage(hDlg, IDC_AUMP_LIST_GRANTS,LB_ADDSTRING, 0,(LPARAM)"200 - 37F"); + SendDlgItemMessage(hDlg, IDC_AUMP_LIST_GRANTS,LB_ADDSTRING, 0,(LPARAM)"3BC - 3BF"); + SendDlgItemMessage(hDlg, IDC_AUMP_LIST_GRANTS,LB_ADDSTRING, 0,(LPARAM)"3E8 - 3FF"); + return TRUE; +} +BOOL AddTCFDefaults() +{ + int nCount,i; + + nCount = SendDlgItemMessage(hDlg, IDC_TCF_LIST_GRANTS,LB_GETCOUNT, 0,0); + + for (i=0;i<nCount;i++) + SendDlgItemMessage(hDlg, IDC_TCF_LIST_GRANTS,LB_DELETESTRING, 0,0); + + SendDlgItemMessage(hDlg, IDC_TCF_LIST_GRANTS,LB_ADDSTRING, 0,(LPARAM)"200 - 37F"); + SendDlgItemMessage(hDlg, IDC_TCF_LIST_GRANTS,LB_ADDSTRING, 0,(LPARAM)"3BC - 3BF"); + SendDlgItemMessage(hDlg, IDC_TCF_LIST_GRANTS,LB_ADDSTRING, 0,(LPARAM)"3E8 - 3FF"); + return TRUE; +} + +BOOL WINAPI DlgProc( + HWND hWnd, //Handtag till fЎnster, 16-bitar + UINT msg, //Meddelande, unsigned int + WPARAM wParam, //Parameter (word), unsigned int + LPARAM lParam ) //Parameter (long), unsigned long int +{ + char szTemp[256]; + int nIndex; + switch (msg) + { + case WM_INITDIALOG: + hDlg=hWnd; + if (!ReadRegistry()) + { + AddTCFDefaults(); + AddAUMPDefaults(); + } + break; + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case IDCANCEL: + PostQuitMessage ( 0 ); + EndDialog(hWnd,FALSE); + break; + case IDC_BUTTON_START: + StartDriver(); + break; + case IDC_BUTTON_STOP: + if (!StopDriver()) + { + if (GetLastError() == ERROR_ACCESS_DENIED) + MessageBox(hDlg,"You are not authorized to remove drivers.\r\nPlase contact your administrator.","UserPort",MB_OK); + else + MessageBox(hDlg,"Driver is not installed!","UserPort",MB_OK); + } + break; + case IDC_AUMP_BUTTON_ADD: + AddAUMPBtn(); + break; + case IDC_TCF_BUTTON_ADD: + AddTCFBtn(); + break; + case IDC_BUTTON_UPDATE: + UpdateBtn(); + break; + case IDC_AUMP_BUTTON_REMOVE: + nIndex = SendDlgItemMessage(hDlg, IDC_AUMP_LIST_GRANTS,LB_GETCURSEL, 0,0); + SendDlgItemMessage(hDlg, IDC_AUMP_LIST_GRANTS,LB_DELETESTRING, nIndex,0); + EnableWindow(GetDlgItem(hWnd,IDC_AUMP_BUTTON_REMOVE), FALSE); + break; + case IDC_TCF_BUTTON_REMOVE: + nIndex = SendDlgItemMessage(hDlg, IDC_TCF_LIST_GRANTS,LB_GETCURSEL, 0,0); + SendDlgItemMessage(hDlg, IDC_TCF_LIST_GRANTS,LB_DELETESTRING, nIndex,0); + EnableWindow(GetDlgItem(hWnd,IDC_TCF_BUTTON_REMOVE), FALSE); + break; + case IDC_AUMP_BUTTON_DEFAULTS: + AddAUMPDefaults(); + break; + case IDC_TCF_BUTTON_DEFAULTS: + AddTCFDefaults(); + break; + case IDC_AUMP_EDIT_ADD: + GetDlgItemText(hDlg,IDC_AUMP_EDIT_ADD,szTemp,sizeof(szTemp)); + EnableWindow(GetDlgItem(hWnd,IDC_AUMP_BUTTON_ADD), szTemp[0]!='\0'); + break; + case IDC_TCF_EDIT_ADD: + GetDlgItemText(hDlg,IDC_TCF_EDIT_ADD,szTemp,sizeof(szTemp)); + EnableWindow(GetDlgItem(hWnd,IDC_TCF_BUTTON_ADD), szTemp[0]!='\0'); + break; + case IDC_AUMP_LIST_GRANTS: + if (HIWORD(wParam) == LBN_SELCHANGE) + { + nIndex = SendDlgItemMessage(hDlg, IDC_AUMP_LIST_GRANTS,LB_GETCURSEL, 0,0); + SendDlgItemMessage(hDlg, IDC_AUMP_LIST_GRANTS,LB_SETCURSEL, nIndex,0); + EnableWindow(GetDlgItem(hWnd,IDC_AUMP_BUTTON_REMOVE), TRUE); + } + break; + case IDC_TCF_LIST_GRANTS: + if (HIWORD(wParam) == LBN_SELCHANGE) + { + nIndex = SendDlgItemMessage(hDlg, IDC_TCF_LIST_GRANTS,LB_GETCURSEL, 0,0); + SendDlgItemMessage(hDlg, IDC_TCF_LIST_GRANTS,LB_SETCURSEL, nIndex,0); + EnableWindow(GetDlgItem(hWnd,IDC_TCF_BUTTON_REMOVE), TRUE); + } + break; + default: + return FALSE; + break; + } + break; + default: + return FALSE; + } + return TRUE; +} //DlgProc + +int WINAPI WinMain( + HINSTANCE hInstance, + HINSTANCE hPrevInstance, + LPSTR lpszCmdline, + int nShow ) +{ + MSG msg; + + OSVERSIONINFO osvi; + + GetVersionEx(&osvi); + + if ((osvi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) || (osvi.dwPlatformId == VER_PLATFORM_WIN32s)) + { + MessageBox(NULL,"UserPort does not work on Windows 3.11/95/98/Me.\r\n\r\nUsermode programs does always have access to ports in Windows 3.11/95/98.\r\nThis program is therefore not needed on these operating systems.","UserPort",MB_OK); + return 0; + } + + if (lpszCmdline[0] != '\0') + lstrcpy(szDriverFileName, lpszCmdline); + else + lstrcpy(szDriverFileName,"\\SystemRoot\\System32\\Drivers\\UserPort.sys"); + CreateDialog( + hInstance, + MAKEINTRESOURCE(IDD_USERPORT), + NULL, + (DLGPROC)DlgProc); + + SetClassLong(hDlg,GCL_HICON,(long)LoadIcon ( hInstance, MAKEINTRESOURCE(IDI_APP))); + + while ( GetMessage ( &msg, NULL, 0, 0 ) ) + { + if (IsDialogMessage(hDlg,&msg)) + continue; + TranslateMessage ( &msg ); + DispatchMessage ( &msg ); + } + return 0; +} //WinMain diff --git a/res/ATFBlast_ALL/userport/UserPort/UserPort_EXE/UserPort.ico b/res/ATFBlast_ALL/userport/UserPort/UserPort_EXE/UserPort.ico Binary files differnew file mode 100644 index 0000000..a603441 --- /dev/null +++ b/res/ATFBlast_ALL/userport/UserPort/UserPort_EXE/UserPort.ico diff --git a/res/ATFBlast_ALL/userport/UserPort/UserPort_EXE/UserPort.mak b/res/ATFBlast_ALL/userport/UserPort/UserPort_EXE/UserPort.mak new file mode 100644 index 0000000..0b5d146 --- /dev/null +++ b/res/ATFBlast_ALL/userport/UserPort/UserPort_EXE/UserPort.mak @@ -0,0 +1,240 @@ +# Microsoft Developer Studio Generated NMAKE File, Format Version 4.10 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Application" 0x0101 + +!IF "$(CFG)" == "" +CFG=UserPort - Win32 Debug +!MESSAGE No configuration specified. Defaulting to UserPort - Win32 Debug. +!ENDIF + +!IF "$(CFG)" != "UserPort - Win32 Release" && "$(CFG)" !=\ + "UserPort - Win32 Debug" +!MESSAGE Invalid configuration "$(CFG)" specified. +!MESSAGE You can specify a configuration when running NMAKE on this makefile +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "UserPort.mak" CFG="UserPort - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "UserPort - Win32 Release" (based on "Win32 (x86) Application") +!MESSAGE "UserPort - Win32 Debug" (based on "Win32 (x86) Application") +!MESSAGE +!ERROR An invalid configuration is specified. +!ENDIF + +!IF "$(OS)" == "Windows_NT" +NULL= +!ELSE +NULL=nul +!ENDIF +################################################################################ +# Begin Project +# PROP Target_Last_Scanned "UserPort - Win32 Debug" +CPP=cl.exe +MTL=mktyplib.exe +RSC=rc.exe + +!IF "$(CFG)" == "UserPort - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" +OUTDIR=.\Release +INTDIR=.\Release + +ALL : "$(OUTDIR)\UserPort.exe" + +CLEAN : + -@erase "$(INTDIR)\UserPort.obj" + -@erase "$(INTDIR)\UserPort.res" + -@erase "$(OUTDIR)\UserPort.exe" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c +# ADD CPP /nologo /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c +CPP_PROJ=/nologo /ML /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS"\ + /Fp"$(INTDIR)/UserPort.pch" /YX /Fo"$(INTDIR)/" /c +CPP_OBJS=.\Release/ +CPP_SBRS=.\. +# ADD BASE MTL /nologo /D "NDEBUG" /win32 +# ADD MTL /nologo /D "NDEBUG" /win32 +MTL_PROJ=/nologo /D "NDEBUG" /win32 +# ADD BASE RSC /l 0x41d /d "NDEBUG" +# ADD RSC /l 0x41d /d "NDEBUG" +RSC_PROJ=/l 0x41d /fo"$(INTDIR)/UserPort.res" /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o"$(OUTDIR)/UserPort.bsc" +BSC32_SBRS= \ + +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib msvcrt.lib /nologo /subsystem:windows /machine:I386 /nodefaultlib +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ + advapi32.lib shell32.lib msvcrt.lib /nologo /subsystem:windows /incremental:no\ + /pdb:"$(OUTDIR)/UserPort.pdb" /machine:I386 /nodefaultlib\ + /out:"$(OUTDIR)/UserPort.exe" +LINK32_OBJS= \ + "$(INTDIR)\UserPort.obj" \ + "$(INTDIR)\UserPort.res" + +"$(OUTDIR)\UserPort.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ELSEIF "$(CFG)" == "UserPort - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Target_Dir "" +OUTDIR=.\Debug +INTDIR=.\Debug + +ALL : "$(OUTDIR)\UserPort.exe" "$(OUTDIR)\UserPort.bsc" + +CLEAN : + -@erase "$(INTDIR)\UserPort.obj" + -@erase "$(INTDIR)\UserPort.res" + -@erase "$(INTDIR)\UserPort.sbr" + -@erase "$(INTDIR)\vc40.idb" + -@erase "$(INTDIR)\vc40.pdb" + -@erase "$(OUTDIR)\UserPort.bsc" + -@erase "$(OUTDIR)\UserPort.exe" + -@erase "$(OUTDIR)\UserPort.ilk" + -@erase "$(OUTDIR)\UserPort.pdb" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c +# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /YX /c +CPP_PROJ=/nologo /MLd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS"\ + /FR"$(INTDIR)/" /Fp"$(INTDIR)/UserPort.pch" /YX /Fo"$(INTDIR)/" /Fd"$(INTDIR)/"\ + /c +CPP_OBJS=.\Debug/ +CPP_SBRS=.\Debug/ +# ADD BASE MTL /nologo /D "_DEBUG" /win32 +# ADD MTL /nologo /D "_DEBUG" /win32 +MTL_PROJ=/nologo /D "_DEBUG" /win32 +# ADD BASE RSC /l 0x41d /d "_DEBUG" +# ADD RSC /l 0x41d /d "_DEBUG" +RSC_PROJ=/l 0x41d /fo"$(INTDIR)/UserPort.res" /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o"$(OUTDIR)/UserPort.bsc" +BSC32_SBRS= \ + "$(INTDIR)\UserPort.sbr" + +"$(OUTDIR)\UserPort.bsc" : "$(OUTDIR)" $(BSC32_SBRS) + $(BSC32) @<< + $(BSC32_FLAGS) $(BSC32_SBRS) +<< + +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /debug /machine:I386 +# ADD LINK32 ole32.lib oleaut32.lib uuid.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib /nologo /subsystem:windows /debug /machine:I386 +# SUBTRACT LINK32 /nodefaultlib +LINK32_FLAGS=ole32.lib oleaut32.lib uuid.lib kernel32.lib user32.lib gdi32.lib\ + winspool.lib comdlg32.lib advapi32.lib shell32.lib /nologo /subsystem:windows\ + /incremental:yes /pdb:"$(OUTDIR)/UserPort.pdb" /debug /machine:I386\ + /out:"$(OUTDIR)/UserPort.exe" +LINK32_OBJS= \ + "$(INTDIR)\UserPort.obj" \ + "$(INTDIR)\UserPort.res" + +"$(OUTDIR)\UserPort.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ENDIF + +.c{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.cpp{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.cxx{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.c{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +.cpp{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +.cxx{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +################################################################################ +# Begin Target + +# Name "UserPort - Win32 Release" +# Name "UserPort - Win32 Debug" + +!IF "$(CFG)" == "UserPort - Win32 Release" + +!ELSEIF "$(CFG)" == "UserPort - Win32 Debug" + +!ENDIF + +################################################################################ +# Begin Source File + +SOURCE=.\UserPort.rc +DEP_RSC_USERP=\ + ".\UserPort.ico"\ + + +"$(INTDIR)\UserPort.res" : $(SOURCE) $(DEP_RSC_USERP) "$(INTDIR)" + $(RSC) $(RSC_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\UserPort.c + +!IF "$(CFG)" == "UserPort - Win32 Release" + + +"$(INTDIR)\UserPort.obj" : $(SOURCE) "$(INTDIR)" + + +!ELSEIF "$(CFG)" == "UserPort - Win32 Debug" + + +"$(INTDIR)\UserPort.obj" : $(SOURCE) "$(INTDIR)" + +"$(INTDIR)\UserPort.sbr" : $(SOURCE) "$(INTDIR)" + + +!ENDIF + +# End Source File +# End Target +# End Project +################################################################################ diff --git a/res/ATFBlast_ALL/userport/UserPort/UserPort_EXE/UserPort.mdp b/res/ATFBlast_ALL/userport/UserPort/UserPort_EXE/UserPort.mdp Binary files differnew file mode 100644 index 0000000..d332bda --- /dev/null +++ b/res/ATFBlast_ALL/userport/UserPort/UserPort_EXE/UserPort.mdp diff --git a/res/ATFBlast_ALL/userport/UserPort/UserPort_EXE/UserPort.rc b/res/ATFBlast_ALL/userport/UserPort/UserPort_EXE/UserPort.rc new file mode 100644 index 0000000..ad92f0d --- /dev/null +++ b/res/ATFBlast_ALL/userport/UserPort/UserPort_EXE/UserPort.rc @@ -0,0 +1,130 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// Swedish resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_SVE) +#ifdef _WIN32 +LANGUAGE LANG_SWEDISH, SUBLANG_DEFAULT +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_USERPORT DIALOG DISCARDABLE 0, 0, 243, 159 +STYLE DS_CENTER | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_VISIBLE | + WS_CAPTION | WS_SYSMENU +CAPTION "UserPort 1.0 - Tomas Franzon (c) 2001" +FONT 8, "MS Sans Serif" +BEGIN + GROUPBOX "All User Mode Processes Grant List",IDC_STATIC,2,3,118, + 122 + LTEXT "Enter Grant Intervall:(0x000-0x3ff)",IDC_STATIC,10,13, + 105,8 + EDITTEXT IDC_AUMP_EDIT_ADD,8,23,60,14,ES_AUTOHSCROLL + LISTBOX IDC_AUMP_LIST_GRANTS,8,38,60,82,LBS_NOINTEGRALHEIGHT | + WS_VSCROLL | WS_TABSTOP + PUSHBUTTON "Add",IDC_AUMP_BUTTON_ADD,74,24,38,14,WS_DISABLED + PUSHBUTTON "Remove",IDC_AUMP_BUTTON_REMOVE,74,41,38,14,WS_DISABLED + GROUPBOX "Driver (UserPort.SYS)",IDC_STATIC,2,124,139,33 + PUSHBUTTON "Start",IDC_BUTTON_START,7,136,36,14 + PUSHBUTTON "Update",IDC_BUTTON_UPDATE,53,136,35,14 + PUSHBUTTON "Stop",IDC_BUTTON_STOP,98,136,36,14 + PUSHBUTTON "Exit",IDCANCEL,145,128,95,29 + PUSHBUTTON "Defaults",IDC_AUMP_BUTTON_DEFAULTS,74,59,38,14 + GROUPBOX "Through ""\\\\.\\UserPort"" Grant List",IDC_STATIC,123, + 3,118,122 + LTEXT "Enter Grant Intervall:(0x000-0x3ff)",IDC_STATIC,131,13, + 108,8 + EDITTEXT IDC_TCF_EDIT_ADD,129,22,60,14,ES_AUTOHSCROLL + LISTBOX IDC_TCF_LIST_GRANTS,129,38,60,82,LBS_NOINTEGRALHEIGHT | + WS_VSCROLL | WS_TABSTOP + PUSHBUTTON "Add",IDC_TCF_BUTTON_ADD,195,24,38,14,WS_DISABLED + PUSHBUTTON "Remove",IDC_TCF_BUTTON_REMOVE,195,41,38,14,WS_DISABLED + PUSHBUTTON "Defaults",IDC_TCF_BUTTON_DEFAULTS,195,59,38,14 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO DISCARDABLE +BEGIN + IDD_USERPORT, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 241 + TOPMARGIN, 7 + BOTTOMMARGIN, 156 + END +END +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_APP ICON DISCARDABLE "UserPort.ico" +#endif // Swedish resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/res/ATFBlast_ALL/userport/UserPort/UserPort_SYS/Makefile b/res/ATFBlast_ALL/userport/UserPort/UserPort_SYS/Makefile new file mode 100644 index 0000000..5818975 --- /dev/null +++ b/res/ATFBlast_ALL/userport/UserPort/UserPort_SYS/Makefile @@ -0,0 +1,7 @@ +# +# DO NOT EDIT THIS FILE!!! Edit .\sources. if you want to add a new source +# file to this component. This file merely indirects to the real make file +# that is shared by all the driver components of the Windows NT DDK +# + +!INCLUDE $(NTMAKEENV)\makefile.def diff --git a/res/ATFBlast_ALL/userport/UserPort/UserPort_SYS/Sources b/res/ATFBlast_ALL/userport/UserPort/UserPort_SYS/Sources new file mode 100644 index 0000000..50c69e7 --- /dev/null +++ b/res/ATFBlast_ALL/userport/UserPort/UserPort_SYS/Sources @@ -0,0 +1,7 @@ +TARGETNAME=UserPort +TARGETPATH=. +TARGETTYPE=DRIVER + +INCLUDES=c:\ddk\inc + +SOURCES=UserPort.C diff --git a/res/ATFBlast_ALL/userport/UserPort/UserPort_SYS/UserPort.C b/res/ATFBlast_ALL/userport/UserPort/UserPort_SYS/UserPort.C new file mode 100644 index 0000000..f0e40df --- /dev/null +++ b/res/ATFBlast_ALL/userport/UserPort/UserPort_SYS/UserPort.C @@ -0,0 +1,312 @@ +/********************************************************************* + +Author: Tomas Franzon +Date: 11/09/2000 +Program: UserPort.SYS +Compile: Use DDK BUILD facility + +Purpose: Give direct port I/O access to user mode programs. + +This driver is influenced by an article written by Dale Roberts 8/30/95, +published in May 96 Dr Dobbs Journal, see www.ddj.com. +The driver gives user mode program access to selected ports by changing +the x86-processors IOPM (I/O Permission Map). The driver has one separate +map for all procsesses (AllProcessesIOPM) and one separate map +(ThroughCreateFileIOPM) for processes that opens the file "\\.\UserPort" + +The driver tries to read the registry keys: +HKEY_LOCAL_MACHINE\Software\UserPort\AllProcessesIOPM +HKEY_LOCAL_MACHINE\Software\UserPort\ThroughCreateFileIOPM +It will use the default values below if these doesn't exist. + +*********************************************************************/ +#include <ntddk.h> + +/* + * Make sure our structure is packed properly, on byte boundary, not + * on the default doubleword boundary. +*/ +#pragma pack(push,1) + +/* + * Structures for manipulating the GDT register and a GDT segment + * descriptor entry. Documented in Intel processor handbooks. + */ +typedef struct { + unsigned limit : 16; + unsigned baselo : 16; + unsigned basemid : 8; + unsigned type : 4; + unsigned system : 1; + unsigned dpl : 2; + unsigned present : 1; + unsigned limithi : 4; + unsigned available : 1; + unsigned zero : 1; + unsigned size : 1; + unsigned granularity : 1; + unsigned basehi : 8; +} GDTENT; + +typedef struct { + unsigned short limit; + GDTENT *base; +} GDTREG; + +#pragma pack(pop) +/* + * The name of our device driver. + */ +#define DEVICE_NAME_STRING L"UserPort" + +/* + OriginalMapCopy is used to restore the IOPM when the driver exists. + CurrentMap points to NULL or to the place where the processors IOPM is located. + Accessmap is the IOPM that is used by the driver. + Every port address has one cooresponding bit in the IOPM. The driver supports + addresses from 0x000 to 0x3FF and the IOPM size is then 0x3ff / 8 = 0x80. + */ + +UCHAR OriginalAllProcIOPMCopy[0x80]; +UCHAR OriginalThroughCreateFileIOPMCopy[0x80]; +const UCHAR DefaultMap[0x80]= +/*0x000*/ {0xFF,0xFF, +/*0x010*/ 0xFF,0xFF, +/*0x020*/ 0xFF,0xFF, +/*0x030*/ 0xFF,0xFF, +/*0x040*/ 0xFF,0xFF, +/*0x050*/ 0xFF,0xFF, +/*0x060*/ 0xFF,0xFF, +/*0x070*/ 0xFF,0xFF, +/*0x080*/ 0xFF,0xFF, +/*0x090*/ 0xFF,0xFF, +/*0x0A0*/ 0xFF,0xFF, +/*0x0B0*/ 0xFF,0xFF, +/*0x0C0*/ 0xFF,0xFF, +/*0x0D0*/ 0xFF,0xFF, +/*0x0E0*/ 0xFF,0xFF, +/*0x0F0*/ 0xFF,0xFF, +/*0x100*/ 0xFF,0xFF, +/*0x110*/ 0xFF,0xFF, +/*0x120*/ 0xFF,0xFF, +/*0x130*/ 0xFF,0xFF, +/*0x140*/ 0xFF,0xFF, +/*0x150*/ 0xFF,0xFF, +/*0x160*/ 0xFF,0xFF, +/*0x170*/ 0xFF,0xFF, +/*0x180*/ 0xFF,0xFF, +/*0x190*/ 0xFF,0xFF, +/*0x1A0*/ 0xFF,0xFF, +/*0x1B0*/ 0xFF,0xFF, +/*0x1C0*/ 0xFF,0xFF, +/*0x1D0*/ 0xFF,0xFF, +/*0x1E0*/ 0xFF,0xFF, +/*0x1F0*/ 0xFF,0xFF, +/*0x200*/ 0x00,0x00, +/*0x210*/ 0x00,0x00, +/*0x220*/ 0x00,0x00, +/*0x230*/ 0x00,0x00, +/*0x240*/ 0x00,0x00, +/*0x250*/ 0x00,0x00, +/*0x260*/ 0x00,0x00, +/*0x270*/ 0x00,0x00, +/*0x280*/ 0x00,0x00, +/*0x290*/ 0x00,0x00, +/*0x2A0*/ 0x00,0x00, +/*0x2B0*/ 0x00,0x00, +/*0x2C0*/ 0x00,0x00, +/*0x2D0*/ 0x00,0x00, +/*0x2E0*/ 0x00,0x00, +/*0x2F0*/ 0x00,0x00, +/*0x300*/ 0x00,0x00, +/*0x310*/ 0x00,0x00, +/*0x320*/ 0x00,0x00, +/*0x330*/ 0x00,0x00, +/*0x340*/ 0x00,0x00, +/*0x350*/ 0x00,0x00, +/*0x360*/ 0x00,0x00, +/*0x370*/ 0x00,0x00, +/*0x380*/ 0xFF,0xFF, +/*0x390*/ 0xFF,0xFF, +/*0x3A0*/ 0xFF,0xFF, +/*0x3B0*/ 0xFF,0x0F, +/*0x3C0*/ 0xFF,0xFF, +/*0x3D0*/ 0xFF,0xFF, +/*0x3E0*/ 0xFF,0x00, +/*0x3F0*/ 0x00,0x00}; + +unsigned OrgGDTSize; // The original sise of the TSS + +/* + Ke386IoSetAccessProcess() adjusts the IOPM offset pointer to the IOPM at 0x88 + Ke386IoSetAccessProcess() is located in NTOSKRNL.EXE but is not included in any + header file or documented anywhere... +*/ + +void Ke386IoSetAccessProcess(PEPROCESS, int); + +/********************************************************************* + Service handler for a CreateFile() user mode call. + + This routine is entered in the driver object function call table by +the DriverEntry() routine. When the user mode application calls +CreateFile(), this routine gets called while still in the context of +the user mode application, but with the CPL (the processor's Current +Privelege Level) set to 0. This allows us to do kernel mode +operations. UserPort() is called to give the calling process I/O +access. All the user mode application needs do to obtain I/O access +is open this device with CreateFile(). No other operations are +required. +*********************************************************************/ +NTSTATUS CreateFileDispatch( + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp + ) +{ + // Give the current process IO access + Ke386IoSetAccessProcess(PsGetCurrentProcess(), 1); + + Irp->IoStatus.Information = 0; + Irp->IoStatus.Status = STATUS_SUCCESS; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return STATUS_SUCCESS; +} + +// remove the link \\.\UserPort and restore the IOPM +void UserPortUnload(IN PDRIVER_OBJECT DriverObject) +{ + WCHAR DOSNameBuffer[] = L"\\DosDevices\\" DEVICE_NAME_STRING; + UNICODE_STRING uniDOSString; + GDTREG gdtreg; + GDTENT *g; + short TaskSeg; + UCHAR *TSSAllProcessesIOPM; + UCHAR *TSSThroughCreateFileIOPM; + unsigned i; + UCHAR *TSSbase; + + _asm cli; + _asm sgdt gdtreg; + _asm str TaskSeg; + g = gdtreg.base + (TaskSeg >> 3); + g->limit = OrgGDTSize; + g->type = 9; + _asm ltr TaskSeg; + _asm sti; + + TSSbase = (UCHAR *) (g->baselo | (g->basemid << 16) | (g->basehi << 24)); + TSSAllProcessesIOPM = *((USHORT *)(TSSbase + 0x66)) + TSSbase; + TSSThroughCreateFileIOPM = TSSbase + 0x88; + + // Restore to the original map + for (i=0;i<sizeof(DefaultMap);i++) + { + TSSAllProcessesIOPM[i] = OriginalAllProcIOPMCopy[i]; + TSSThroughCreateFileIOPM[i] = OriginalThroughCreateFileIOPMCopy[i]; + } + + RtlInitUnicodeString(&uniDOSString, DOSNameBuffer); + IoDeleteSymbolicLink (&uniDOSString); + IoDeleteDevice(DriverObject->DeviceObject); +} + +// This routine is the entrypoint of the driver. +// This routine reads the AllProcessesIOPM and ThroughCreateFileIOPM from registry and start the driver +NTSTATUS DriverEntry( + IN PDRIVER_OBJECT DriverObject, + IN PUNICODE_STRING RegistryPath + ) +{ + PDEVICE_OBJECT deviceObject; + NTSTATUS status; + WCHAR NameBuffer[] = L"\\Device\\" DEVICE_NAME_STRING; + WCHAR DOSNameBuffer[] = L"\\DosDevices\\" DEVICE_NAME_STRING; + UNICODE_STRING uniNameString, uniDOSString; + GDTREG gdtreg; + GDTENT *g; + short TaskSeg; + UCHAR *TSSAllProcessesIOPM; + UCHAR *TSSThroughCreateFileIOPM; + const UCHAR *AllProcessesIOPM = DefaultMap; + const UCHAR *ThroughCreateFileIOPM = DefaultMap; + unsigned i; + UCHAR *TSSbase; + UCHAR InformationBuffer1[sizeof(DefaultMap)+sizeof(KEY_VALUE_PARTIAL_INFORMATION)]; + PKEY_VALUE_PARTIAL_INFORMATION Information1 = (PKEY_VALUE_PARTIAL_INFORMATION)InformationBuffer1; + UCHAR InformationBuffer2[sizeof(DefaultMap)+sizeof(KEY_VALUE_PARTIAL_INFORMATION)]; + PKEY_VALUE_PARTIAL_INFORMATION Information2 = (PKEY_VALUE_PARTIAL_INFORMATION)InformationBuffer2; + ULONG ResultLength; + HANDLE KeyHandle; + OBJECT_ATTRIBUTES ObjectAttributes; + UNICODE_STRING ThroughCreateFileIOPMString,AllProcessesIOPMString,RegPathString; + + RtlInitUnicodeString(&AllProcessesIOPMString, L"AllProcessesIOPM"); + RtlInitUnicodeString(&ThroughCreateFileIOPMString, L"ThroughCreateFileIOPM"); + RtlInitUnicodeString(&RegPathString,L"\\Registry\\Machine\\Software\\UserPort"); + + InitializeObjectAttributes(&ObjectAttributes,&RegPathString,OBJ_CASE_INSENSITIVE,NULL,NULL); + + if (STATUS_SUCCESS == ZwOpenKey(&KeyHandle, KEY_QUERY_VALUE,&ObjectAttributes)) + { + if (STATUS_SUCCESS == ZwQueryValueKey(KeyHandle,&ThroughCreateFileIOPMString,KeyValuePartialInformation,Information1,sizeof(InformationBuffer1),&ResultLength)) + ThroughCreateFileIOPM = Information1->Data; + if (STATUS_SUCCESS == ZwQueryValueKey(KeyHandle,&AllProcessesIOPMString,KeyValuePartialInformation,Information2,sizeof(InformationBuffer2),&ResultLength)) + AllProcessesIOPM = Information2->Data; + ZwClose(KeyHandle); + } + + _asm cli; // don't get interrupted! + _asm str TaskSeg; // get the TSS selector + _asm sgdt gdtreg; // get the GDT address + g = gdtreg.base + (TaskSeg >> 3); // get the TSS descript + // get the TSS address + OrgGDTSize = g->limit; + g->limit += 0x082; // modify TSS segment limit + g->type = 9; // mark TSS as "not busy" + _asm ltr TaskSeg; // reload task register (TR) + _asm sti; // let interrupts continue*/ + + TSSbase = (UCHAR *) (g->baselo | (g->basemid << 16) | (g->basehi << 24)); + TSSAllProcessesIOPM = *((USHORT *)(TSSbase + 0x66)) + TSSbase; + TSSThroughCreateFileIOPM = TSSbase + 0x88; + + // Copy the AccessMap to TSSbase + 0x20ad and save the original map + for (i=0;i<sizeof(DefaultMap);i++) + { + OriginalAllProcIOPMCopy[i] = TSSAllProcessesIOPM[i]; + TSSAllProcessesIOPM[i] = AllProcessesIOPM[i]; + OriginalThroughCreateFileIOPMCopy[i] = TSSThroughCreateFileIOPM[i]; + TSSThroughCreateFileIOPM[i] = TSSThroughCreateFileIOPM[i] & ThroughCreateFileIOPM[i]; + } + + // + // Set up device driver name and device object. + // Make the driver accessable though the file \\.\UserPort + + RtlInitUnicodeString(&uniNameString, NameBuffer); + RtlInitUnicodeString(&uniDOSString, DOSNameBuffer); + + status = IoCreateDevice(DriverObject, 0, + &uniNameString, + FILE_DEVICE_UNKNOWN, + 0, FALSE, &deviceObject); + + if(!NT_SUCCESS(status)) + return status; + + status = IoCreateSymbolicLink (&uniDOSString, &uniNameString); + + if (!NT_SUCCESS(status)) + return status; + + // + // Initialize the Driver Object with driver's entry points. + // All we require are the Create and Unload operations. + // + DriverObject->MajorFunction[IRP_MJ_CREATE] = CreateFileDispatch; + + DriverObject->DriverUnload = UserPortUnload; + + return STATUS_SUCCESS; +} + diff --git a/res/ATFBlast_ALL/userport/Win_XP.txt b/res/ATFBlast_ALL/userport/Win_XP.txt new file mode 100644 index 0000000..f12ee47 --- /dev/null +++ b/res/ATFBlast_ALL/userport/Win_XP.txt @@ -0,0 +1,25 @@ +Программатор может работать в Windows 95/98/ME, но не работает в +Windows NT/2000/XP, если не установлен драйвер прямого доступа к +портам компьютера UserPort. + + Краткая инструкция. + +Если у Вас Windows NT/2000/XP, то необходимо установить дополнительную +утилиту UserPort, которая позволит программам беспрепятственно +обращаться к указанным Вами портам, в данном случае это LPT. + +Установка UserPort: +1. Распаковываем UserPort.zip во временную папку. +2. Копируем файл UserPort.sys в папку C:\WINDOWS\SYSTEM32\DRIVERS +3. Запускаем файл UserPort.exe, удаляем оттуда все элементы. +4. Заходим в Панель Управления\Система, выбираем закладку Оборудование, + Диспетчер устройств, заходим в Порты (COM и LPT) и смотрим + свойства LPT порта, по которому вы хотите установить соединение. + В Свойствах открываем закладку Ресурсы и смотрим значение + параметра Диапазон ввода/вывода (I/O). (Например, у меня в + Windows XP оно равно 378 - 37F) +5. Добавляем это значение в UserPort.exe (в оба поля) и нажимаем + кнопку Start. + +После этого должен появиться доступ к портам и можно запускать +программу ATFBLAST.EXE.
\ No newline at end of file |