Compare commits

..

43 Commits

Author SHA1 Message Date
Brandon Turner
9995407642 version -> release
svn path=/branches/ros-branch-0_2_9/; revision=20302
2005-12-22 18:32:14 +00:00
Brandon Turner
0970bef959 merge 20263 from GL's request.
svn path=/branches/ros-branch-0_2_9/; revision=20266
2005-12-19 01:50:51 +00:00
Hervé Poussineau
501f3eae92 Merge 20261 and part of 20256 from trunk:
- Fix little bug which prevented IRP_MJ_PNP to be forwarded to lower driver
- Fix serial mouse type detection
- Shut up some debug message

svn path=/branches/ros-branch-0_2_9/; revision=20262
2005-12-18 23:02:36 +00:00
Brandon Turner
1bab34f39f change version to RC2
svn path=/branches/ros-branch-0_2_9/; revision=20260
2005-12-18 22:51:10 +00:00
Gé van Geldorp
9902d58ce2 Merge from trunk:
Fix C++ exception handling

svn path=/branches/ros-branch-0_2_9/; revision=20258
2005-12-18 21:01:56 +00:00
Hervé Poussineau
4b5d91277e Merge from trunk:
Fix typo, which lead to be unable to create services with a description text

svn path=/branches/ros-branch-0_2_9/; revision=20254
2005-12-18 18:14:48 +00:00
Hervé Poussineau
f95ef07957 Merge from trunk:
Use the right default value for the serial port baud rate

svn path=/branches/ros-branch-0_2_9/; revision=20252
2005-12-18 18:12:51 +00:00
Gé van Geldorp
1471bad4d2 Add static entries for PCnet and NE2000 network cards (VMware/QEmu resp.) so
networking is available on the LiveCD. Fixes bug 1116 (again :-))

svn path=/branches/ros-branch-0_2_9/; revision=20214
2005-12-16 23:17:18 +00:00
Andrew Munger
33be95a93e Merge 20204 from trunk.
svn path=/branches/ros-branch-0_2_9/; revision=20205
2005-12-16 03:04:02 +00:00
Gé van Geldorp
0ef3fa89ca Fix by Royce3:
Don't wait 10 sec after starting an app via a .lnk file

svn path=/branches/ros-branch-0_2_9/; revision=20199
2005-12-15 20:58:51 +00:00
Ged Murphy
5093f4e90e merge 20197
svn path=/branches/ros-branch-0_2_9/; revision=20198
2005-12-15 20:50:04 +00:00
Andrew Munger
7566da4dbc *Tweetmerge -r 20194:20193 . *Yellow Card* Revert 20194. *g*
svn path=/branches/ros-branch-0_2_9/; revision=20195
2005-12-15 19:12:37 +00:00
Brandon Turner
c805e6657c set default res to 800x600x16
svn path=/branches/ros-branch-0_2_9/; revision=20194
2005-12-15 18:53:33 +00:00
Hervé Poussineau
35a1e044f5 Merge from trunk:
Add message box to tell the user to reboot after the installation of a network card

svn path=/branches/ros-branch-0_2_9/; revision=20193
2005-12-15 18:22:34 +00:00
Andrew Munger
ac5b031aea Merge 20151 from trunk.
svn path=/branches/ros-branch-0_2_9/; revision=20186
2005-12-15 01:47:36 +00:00
Gé van Geldorp
88c6bdc581 Martin Fuchs <martin-fuchs@gmx.net>
Directly return the correct "My Computer" attributes in
ISF_Desktop_fnGetAttributesOf().
Fixes bug 1097

svn path=/branches/ros-branch-0_2_9/; revision=20178
2005-12-14 22:41:16 +00:00
Gé van Geldorp
f4ef493c15 Merge from trunk:
Make property sheet fit in 640x480. Fixes bug 1099

svn path=/branches/ros-branch-0_2_9/; revision=20177
2005-12-14 21:39:24 +00:00
Gé van Geldorp
ef206239f6 Don't pop-up device installer screen.
Fixes bug 1026

svn path=/branches/ros-branch-0_2_9/; revision=20175
2005-12-14 20:32:57 +00:00
Ged Murphy
7ba0b3e0ad merge Art's tcpip changes to the branch
svn path=/branches/ros-branch-0_2_9/; revision=20162
2005-12-14 10:28:30 +00:00
Ged Murphy
5d1b580120 merge 20108 to branch
svn path=/branches/ros-branch-0_2_9/; revision=20109
2005-12-12 20:01:44 +00:00
Andrew Munger
ac56de8f10 Merge 20041 from trunk
svn path=/branches/ros-branch-0_2_9/; revision=20099
2005-12-12 04:50:06 +00:00
Sebastian Gasiorek
0a08dc64a5 merge 20084
svn path=/branches/ros-branch-0_2_9/; revision=20087
2005-12-11 21:29:07 +00:00
Gé van Geldorp
d5ba90fc03 Merge from trunk:
Put back extra info if it was present

svn path=/branches/ros-branch-0_2_9/; revision=20086
2005-12-11 21:24:51 +00:00
Gé van Geldorp
22ea8a7f36 Merge from trunk:
Resolve chained CNAME records

svn path=/branches/ros-branch-0_2_9/; revision=20083
2005-12-11 21:18:32 +00:00
Sebastian Gasiorek
824ed815aa merge 20065
svn path=/branches/ros-branch-0_2_9/; revision=20080
2005-12-11 20:22:21 +00:00
Brandon Turner
1c0fdf270d merge 20048
svn path=/branches/ros-branch-0_2_9/; revision=20076
2005-12-11 19:30:07 +00:00
Brandon Turner
21728b5d71 merge 20051 / 20052
svn path=/branches/ros-branch-0_2_9/; revision=20075
2005-12-11 19:28:17 +00:00
Brandon Turner
f4d4dc00c0 merge 20053
svn path=/branches/ros-branch-0_2_9/; revision=20074
2005-12-11 19:27:51 +00:00
Brandon Turner
81fa1382bb merge 20049
svn path=/branches/ros-branch-0_2_9/; revision=20073
2005-12-11 19:27:22 +00:00
Gé van Geldorp
44689c61ed Merge from trunk:
Use links.reactos.org redirection script

svn path=/branches/ros-branch-0_2_9/; revision=20064
2005-12-11 14:35:33 +00:00
Gé van Geldorp
b7f02b4160 Merge from trunk:
Shut off some debug messages

svn path=/branches/ros-branch-0_2_9/; revision=20046
2005-12-10 22:28:26 +00:00
Gé van Geldorp
2966911af9 Merge from trunk:
Multiple interrupt status bits can be active at the same time, process them
all instead of just one and ignoring the rest.
On an active network card, this would eventually cause all transmit buffers
to be marked "in use", blocking all transmits. Sinds no TCP acks would go out,
it would block TCP receives too.

svn path=/branches/ros-branch-0_2_9/; revision=20044
2005-12-10 22:21:55 +00:00
Gé van Geldorp
a714b65aa6 Merge from trunk:
Remove Wine-ism

svn path=/branches/ros-branch-0_2_9/; revision=20023
2005-12-09 21:50:59 +00:00
Gé van Geldorp
9a9811c882 Merge from trunk:
Tell shdocvw where to get the Mozilla control

svn path=/branches/ros-branch-0_2_9/; revision=20021
2005-12-09 21:48:35 +00:00
Gé van Geldorp
8ec6560a0f Merge from trunk:
Never allocate 0 bytes. Fixes bug 1082.

svn path=/branches/ros-branch-0_2_9/; revision=20011
2005-12-09 17:57:58 +00:00
Gé van Geldorp
19c2f33c29 Merge from trunk:
Synthesize FILE_ATTRIBUTE_NORMAL on NetworkOpenInformation query too.
This fixes the final problem with the Firefox installer.

svn path=/branches/ros-branch-0_2_9/; revision=20006
2005-12-09 13:24:00 +00:00
Gé van Geldorp
c3511de52b Merge from trunk:
Strings with different lengths are not equal

svn path=/branches/ros-branch-0_2_9/; revision=19977
2005-12-08 21:33:49 +00:00
Gé van Geldorp
24c4a95a96 Merge from trunk:
Don't do WM_INITDIALOG processing during window destruction...
Fixes bug 1087.

svn path=/branches/ros-branch-0_2_9/; revision=19974
2005-12-08 19:08:04 +00:00
Gé van Geldorp
84ffb3645f Merge from trunk:
Self-registration of devenum.dll depends on quartz.dll, which we don't have yet.

svn path=/branches/ros-branch-0_2_9/; revision=19972
2005-12-08 18:33:57 +00:00
Gé van Geldorp
cce3271e71 Merge from trunk:
It's possible to select an (indexed) palette into a bitfield (e.g. 16 bit
deep) DC. This palette will be used when calling CreateDIBSection with
DIB_PAL_COLORS usage. Fixes bug 1077.

svn path=/branches/ros-branch-0_2_9/; revision=19969
2005-12-08 17:42:31 +00:00
Gé van Geldorp
ad9c234c2e Merge from trunk:
It's possible to select an (indexed) palette into a bitfield (e.g. 16 bit
deep) DC. This palette will be used when calling CreateDIBSection with
DIB_PAL_COLORS usage. Fixes bug 1077.

svn path=/branches/ros-branch-0_2_9/; revision=19968
2005-12-08 17:41:57 +00:00
Andrew Munger
dafd96040c Merge 19941, 19955, and 19956 to 0.2.9
svn path=/branches/ros-branch-0_2_9/; revision=19965
2005-12-08 17:09:25 +00:00
Brandon Turner
1fd2b6f20a Change version and DBG=0
svn path=/branches/ros-branch-0_2_9/; revision=19952
2005-12-07 18:14:41 +00:00
1236 changed files with 27600 additions and 485673 deletions

View File

@@ -730,12 +730,7 @@ namespace ReactOS.CustomRevisionAction
this.sendCommand( "CWD " + dirName );
if ( this.resultCode != 250 )
{
if (this.resultCode == 550)
throw new FtpException(String.Format("Access denied to {0}", this.remotePath + "/" + dirName));
throw new FtpException(result.Substring(4));
}
if ( this.resultCode != 250 ) throw new FtpException(result.Substring(4));
this.sendCommand( "PWD" );

View File

@@ -1,321 +0,0 @@
<?xml version="1.0" ?>
<WindowMessageList>
<WindowMessage text="WM_APP" value="32768" />
<WindowMessage text="WM_ACTIVATE" value="6" />
<WindowMessage text="WM_ACTIVATEAPP" value="28" />
<WindowMessage text="WM_AFXFIRST" value="864" />
<WindowMessage text="WM_AFXLAST" value="895" />
<WindowMessage text="WM_ASKCBFORMATNAME" value="780" />
<WindowMessage text="WM_CANCELJOURNAL" value="75" />
<WindowMessage text="WM_CANCELMODE" value="31" />
<WindowMessage text="WM_CAPTURECHANGED" value="533" />
<WindowMessage text="WM_CHANGECBCHAIN" value="781" />
<WindowMessage text="WM_CHANGEUISTATE" value="295" />
<WindowMessage text="WM_UPDATEUISTATE" value="296" />
<WindowMessage text="WM_QUERYUISTATE" value="297" />
<WindowMessage text="WM_CHAR" value="258" />
<WindowMessage text="WM_CHARTOITEM" value="47" />
<WindowMessage text="WM_CHILDACTIVATE" value="34" />
<WindowMessage text="WM_CLEAR" value="771" />
<WindowMessage text="WM_CLOSE" value="16" />
<WindowMessage text="WM_COMMAND" value="273" />
<WindowMessage text="WM_COMMNOTIFY" value="68" />
<WindowMessage text="WM_COMPACTING" value="65" />
<WindowMessage text="WM_COMPAREITEM" value="57" />
<WindowMessage text="WM_CONTEXTMENU" value="123" />
<WindowMessage text="WM_COPY" value="769" />
<WindowMessage text="WM_COPYDATA" value="74" />
<WindowMessage text="WM_CREATE" value="1" />
<WindowMessage text="WM_CTLCOLORBTN" value="309" />
<WindowMessage text="WM_CTLCOLORDLG" value="310" />
<WindowMessage text="WM_CTLCOLOREDIT" value="307" />
<WindowMessage text="WM_CTLCOLORLISTBOX" value="308" />
<WindowMessage text="WM_CTLCOLORMSGBOX" value="306" />
<WindowMessage text="WM_CTLCOLORSCROLLBAR" value="311" />
<WindowMessage text="WM_CTLCOLORSTATIC" value="312" />
<WindowMessage text="WM_CUT" value="768" />
<WindowMessage text="WM_DEADCHAR" value="259" />
<WindowMessage text="WM_DELETEITEM" value="45" />
<WindowMessage text="WM_DESTROY" value="2" />
<WindowMessage text="WM_DESTROYCLIPBOARD" value="775" />
<WindowMessage text="WM_DEVICECHANGE" value="537" />
<WindowMessage text="WM_DEVMODECHANGE" value="27" />
<WindowMessage text="WM_DISPLAYCHANGE" value="126" />
<WindowMessage text="WM_DRAWCLIPBOARD" value="776" />
<WindowMessage text="WM_DRAWITEM" value="43" />
<WindowMessage text="WM_DROPFILES" value="563" />
<WindowMessage text="WM_ENABLE" value="10" />
<WindowMessage text="WM_ENDSESSION" value="22" />
<WindowMessage text="WM_ENTERIDLE" value="289" />
<WindowMessage text="WM_ENTERMENULOOP" value="529" />
<WindowMessage text="WM_ENTERSIZEMOVE" value="561" />
<WindowMessage text="WM_ERASEBKGND" value="20" />
<WindowMessage text="WM_EXITMENULOOP" value="530" />
<WindowMessage text="WM_EXITSIZEMOVE" value="562" />
<WindowMessage text="WM_FONTCHANGE" value="29" />
<WindowMessage text="WM_GETDLGCODE" value="135" />
<WindowMessage text="WM_GETFONT" value="49" />
<WindowMessage text="WM_GETHOTKEY" value="51" />
<WindowMessage text="WM_GETICON" value="127" />
<WindowMessage text="WM_GETMINMAXINFO" value="36" />
<WindowMessage text="WM_GETTEXT" value="13" />
<WindowMessage text="WM_GETTEXTLENGTH" value="14" />
<WindowMessage text="WM_HANDHELDFIRST" value="856" />
<WindowMessage text="WM_HANDHELDLAST" value="863" />
<WindowMessage text="WM_HELP" value="83" />
<WindowMessage text="WM_HOTKEY" value="786" />
<WindowMessage text="WM_HSCROLL" value="276" />
<WindowMessage text="WM_HSCROLLCLIPBOARD" value="782" />
<WindowMessage text="WM_ICONERASEBKGND" value="39" />
<WindowMessage text="WM_INITDIALOG" value="272" />
<WindowMessage text="WM_INITMENU" value="278" />
<WindowMessage text="WM_INITMENUPOPUP" value="279" />
<WindowMessage text="WM_INPUTLANGCHANGE" value="81" />
<WindowMessage text="WM_INPUTLANGCHANGEREQUEST" value="80" />
<WindowMessage text="WM_KEYDOWN" value="256" />
<WindowMessage text="WM_KEYUP" value="257" />
<WindowMessage text="WM_KILLFOCUS" value="8" />
<WindowMessage text="WM_MDIACTIVATE" value="546" />
<WindowMessage text="WM_MDICASCADE" value="551" />
<WindowMessage text="WM_MDICREATE" value="544" />
<WindowMessage text="WM_MDIDESTROY" value="545" />
<WindowMessage text="WM_MDIGETACTIVE" value="553" />
<WindowMessage text="WM_MDIICONARRANGE" value="552" />
<WindowMessage text="WM_MDIMAXIMIZE" value="549" />
<WindowMessage text="WM_MDINEXT" value="548" />
<WindowMessage text="WM_MDIREFRESHMENU" value="564" />
<WindowMessage text="WM_MDIRESTORE" value="547" />
<WindowMessage text="WM_MDISETMENU" value="560" />
<WindowMessage text="WM_MDITILE" value="550" />
<WindowMessage text="WM_MEASUREITEM" value="44" />
<WindowMessage text="WM_MENURBUTTONUP" value="290" />
<WindowMessage text="WM_MENUCHAR" value="288" />
<WindowMessage text="WM_MENUSELECT" value="287" />
<WindowMessage text="WM_NEXTMENU" value="531" />
<WindowMessage text="WM_MOVE" value="3" />
<WindowMessage text="WM_MOVING" value="534" />
<WindowMessage text="WM_NCACTIVATE" value="134" />
<WindowMessage text="WM_NCCALCSIZE" value="131" />
<WindowMessage text="WM_NCCREATE" value="129" />
<WindowMessage text="WM_NCDESTROY" value="130" />
<WindowMessage text="WM_NCHITTEST" value="132" />
<WindowMessage text="WM_NCLBUTTONDBLCLK" value="163" />
<WindowMessage text="WM_NCLBUTTONDOWN" value="161" />
<WindowMessage text="WM_NCLBUTTONUP" value="162" />
<WindowMessage text="WM_NCMBUTTONDBLCLK" value="169" />
<WindowMessage text="WM_NCMBUTTONDOWN" value="167" />
<WindowMessage text="WM_NCMBUTTONUP" value="168" />
<WindowMessage text="WM_NCXBUTTONDOWN" value="171" />
<WindowMessage text="WM_NCXBUTTONUP" value="172" />
<WindowMessage text="WM_NCXBUTTONDBLCLK" value="173" />
<WindowMessage text="WM_NCMOUSEMOVE" value="160" />
<WindowMessage text="WM_NCMOUSEHOVER" value="0x02A0" />
<WindowMessage text="WM_NCMOUSELEAVE" value="0x02A2" />
<WindowMessage text="WM_NCPAINT" value="133" />
<WindowMessage text="WM_NCRBUTTONDBLCLK" value="166" />
<WindowMessage text="WM_NCRBUTTONDOWN" value="164" />
<WindowMessage text="WM_NCRBUTTONUP" value="165" />
<WindowMessage text="WM_NEXTDLGCTL" value="40" />
<WindowMessage text="WM_NEXTMENU" value="531" />
<WindowMessage text="WM_NOTIFY" value="78" />
<WindowMessage text="WM_NOTIFYFORMAT" value="85" />
<WindowMessage text="WM_NULL" value="0" />
<WindowMessage text="WM_PAINT" value="15" />
<WindowMessage text="WM_PAINTCLIPBOARD" value="777" />
<WindowMessage text="WM_PAINTICON" value="38" />
<WindowMessage text="WM_PALETTECHANGED" value="785" />
<WindowMessage text="WM_PALETTEISCHANGING" value="784" />
<WindowMessage text="WM_PARENTNOTIFY" value="528" />
<WindowMessage text="WM_PASTE" value="770" />
<WindowMessage text="WM_PENWINFIRST" value="896" />
<WindowMessage text="WM_PENWINLAST" value="911" />
<WindowMessage text="WM_POWER" value="72" />
<WindowMessage text="WM_POWERBROADCAST" value="536" />
<WindowMessage text="WM_PRINT" value="791" />
<WindowMessage text="WM_PRINTCLIENT" value="792" />
<WindowMessage text="WM_QUERYDRAGICON" value="55" />
<WindowMessage text="WM_QUERYENDSESSION" value="17" />
<WindowMessage text="WM_QUERYNEWPALETTE" value="783" />
<WindowMessage text="WM_QUERYOPEN" value="19" />
<WindowMessage text="WM_QUEUESYNC" value="35" />
<WindowMessage text="WM_QUIT" value="18" />
<WindowMessage text="WM_RENDERALLFORMATS" value="774" />
<WindowMessage text="WM_RENDERFORMAT" value="773" />
<WindowMessage text="WM_SETCURSOR" value="32" />
<WindowMessage text="WM_SETFOCUS" value="7" />
<WindowMessage text="WM_SETFONT" value="48" />
<WindowMessage text="WM_SETHOTKEY" value="50" />
<WindowMessage text="WM_SETICON" value="128" />
<WindowMessage text="WM_SETREDRAW" value="11" />
<WindowMessage text="WM_SETTEXT" value="12" />
<WindowMessage text="WM_SETTINGCHANGE" value="26" />
<WindowMessage text="WM_SHOWWINDOW" value="24" />
<WindowMessage text="WM_SIZE" value="5" />
<WindowMessage text="WM_SIZECLIPBOARD" value="779" />
<WindowMessage text="WM_SIZING" value="532" />
<WindowMessage text="WM_SPOOLERSTATUS" value="42" />
<WindowMessage text="WM_STYLECHANGED" value="125" />
<WindowMessage text="WM_STYLECHANGING" value="124" />
<WindowMessage text="WM_SYSCHAR" value="262" />
<WindowMessage text="WM_SYSCOLORCHANGE" value="21" />
<WindowMessage text="WM_SYSCOMMAND" value="274" />
<WindowMessage text="WM_SYSDEADCHAR" value="263" />
<WindowMessage text="WM_SYSKEYDOWN" value="260" />
<WindowMessage text="WM_SYSKEYUP" value="261" />
<WindowMessage text="WM_TCARD" value="82" />
<WindowMessage text="WM_TIMECHANGE" value="30" />
<WindowMessage text="WM_TIMER" value="275" />
<WindowMessage text="WM_SYSTIMER" value="280" />
<WindowMessage text="WM_UNDO" value="772" />
<WindowMessage text="WM_USER" value="1024" />
<WindowMessage text="WM_USERCHANGED" value="84" />
<WindowMessage text="WM_VKEYTOITEM" value="46" />
<WindowMessage text="WM_VSCROLL" value="277" />
<WindowMessage text="WM_VSCROLLCLIPBOARD" value="778" />
<WindowMessage text="WM_WINDOWPOSCHANGED" value="71" />
<WindowMessage text="WM_WINDOWPOSCHANGING" value="70" />
<WindowMessage text="WM_WININICHANGE" value="26" />
<WindowMessage text="WM_KEYFIRST" value="256" />
<WindowMessage text="WM_KEYLAST" value="264" />
<WindowMessage text="WM_SYNCPAINT" value="136" />
<WindowMessage text="WM_MOUSEACTIVATE" value="33" />
<WindowMessage text="WM_MOUSEMOVE" value="512" />
<WindowMessage text="WM_LBUTTONDOWN" value="513" />
<WindowMessage text="WM_LBUTTONUP" value="514" />
<WindowMessage text="WM_LBUTTONDBLCLK" value="515" />
<WindowMessage text="WM_RBUTTONDOWN" value="516" />
<WindowMessage text="WM_RBUTTONUP" value="517" />
<WindowMessage text="WM_RBUTTONDBLCLK" value="518" />
<WindowMessage text="WM_MBUTTONDOWN" value="519" />
<WindowMessage text="WM_MBUTTONUP" value="520" />
<WindowMessage text="WM_MBUTTONDBLCLK" value="521" />
<WindowMessage text="WM_MOUSEWHEEL" value="522" />
<WindowMessage text="WM_MOUSEFIRST" value="512" />
<WindowMessage text="WM_XBUTTONDOWN" value="523" />
<WindowMessage text="WM_XBUTTONUP" value="524" />
<WindowMessage text="WM_XBUTTONDBLCLK" value="525" />
<WindowMessage text="WM_MOUSELAST" value="525" />
<WindowMessage text="WM_MOUSEHOVER" value="0x2A1" />
<WindowMessage text="WM_MOUSELEAVE" value="0x2A3" />
<WindowMessage text="WM_THEMECHANGED" value="794" />
<WindowMessage text="BM_CLICK" value="245" />
<WindowMessage text="BM_GETCHECK" value="240" />
<WindowMessage text="BM_GETIMAGE" value="246" />
<WindowMessage text="BM_GETSTATE" value="242" />
<WindowMessage text="BM_SETCHECK" value="241" />
<WindowMessage text="BM_SETIMAGE" value="247" />
<WindowMessage text="BM_SETSTATE" value="243" />
<WindowMessage text="BM_SETSTYLE" value="244" />
<WindowMessage text="CB_ADDSTRING" value="323" />
<WindowMessage text="CB_DELETESTRING" value="324" />
<WindowMessage text="CB_DIR" value="325" />
<WindowMessage text="CB_FINDSTRING" value="332" />
<WindowMessage text="CB_FINDSTRINGEXACT" value="344" />
<WindowMessage text="CB_GETCOMBOBOXINFO" value="356" />
<WindowMessage text="CB_GETCOUNT" value="326" />
<WindowMessage text="CB_GETCURSEL" value="327" />
<WindowMessage text="CB_GETDROPPEDCONTROLRECT" value="338" />
<WindowMessage text="CB_GETDROPPEDSTATE" value="343" />
<WindowMessage text="CB_GETDROPPEDWIDTH" value="351" />
<WindowMessage text="CB_GETEDITSEL" value="320" />
<WindowMessage text="CB_GETEXTENDEDUI" value="342" />
<WindowMessage text="CB_GETHORIZONTALEXTENT" value="349" />
<WindowMessage text="CB_GETITEMDATA" value="336" />
<WindowMessage text="CB_GETITEMHEIGHT" value="340" />
<WindowMessage text="CB_GETLBTEXT" value="328" />
<WindowMessage text="CB_GETLBTEXTLEN" value="329" />
<WindowMessage text="CB_GETLOCALE" value="346" />
<WindowMessage text="CB_GETTOPINDEX" value="347" />
<WindowMessage text="CB_INITSTORAGE" value="353" />
<WindowMessage text="CB_INSERTSTRING" value="330" />
<WindowMessage text="CB_LIMITTEXT" value="321" />
<WindowMessage text="CB_RESETCONTENT" value="331" />
<WindowMessage text="CB_SELECTSTRING" value="333" />
<WindowMessage text="CB_SETCURSEL" value="334" />
<WindowMessage text="CB_SETDROPPEDWIDTH" value="352" />
<WindowMessage text="CB_SETEDITSEL" value="322" />
<WindowMessage text="CB_SETEXTENDEDUI" value="341" />
<WindowMessage text="CB_SETHORIZONTALEXTENT" value="350" />
<WindowMessage text="CB_SETITEMDATA" value="337" />
<WindowMessage text="CB_SETITEMHEIGHT" value="339" />
<WindowMessage text="CB_SETLOCALE" value="345" />
<WindowMessage text="CB_SETTOPINDEX" value="348" />
<WindowMessage text="CB_SHOWDROPDOWN" value="335" />
<WindowMessage text="EM_CANUNDO" value="198" />
<WindowMessage text="EM_CHARFROMPOS" value="215" />
<WindowMessage text="EM_EMPTYUNDOBUFFER" value="205" />
<WindowMessage text="EM_FMTLINES" value="200" />
<WindowMessage text="EM_GETFIRSTVISIBLELINE" value="206" />
<WindowMessage text="EM_GETHANDLE" value="189" />
<WindowMessage text="EM_GETLIMITTEXT" value="213" />
<WindowMessage text="EM_GETLINE" value="196" />
<WindowMessage text="EM_GETLINECOUNT" value="186" />
<WindowMessage text="EM_GETMARGINS" value="212" />
<WindowMessage text="EM_GETMODIFY" value="184" />
<WindowMessage text="EM_GETPASSWORDCHAR" value="210" />
<WindowMessage text="EM_GETRECT" value="178" />
<WindowMessage text="EM_GETSEL" value="176" />
<WindowMessage text="EM_GETTHUMB" value="190" />
<WindowMessage text="EM_GETWORDBREAKPROC" value="209" />
<WindowMessage text="EM_LIMITTEXT" value="197" />
<WindowMessage text="EM_LINEFROMCHAR" value="201" />
<WindowMessage text="EM_LINEINDEX" value="187" />
<WindowMessage text="EM_LINELENGTH" value="193" />
<WindowMessage text="EM_LINESCROLL" value="182" />
<WindowMessage text="EM_POSFROMCHAR" value="214" />
<WindowMessage text="EM_REPLACESEL" value="194" />
<WindowMessage text="EM_SCROLL" value="181" />
<WindowMessage text="EM_SCROLLCARET" value="183" />
<WindowMessage text="EM_SETHANDLE" value="188" />
<WindowMessage text="EM_SETLIMITTEXT" value="197" />
<WindowMessage text="EM_SETMARGINS" value="211" />
<WindowMessage text="EM_SETMODIFY" value="185" />
<WindowMessage text="EM_SETPASSWORDCHAR" value="204" />
<WindowMessage text="EM_SETREADONLY" value="207" />
<WindowMessage text="EM_SETRECT" value="179" />
<WindowMessage text="EM_SETRECTNP" value="180" />
<WindowMessage text="EM_SETSEL" value="177" />
<WindowMessage text="EM_SETTABSTOPS" value="203" />
<WindowMessage text="EM_SETWORDBREAKPROC" value="208" />
<WindowMessage text="EM_UNDO" value="199" />
<WindowMessage text="LB_ADDFILE" value="406" />
<WindowMessage text="LB_ADDSTRING" value="384" />
<WindowMessage text="LB_DELETESTRING" value="386" />
<WindowMessage text="LB_DIR" value="397" />
<WindowMessage text="LB_FINDSTRING" value="399" />
<WindowMessage text="LB_FINDSTRINGEXACT" value="418" />
<WindowMessage text="LB_GETANCHORINDEX" value="413" />
<WindowMessage text="LB_GETCARETINDEX" value="415" />
<WindowMessage text="LB_GETCOUNT" value="395" />
<WindowMessage text="LB_GETCURSEL" value="392" />
<WindowMessage text="LB_GETHORIZONTALEXTENT" value="403" />
<WindowMessage text="LB_GETITEMDATA" value="409" />
<WindowMessage text="LB_GETITEMHEIGHT" value="417" />
<WindowMessage text="LB_GETITEMRECT" value="408" />
<WindowMessage text="LB_GETLOCALE" value="422" />
<WindowMessage text="LB_GETSEL" value="391" />
<WindowMessage text="LB_GETSELCOUNT" value="400" />
<WindowMessage text="LB_GETSELITEMS" value="401" />
<WindowMessage text="LB_GETTEXT" value="393" />
<WindowMessage text="LB_GETTEXTLEN" value="394" />
<WindowMessage text="LB_GETTOPINDEX" value="398" />
<WindowMessage text="LB_INITSTORAGE" value="424" />
<WindowMessage text="LB_INSERTSTRING" value="385" />
<WindowMessage text="LB_ITEMFROMPOINT" value="425" />
<WindowMessage text="LB_RESETCONTENT" value="388" />
<WindowMessage text="LB_SELECTSTRING" value="396" />
<WindowMessage text="LB_SELITEMRANGE" value="411" />
<WindowMessage text="LB_SELITEMRANGEEX" value="387" />
<WindowMessage text="LB_SETANCHORINDEX" value="412" />
<WindowMessage text="LB_SETCARETINDEX" value="414" />
<WindowMessage text="LB_SETCOLUMNWIDTH" value="405" />
<WindowMessage text="LB_SETCOUNT" value="423" />
<WindowMessage text="LB_SETCURSEL" value="390" />
<WindowMessage text="LB_SETHORIZONTALEXTENT" value="404" />
<WindowMessage text="LB_SETITEMDATA" value="410" />
<WindowMessage text="LB_SETITEMHEIGHT" value="416" />
<WindowMessage text="LB_SETLOCALE" value="421" />
<WindowMessage text="LB_SETSEL" value="389" />
<WindowMessage text="LB_SETTABSTOPS" value="402" />
<WindowMessage text="LB_SETTOPINDEX" value="407" />
</WindowMessageList>

View File

@@ -10,8 +10,6 @@
<add key="NtstatusXml" value="C:\IRC\TechBot\ntstatus.xml" />
<add key="WinerrorXml" value="C:\IRC\TechBot\winerror.xml" />
<add key="HresultXml" value="C:\IRC\TechBot\hresult.xml" />
<add key="WmXml" value="C:\IRC\TechBot\wm.xml" />
<add key="SvnCommand" value="svn co svn://svn.reactos.com/trunk/reactos" />
<add key="BugUrl" value="www.reactos.org/bugzilla/show_bug.cgi?id={0}" />
</appSettings>
</configuration>

View File

@@ -134,18 +134,6 @@ namespace TechBot.Console
}
}
private static string WmXml
{
get
{
string optionName = "WmXml";
string s = ConfigurationSettings.AppSettings[optionName];
VerifyRequiredOption(optionName,
s);
return s;
}
}
private static string SvnCommand
{
get
@@ -158,18 +146,6 @@ namespace TechBot.Console
}
}
private static string BugUrl
{
get
{
string optionName = "BugUrl";
string s = ConfigurationSettings.AppSettings[optionName];
VerifyRequiredOption(optionName,
s);
return s;
}
}
private static void RunIrcService()
{
IrcService ircService = new IrcService(IRCServerHostName,
@@ -181,9 +157,7 @@ namespace TechBot.Console
NtstatusXml,
WinerrorXml,
HresultXml,
WmXml,
SvnCommand,
BugUrl);
SvnCommand);
ircService.Run();
}
@@ -202,9 +176,7 @@ namespace TechBot.Console
NtstatusXml,
WinerrorXml,
HresultXml,
WmXml,
SvnCommand,
BugUrl);
SvnCommand);
service.Run();
while (true)
{

View File

@@ -1,54 +0,0 @@
using System;
namespace TechBot.Library
{
public class BugCommand : BaseCommand, ICommand
{
private IServiceOutput serviceOutput;
private string bugUrl;
public BugCommand(IServiceOutput serviceOutput,
string bugUrl)
{
this.serviceOutput = serviceOutput;
this.bugUrl = bugUrl;
}
public bool CanHandle(string commandName)
{
return CanHandle(commandName,
new string[] { "bug" });
}
public void Handle(MessageContext context,
string commandName,
string parameters)
{
string bugText = parameters;
if (bugText.Equals(String.Empty))
{
serviceOutput.WriteLine(context,
"Please provide a valid bug number.");
return;
}
NumberParser np = new NumberParser();
long bug = np.Parse(bugText);
if (np.Error)
{
serviceOutput.WriteLine(context,
String.Format("{0} is not a valid bug number.",
bugText));
return;
}
serviceOutput.WriteLine(context,
String.Format(bugUrl, bug));
}
public string Help()
{
return "!bug <number>";
}
}
}

View File

@@ -16,9 +16,7 @@ namespace TechBot.Library
private string ntstatusXml;
private string winerrorXml;
private string hresultXml;
private string wmXml;
private string svnCommand;
private string bugUrl;
private IrcClient client;
private ArrayList channels = new ArrayList(); /* IrcChannel */
private TechBotService service;
@@ -33,22 +31,18 @@ namespace TechBot.Library
string ntstatusXml,
string winerrorXml,
string hresultXml,
string wmXml,
string svnCommand,
string bugUrl)
string svnCommand)
{
this.hostname = hostname;
this.port = port;
this.channelnames = channelnames;
this.botname = botname;
this.chmPath = chmPath;
this.mainChm = mainChm;
this.ntstatusXml = ntstatusXml;
this.winerrorXml = winerrorXml;
this.hresultXml = hresultXml;
this.wmXml = wmXml;
this.svnCommand = svnCommand;
this.bugUrl = bugUrl;
this.botname = botname;
this.chmPath = chmPath;
this.mainChm = mainChm;
this.ntstatusXml = ntstatusXml;
this.winerrorXml = winerrorXml;
this.hresultXml = hresultXml;
this.svnCommand = svnCommand;
}
public void Run()
@@ -59,9 +53,7 @@ namespace TechBot.Library
ntstatusXml,
winerrorXml,
hresultXml,
wmXml,
svnCommand,
bugUrl);
svnCommand);
service.Run();
client = new IrcClient();

View File

@@ -13,9 +13,6 @@
<File name=".\HresultCommand.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
<File name=".\WinerrorCommand.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
<File name=".\SvnCommand.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
<File name=".\BugCommand.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
<File name=".\WmCommand.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
<File name=".\MessageContext.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
</Contents>
<References>
<Reference type="Project" refto="CHMLibrary" localcopy="True" />

View File

@@ -15,20 +15,16 @@ namespace TechBot.Library
private string ntstatusXml;
private string winerrorXml;
private string hresultXml;
private string wmXml;
private string svnCommand;
private string bugUrl;
private ArrayList commands = new ArrayList();
public TechBotService(IServiceOutput serviceOutput,
string chmPath,
string mainChm,
string ntstatusXml,
string winerrorXml,
string hresultXml,
string wmXml,
string svnCommand,
string bugUrl)
string mainChm,
string ntstatusXml,
string winerrorXml,
string hresultXml,
string svnCommand)
{
this.serviceOutput = serviceOutput;
this.chmPath = chmPath;
@@ -36,9 +32,7 @@ namespace TechBot.Library
this.ntstatusXml = ntstatusXml;
this.winerrorXml = winerrorXml;
this.hresultXml = hresultXml;
this.wmXml = wmXml;
this.svnCommand = svnCommand;
this.bugUrl = bugUrl;
}
public void Run()
@@ -54,12 +48,8 @@ namespace TechBot.Library
winerrorXml));
commands.Add(new HresultCommand(serviceOutput,
hresultXml));
commands.Add(new WmCommand(serviceOutput,
wmXml));
commands.Add(new SvnCommand(serviceOutput,
svnCommand));
commands.Add(new BugCommand(serviceOutput,
bugUrl));
}
public void InjectMessage(MessageContext context,

View File

@@ -1,104 +0,0 @@
using System;
using System.Xml;
namespace TechBot.Library
{
public class WmCommand : BaseCommand, ICommand
{
private IServiceOutput serviceOutput;
private string wmXml;
private XmlDocument wmXmlDocument;
public WmCommand(IServiceOutput serviceOutput,
string wmXml)
{
this.serviceOutput = serviceOutput;
this.wmXml = wmXml;
wmXmlDocument = new XmlDocument();
wmXmlDocument.Load(wmXml);
}
public bool CanHandle(string commandName)
{
return CanHandle(commandName,
new string[] { "wm" });
}
public void Handle(MessageContext context,
string commandName,
string parameters)
{
string wmText = parameters;
if (wmText.Equals(String.Empty))
{
serviceOutput.WriteLine(context,
"Please provide a valid window message value or name.");
return;
}
NumberParser np = new NumberParser();
long wm = np.Parse(wmText);
string output;
if (np.Error)
{
// Assume "!wm <name>" form.
output = GetWmNumber(wmText);
}
else
{
output = GetWmDescription(wm);
}
if (output != null)
{
serviceOutput.WriteLine(context,
String.Format("{0} is {1}.",
wmText,
output));
}
else
{
serviceOutput.WriteLine(context,
String.Format("I don't know about window message {0}.",
wmText));
}
}
public string Help()
{
return "!wm <value> or !wm <name>";
}
private string GetWmDescription(long wm)
{
XmlElement root = wmXmlDocument.DocumentElement;
XmlNode node = root.SelectSingleNode(String.Format("WindowMessage[@value='{0}']",
wm));
if (node != null)
{
XmlAttribute text = node.Attributes["text"];
if (text == null)
throw new Exception("Node has no text attribute.");
return text.Value;
}
else
return null;
}
private string GetWmNumber(string wmName)
{
XmlElement root = wmXmlDocument.DocumentElement;
XmlNode node = root.SelectSingleNode(String.Format("WindowMessage[@text='{0}']",
wmName));
if (node != null)
{
XmlAttribute value = node.Attributes["value"];
if (value == null)
throw new Exception("Node has no value attribute.");
return value.Value;
}
else
return null;
}
}
}

View File

@@ -10,8 +10,6 @@
<add key="NtstatusXml" value="C:\IRC\TechBot\ntstatus.xml" />
<add key="WinerrorXml" value="C:\IRC\TechBot\winerror.xml" />
<add key="HresultXml" value="C:\IRC\TechBot\hresult.xml" />
<add key="WmXml" value="C:\IRC\TechBot\wm.xml" />
<add key="SvnCommand" value="svn co svn://svn.reactos.org/trunk/reactos" />
<add key="BugUrl" value="www.reactos.org/bugzilla/show_bug.cgi?id={0}" />
<add key="SvnCommand" value="svn co svn://svn.reactos.com/trunk/reactos" />
</appSettings>
</configuration>

View File

@@ -15,10 +15,8 @@ namespace TechBot
private string MainChm;
private string NtstatusXml;
private string HresultXml;
private string WmXml;
private string WinerrorXml;
private string SvnCommand;
private string BugUrl;
private EventLog eventLog;
public ServiceThread(EventLog eventLog)
@@ -36,10 +34,8 @@ namespace TechBot
MainChm = ConfigurationSettings.AppSettings["MainChm"];
NtstatusXml = ConfigurationSettings.AppSettings["NtstatusXml"];
HresultXml = ConfigurationSettings.AppSettings["HresultXml"];
WmXml = ConfigurationSettings.AppSettings["WmXml"];
WinerrorXml = ConfigurationSettings.AppSettings["WinerrorXml"];
SvnCommand = ConfigurationSettings.AppSettings["SvnCommand"];
BugUrl = ConfigurationSettings.AppSettings["BugUrl"];
}
public void Run()
@@ -56,9 +52,7 @@ namespace TechBot
NtstatusXml,
WinerrorXml,
HresultXml,
WmXml,
SvnCommand,
BugUrl);
SvnCommand);
ircService.Run();
}

View File

@@ -47,8 +47,6 @@ David Welch <welch@cwcom.net>
Jonathan Wilson <jonwil@tpgi.com.au>
Art Yerkes <ayerkes@speakeasy.net>
Magnus Olsen (magnus@greatlord.com)
Brandon Turner (turnerb7@msu.edu)
Christoph von Wittich (Christoph@ApiViewer.de)
Graphic Design from

View File

@@ -25,7 +25,7 @@
<compilerflag>-Wno-strict-aliasing</compilerflag>
<compilerflag>-ftracer</compilerflag>
<compilerflag>-momit-leaf-frame-pointer</compilerflag>
<compilerflag>-mpreferred-stack-boundary=2</compilerflag>
<compilerflag>-mpreferred-stack-boundary=2</compilerflag>
</if>
<if property="KDBG" value="1">
<define name="KDBG" value="1" />

View File

@@ -11,11 +11,15 @@ iphlpapi.dll reactos/lib/iphlpapi
kernel32.dll reactos/lib/kernel32
lz32.dll reactos/lib/lzexpand
msvcrt.dll reactos/lib/msvcrt
ole32.dll reactos/lib/ole32
oleaut32.dll reactos/lib/oleaut32
rpcrt4.dll reactos/lib/rpcrt4
secur32.dll reactos/lib/secur32
shell32.dll reactos/lib/shell32
snmpapi.dll reactos/lib/snmpapi
user32.dll reactos/lib/user32
version.dll reactos/lib/version
winmm.dll reactos/lib/winmm
winspool.dll reactos/lib/winspool
ws2_32.dll reactos/lib/ws2_32
wsock32.dll reactos/lib/wsock32

View File

@@ -2,9 +2,6 @@
<directory name="net">
<xi:include href="net/directory.xml" />
</directory>
<directory name="getfirefox">
<xi:include href="getfirefox/getfirefox.xml" />
</directory>
<directory name="shutdown">
<xi:include href="shutdown/shutdown.xml" />
</directory>

View File

@@ -1,44 +0,0 @@
/*
* PROJECT: ReactOS utilities
* LICENSE: GPL - See COPYING in the top level directory
* FILE: apps/utils/getfirefox/En.rc
* PURPOSE: English resources
* COPYRIGHT: Copyright 2004 Mike McCormack for CodeWeavers
* Copyright 2005 Ge van Geldorp (gvg@reactos.org)
*/
/*
* Based on Wine dlls/shdocvw/En.rc
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
LANGUAGE LANG_GERMAN, SUBLANG_DEFAULT
IDD_GETFIREFOX DIALOG LOADONCALL MOVEABLE DISCARDABLE 0, 0, 220, 76
STYLE DS_MODALFRAME | DS_CENTER | WS_VISIBLE | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Lade Firefox herunter"
FONT 8, "MS Shell Dlg"
{
CONTROL "Progress1",IDC_PROGRESS,"msctls_progress32",WS_BORDER|PBS_SMOOTH,10,10,200,12
LTEXT "", IDC_STATUS, 10, 30, 200, 10, SS_CENTER
CHECKBOX "Entferne ""Get Firefox"" nach Fertigstellung aus dem Startmen<65>", IDC_REMOVE,
10, 44, 200, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
PUSHBUTTON "Cancel", IDCANCEL, 85, 58, 50, 15, WS_GROUP | WS_TABSTOP
}
STRINGTABLE
BEGIN
IDS_START_MENU_NAME "Get Firefox"
END

View File

@@ -1,44 +0,0 @@
/*
* PROJECT: ReactOS utilities
* LICENSE: GPL - See COPYING in the top level directory
* FILE: apps/utils/getfirefox/En.rc
* PURPOSE: English resources
* COPYRIGHT: Copyright 2004 Mike McCormack for CodeWeavers
* Copyright 2005 Ge van Geldorp (gvg@reactos.org)
*/
/*
* Based on Wine dlls/shdocvw/En.rc
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT
IDD_GETFIREFOX DIALOG LOADONCALL MOVEABLE DISCARDABLE 0, 0, 220, 76
STYLE DS_MODALFRAME | DS_CENTER | WS_VISIBLE | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Downloading Firefox"
FONT 8, "MS Shell Dlg"
{
CONTROL "Progress1",IDC_PROGRESS,"msctls_progress32",WS_BORDER|PBS_SMOOTH,10,10,200,12
LTEXT "", IDC_STATUS, 10, 30, 200, 10, SS_CENTER
CHECKBOX "Remove ""Get Firefox"" from Start Menu when done", IDC_REMOVE,
10, 44, 200, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
PUSHBUTTON "Cancel", IDCANCEL, 85, 58, 50, 15, WS_GROUP | WS_TABSTOP
}
STRINGTABLE
BEGIN
IDS_START_MENU_NAME "Get Firefox"
END

View File

@@ -1,45 +0,0 @@
/*
* PROJECT: ReactOS utilities
* LICENSE: GPL - See COPYING in the top level directory
* FILE: apps/utils/getfirefox/En.rc
* PURPOSE: French resources
* COPYRIGHT: Copyright 2004 Mike McCormack for CodeWeavers
* Copyright 2005 Ge van Geldorp (gvg@reactos.org)
* Copyright 2005 G. Maton (mustang9@gmail.com) - French translation
*/
/*
* Based on Wine dlls/shdocvw/En.rc
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
LANGUAGE LANG_FRENCH, SUBLANG_DEFAULT
IDD_GETFIREFOX DIALOG LOADONCALL MOVEABLE DISCARDABLE 0, 0, 220, 76
STYLE DS_MODALFRAME | DS_CENTER | WS_VISIBLE | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "T<>l<EFBFBD>chargement de Firefox"
FONT 8, "MS Shell Dlg"
{
CONTROL "Progress1",IDC_PROGRESS,"msctls_progress32",WS_BORDER|PBS_SMOOTH,10,10,200,12
LTEXT "", IDC_STATUS, 10, 30, 200, 10, SS_CENTER
CHECKBOX "Supprimer ""Obtenir Firefox"" du Menu d<>marrer une fois termin<69>", IDC_REMOVE,
10, 44, 200, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
PUSHBUTTON "Annuler", IDCANCEL, 85, 58, 50, 15, WS_GROUP | WS_TABSTOP
}
STRINGTABLE
BEGIN
IDS_START_MENU_NAME "Obtenir Firefox"
END

View File

@@ -1,45 +0,0 @@
/*
* PROJECT: ReactOS utilities
* LICENSE: GPL - See COPYING in the top level directory
* FILE: apps/utils/getfirefox/En.rc
* PURPOSE: English resources
* COPYRIGHT: Copyright 2004 Mike McCormack for CodeWeavers
* Copyright 2005 Ge van Geldorp (gvg@reactos.org)
* Copyright 2005 Robert Horvath (talley@cubeclub.hu) - Hungarian translation
*/
/*
* Based on Wine dlls/shdocvw/En.rc
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
LANGUAGE LANG_HUNGARIAN, SUBLANG_NEUTRAL
IDD_GETFIREFOX DIALOG LOADONCALL MOVEABLE DISCARDABLE 0, 0, 220, 76
STYLE DS_MODALFRAME | DS_CENTER | WS_VISIBLE | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "A Firefox let<65>lt<6C>se"
FONT 8, "MS Shell Dlg"
{
CONTROL "Progress1",IDC_PROGRESS,"msctls_progress32",WS_BORDER|PBS_SMOOTH,10,10,200,12
LTEXT "", IDC_STATUS, 10, 30, 200, 10, SS_CENTER
CHECKBOX "A ""Szerezd meg a Firefoxot"" elv<6C>tol<6F>t<EFBFBD>sa a Start Men<65>b<EFBFBD>l befejez<65>s ut<75>n", IDC_REMOVE,
10, 44, 200, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
PUSHBUTTON "M<>gse", IDCANCEL, 85, 58, 50, 15, WS_GROUP | WS_TABSTOP
}
STRINGTABLE
BEGIN
IDS_START_MENU_NAME "Szerezd meg Firefoxot"
END

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

View File

@@ -1,383 +0,0 @@
/*
* PROJECT: ReactOS utilities
* LICENSE: GPL - See COPYING in the top level directory
* FILE: apps/utils/getfirefox/getfirefox.c
* PURPOSE: Main program
* COPYRIGHT: Copyright 2001 John R. Sheets (for CodeWeavers)
* Copyright 2004 Mike McCormack (for CodeWeavers)
* Copyright 2005 Ge van Geldorp (gvg@reactos.org)
*/
/*
* Based on Wine dlls/shdocvw/shdocvw_main.c
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <precomp.h>
#define NDEBUG
#include <debug.h>
#define DOWNLOAD_URL L"http://links.reactos.org/getfirefox"
typedef struct _IBindStatusCallbackImpl
{
const IBindStatusCallbackVtbl *vtbl;
LONG ref;
HWND hDialog;
BOOL *pbCancelled;
} IBindStatusCallbackImpl;
static HRESULT WINAPI
dlQueryInterface(IBindStatusCallback* This, REFIID riid, void** ppvObject)
{
if (NULL == ppvObject)
{
return E_POINTER;
}
if (IsEqualIID(riid, &IID_IUnknown) ||
IsEqualIID(riid, &IID_IBindStatusCallback))
{
IBindStatusCallback_AddRef( This );
*ppvObject = This;
return S_OK;
}
return E_NOINTERFACE;
}
static ULONG WINAPI
dlAddRef(IBindStatusCallback* iface)
{
IBindStatusCallbackImpl *This = (IBindStatusCallbackImpl *) iface;
return InterlockedIncrement(&This->ref);
}
static ULONG WINAPI
dlRelease(IBindStatusCallback* iface)
{
IBindStatusCallbackImpl *This = (IBindStatusCallbackImpl *) iface;
DWORD ref = InterlockedDecrement(&This->ref);
if( !ref )
{
DestroyWindow( This->hDialog );
HeapFree(GetProcessHeap(), 0, This);
}
return ref;
}
static HRESULT WINAPI
dlOnStartBinding(IBindStatusCallback* iface, DWORD dwReserved, IBinding* pib)
{
DPRINT1("OnStartBinding not implemented\n");
return S_OK;
}
static HRESULT WINAPI
dlGetPriority(IBindStatusCallback* iface, LONG* pnPriority)
{
DPRINT1("GetPriority not implemented\n");
return S_OK;
}
static HRESULT WINAPI
dlOnLowResource( IBindStatusCallback* iface, DWORD reserved)
{
DPRINT1("OnLowResource not implemented\n");
return S_OK;
}
static HRESULT WINAPI
dlOnProgress(IBindStatusCallback* iface, ULONG ulProgress,
ULONG ulProgressMax, ULONG ulStatusCode, LPCWSTR szStatusText)
{
IBindStatusCallbackImpl *This = (IBindStatusCallbackImpl *) iface;
HWND Item;
LONG r;
WCHAR OldText[100];
Item = GetDlgItem(This->hDialog, IDC_PROGRESS);
if (NULL != Item && 0 != ulProgressMax)
{
SendMessageW(Item, PBM_SETPOS, (ulProgress * 100) / ulProgressMax, 0);
}
Item = GetDlgItem(This->hDialog, IDC_STATUS);
if (NULL != Item)
{
SendMessageW(Item, WM_GETTEXT, sizeof(OldText) / sizeof(OldText[0]),
(LPARAM) OldText);
if (sizeof(OldText) / sizeof(OldText[0]) - 1 <= wcslen(OldText) ||
0 != wcscmp(OldText, szStatusText))
{
SendMessageW(Item, WM_SETTEXT, 0, (LPARAM) szStatusText);
}
}
SetLastError(0);
r = GetWindowLongPtrW(This->hDialog, GWLP_USERDATA);
if (0 != r || 0 != GetLastError())
{
*This->pbCancelled = TRUE;
DPRINT("Cancelled\n");
return E_ABORT;
}
return S_OK;
}
static HRESULT WINAPI
dlOnStopBinding(IBindStatusCallback* iface, HRESULT hresult, LPCWSTR szError)
{
DPRINT1("OnStopBinding not implemented\n");
return S_OK;
}
static HRESULT WINAPI
dlGetBindInfo(IBindStatusCallback* iface, DWORD* grfBINDF, BINDINFO* pbindinfo)
{
DPRINT1("GetBindInfo not implemented\n");
return S_OK;
}
static HRESULT WINAPI
dlOnDataAvailable(IBindStatusCallback* iface, DWORD grfBSCF,
DWORD dwSize, FORMATETC* pformatetc, STGMEDIUM* pstgmed)
{
DPRINT1("OnDataAvailable implemented\n");
return S_OK;
}
static HRESULT WINAPI
dlOnObjectAvailable(IBindStatusCallback* iface, REFIID riid, IUnknown* punk)
{
DPRINT1("OnObjectAvailable implemented\n");
return S_OK;
}
static const IBindStatusCallbackVtbl dlVtbl =
{
dlQueryInterface,
dlAddRef,
dlRelease,
dlOnStartBinding,
dlGetPriority,
dlOnLowResource,
dlOnProgress,
dlOnStopBinding,
dlGetBindInfo,
dlOnDataAvailable,
dlOnObjectAvailable
};
static IBindStatusCallback*
CreateDl(HWND Dlg, BOOL *pbCancelled)
{
IBindStatusCallbackImpl *This;
This = HeapAlloc(GetProcessHeap(), 0, sizeof(IBindStatusCallbackImpl));
This->vtbl = &dlVtbl;
This->ref = 1;
This->hDialog = Dlg;
This->pbCancelled = pbCancelled;
return (IBindStatusCallback*) This;
}
static BOOL
GetShortcutName(LPWSTR ShortcutName)
{
if (! SHGetSpecialFolderPathW(0, ShortcutName, CSIDL_PROGRAMS, FALSE))
{
return FALSE;
}
if (NULL == PathAddBackslashW(ShortcutName))
{
return FALSE;
}
if (0 == LoadStringW(GetModuleHandle(NULL), IDS_START_MENU_NAME,
ShortcutName + wcslen(ShortcutName),
MAX_PATH - wcslen(ShortcutName)))
{
return FALSE;
}
if (MAX_PATH - 5 < wcslen(ShortcutName))
{
return FALSE;
}
wcscat(ShortcutName, L".lnk");
return TRUE;
}
static DWORD WINAPI
ThreadFunc(LPVOID Context)
{
static const WCHAR szUrl[] = DOWNLOAD_URL;
IBindStatusCallback *dl;
WCHAR path[MAX_PATH], ShortcutName[MAX_PATH];
LPWSTR p;
STARTUPINFOW si;
PROCESS_INFORMATION pi;
HWND Dlg = (HWND) Context;
DWORD r;
BOOL bCancelled = FALSE;
BOOL bTempfile = FALSE;
/* built the path for the download */
p = wcsrchr(szUrl, L'/');
if (NULL == p)
{
goto end;
}
if (! GetTempPathW(MAX_PATH, path))
{
goto end;
}
wcscat(path, p + 1);
/* download it */
bTempfile = TRUE;
dl = CreateDl(Context, &bCancelled);
r = URLDownloadToFileW(NULL, szUrl, path, 0, dl);
if (NULL != dl)
{
IBindStatusCallback_Release(dl);
}
if (S_OK != r || bCancelled )
{
goto end;
}
ShowWindow(Dlg, SW_HIDE);
/* run it */
memset(&si, 0, sizeof(si));
si.cb = sizeof(si);
r = CreateProcessW(path, NULL, NULL, NULL, 0, 0, NULL, NULL, &si, &pi);
if (0 == r)
{
goto end;
}
CloseHandle(pi.hThread);
WaitForSingleObject(pi.hProcess, INFINITE);
CloseHandle(pi.hProcess);
if (BST_CHECKED == SendMessageW(GetDlgItem(Dlg, IDC_REMOVE), BM_GETCHECK,
0, 0) &&
GetShortcutName(ShortcutName))
{
DeleteFileW(ShortcutName);
}
end:
if (bTempfile)
{
DeleteFileW(path);
}
EndDialog(Dlg, 0);
return 0;
}
static INT_PTR CALLBACK
dlProc(HWND Dlg, UINT Msg, WPARAM wParam, LPARAM lParam)
{
HANDLE Thread;
DWORD ThreadId;
HWND Item;
HICON Icon;
WCHAR ShortcutName[MAX_PATH];
switch (Msg)
{
case WM_INITDIALOG:
Icon = LoadIconW((HINSTANCE) GetWindowLongPtr(Dlg, GWLP_HINSTANCE),
MAKEINTRESOURCEW(IDI_ICON_MAIN));
if (NULL != Icon)
{
SendMessageW(Dlg, WM_SETICON, ICON_BIG, (LPARAM) Icon);
SendMessageW(Dlg, WM_SETICON, ICON_SMALL, (LPARAM) Icon);
}
SetWindowLongPtrW(Dlg, GWLP_USERDATA, 0);
Item = GetDlgItem(Dlg, IDC_PROGRESS);
if (NULL != Item)
{
SendMessageW(Item, PBM_SETRANGE, 0, MAKELPARAM(0,100));
SendMessageW(Item, PBM_SETPOS, 0, 0);
}
Item = GetDlgItem(Dlg, IDC_REMOVE);
if (NULL != Item)
{
if (GetShortcutName(ShortcutName) &&
INVALID_FILE_ATTRIBUTES != GetFileAttributesW(ShortcutName))
{
SendMessageW(Item, BM_SETCHECK, BST_CHECKED, 0);
}
else
{
SendMessageW(Item, BM_SETCHECK, BST_UNCHECKED, 0);
ShowWindow(Item, SW_HIDE);
}
}
Thread = CreateThread(NULL, 0, ThreadFunc, Dlg, 0, &ThreadId);
if (NULL == Thread)
{
return FALSE;
}
CloseHandle(Thread);
return TRUE;
case WM_COMMAND:
if (wParam == IDCANCEL)
{
SetWindowLongPtrW(Dlg, GWLP_USERDATA, 1);
PostMessage(Dlg, WM_CLOSE, 0, 0);
}
return FALSE;
case WM_CLOSE:
EndDialog(Dlg, 0);
return TRUE;
default:
return FALSE;
}
}
/***********************************************************************
* Main program
*/
int
main(int argc, char *argv[])
{
InitCommonControls();
DialogBoxW(GetModuleHandle(NULL), MAKEINTRESOURCEW(IDD_GETFIREFOX), 0,
dlProc);
return 0;
}

View File

@@ -1,28 +0,0 @@
/*
* PROJECT: ReactOS utilities
* LICENSE: GPL - See COPYING in the top level directory
* FILE: apps/utils/getfirefox/getfirefox.rc
* PURPOSE: Language-independent resources
* COPYRIGHT: Copyright 2005 Ge van Geldorp (gvg@reactos.org)
*/
#include <windows.h>
#include "resource.h"
#define REACTOS_STR_FILE_DESCRIPTION "Firefox downloader\0"
#define REACTOS_STR_INTERNAL_NAME "getfirefox\0"
#define REACTOS_STR_ORIGINAL_FILENAME "getfirefox.exe\0"
#include <reactos/version.rc>
/*
* Note: this icon is the "default logo" referenced here:
* http://www.mozilla.org/foundation/trademarks/faq.html (under "What are the
* Mozilla Trademarks and Logos?"). Don't use the official Firefox logo as it
* is trademarked.
*/
1 ICON "firefox.ico"
#include "De.rc"
#include "En.rc"
#include "Fr.rc"
#include "Hu.rc"

View File

@@ -1,17 +0,0 @@
<module name="getfirefox" type="win32gui" installbase="system32" installname="getfirefox.exe">
<include base="getfirefox">.</include>
<define name="UNICODE" />
<define name="_UNICODE" />
<define name="__USE_W32API" />
<define name="WINVER">0x0501</define>
<define name="_WIN32_IE>0x0600</define>
<library>comctl32</library>
<library>ntdll</library>
<library>shell32</library>
<library>shlwapi</library>
<library>urlmon</library>
<library>uuid</library>
<pch>precomp.h</pch>
<file>getfirefox.c</file>
<file>getfirefox.rc</file>
</module>

View File

@@ -1,19 +0,0 @@
/*
* PROJECT: ReactOS utilities
* LICENSE: GPL - See COPYING in the top level directory
* FILE: apps/utils/getfirefox/precomp.h
* PURPOSE: Precompiled header file
* COPYRIGHT: Copyright 2005 Ge van Geldorp (gvg@reactos.org)
*/
#define COBJMACROS
#define NTOS_MODE_USER
#define WIN32_NO_STATUS
#include <windows.h>
#include <ndk/ntndk.h>
#include <commctrl.h>
#include <shlobj.h>
#include <shlwapi.h>
#include <urlmon.h>
#include "resource.h"

View File

@@ -1,17 +0,0 @@
/*
* PROJECT: ReactOS utilities
* LICENSE: GPL - See COPYING in the top level directory
* FILE: apps/utils/getfirefox/resource.h
* PURPOSE: Resource constants
* COPYRIGHT: Copyright 2005 Ge van Geldorp (gvg@reactos.org)
*/
#define IDI_ICON_MAIN 1
#define IDD_GETFIREFOX 100
#define IDC_PROGRESS 1000
#define IDC_STATUS 1001
#define IDC_REMOVE 1002
#define IDS_START_MENU_NAME 1100

View File

@@ -51,7 +51,7 @@ int _CRT_glob = 0; // stop * from listing dir files in arp -d *
/*
* function declerations
*/
DWORD DoFormatMessage(VOID);
DWORD DoFormatMessage(DWORD ErrorCode);
INT PrintEntries(PMIB_IPNETROW pIpAddRow);
INT DisplayArpEntries(PTCHAR pszInetAddr, PTCHAR pszIfAddr);
INT Addhost(PTCHAR pszInetAddr, PTCHAR pszEthAddr, PTCHAR pszIfAddr);
@@ -62,36 +62,30 @@ VOID Usage(VOID);
/*
* convert error code into meaningful message
*/
DWORD DoFormatMessage(VOID)
DWORD DoFormatMessage(DWORD ErrorCode)
{
LPVOID lpMsgBuf;
DWORD RetVal;
/* double brackets to silence the assignment warning message */
if ((RetVal = FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
ErrorCode,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), /* Default language */
(LPTSTR) &lpMsgBuf,
0,
NULL ))) {
_tprintf(_T("%s"), (LPTSTR)lpMsgBuf);
DWORD ErrorCode = GetLastError();
if (ErrorCode != ERROR_SUCCESS)
{
RetVal = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
ErrorCode,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), /* Default language */
(LPTSTR) &lpMsgBuf,
0,
NULL );
if (RetVal != 0)
{
_tprintf(_T("%s"), (LPTSTR)lpMsgBuf);
LocalFree(lpMsgBuf);
/* return number of TCHAR's stored in output buffer
* excluding '\0' - as FormatMessage does*/
return RetVal;
}
LocalFree(lpMsgBuf);
/* return number of TCHAR's stored in output buffer
* excluding '\0' - as FormatMessage does*/
return RetVal;
}
return 0;
else
return 0;
}
@@ -151,63 +145,55 @@ INT DisplayArpEntries(PTCHAR pszInetAddr, PTCHAR pszIfAddr)
{
INT iRet;
UINT i, k;
PMIB_IPNETTABLE pIpNetTable = NULL;
PMIB_IPADDRTABLE pIpAddrTable = NULL;
DWORD Size = 0;
PMIB_IPNETTABLE pIpNetTable;
PMIB_IPADDRTABLE pIpAddrTable;
ULONG ulSize = 0;
struct in_addr inaddr, inaddr2;
DWORD dwSize = 0;
PTCHAR pszIpAddr;
TCHAR szIntIpAddr[20];
/* retrieve the IP-to-physical address mapping table */
/* get table size */
GetIpNetTable(pIpNetTable, &Size, 0);
/* Return required buffer size */
GetIpNetTable(NULL, &ulSize, 0);
/* allocate memory for ARP address table */
pIpNetTable = (PMIB_IPNETTABLE) HeapAlloc(GetProcessHeap(), 0, Size);
if (pIpNetTable == NULL)
goto cleanup;
pIpNetTable = (PMIB_IPNETTABLE) malloc(ulSize * sizeof(BYTE));
ZeroMemory(pIpNetTable, sizeof(*pIpNetTable));
iRet = GetIpNetTable(pIpNetTable, &Size, TRUE);
if (iRet != NO_ERROR)
/* get Arp address table */
if (pIpNetTable != NULL)
GetIpNetTable(pIpNetTable, &ulSize, TRUE);
else
{
_tprintf(_T("failed to allocate memory for GetIpNetTable\n"));
DoFormatMessage();
goto cleanup;
free(pIpNetTable);
exit(EXIT_FAILURE);
}
/* check there are entries in the table */
if (pIpNetTable->dwNumEntries == 0)
{
_tprintf(_T("No ARP entires found\n"));
goto cleanup;
free(pIpNetTable);
exit(EXIT_FAILURE);
}
/* try doing this in the way it's done above, it's clearer */
/* Retrieve the interface-to-ip address mapping
* table to get the IP address for adapter */
pIpAddrTable = (MIB_IPADDRTABLE *) malloc(dwSize);
GetIpAddrTable(pIpAddrTable, &dwSize, 0); // NULL ?
/* get table size */
Size = 0;
GetIpAddrTable(pIpAddrTable, &Size, 0);
pIpAddrTable = (MIB_IPADDRTABLE *) HeapAlloc(GetProcessHeap(), 0, Size);
if (pIpAddrTable == NULL)
goto cleanup;
pIpAddrTable = (MIB_IPADDRTABLE *) malloc(dwSize);
//ZeroMemory(pIpAddrTable, sizeof(*pIpAddrTable));
ZeroMemory(pIpAddrTable, sizeof(*pIpAddrTable));
iRet = GetIpAddrTable(pIpAddrTable, &Size, TRUE);
if (iRet != NO_ERROR)
if ((iRet = GetIpAddrTable(pIpAddrTable, &dwSize, TRUE)) != NO_ERROR)
{
_tprintf(_T("GetIpAddrTable failed: %d\n"), iRet);
DoFormatMessage();
goto cleanup;
_tprintf(_T("error: %d\n"), WSAGetLastError());
}
@@ -247,14 +233,10 @@ INT DisplayArpEntries(PTCHAR pszInetAddr, PTCHAR pszIfAddr)
PrintEntries(&pIpNetTable->table[i]);
}
free(pIpNetTable);
free(pIpAddrTable);
return EXIT_SUCCESS;
cleanup:
if (pIpNetTable != NULL)
HeapFree(GetProcessHeap(), 0, pIpNetTable);
if (pIpAddrTable != NULL)
HeapFree(GetProcessHeap(), 0, pIpAddrTable);
return EXIT_FAILURE;
}
@@ -268,11 +250,14 @@ cleanup:
*/
INT Addhost(PTCHAR pszInetAddr, PTCHAR pszEthAddr, PTCHAR pszIfAddr)
{
PMIB_IPNETROW pAddHost = NULL;
PMIB_IPNETTABLE pIpNetTable = NULL;
PMIB_IPNETROW pAddHost;
PMIB_IPADDRTABLE pIpAddrTable;
PMIB_IPNETTABLE pIpNetTable;
DWORD dwIpAddr = 0;
ULONG Size = 0;
INT iRet, i, val, c;
DWORD dwSize = 0;
ULONG ulSize = 0;
INT iRet, i, val;
TCHAR c;
/* error checking */
@@ -282,20 +267,20 @@ INT Addhost(PTCHAR pszInetAddr, PTCHAR pszEthAddr, PTCHAR pszIfAddr)
if ((dwIpAddr = inet_addr(pszInetAddr)) == INADDR_NONE)
{
_tprintf(_T("ARP: bad IP address: %s\n"), pszInetAddr);
return EXIT_FAILURE;
exit(EXIT_FAILURE);
}
}
else
{
Usage();
return EXIT_FAILURE;
exit(EXIT_FAILURE);
}
/* check MAC address */
if (strlen(pszEthAddr) != 17)
{
_tprintf(_T("ARP: bad argument: %s\n"), pszEthAddr);
return EXIT_FAILURE;
exit(EXIT_FAILURE);
}
for (i=0; i<17; i++)
{
@@ -305,53 +290,54 @@ INT Addhost(PTCHAR pszInetAddr, PTCHAR pszEthAddr, PTCHAR pszIfAddr)
if (!isxdigit(pszEthAddr[i]))
{
_tprintf(_T("ARP: bad argument: %s\n"), pszEthAddr);
return EXIT_FAILURE;
exit(EXIT_FAILURE);
}
}
/* We need the IpNetTable to get the adapter index */
/* Return required buffer size */
GetIpNetTable(pIpNetTable, &Size, 0);
GetIpNetTable(NULL, &ulSize, 0);
/* allocate memory for ARP address table */
pIpNetTable = (PMIB_IPNETTABLE) HeapAlloc(GetProcessHeap(), 0, Size);
if (pIpNetTable == NULL)
goto cleanup;
pIpNetTable = (PMIB_IPNETTABLE) malloc(ulSize * sizeof(BYTE));
ZeroMemory(pIpNetTable, sizeof(*pIpNetTable));
iRet = GetIpNetTable(pIpNetTable, &Size, TRUE);
if (iRet != NO_ERROR)
/* get Arp address table */
if (pIpNetTable != NULL)
GetIpNetTable(pIpNetTable, &ulSize, TRUE);
else
{
_tprintf(_T("failed to allocate memory for GetIpNetTable\n"));
DoFormatMessage();
goto cleanup;
free(pIpNetTable);
return -1;
}
/* reserve memory on heap and zero */
pAddHost = (MIB_IPNETROW *) HeapAlloc(GetProcessHeap(), 0, sizeof(MIB_IPNETROW));
if (pAddHost == NULL)
goto cleanup;
pAddHost = (MIB_IPNETROW *) malloc(sizeof(MIB_IPNETROW));
ZeroMemory(pAddHost, sizeof(MIB_IPNETROW));
/* set dwIndex field to the index of a local IP address to
* indicate the network on which the ARP entry applies */
if (pszIfAddr)
{
if (sscanf(pszIfAddr, "%lx", &pAddHost->dwIndex) == EOF)
{
goto cleanup;
}
}
sscanf(pszIfAddr, "%lx", &pAddHost->dwIndex);
else
{
/* map the IP to the index */
pIpAddrTable = (MIB_IPADDRTABLE *) malloc(dwSize);
GetIpAddrTable(pIpAddrTable, &dwSize, 0);
pIpAddrTable = (MIB_IPADDRTABLE *) malloc(dwSize);
if ((iRet = GetIpAddrTable(pIpAddrTable, &dwSize, TRUE)) != NO_ERROR)
{
_tprintf(_T("GetIpAddrTable failed: %d\n"), iRet);
_tprintf(_T("error: %d\n"), WSAGetLastError());
}
//printf("debug print: pIpNetTable->table[0].dwIndex = %lx\n", pIpNetTable->table[0].dwIndex);
/* needs testing. I get the correct index on my machine, but need others
* to test their card index. Any problems and we can use GetAdaptersInfo instead */
pAddHost->dwIndex = pIpNetTable->table[0].dwIndex;
free(pIpAddrTable);
}
/* Set MAC address to 6 bytes (typical) */
@@ -369,7 +355,7 @@ INT Addhost(PTCHAR pszInetAddr, PTCHAR pszEthAddr, PTCHAR pszIfAddr)
c = toupper(pszEthAddr[i*3 + 1]);
c = c - (isdigit(c) ? '0' : ('A' - 10));
val += c;
pAddHost->bPhysAddr[i] = (BYTE)val;
pAddHost->bPhysAddr[i] = val;
}
@@ -384,20 +370,14 @@ INT Addhost(PTCHAR pszInetAddr, PTCHAR pszEthAddr, PTCHAR pszIfAddr)
/* Add the ARP entry */
if ((iRet = SetIpNetEntry(pAddHost)) != NO_ERROR)
{
DoFormatMessage();
goto cleanup;
DoFormatMessage(iRet);
free(pAddHost);
exit(EXIT_FAILURE);
}
HeapFree(GetProcessHeap(), 0, pAddHost);
free(pAddHost);
return EXIT_SUCCESS;
cleanup:
if (pIpNetTable != NULL)
HeapFree(GetProcessHeap(), 0, pIpNetTable);
if (pAddHost != NULL)
HeapFree(GetProcessHeap(), 0, pAddHost);
return EXIT_FAILURE;
}
@@ -411,10 +391,12 @@ cleanup:
*/
INT Deletehost(PTCHAR pszInetAddr, PTCHAR pszIfAddr)
{
PMIB_IPNETROW pDelHost = NULL;
PMIB_IPNETTABLE pIpNetTable = NULL;
DWORD Size = 0;
PMIB_IPNETROW pDelHost;
PMIB_IPADDRTABLE pIpAddrTable;
PMIB_IPNETTABLE pIpNetTable;
ULONG ulSize = 0;
DWORD dwIpAddr = 0;
DWORD dwSize = 0;
INT iRet;
BOOL bFlushTable = FALSE;
@@ -440,43 +422,40 @@ INT Deletehost(PTCHAR pszInetAddr, PTCHAR pszIfAddr)
/* We need the IpNetTable to get the adapter index */
/* Return required buffer size */
GetIpNetTable(NULL, &Size, 0);
GetIpNetTable(NULL, &ulSize, 0);
/* allocate memory for ARP address table */
pIpNetTable = (PMIB_IPNETTABLE) HeapAlloc(GetProcessHeap(), 0, Size);
if (pIpNetTable == NULL)
goto cleanup;
pIpNetTable = (PMIB_IPNETTABLE) malloc(ulSize * sizeof(BYTE));
ZeroMemory(pIpNetTable, sizeof(*pIpNetTable));
iRet = GetIpNetTable(pIpNetTable, &Size, TRUE);
if (iRet != NO_ERROR)
/* get Arp address table */
if (pIpNetTable != NULL)
GetIpNetTable(pIpNetTable, &ulSize, TRUE);
else
{
_tprintf(_T("failed to allocate memory for GetIpNetTable\n"));
DoFormatMessage();
goto cleanup;
free(pIpNetTable);
return -1;
}
/* reserve memory on heap and zero */
pDelHost = (MIB_IPNETROW *) HeapAlloc(GetProcessHeap(), 0, sizeof(MIB_IPNETROW));
if (pDelHost == NULL)
goto cleanup;
ZeroMemory(pDelHost, sizeof(MIB_IPNETROW));
pIpAddrTable = (MIB_IPADDRTABLE*) malloc(sizeof(MIB_IPADDRTABLE));
pDelHost = (MIB_IPNETROW *) malloc(sizeof(MIB_IPNETROW));
ZeroMemory(pIpAddrTable, sizeof(MIB_IPADDRTABLE));
ZeroMemory(pDelHost, sizeof(MIB_IPNETROW));
/* set dwIndex field to the index of a local IP address to
* indicate the network on which the ARP entry applies */
if (pszIfAddr)
{
if (sscanf(pszIfAddr, "%lx", &pDelHost->dwIndex) == EOF)
{
goto cleanup;
}
}
sscanf(pszIfAddr, "%lx", &pDelHost->dwIndex);
else
{
/* map the IP to the index */
if (GetIpAddrTable(pIpAddrTable, &dwSize, 0) == ERROR_INSUFFICIENT_BUFFER)
pIpAddrTable = (MIB_IPADDRTABLE *) malloc(dwSize);
if ((iRet = GetIpAddrTable(pIpAddrTable, &dwSize, TRUE)) != NO_ERROR)
{
_tprintf(_T("GetIpAddrTable failed: %d\n"), iRet);
_tprintf(_T("error: %d\n"), WSAGetLastError());
}
/* needs testing. I get the correct index on my machine, but need others
* to test their card index. Any problems and we can use GetAdaptersInfo instead */
pDelHost->dwIndex = pIpNetTable->table[0].dwIndex;
@@ -487,12 +466,15 @@ INT Deletehost(PTCHAR pszInetAddr, PTCHAR pszIfAddr)
/* delete arp cache */
if ((iRet = FlushIpNetTable(pDelHost->dwIndex)) != NO_ERROR)
{
DoFormatMessage();
goto cleanup;
DoFormatMessage(iRet);
free(pIpAddrTable);
free(pDelHost);
return EXIT_FAILURE;
}
else
{
HeapFree(GetProcessHeap(), 0, pDelHost);
free(pIpAddrTable);
free(pDelHost);
return EXIT_SUCCESS;
}
}
@@ -503,20 +485,17 @@ INT Deletehost(PTCHAR pszInetAddr, PTCHAR pszIfAddr)
/* Add the ARP entry */
if ((iRet = DeleteIpNetEntry(pDelHost)) != NO_ERROR)
{
DoFormatMessage();
goto cleanup;
DoFormatMessage(iRet);
free(pIpAddrTable);
free(pDelHost);
exit(EXIT_FAILURE);
}
HeapFree(GetProcessHeap(), 0, pDelHost);
free(pIpAddrTable);
free(pDelHost);
return EXIT_SUCCESS;
cleanup:
if (pIpNetTable != NULL)
HeapFree(GetProcessHeap(), 0, pIpNetTable);
if (pDelHost != NULL)
HeapFree(GetProcessHeap(), 0, pDelHost);
return EXIT_FAILURE;
}
@@ -618,4 +597,6 @@ INT main(int argc, char* argv[])
Usage();
return EXIT_SUCCESS;
}
} /*
warning: suggest parentheses around assignment used as truth value
warning: char format, void arg (arg 2)*/

View File

@@ -317,8 +317,8 @@ int gettimeofday(struct timeval *tv, struct timezone *tz)
if (tv)
{
GetSystemTimeAsFileTime(&ft);
li.LowPart = ft.dwLowDateTime;
li.HighPart = ft.dwHighDateTime;
//li.LowPart = ft.dwLowDateTime;
//li.HighPart = ft.dwHighDateTime;
t = li.QuadPart; /* In 100-nanosecond intervals */
t -= EPOCHFILETIME; /* Offset to the Epoch time */
t /= 10; /* In microseconds */

View File

@@ -1294,7 +1294,7 @@ void ptransfer(direction, bytes, t0, t1)
s = td.tv_sec + (td.tv_usec / 1000000.);
#define nz(x) ((x) == 0 ? 1 : (x))
bs = bytes / nz(s);
printf("%ld bytes %s in %.1f seconds (%.0f Kbytes/s)\n",
printf("%ld bytes %s in %.2g seconds (%.2g Kbytes/s)\n",
bytes, direction, s, bs / 1024.);
(void) fflush(stdout);
}

View File

@@ -1,10 +1,34 @@
/*
* ReactOS Win32 Applications
* Copyright (C) 2005 ReactOS Team
*
* This program 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 2 of the License, or
* (at your option) any later version.
*
* This program 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 this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS netstat utility
* LICENSE: GPL - See COPYING in the top level directory
* FILE: apps/utils/net/netstat/netstat.c
* PURPOSE: display IP stack statistics
* COPYRIGHT: Copyright 2005 Ged Murphy <gedmurphy@gmail.com>
* PROGRAMMERS: Ged Murphy (gedmurphy@gmail.com)
* REVISIONS:
* Ged Murphy 19/09/05 Created
* Some ideas/code taken from Rob Dickinson's original app
*
*/
/*
* TODO:
* sort function return values.
@@ -84,7 +108,7 @@ BOOL ParseCmdline(int argc, char* argv[])
TCHAR Proto[5];
if ((argc == 1) || (_istdigit(*argv[1])))
if ((argc == 1) || (isdigit(*argv[1])))
bNoOptions = TRUE;
/* Parse command line for options we have been given. */
@@ -99,21 +123,23 @@ BOOL ParseCmdline(int argc, char* argv[])
switch (tolower(c))
{
case 'a' :
//_tprintf(_T("got a\n"));
bDoShowAllCons = TRUE;
break;
case 'b' :
bDoShowProcName = TRUE;
break;
case 'e' :
//_tprintf(_T("got e\n"));
bDoShowEthStats = TRUE;
break;
case 'n' :
//_tprintf(_T("got n\n"));
bDoShowNumbers = TRUE;
break;
case 's' :
//_tprintf(_T("got s\n"));
bDoShowProtoStats = TRUE;
break;
case 'p' :
//_tprintf(_T("got p\n"));
bDoShowProtoCons = TRUE;
strncpy(Proto, (++argv)[i], sizeof(Proto));
@@ -145,12 +171,10 @@ BOOL ParseCmdline(int argc, char* argv[])
}
}
}
else if (_istdigit(*argv[i]))
else if (isdigit(*argv[i]))
{
if (_stscanf(argv[i], "%lu", &Interval) != EOF)
bLoopOutput = TRUE;
else
return EXIT_FAILURE;
_stscanf(argv[i], "%lu", &Interval);
bLoopOutput = TRUE;
}
// else
// {
@@ -177,9 +201,9 @@ BOOL DisplayOutput()
if (bDoShowRouteTable)
{
/* mingw doesn't have lib for _tsystem */
if (system("route print") == -1)
{
//mingw doesn't have lib for _tsystem
_tprintf(_T("cannot find 'route.exe'\n"));
return EXIT_FAILURE;
}
@@ -254,7 +278,7 @@ VOID ShowIpStatistics()
PMIB_IPSTATS pIpStats;
DWORD dwRetVal;
pIpStats = (MIB_IPSTATS*) HeapAlloc(GetProcessHeap(), 0, sizeof(MIB_IPSTATS));
pIpStats = (MIB_IPSTATS*) malloc(sizeof(MIB_IPSTATS));
if ((dwRetVal = GetIpStatistics(pIpStats)) == NO_ERROR)
{
@@ -279,8 +303,6 @@ VOID ShowIpStatistics()
}
else
DoFormatMessage(dwRetVal);
HeapFree(GetProcessHeap(), 0, pIpStats);
}
VOID ShowIcmpStatistics()
@@ -288,7 +310,7 @@ VOID ShowIcmpStatistics()
PMIB_ICMP pIcmpStats;
DWORD dwRetVal;
pIcmpStats = (MIB_ICMP*) HeapAlloc(GetProcessHeap(), 0, sizeof(MIB_ICMP));
pIcmpStats = (MIB_ICMP*) malloc(sizeof(MIB_ICMP));
if ((dwRetVal = GetIcmpStatistics(pIcmpStats)) == NO_ERROR)
{
@@ -324,8 +346,6 @@ VOID ShowIcmpStatistics()
else
DoFormatMessage(dwRetVal);
HeapFree(GetProcessHeap(), 0, pIcmpStats);
}
VOID ShowTcpStatistics()
@@ -333,7 +353,7 @@ VOID ShowTcpStatistics()
PMIB_TCPSTATS pTcpStats;
DWORD dwRetVal;
pTcpStats = (MIB_TCPSTATS*) HeapAlloc(GetProcessHeap(), 0, sizeof(MIB_TCPSTATS));
pTcpStats = (MIB_TCPSTATS*) malloc(sizeof(MIB_TCPSTATS));
if ((dwRetVal = GetTcpStatistics(pTcpStats)) == NO_ERROR)
{
@@ -349,8 +369,6 @@ VOID ShowTcpStatistics()
}
else
DoFormatMessage(dwRetVal);
HeapFree(GetProcessHeap(), 0, pTcpStats);
}
VOID ShowUdpStatistics()
@@ -358,7 +376,7 @@ VOID ShowUdpStatistics()
PMIB_UDPSTATS pUdpStats;
DWORD dwRetVal;
pUdpStats = (MIB_UDPSTATS*) HeapAlloc(GetProcessHeap(), 0, sizeof(MIB_UDPSTATS));
pUdpStats = (MIB_UDPSTATS*) malloc(sizeof(MIB_UDPSTATS));
if ((dwRetVal = GetUdpStatistics(pUdpStats)) == NO_ERROR)
{
@@ -370,8 +388,6 @@ VOID ShowUdpStatistics()
}
else
DoFormatMessage(dwRetVal);
HeapFree(GetProcessHeap(), 0, pUdpStats);
}
VOID ShowEthernetStatistics()
@@ -380,12 +396,12 @@ VOID ShowEthernetStatistics()
DWORD dwSize = 0;
DWORD dwRetVal = 0;
pIfTable = (MIB_IFTABLE*) HeapAlloc(GetProcessHeap(), 0, sizeof(MIB_IFTABLE));
pIfTable = (MIB_IFTABLE*) malloc(sizeof(MIB_IFTABLE));
if (GetIfTable(pIfTable, &dwSize, 0) == ERROR_INSUFFICIENT_BUFFER)
{
HeapFree(GetProcessHeap(), 0, pIfTable);
pIfTable = (MIB_IFTABLE*) HeapAlloc(GetProcessHeap(), 0, dwSize);
GlobalFree(pIfTable);
pIfTable = (MIB_IFTABLE*) malloc(dwSize);
if ((dwRetVal = GetIfTable(pIfTable, &dwSize, 0)) == NO_ERROR)
{
@@ -407,7 +423,6 @@ VOID ShowEthernetStatistics()
else
DoFormatMessage(dwRetVal);
}
HeapFree(GetProcessHeap(), 0, pIfTable);
}
VOID ShowTcpTable()
@@ -429,13 +444,12 @@ VOID ShowTcpTable()
DoFormatMessage(error);
exit(EXIT_FAILURE);
}
tcpTable = (PMIB_TCPTABLE) HeapAlloc(GetProcessHeap(), 0, dwSize);
tcpTable = (PMIB_TCPTABLE)malloc(dwSize);
error = GetTcpTable(tcpTable, &dwSize, TRUE );
if (error)
{
printf("Failed to snapshot TCP endpoints table.\n");
DoFormatMessage(error);
HeapFree(GetProcessHeap(), 0, tcpTable);
exit(EXIT_FAILURE);
}
@@ -461,7 +475,6 @@ VOID ShowTcpTable()
Host, Remote, TcpState[tcpTable->table[i].dwState]);
}
}
HeapFree(GetProcessHeap(), 0, tcpTable);
}
@@ -482,13 +495,12 @@ VOID ShowUdpTable()
DoFormatMessage(error);
exit(EXIT_FAILURE);
}
udpTable = (PMIB_UDPTABLE) HeapAlloc(GetProcessHeap(), 0, dwSize);
udpTable = (PMIB_UDPTABLE)malloc(dwSize);
error = GetUdpTable(udpTable, &dwSize, TRUE);
if (error)
{
printf("Failed to snapshot UDP endpoints table.\n");
DoFormatMessage(error);
HeapFree(GetProcessHeap(), 0, udpTable);
exit(EXIT_FAILURE);
}
@@ -502,10 +514,8 @@ VOID ShowUdpTable()
sprintf(Host, "%s:%s", HostIp, HostPort);
_tprintf(_T(" %-6s %-22s %-22s\n"), _T("UDP"), Host, _T("*:*"));
_tprintf(_T(" %-6s %-22s %-22s\n"), _T("UDP"), Host, _T(":*:"));
}
HeapFree(GetProcessHeap(), 0, udpTable);
}
@@ -531,16 +541,18 @@ GetPortName(UINT Port, PCSTR Proto, CHAR Name[], INT NameLen)
}
/*
* convert addresses into dotted decimal or hostname
*/
//
// GetIpHostName
//
// Translate IP addresses into their name-resolved form if possible.
//
PCHAR
GetIpHostName(BOOL Local, UINT IpAddr, CHAR Name[], int NameLen)
{
// struct hostent *phostent;
UINT nIpAddr;
/* display dotted decimal */
// Does the user want raw numbers?
nIpAddr = htonl(IpAddr);
if (bDoShowNumbers) {
sprintf(Name, "%d.%d.%d.%d",
@@ -551,9 +563,9 @@ GetIpHostName(BOOL Local, UINT IpAddr, CHAR Name[], int NameLen)
return Name;
}
Name[0] = _T('\0');
Name[0] = L'\0';
/* try to resolve the name */
// Try to translate to a name
if (!IpAddr) {
if (!Local) {
sprintf(Name, "%d.%d.%d.%d",
@@ -562,15 +574,13 @@ GetIpHostName(BOOL Local, UINT IpAddr, CHAR Name[], int NameLen)
(nIpAddr >> 8) & 0xFF,
(nIpAddr) & 0xFF);
} else {
if (gethostname(Name, NameLen) != 0)
DoFormatMessage(WSAGetLastError());
//gethostname(name, namelen);
}
} else if (IpAddr == 0x0100007f) {
if (Local) {
if (gethostname(Name, NameLen) != 0)
DoFormatMessage(WSAGetLastError());
//gethostname(name, namelen);
} else {
_tcsncpy(Name, _T("localhost"), 10);
strcpy(Name, "localhost");
}
// } else if (phostent = gethostbyaddr((char*)&ipaddr, sizeof(nipaddr), PF_INET)) {
// strcpy(name, phostent->h_name);
@@ -586,7 +596,7 @@ GetIpHostName(BOOL Local, UINT IpAddr, CHAR Name[], int NameLen)
VOID Usage()
{
_tprintf(_T("\nDisplays current TCP/IP protocol statistics and network connections.\n\n"
_tprintf(_T("Displays current TCP/IP protocol statistics and network connections.\n\n"
"NETSTAT [-a] [-e] [-n] [-s] [-p proto] [-r] [interval]\n\n"
" -a Displays all connections and listening ports.\n"
" -e Displays Ethernet statistics. May be combined with -s\n"
@@ -606,6 +616,7 @@ VOID Usage()
/*
*
* Parse command line parameters and set any options
@@ -614,14 +625,6 @@ VOID Usage()
*/
int main(int argc, char *argv[])
{
WSADATA wsaData;
if (WSAStartup(MAKEWORD(2, 2), &wsaData) != 0)
{
_tprintf(_T("WSAStartup() failed : %d\n"), WSAGetLastError());
return -1;
}
if (ParseCmdline(argc, argv))
return -1;

View File

@@ -7,7 +7,6 @@
/* command line options */
BOOL bNoOptions = FALSE; // print default
BOOL bDoShowAllCons = FALSE; // -a
BOOL bDoShowProcName = FALSE; // -b
BOOL bDoShowEthStats = FALSE; // -e
BOOL bDoShowNumbers = FALSE; // -n
BOOL bDoShowProtoCons = FALSE; // -p

View File

@@ -1,4 +1,5 @@
/*
/* $Id$
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS ping utility
* FILE: apps/net/ping/ping.c
@@ -7,15 +8,18 @@
* REVISIONS:
* CSH 01/09/2000 Created
*/
//#include <windows.h>
#include <winsock2.h>
#include <tchar.h>
#include <stdarg.h>
#include <string.h>
#include <stdio.h>
#ifndef _MSC_VER
#ifdef DBG
#undef DBG
#endif
/* FIXME: Where should this be? */
#ifdef CopyMemory
#undef CopyMemory
@@ -31,12 +35,9 @@ typedef long long __int64;
char * _i64toa(__int64 value, char *string, int radix);
#endif /* _MSC_VER */
#ifdef DBG
#undef DBG
#endif
/* General ICMP constants */
#define ICMP_MINSIZE 8 /* Minimum ICMP packet size */
#define ICMP_MAXSIZE 65535 /* Maximum ICMP packet size */
@@ -181,7 +182,7 @@ static ULONG GetULONG(LPSTR String)
ULONG Value;
i = 0;
Length = (UINT)_tcslen(String);
Length = strlen(String);
while ((i < Length) && ((String[i] < '0') || (String[i] > '9'))) i++;
if ((i >= Length) || ((String[i] < '0') || (String[i] > '9'))) {
InvalidOption = TRUE;
@@ -408,7 +409,7 @@ static BOOL DecodeResponse(PCHAR buffer, UINT size, PSOCKADDR_IN from)
CHAR Time[100];
LARGE_INTEGER RelativeTime;
LARGE_INTEGER LargeTime;
CHAR Sign[2];
CHAR Sign[1];
IpHeader = (PIPv4_HEADER)buffer;
@@ -452,13 +453,12 @@ static BOOL DecodeResponse(PCHAR buffer, UINT size, PSOCKADDR_IN from)
printf("Reply from %s: bytes=%d time%s%s TTL=%d\n", inet_ntoa(from->sin_addr),
size - IphLength - sizeof(ICMP_ECHO_PACKET), Sign, Time, IpHeader->TTL);
if (RelativeTime.QuadPart < MinRTT.QuadPart || !MinRTTSet) {
MinRTT.QuadPart = RelativeTime.QuadPart;
MinRTTSet = TRUE;
if (RelativeTime.QuadPart < MinRTT.QuadPart) {
MinRTT.QuadPart = RelativeTime.QuadPart;
MinRTTSet = TRUE;
}
if (RelativeTime.QuadPart > MaxRTT.QuadPart)
MaxRTT.QuadPart = RelativeTime.QuadPart;
if (RelativeTime.QuadPart > MaxRTT.QuadPart)
MaxRTT.QuadPart = RelativeTime.QuadPart;
SumRTT.QuadPart += RelativeTime.QuadPart;
return TRUE;

View File

@@ -1,4 +1,4 @@
<module name="telnet" type="win32cui" installbase="system32" installname="telnet.exe" allowwarnings ="true">
<module name="telnet" type="win32cui" installbase="system32" installname="telnet.exe">
<include base="telnet">.</include>
<define name="__USE_W32API" />
<define name="__REACTOS__" />

View File

@@ -69,6 +69,20 @@ INT iMaxHops = 30; // -h Max number of hops before trace ends
INT iHostList; // -j @UNIMPLEMENTED@
INT iTimeOut = 2000; // -w time before packet times out
/* function definitions */
static BOOL ParseCmdline(int argc, char* argv[]);
static INT Driver(void);
static INT Setup(INT ttl);
static VOID SetupTimingMethod(void);
static VOID ResolveHostname(void);
static VOID PreparePacket(INT packetSize, INT seqNum);
static INT SendPacket(INT datasize);
static INT ReceivePacket(INT datasize);
static INT DecodeResponse(INT packetSize, INT seqNum);
static LONG GetTime(void);
static WORD CheckSum(PUSHORT data, UINT size);
static VOID Usage(void);
/*
*
@@ -123,7 +137,7 @@ static INT Driver(VOID)
{
INT iHopCount = 1; // hop counter. default max is 30
USHORT iSeqNum = 0; // initialise packet sequence number
INT iSeqNum = 0; // initialise packet sequence number
INT iTTL = 1; // set initial packet TTL to 1
BOOL bFoundTarget = FALSE; // Have we reached our destination yet
BOOL bAwaitPacket; // indicates whether we have recieved a good packet
@@ -419,7 +433,7 @@ static INT Setup(INT iTTL)
* Calculate the packet checksum
*
*/
static VOID PreparePacket(INT iPacketSize, USHORT iSeqNum)
static VOID PreparePacket(INT iPacketSize, INT iSeqNum)
{
/* assemble ICMP echo request packet */
sendpacket.icmpheader.type = ECHO_REQUEST;
@@ -466,8 +480,8 @@ static INT SendPacket(INT datasize)
if (WSAGetLastError() == WSAEACCES)
{
_tprintf(_T("\n\nYou must be an administrator to run this program!\n\n"));
WSACleanup();
exit(1);
WSACleanup();
}
else
{
@@ -570,7 +584,7 @@ static INT ReceivePacket(INT datasize)
* It all is well, print the time taken for the round trip.
*
*/
static INT DecodeResponse(INT iPacketSize, USHORT iSeqNum)
static INT DecodeResponse(INT iPacketSize, INT iSeqNum)
{
unsigned short header_len = recvpacket.h_len * 4;
/* cast the recieved packet into an ECHO reply and a TTL Exceed so we can check the ID*/
@@ -631,7 +645,7 @@ static INT DecodeResponse(INT iPacketSize, USHORT iSeqNum)
*
*/
static LONGLONG GetTime(VOID)
static LONG GetTime(VOID)
{
LARGE_INTEGER Time;

View File

@@ -68,16 +68,3 @@ typedef struct TTLExceedHeader
/* return to normal */
#include <poppack.h>
/* function definitions */
static BOOL ParseCmdline(int argc, char* argv[]);
static INT Driver(void);
static INT Setup(INT ttl);
static VOID SetupTimingMethod(void);
static VOID ResolveHostname(void);
static VOID PreparePacket(INT packetSize, USHORT seqNum);
static INT SendPacket(INT datasize);
static INT ReceivePacket(INT datasize);
static INT DecodeResponse(INT packetSize, USHORT seqNum);
static LONGLONG GetTime(void);
static WORD CheckSum(PUSHORT data, UINT size);
static VOID Usage(void);

View File

@@ -22,7 +22,6 @@
<property name="BASEADDRESS_HID" value="0x688F0000" />
<property name="BASEADDRESS_PSXDLL" value="0x68eb0000" />
<property name="BASEADDRESS_PSAPI" value="0x68f70000" />
<property name="BASEADDRESS_OLEACC" value="0x69640000" />
<property name="BASEADDRESS_MSIMG32" value="0x69cc0000" />
<property name="BASEADDRESS_NETPLWIZ" value="0x6a240000" />
<property name="BASEADDRESS_UNICODE" value="0x6b200000" />

View File

@@ -1,198 +0,0 @@
/////////////////////////////////////////////////////////////////////////////
// Turkish resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_TURKISH, SUBLANG_DEFAULT
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_FDEBUG ICON DISCARDABLE "fdebug.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Menu
//
IDC_FDEBUG MENU DISCARDABLE
BEGIN
POPUP "&Dosya"
BEGIN
MENUITEM "&Ba<42>lan", ID_FILE_CONNECT
MENUITEM "Ba<42>lant<6E>y<EFBFBD> &Kes", ID_FILE_DISCONNECT, GRAYED
MENUITEM SEPARATOR
MENUITEM "&Yakalamay<61> Ba<42>lat", ID_FILE_STARTCAPTURE
MENUITEM "Yakalamay<61> &Durdur", ID_FILE_STOPCAPTURE, GRAYED
MENUITEM SEPARATOR
MENUITEM "B<>lgesel &Yank<6E>", ID_FILE_LOCALECHO
MENUITEM SEPARATOR
MENUITEM "&<26><>k<EFBFBD><6B>", IDM_EXIT
END
POPUP "&Yard<72>m"
BEGIN
MENUITEM "&Hakk<6B>nda ...", IDM_ABOUT
END
END
/////////////////////////////////////////////////////////////////////////////
//
// Accelerator
//
IDC_FDEBUG ACCELERATORS MOVEABLE PURE
BEGIN
"?", IDM_ABOUT, ASCII, ALT
"/", IDM_ABOUT, ASCII, ALT
END
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#define APSTUDIO_HIDDEN_SYMBOLS\r\n"
"#include ""windows.h""\r\n"
"#undef APSTUDIO_HIDDEN_SYMBOLS\r\n"
"#include ""resource.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"\r\n"
"\0"
END
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
IDD_ABOUTBOX, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 252
TOPMARGIN, 7
BOTTOMMARGIN, 203
END
IDD_CONNECTION, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 189
TOPMARGIN, 7
BOTTOMMARGIN, 93
END
IDD_CAPTURE, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 244
TOPMARGIN, 7
BOTTOMMARGIN, 88
END
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_ABOUTBOX DIALOG DISCARDABLE 22, 17, 259, 210
STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
CAPTION "FreeLoader Debugger Hakk<6B>nda"
FONT 8, "Tahoma"
BEGIN
CONTROL "FreeLoader Debugger v1.0\nCopyright (C) 2003\nby Brian Palmer (brianp@reactos.org)",
IDC_STATIC,"Static",SS_LEFTNOWORDWRAP | WS_GROUP,53,28,
122,26
DEFPUSHBUTTON "Tamam",IDOK,183,189,44,14,WS_GROUP
ICON IDI_FDEBUG,IDC_STATIC,19,30,20,20
EDITTEXT IDC_LICENSE_EDIT,53,63,174,107,ES_MULTILINE |
ES_READONLY | WS_VSCROLL
END
IDD_CONNECTION DIALOG DISCARDABLE 0, 0, 196, 100
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Ba<42>lant<6E> Se<53>enekleri"
FONT 8, "Tahoma"
BEGIN
LTEXT "COM Port de<64>erini giriniz(<28>rnek COM1):",IDC_STATIC,7,7,108,8
EDITTEXT IDC_COMPORT,7,17,182,14,ES_AUTOHSCROLL
LTEXT "Baudrate de<64>erini giriniz (e.g. 115200):",IDC_STATIC,7,38,114,
8
EDITTEXT IDC_BAUTRATE,7,48,182,14,ES_AUTOHSCROLL
DEFPUSHBUTTON "Tamam",IDOK,45,79,50,14
PUSHBUTTON "<22>ptal",IDCANCEL,100,79,50,14
END
IDD_CAPTURE DIALOG DISCARDABLE 0, 0, 251, 95
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Dosya Yakalama"
FONT 8, "Tahoma"
BEGIN
LTEXT "Yakalanacak Dosya Ad<41>:",IDC_STATIC,7,17,62,8
EDITTEXT IDC_CAPTUREFILENAME,7,26,181,14,ES_AUTOHSCROLL
PUSHBUTTON "&G<>zat",IDC_BROWSE,194,26,50,14
DEFPUSHBUTTON "Tamam",IDOK,139,74,50,14
PUSHBUTTON "<22>ptal",IDCANCEL,194,74,50,14
END
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE DISCARDABLE
BEGIN
IDS_APP_TITLE "fdebug"
IDS_HELLO "Merhaba D<>nya!"
IDC_FDEBUG "FDEBUG"
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_LICENSE "Bu program <20>zg<7A>r bir yaz<61>l<EFBFBD>md<6D>r; <20>zg<7A>r Yaz<61>l<EFBFBD>m Vakf<6B>'n<>n (Free Software Foundation) yay<61>nlad<61><64><EFBFBD> GNU Genel Kamu Lisans<6E>'n<>n 2. versiyonu yada (dilerseniz) herhangi bir sonraki versiyonunun kurallar<61>na uyarak da<64><61>tabilir ve de<64>i<EFBFBD>tirebilirsiniz.\r\n\r\nBu program faydal<61> olaca<63><61> umularak da<64><61>t<EFBFBD>lmaktad<61>r, fakat H<><48>B<EFBFBD>R GARANT<4E> VER<45>LMEZ; ve T<>CAR<41> YADA D<><44>ER AMA<4D>LARA UYGUNLU<4C>U hakk<6B>nda a<><61>ktan yada imal<61> bir bildirim yap<61>lmaz. Ayr<79>nt<6E>lar i<>in l<>tfen GNU Genel Kamu Lisans<6E>'n<> (General Public License) inceleyiniz.\r\n\r\nBu programla birlikte GNU Genel Kamu Lisans<6E>'n<>n da bir kopyas<61>n<EFBFBD>n size verilmi<6D> olmas<61> gerekir; aksi s<>z konusu ise, <20>zg<7A>r Yaz<61>l<EFBFBD>m Vakf<6B>'na yaz<61>n<EFBFBD>z: Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA."
END
#endif // Turkish resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@@ -19,4 +19,3 @@
#include "Hu.rc"
#include "Ja.rc"
#include "Pl.rc"
#include "Tr.rc"

View File

@@ -237,7 +237,6 @@ DetectPciBios(FRLDRHKEY SystemKey, ULONG *BusNumber)
#if 0
FRLDRHKEY BusKey;
ULONG i;
WCHAR szPci[] = L"PCI";
#endif
/* Report the PCI BIOS */
@@ -346,8 +345,8 @@ DetectPciBios(FRLDRHKEY SystemKey, ULONG *BusNumber)
Error = RegSetValue(BusKey,
L"Identifier",
REG_SZ,
(PCSTR)szPci,
sizeof(szPci));
(PUCHAR)"PCI",
4 * sizeof(WCHAR));
if (Error != ERROR_SUCCESS)
{
DbgPrint((DPRINT_HWDETECT, "RegSetValue() failed (Error %u)\n", (int)Error));

View File

@@ -22,9 +22,6 @@
VOID
XboxMachInit(const char *CmdLine)
{
/* Set LEDs to red before anything is initialized */
XboxSetLED("rrrr");
/* Initialize our stuff */
XboxMemInit();
XboxVideoInit();
@@ -58,7 +55,4 @@ XboxMachInit(const char *CmdLine)
MachVtbl.DiskGetCacheableBlockCount = XboxDiskGetCacheableBlockCount;
MachVtbl.RTCGetCurrentDateTime = XboxRTCGetCurrentDateTime;
MachVtbl.HwDetect = XboxHwDetect;
/* Set LEDs to orange after init */
XboxSetLED("oooo");
}

View File

@@ -1,224 +0,0 @@
/* $Id: xboxhw.c 19190 2005-11-13 04:50:55Z fireball $
*
* FreeLoader
*
* This program 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 2 of the License, or
* (at your option) any later version.
*
* This program 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 this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <freeldr.h>
// These functions are used only inside xbox-specific code
// thus I didn't include them in header
#define I2C_IO_BASE 0xc000
static BOOL
WriteToSMBus(UCHAR Address, UCHAR bRegister, UCHAR Size, ULONG Data_to_smbus)
{
int nRetriesToLive=50;
while(READ_PORT_USHORT((PUSHORT) (I2C_IO_BASE+0)) & 0x0800)
{
; // Franz's spin while bus busy with any master traffic
}
while(nRetriesToLive--)
{
UCHAR b;
unsigned int temp;
WRITE_PORT_UCHAR((PUCHAR)(I2C_IO_BASE + 4), (Address << 1) | 0);
WRITE_PORT_UCHAR((PUCHAR)(I2C_IO_BASE + 8), bRegister);
switch (Size)
{
case 4:
WRITE_PORT_UCHAR((PUCHAR) (I2C_IO_BASE + 9), Data_to_smbus & 0xff);
WRITE_PORT_UCHAR((PUCHAR) (I2C_IO_BASE + 9), (Data_to_smbus >> 8) & 0xff );
WRITE_PORT_UCHAR((PUCHAR) (I2C_IO_BASE + 9), (Data_to_smbus >> 16) & 0xff );
WRITE_PORT_UCHAR((PUCHAR) (I2C_IO_BASE + 9), (Data_to_smbus >> 24) & 0xff );
WRITE_PORT_USHORT((PUSHORT) (I2C_IO_BASE + 6), 4);
break;
case 2:
WRITE_PORT_USHORT((PUSHORT) (I2C_IO_BASE + 6), Data_to_smbus&0xffff);
break;
default: // 1
WRITE_PORT_USHORT((PUSHORT) (I2C_IO_BASE + 6), Data_to_smbus&0xff);
break;
}
temp = READ_PORT_USHORT((PUSHORT) (I2C_IO_BASE + 0));
WRITE_PORT_USHORT((PUSHORT) (I2C_IO_BASE + 0), temp); // clear down all preexisting errors
switch (Size)
{
case 4:
WRITE_PORT_UCHAR((PUCHAR) (I2C_IO_BASE + 2), 0x1d); // DWORD modus
break;
case 2:
WRITE_PORT_UCHAR((PUCHAR) (I2C_IO_BASE + 2), 0x1b); // WORD modus
break;
default: // 1
WRITE_PORT_UCHAR((PUCHAR) (I2C_IO_BASE + 2), 0x1a); // BYTE modus
break;
}
b = 0;
while( (b&0x36)==0 )
{
b=READ_PORT_UCHAR((PUCHAR) (I2C_IO_BASE + 0));
}
if ((b&0x10) != 0)
{
return TRUE;
}
StallExecutionProcessor(1);
}
return FALSE;
}
static BOOL
ReadfromSMBus(UCHAR Address, UCHAR bRegister, UCHAR Size, ULONG *Data_to_smbus)
{
int nRetriesToLive=50;
while (0 != (READ_PORT_USHORT((PUSHORT) (I2C_IO_BASE + 0)) & 0x0800))
{
; /* Franz's spin while bus busy with any master traffic */
}
while (0 != nRetriesToLive--)
{
UCHAR b;
int temp;
WRITE_PORT_UCHAR((PUCHAR) (I2C_IO_BASE + 4), (Address << 1) | 1);
WRITE_PORT_UCHAR((PUCHAR) (I2C_IO_BASE + 8), bRegister);
temp = READ_PORT_USHORT((USHORT *) (I2C_IO_BASE + 0));
WRITE_PORT_USHORT((PUSHORT) (I2C_IO_BASE + 0), temp); /* clear down all preexisting errors */
switch (Size)
{
case 4:
WRITE_PORT_UCHAR((PUCHAR) (I2C_IO_BASE + 2), 0x0d); /* DWORD modus ? */
break;
case 2:
WRITE_PORT_UCHAR((PUCHAR) (I2C_IO_BASE + 2), 0x0b); /* WORD modus */
break;
default:
WRITE_PORT_UCHAR((PUCHAR) (I2C_IO_BASE + 2), 0x0a); // BYTE
break;
}
b = 0;
while (0 == (b & 0x36))
{
b = READ_PORT_UCHAR((PUCHAR) (I2C_IO_BASE + 0));
}
if (0 != (b & 0x24))
{
/* printf("I2CTransmitByteGetReturn error %x\n", b); */
}
if(0 == (b & 0x10))
{
/* printf("I2CTransmitByteGetReturn no complete, retry\n"); */
}
else
{
switch (Size)
{
case 4:
READ_PORT_UCHAR((PUCHAR) (I2C_IO_BASE + 6));
READ_PORT_UCHAR((PUCHAR) (I2C_IO_BASE + 9));
READ_PORT_UCHAR((PUCHAR) (I2C_IO_BASE + 9));
READ_PORT_UCHAR((PUCHAR) (I2C_IO_BASE + 9));
READ_PORT_UCHAR((PUCHAR) (I2C_IO_BASE + 9));
break;
case 2:
*Data_to_smbus = READ_PORT_USHORT((USHORT *) (I2C_IO_BASE + 6));
break;
default:
*Data_to_smbus = READ_PORT_UCHAR((PUCHAR) (I2C_IO_BASE + 6));
break;
}
return TRUE;
}
}
return FALSE;
}
BOOL
I2CTransmitByteGetReturn(UCHAR bPicAddressI2cFormat, UCHAR bDataToWrite, ULONG *Return)
{
return ReadfromSMBus(bPicAddressI2cFormat, bDataToWrite, 1, Return);
}
// transmit a word, no returned data from I2C device
static BOOL
I2CTransmitWord(UCHAR bPicAddressI2cFormat, USHORT wDataToWrite)
{
return WriteToSMBus(bPicAddressI2cFormat,(wDataToWrite>>8)&0xff,1,(wDataToWrite&0xff));
}
static void
I2cSetFrontpanelLed(UCHAR b)
{
I2CTransmitWord( 0x10, 0x800 | b); // sequencing thanks to Jarin the Penguin!
I2CTransmitWord( 0x10, 0x701);
}
// Set the pattern of the LED.
// r = Red, g = Green, o = Orange, x = Off
// This func is taken from cromwell, all credits goes for them
void
XboxSetLED(PCSTR pattern) {
const char *x = pattern;
int r, g;
if(strlen(pattern) == 4) {
r = g = 0;
while (*x) {
r *= 2;
g *= 2;
switch (*x) {
case 'r':
r++;
break;
case 'g':
g++;
break;
case 'o':
r++;
g++;
break;
}
x++;
}
I2cSetFrontpanelLed(((r<<4) & 0xF0) + (g & 0xF));
}
}

View File

@@ -22,6 +22,8 @@
#include <freeldr.h>
#define I2C_IO_BASE 0xc000
static PVOID FrameBuffer;
static ULONG ScreenWidth;
static ULONG ScreenHeight;
@@ -37,8 +39,6 @@ static ULONG Delta;
#define MAKE_COLOR(Red, Green, Blue) (0xff000000 | (((Red) & 0xff) << 16) | (((Green) & 0xff) << 8) | ((Blue) & 0xff))
BOOL I2CTransmitByteGetReturn(UCHAR bPicAddressI2cFormat, UCHAR bDataToWrite, ULONG *Return);
static VOID
XboxVideoOutputChar(UCHAR Char, unsigned X, unsigned Y, ULONG FgColor, ULONG BgColor)
{
@@ -119,6 +119,91 @@ XboxVideoPutChar(int Ch, UCHAR Attr, unsigned X, unsigned Y)
XboxVideoOutputChar(Ch, X, Y, FgColor, BgColor);
}
static BOOL
ReadfromSMBus(UCHAR Address, UCHAR bRegister, UCHAR Size, ULONG *Data_to_smbus)
{
int nRetriesToLive=50;
while (0 != (READ_PORT_USHORT((PUSHORT) (I2C_IO_BASE + 0)) & 0x0800))
{
; /* Franz's spin while bus busy with any master traffic */
}
while (0 != nRetriesToLive--)
{
UCHAR b;
int temp;
WRITE_PORT_UCHAR((PUCHAR) (I2C_IO_BASE + 4), (Address << 1) | 1);
WRITE_PORT_UCHAR((PUCHAR) (I2C_IO_BASE + 8), bRegister);
temp = READ_PORT_USHORT((USHORT *) (I2C_IO_BASE + 0));
WRITE_PORT_USHORT((PUSHORT) (I2C_IO_BASE + 0), temp); /* clear down all preexisting errors */
switch (Size)
{
case 4:
WRITE_PORT_UCHAR((PUCHAR) (I2C_IO_BASE + 2), 0x0d); /* DWORD modus ? */
break;
case 2:
WRITE_PORT_UCHAR((PUCHAR) (I2C_IO_BASE + 2), 0x0b); /* WORD modus */
break;
default:
WRITE_PORT_UCHAR((PUCHAR) (I2C_IO_BASE + 2), 0x0a); // BYTE
break;
}
b = 0;
while (0 == (b & 0x36))
{
b = READ_PORT_UCHAR((PUCHAR) (I2C_IO_BASE + 0));
}
if (0 != (b & 0x24))
{
/* printf("I2CTransmitByteGetReturn error %x\n", b); */
}
if(0 == (b & 0x10))
{
/* printf("I2CTransmitByteGetReturn no complete, retry\n"); */
}
else
{
switch (Size)
{
case 4:
READ_PORT_UCHAR((PUCHAR) (I2C_IO_BASE + 6));
READ_PORT_UCHAR((PUCHAR) (I2C_IO_BASE + 9));
READ_PORT_UCHAR((PUCHAR) (I2C_IO_BASE + 9));
READ_PORT_UCHAR((PUCHAR) (I2C_IO_BASE + 9));
READ_PORT_UCHAR((PUCHAR) (I2C_IO_BASE + 9));
break;
case 2:
*Data_to_smbus = READ_PORT_USHORT((USHORT *) (I2C_IO_BASE + 6));
break;
default:
*Data_to_smbus = READ_PORT_UCHAR((PUCHAR) (I2C_IO_BASE + 6));
break;
}
return TRUE;
}
}
return FALSE;
}
static BOOL
I2CTransmitByteGetReturn(UCHAR bPicAddressI2cFormat, UCHAR bDataToWrite, ULONG *Return)
{
return ReadfromSMBus(bPicAddressI2cFormat, bDataToWrite, 1, Return);
}
VOID
XboxVideoInit(VOID)
{

View File

@@ -36,7 +36,6 @@
<file>xboxdisk.c</file>
<file>xboxfont.c</file>
<file>xboxhw.c</file>
<file>xboxi2c.c</file>
<file>xboxmem.c</file>
<file>xboxrtc.c</file>
<file>xboxvideo.c</file>

View File

@@ -60,9 +60,6 @@ VOID XboxRTCGetCurrentDateTime(PULONG Year, PULONG Month, PULONG Day, PULONG Hou
VOID XboxHwDetect(VOID);
VOID XboxSetLED(PCSTR Pattern);
#endif /* __I386_HWXBOX_H_ */
/* EOF */

View File

@@ -46,10 +46,6 @@ extern CHAR UiTitleBoxTitleText[260]; // Title box's title text
extern BOOL UserInterfaceUp; // Tells us if the user interface is displayed
extern BOOL UiUseSpecialEffects; // Tells us if we should use fade effects
extern BOOL UiCenterMenu;
extern BOOL UiMenuBox;
extern BOOL UiMinimal;
extern CHAR UiTimeText[];
extern const CHAR UiMonthNames[12][15];

View File

@@ -73,12 +73,12 @@ typedef struct
} TUI_MENU_INFO, *PTUI_MENU_INFO;
VOID WINAPI TuiCalcMenuBoxSize(PTUI_MENU_INFO MenuInfo);
VOID WINAPI TuiDrawMenu(PTUI_MENU_INFO MenuInfo);
VOID WINAPI TuiDrawMenuBox(PTUI_MENU_INFO MenuInfo);
VOID WINAPI TuiDrawMenuItem(PTUI_MENU_INFO MenuInfo, ULONG MenuItemNumber);
ULONG WINAPI TuiProcessMenuKeyboardEvent(PTUI_MENU_INFO MenuInfo, UiMenuKeyPressFilterCallback KeyPressFilter);
BOOL WINAPI TuiDisplayMenu(PCSTR MenuItemList[], ULONG MenuItemCount, ULONG DefaultMenuItem, LONG MenuTimeOut, ULONG* SelectedMenuItem, BOOL CanEscape, UiMenuKeyPressFilterCallback KeyPressFilter);
VOID TuiCalcMenuBoxSize(PTUI_MENU_INFO MenuInfo);
VOID TuiDrawMenu(PTUI_MENU_INFO MenuInfo);
VOID TuiDrawMenuBox(PTUI_MENU_INFO MenuInfo);
VOID TuiDrawMenuItem(PTUI_MENU_INFO MenuInfo, ULONG MenuItemNumber);
ULONG TuiProcessMenuKeyboardEvent(PTUI_MENU_INFO MenuInfo, UiMenuKeyPressFilterCallback KeyPressFilter);
BOOL TuiDisplayMenu(PCSTR MenuItemList[], ULONG MenuItemCount, ULONG DefaultMenuItem, LONG MenuTimeOut, ULONG* SelectedMenuItem, BOOL CanEscape, UiMenuKeyPressFilterCallback KeyPressFilter);
/*

View File

@@ -31,8 +31,6 @@ char reactos_module_strings[64][256]; // Array to hold module names
unsigned long reactos_memory_map_descriptor_size;
memory_map_t reactos_memory_map[32]; // Memory map
static CHAR szLoadingMsg[] = "Loading ReactOS...";
static BOOL
STDCALL
FrLdrLoadKernel(PCHAR szFileName,
@@ -77,7 +75,7 @@ FrLdrLoadKernel(PCHAR szFileName,
FrLdrMapKernel(FilePointer);
/* Update Processbar and return success */
UiDrawProgressBarCenter(nPos, 100, szLoadingMsg);
UiDrawProgressBarCenter(nPos, 100, (PCHAR)"Loading ReactOS...");
return(TRUE);
}
@@ -333,7 +331,7 @@ FrLdrLoadDriver(PCHAR szFileName,
FrLdrLoadModule(FilePointer, szFileName, NULL);
/* Update status and return */
UiDrawProgressBarCenter(nPos, 100, szLoadingMsg);
UiDrawProgressBarCenter(nPos, 100, (PCHAR)"Loading ReactOS...");
return(TRUE);
}
@@ -587,10 +585,6 @@ LoadAndBootReactOS(PCSTR OperatingSystemName)
return;
}
UiDrawBackdrop();
UiDrawStatusText("Detecting Hardware...");
UiDrawProgressBarCenter(1, 100, szLoadingMsg);
/*
* Setup multiboot information structure
*/
@@ -681,15 +675,19 @@ LoadAndBootReactOS(PCSTR OperatingSystemName)
strcat(reactos_kernel_cmdline, value);
}
UiDrawBackdrop();
UiDrawStatusText("Detecting Hardware...");
/*
* Detect hardware
*/
MachHwDetect();
UiDrawProgressBarCenter(5, 100, szLoadingMsg);
if (AcpiPresent) LoaderBlock.Flags |= MB_FLAGS_ACPI_TABLE;
UiDrawStatusText("Loading...");
UiDrawProgressBarCenter(0, 100, (PCHAR)"Loading ReactOS...");
/*
* Try to open system drive
@@ -823,7 +821,7 @@ LoadAndBootReactOS(PCSTR OperatingSystemName)
*/
RegInitCurrentControlSet(FALSE);
UiDrawProgressBarCenter(15, 100, szLoadingMsg);
UiDrawProgressBarCenter(15, 100, (PCHAR)"Loading ReactOS...");
/*
* Export the hardware hive
@@ -832,7 +830,7 @@ LoadAndBootReactOS(PCSTR OperatingSystemName)
RegExportBinaryHive (L"\\Registry\\Machine\\HARDWARE", (PCHAR)Base, &Size);
FrLdrCloseModule (Base, Size);
UiDrawProgressBarCenter(20, 100, szLoadingMsg);
UiDrawProgressBarCenter(20, 100, (PCHAR)"Loading ReactOS...");
/*
* Load NLS files
@@ -842,13 +840,13 @@ LoadAndBootReactOS(PCSTR OperatingSystemName)
UiMessageBox(MsgBuffer);
return;
}
UiDrawProgressBarCenter(30, 100, szLoadingMsg);
UiDrawProgressBarCenter(30, 100, (PCHAR)"Loading ReactOS...");
/*
* Load kernel symbols
*/
LoadKernelSymbols(szKernelName, 30);
UiDrawProgressBarCenter(40, 100, szLoadingMsg);
UiDrawProgressBarCenter(40, 100, (PCHAR)"Loading ReactOS...");
/*
* Load boot drivers

View File

@@ -31,7 +31,6 @@ RegInitializeRegistry (VOID)
{
#if 0
FRLDRHKEY TestKey;
WCHAR szTestString[] = L"TestString";
#endif
/* Create root key */
@@ -86,8 +85,8 @@ RegInitializeRegistry (VOID)
RegSetValue (TestKey,
L"TestValue",
REG_SZ,
szTestString,
sizeof(szTestString));
(PUCHAR)"TestString",
11);
#endif
}

View File

@@ -20,8 +20,6 @@
#include <freeldr.h>
PVOID TextVideoBuffer = NULL;
extern BOOL UiDrawTime;
extern BOOL UiMinimal;
/*
* printf() - prints formatted text to stdout
@@ -113,25 +111,6 @@ VOID TuiUnInitialize(VOID)
VOID TuiDrawBackdrop(VOID)
{
if (UiMinimal)
{
//
// Fill in a black background
//
TuiFillArea(0,
0,
UiScreenWidth - 1,
UiScreenHeight - 1,
0,
0);
//
// Update the screen buffer
//
VideoCopyOffScreenBufferToVRAM();
return;
}
//
// Fill in the background (excluding title box & status bar)
//
@@ -450,11 +429,6 @@ VOID TuiDrawStatusText(PCSTR StatusText)
{
ULONG i;
//
// Minimal UI doesn't have a status bar
//
if (UiMinimal) return;
TuiDrawText(0, UiScreenHeight-1, " ", ATTR(UiStatusBarFgColor, UiStatusBarBgColor));
TuiDrawText(1, UiScreenHeight-1, StatusText, ATTR(UiStatusBarFgColor, UiStatusBarBgColor));
@@ -475,9 +449,6 @@ VOID TuiUpdateDateTime(VOID)
CHAR TempString[20];
BOOL PMHour = FALSE;
/* Don't draw the time if this has been disabled */
if (!UiDrawTime) return;
MachRTCGetCurrentDateTime(&Year, &Month, &Day, &Hour, &Minute, &Second);
if (Year < 1 || 9999 < Year || Month < 1 || 12 < Month || Day < 1 ||
31 < Day || 23 < Hour || 59 < Minute || 59 < Second)
@@ -692,28 +663,10 @@ VOID TuiDrawProgressBarCenter(ULONG Position, ULONG Range, PCHAR ProgressText)
ULONG Width = 50; // Allow for 50 "bars"
ULONG Height = 2;
//
// Is this the minimal UI?
//
if (UiMinimal)
{
//
// Use alternate settings
//
Width = 80;
Left = 0;
Right = Left + Width;
Top = UiScreenHeight - Height - 4;
Bottom = Top + Height + 1;
}
else
{
Left = (UiScreenWidth - Width - 4) / 2;
Right = Left + Width + 3;
Top = (UiScreenHeight - Height - 2) / 2;
Top += 2;
}
Left = (UiScreenWidth - Width - 4) / 2;
Right = Left + Width + 3;
Top = (UiScreenHeight - Height - 2) / 2;
Top += 2;
Bottom = Top + Height + 1;
TuiDrawProgressBar(Left, Top, Right, Bottom, Position, Range, ProgressText);
@@ -732,26 +685,12 @@ VOID TuiDrawProgressBar(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, ULONG
Position = Range;
}
//
// Minimal UI has no box, and only generic loading text
//
if (!UiMinimal)
{
// Draw the box
TuiDrawBox(Left, Top, Right, Bottom, VERT, HORZ, TRUE, TRUE, ATTR(UiMenuFgColor, UiMenuBgColor));
// Draw the box
TuiDrawBox(Left, Top, Right, Bottom, VERT, HORZ, TRUE, TRUE, ATTR(UiMenuFgColor, UiMenuBgColor));
//
// Draw the "Loading..." text
//
TuiDrawCenteredText(Left + 2, Top + 2, Right - 2, Top + 2, ProgressText, ATTR(UiTextColor, UiMenuBgColor));
}
else
{
//
// Draw the "Loading..." text
//
TuiDrawCenteredText(Left + 2, Top + 1, Right - 2, Top + 1, "ReactOS is loading files...", ATTR(7, 0));
}
// Draw the "Loading..." text
//TuiDrawText(70/2, Top+1, "Loading...", ATTR(UiTextColor, UiMenuBgColor));
TuiDrawCenteredText(Left + 2, Top + 2, Right - 2, Top + 2, ProgressText, ATTR(UiTextColor, UiMenuBgColor));
// Draw the percent complete
for (i=0; i<(Position*ProgressBarWidth)/Range; i++)
@@ -759,16 +698,14 @@ VOID TuiDrawProgressBar(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, ULONG
TuiDrawText(Left+2+i, Top+2, "\xDB", ATTR(UiTextColor, UiMenuBgColor));
}
// Draw the shadow for non-minimal UI
if (!UiMinimal)
{
for (; i<ProgressBarWidth; i++)
{
TuiDrawText(Left+2+i, Top+2, "\xB2", ATTR(UiTextColor, UiMenuBgColor));
}
}
// Draw the rest
for (; i<ProgressBarWidth; i++)
{
TuiDrawText(Left+2+i, Top+2, "\xB2", ATTR(UiTextColor, UiMenuBgColor));
}
TuiUpdateDateTime();
VideoCopyOffScreenBufferToVRAM();
}

View File

@@ -1,549 +1,427 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: FreeLoader
* FILE: freeldr/ui/tuimenu.c
* PURPOSE: UI Menu Functions
* PROGRAMMERS: Alex Ionescu (alex@relsoft.net)
* Brian Palmer (brianp@sginet.com)
* FreeLoader
* Copyright (C) 1998-2003 Brian Palmer <brianp@sginet.com>
*
* This program 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 2 of the License, or
* (at your option) any later version.
*
* This program 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 this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* INCLUDES ******************************************************************/
#include <freeldr.h>
/* FUNCTIONS *****************************************************************/
BOOL
WINAPI
TuiDisplayMenu(PCSTR MenuItemList[],
ULONG MenuItemCount,
ULONG DefaultMenuItem,
LONG MenuTimeOut,
ULONG* SelectedMenuItem,
BOOL CanEscape,
UiMenuKeyPressFilterCallback KeyPressFilter)
BOOL TuiDisplayMenu(PCSTR MenuItemList[], ULONG MenuItemCount, ULONG DefaultMenuItem, LONG MenuTimeOut, ULONG* SelectedMenuItem, BOOL CanEscape, UiMenuKeyPressFilterCallback KeyPressFilter)
{
TUI_MENU_INFO MenuInformation;
ULONG LastClockSecond;
ULONG CurrentClockSecond;
ULONG KeyPress;
TUI_MENU_INFO MenuInformation;
ULONG LastClockSecond;
ULONG CurrentClockSecond;
ULONG KeyPress;
//
// Check if there's no timeout
if (!MenuTimeOut)
{
//
// Return the default selected item
//
if (SelectedMenuItem) *SelectedMenuItem = DefaultMenuItem;
return TRUE;
}
//
// The first thing we need to check is the timeout
// If it's zero then don't bother with anything,
// just return the default item
//
if (MenuTimeOut == 0)
{
if (SelectedMenuItem != NULL)
{
*SelectedMenuItem = DefaultMenuItem;
}
//
// Setup the MENU_INFO structure
//
MenuInformation.MenuItemList = MenuItemList;
MenuInformation.MenuItemCount = MenuItemCount;
MenuInformation.MenuTimeRemaining = MenuTimeOut;
MenuInformation.SelectedMenuItem = DefaultMenuItem;
return TRUE;
}
//
// Calculate the size of the menu box
//
TuiCalcMenuBoxSize(&MenuInformation);
//
// Setup the MENU_INFO structure
//
MenuInformation.MenuItemList = MenuItemList;
MenuInformation.MenuItemCount = MenuItemCount;
MenuInformation.MenuTimeRemaining = MenuTimeOut;
MenuInformation.SelectedMenuItem = DefaultMenuItem;
//
// Draw the menu
//
TuiDrawMenu(&MenuInformation);
//
// Calculate the size of the menu box
//
TuiCalcMenuBoxSize(&MenuInformation);
//
// Get the current second of time
//
MachRTCGetCurrentDateTime(NULL, NULL, NULL, NULL, NULL, &LastClockSecond);
//
// Draw the menu
//
TuiDrawMenu(&MenuInformation);
//
// Process keys
//
while (TRUE)
{
//
// Process key presses
//
KeyPress = TuiProcessMenuKeyboardEvent(&MenuInformation,
KeyPressFilter);
//
// Get the current second of time
//
MachRTCGetCurrentDateTime(NULL, NULL, NULL, NULL, NULL, &LastClockSecond);
//
// Check for ENTER or ESC
//
if (KeyPress == KEY_ENTER) break;
if (CanEscape && KeyPress == KEY_ESC) return FALSE;
//
// Process keys
//
while (1)
{
//
// Process key presses
//
KeyPress = TuiProcessMenuKeyboardEvent(&MenuInformation, KeyPressFilter);
if (KeyPress == KEY_ENTER)
{
//
// If they pressed enter then exit this loop
//
break;
}
else if (CanEscape && KeyPress == KEY_ESC)
{
//
// They pressed escape, so just return FALSE
//
return FALSE;
}
//
// Update the date & time
//
TuiUpdateDateTime();
VideoCopyOffScreenBufferToVRAM();
//
// Update the date & time
//
TuiUpdateDateTime();
//
// Check if there is a countdown
//
if (MenuInformation.MenuTimeRemaining)
{
//
// Get the updated time, seconds only
//
MachRTCGetCurrentDateTime(NULL,
NULL,
NULL,
NULL,
NULL,
&CurrentClockSecond);
VideoCopyOffScreenBufferToVRAM();
//
// Check if more then a second has now elapsed
//
if (CurrentClockSecond != LastClockSecond)
{
//
// Update the time information
//
LastClockSecond = CurrentClockSecond;
MenuInformation.MenuTimeRemaining--;
if (MenuInformation.MenuTimeRemaining > 0)
{
MachRTCGetCurrentDateTime(NULL, NULL, NULL, NULL, NULL, &CurrentClockSecond);
if (CurrentClockSecond != LastClockSecond)
{
//
// Update the time information
//
LastClockSecond = CurrentClockSecond;
MenuInformation.MenuTimeRemaining--;
//
// Update the menu
//
TuiDrawMenuBox(&MenuInformation);
VideoCopyOffScreenBufferToVRAM();
}
}
else
{
//
// A time out occurred, exit this loop and return default OS
//
break;
}
}
//
// Update the menu
//
TuiDrawMenuBox(&MenuInformation);
//
// Return the selected item
//
if (SelectedMenuItem) *SelectedMenuItem = MenuInformation.SelectedMenuItem;
return TRUE;
VideoCopyOffScreenBufferToVRAM();
}
}
else if (MenuInformation.MenuTimeRemaining == 0)
{
//
// A time out occurred, exit this loop and return default OS
//
break;
}
}
//
// Update the selected menu item information
//
if (SelectedMenuItem != NULL)
{
*SelectedMenuItem = MenuInformation.SelectedMenuItem;
}
return TRUE;
}
VOID
WINAPI
TuiCalcMenuBoxSize(PTUI_MENU_INFO MenuInfo)
VOID TuiCalcMenuBoxSize(PTUI_MENU_INFO MenuInfo)
{
ULONG i;
ULONG Width = 0;
ULONG Height;
ULONG Length;
ULONG Idx;
ULONG Width;
ULONG Height;
ULONG Length;
//
// Height is the menu item count plus 2 (top border & bottom border)
//
Height = MenuInfo->MenuItemCount + 2;
Height -= 1; // Height is zero-based
//
// Height is the menu item count plus 2 (top border & bottom border)
//
Height = MenuInfo->MenuItemCount + 2;
Height -= 1; // Height is zero-based
//
// Loop every item
//
for(i = 0; i < MenuInfo->MenuItemCount; i++)
{
//
// Get the string length and make it become the new width if necessary
//
Length = strlen(MenuInfo->MenuItemList[i]);
if (Length > Width) Width = Length;
}
//
// Find the length of the longest string in the menu
//
Width = 0;
for(Idx=0; Idx<MenuInfo->MenuItemCount; Idx++)
{
Length = strlen(MenuInfo->MenuItemList[Idx]);
//
// Allow room for left & right borders, plus 8 spaces on each side
//
Width += 18;
if (Length > Width)
{
Width = Length;
}
}
//
// Check if we're drawing a centered menu
//
if (UiCenterMenu)
{
//
// Calculate the menu box area for a centered menu
//
MenuInfo->Left = (UiScreenWidth - Width) / 2;
MenuInfo->Top = (((UiScreenHeight - TUI_TITLE_BOX_CHAR_HEIGHT) -
Height) / 2) + TUI_TITLE_BOX_CHAR_HEIGHT;
}
else
{
//
// Put the menu in the default left-corner position
//
MenuInfo->Left = -1;
MenuInfo->Top = 4;
}
//
// Allow room for left & right borders, plus 8 spaces on each side
//
Width += 18;
//
// The other margins are the same
//
MenuInfo->Right = (MenuInfo->Left) + Width;
MenuInfo->Bottom = (MenuInfo->Top) + Height;
//
// Calculate the menu box area
//
MenuInfo->Left = (UiScreenWidth - Width) / 2;
MenuInfo->Right = (MenuInfo->Left) + Width;
MenuInfo->Top = (((UiScreenHeight - TUI_TITLE_BOX_CHAR_HEIGHT) - Height) / 2) + TUI_TITLE_BOX_CHAR_HEIGHT;
MenuInfo->Bottom = (MenuInfo->Top) + Height;
}
VOID
WINAPI
TuiDrawMenu(PTUI_MENU_INFO MenuInfo)
VOID TuiDrawMenu(PTUI_MENU_INFO MenuInfo)
{
ULONG i;
ULONG Idx;
//
// Draw the backdrop
//
UiDrawBackdrop();
//
// Draw the backdrop
//
UiDrawBackdrop();
//
// Check if this is the minimal (console) UI
//
if (UiMinimal)
{
//
// No GUI status bar text, just minimal text. first to tell the user to
// choose.
//
TuiDrawText(0,
MenuInfo->Top - 2,
"Please select the operating system to start:",
ATTR(UiMenuFgColor, UiMenuBgColor));
//
// Update the status bar
//
UiDrawStatusText("Use \x18\x19 to select, then press ENTER.");
//
// Now tell him how to choose
//
TuiDrawText(0,
MenuInfo->Bottom + 1,
"Use the up and down arrow keys to move the highlight to "
"your choice.",
ATTR(UiMenuFgColor, UiMenuBgColor));
TuiDrawText(0,
MenuInfo->Bottom + 2,
"Press ENTER to choose.",
ATTR(UiMenuFgColor, UiMenuBgColor));
//
// Draw the menu box
//
TuiDrawMenuBox(MenuInfo);
//
// And offer F8 options
//
TuiDrawText(0,
UiScreenHeight - 4,
"For troubleshooting and advanced startup options for "
"ReactOS, press F8.",
ATTR(UiMenuFgColor, UiMenuBgColor));
}
else
{
//
// Update the status bar
//
UiDrawStatusText("Use \x18\x19 to select, then press ENTER.");
}
//
// Draw each line of the menu
//
for (Idx=0; Idx<MenuInfo->MenuItemCount; Idx++)
{
TuiDrawMenuItem(MenuInfo, Idx);
}
//
// Draw the menu box
//
TuiDrawMenuBox(MenuInfo);
//
// Draw each line of the menu
//
for (i = 0; i < MenuInfo->MenuItemCount; i++) TuiDrawMenuItem(MenuInfo, i);
VideoCopyOffScreenBufferToVRAM();
VideoCopyOffScreenBufferToVRAM();
}
VOID
WINAPI
TuiDrawMenuBox(PTUI_MENU_INFO MenuInfo)
VOID TuiDrawMenuBox(PTUI_MENU_INFO MenuInfo)
{
CHAR MenuLineText[80];
CHAR TempString[80];
ULONG i;
CHAR MenuLineText[80];
CHAR TempString[80];
ULONG Idx;
//
// Draw the menu box if requested
//
if (UiMenuBox)
{
UiDrawBox(MenuInfo->Left,
MenuInfo->Top,
MenuInfo->Right,
MenuInfo->Bottom,
D_VERT,
D_HORZ,
FALSE, // Filled
TRUE, // Shadow
ATTR(UiMenuFgColor, UiMenuBgColor));
}
//
// Draw the menu box
//
UiDrawBox(MenuInfo->Left,
MenuInfo->Top,
MenuInfo->Right,
MenuInfo->Bottom,
D_VERT,
D_HORZ,
FALSE, // Filled
TRUE, // Shadow
ATTR(UiMenuFgColor, UiMenuBgColor));
//
// If there is a timeout draw the time remaining
//
if (MenuInfo->MenuTimeRemaining >= 0)
{
//
// Copy the integral time text string, and remove the last 2 chars
//
strcpy(TempString, UiTimeText);
i = strlen(TempString);
TempString[i - 2] = 0;
//
// If there is a timeout draw the time remaining
//
if (MenuInfo->MenuTimeRemaining >= 0)
{
strcpy(MenuLineText, "[ Time Remaining: ");
_itoa(MenuInfo->MenuTimeRemaining, TempString, 10);
strcat(MenuLineText, TempString);
strcat(MenuLineText, " ]");
//
// Display the first part of the string and the remaining time
//
strcpy(MenuLineText, TempString);
_itoa(MenuInfo->MenuTimeRemaining, TempString, 10);
strcat(MenuLineText, TempString);
UiDrawText(MenuInfo->Right - strlen(MenuLineText) - 1,
MenuInfo->Bottom,
MenuLineText,
ATTR(UiMenuFgColor, UiMenuBgColor));
}
//
// Add the last 2 chars
//
strcat(MenuLineText, &UiTimeText[i - 2]);
//
// Check if this is a centered menu
//
if (UiCenterMenu)
{
//
// Display it in the center of the menu
//
UiDrawText(MenuInfo->Right - strlen(MenuLineText) - 1,
MenuInfo->Bottom,
MenuLineText,
ATTR(UiMenuFgColor, UiMenuBgColor));
}
else
{
//
// Display under the menu directly
//
UiDrawText(0,
MenuInfo->Bottom + 3,
MenuLineText,
ATTR(UiMenuFgColor, UiMenuBgColor));
}
}
//
// Loop each item
//
for (i = 0; i < MenuInfo->MenuItemCount; i++)
{
//
// Check if it's a separator
//
if (!(_stricmp(MenuInfo->MenuItemList[i], "SEPARATOR")))
{
//
// Draw the separator line
//
UiDrawText(MenuInfo->Left,
MenuInfo->Top + i + 1,
"\xC7",
ATTR(UiMenuFgColor, UiMenuBgColor));
UiDrawText(MenuInfo->Right,
MenuInfo->Top + i + 1,
"\xB6",
ATTR(UiMenuFgColor, UiMenuBgColor));
}
}
//
// Now draw the separators
//
for (Idx=0; Idx<MenuInfo->MenuItemCount; Idx++)
{
if (_stricmp(MenuInfo->MenuItemList[Idx], "SEPARATOR") == 0)
{
UiDrawText(MenuInfo->Left, MenuInfo->Top + Idx + 1, "\xC7", ATTR(UiMenuFgColor, UiMenuBgColor));
UiDrawText(MenuInfo->Right, MenuInfo->Top + Idx + 1, "\xB6", ATTR(UiMenuFgColor, UiMenuBgColor));
}
}
}
VOID
WINAPI
TuiDrawMenuItem(PTUI_MENU_INFO MenuInfo,
ULONG MenuItemNumber)
VOID TuiDrawMenuItem(PTUI_MENU_INFO MenuInfo, ULONG MenuItemNumber)
{
ULONG i;
CHAR MenuLineText[80];
ULONG SpaceTotal;
ULONG SpaceLeft;
ULONG SpaceRight = 0;
UCHAR Attribute = ATTR(UiTextColor, UiMenuBgColor);
ULONG Idx;
CHAR MenuLineText[80];
ULONG SpaceTotal;
ULONG SpaceLeft;
ULONG SpaceRight;
UCHAR Attribute;
//
// Check if using centered menu
//
if (UiCenterMenu)
{
//
// We will want the string centered so calculate
// how many spaces will be to the left and right
//
SpaceTotal = (MenuInfo->Right - MenuInfo->Left - 2) -
strlen(MenuInfo->MenuItemList[MenuItemNumber]);
SpaceLeft = (SpaceTotal / 2) + 1;
SpaceRight = (SpaceTotal - SpaceLeft) + 1;
//
// We will want the string centered so calculate
// how many spaces will be to the left and right
//
SpaceTotal = (MenuInfo->Right - MenuInfo->Left - 2) - strlen(MenuInfo->MenuItemList[MenuItemNumber]);
SpaceLeft = (SpaceTotal / 2) + 1;
SpaceRight = (SpaceTotal - SpaceLeft) + 1;
//
// Insert the spaces on the left
//
for (i = 0; i < SpaceLeft; i++) MenuLineText[i] = ' ';
MenuLineText[i] = '\0';
}
else
{
//
// Simply left-align it
//
MenuLineText[0] = '\0';
strcat(MenuLineText, " ");
}
//
// Insert the spaces on the left
//
for (Idx=0; Idx<SpaceLeft; Idx++)
{
MenuLineText[Idx] = ' ';
}
MenuLineText[Idx] = '\0';
//
// Now append the text string
//
strcat(MenuLineText, MenuInfo->MenuItemList[MenuItemNumber]);
//
// Now append the text string
//
strcat(MenuLineText, MenuInfo->MenuItemList[MenuItemNumber]);
//
// Check if using centered menu, and add spaces on the right if so
//
if (UiCenterMenu) for (i=0; i < SpaceRight; i++) strcat(MenuLineText, " ");
//
// Now append the spaces on the right
//
for (Idx=0; Idx<SpaceRight; Idx++)
{
strcat(MenuLineText, " ");
}
//
// If it is a separator
//
if (!(_stricmp(MenuInfo->MenuItemList[MenuItemNumber], "SEPARATOR")))
{
//
// Make it a separator line and use menu colors
//
memset(MenuLineText, 0, 80);
memset(MenuLineText, 0xC4, (MenuInfo->Right - MenuInfo->Left - 1));
Attribute = ATTR(UiMenuFgColor, UiMenuBgColor);
}
else if (MenuItemNumber == MenuInfo->SelectedMenuItem)
{
//
// If this is the selected item, use the selected colors
//
Attribute = ATTR(UiSelectedTextColor, UiSelectedTextBgColor);
}
//
// If it is a separator then adjust the text accordingly
//
if (_stricmp(MenuInfo->MenuItemList[MenuItemNumber], "SEPARATOR") == 0)
{
memset(MenuLineText, 0, 80);
memset(MenuLineText, 0xC4, (MenuInfo->Right - MenuInfo->Left - 1));
Attribute = ATTR(UiMenuFgColor, UiMenuBgColor);
}
else
{
Attribute = ATTR(UiTextColor, UiMenuBgColor);
}
//
// Draw the item
//
UiDrawText(MenuInfo->Left + 1,
MenuInfo->Top + 1 + MenuItemNumber,
MenuLineText,
Attribute);
//
// If this is the selected menu item then draw it as selected
// otherwise just draw it using the normal colors
//
if (MenuItemNumber == MenuInfo->SelectedMenuItem)
{
UiDrawText(MenuInfo->Left + 1,
MenuInfo->Top + 1 + MenuItemNumber,
MenuLineText,
ATTR(UiSelectedTextColor, UiSelectedTextBgColor));
}
else
{
UiDrawText(MenuInfo->Left + 1,
MenuInfo->Top + 1 + MenuItemNumber,
MenuLineText,
Attribute);
}
}
ULONG
WINAPI
TuiProcessMenuKeyboardEvent(PTUI_MENU_INFO MenuInfo,
UiMenuKeyPressFilterCallback KeyPressFilter)
ULONG TuiProcessMenuKeyboardEvent(PTUI_MENU_INFO MenuInfo, UiMenuKeyPressFilterCallback KeyPressFilter)
{
ULONG KeyEvent = 0;
ULONG Selected, Count;
ULONG KeyEvent = 0;
//
// Check for a keypress
//
if (MachConsKbHit())
{
//
// Check if the timeout is not already complete
//
if (MenuInfo->MenuTimeRemaining != -1)
{
//
// Cancel it and remove it
//
MenuInfo->MenuTimeRemaining = -1;
TuiDrawMenuBox(MenuInfo); // FIXME: Remove for minimal UI too
}
//
// Check for a keypress
//
if (MachConsKbHit())
{
//
// Cancel the timeout
//
if (MenuInfo->MenuTimeRemaining != -1)
{
MenuInfo->MenuTimeRemaining = -1;
TuiDrawMenuBox(MenuInfo);
}
//
// Get the key
//
KeyEvent = MachConsGetCh();
//
// Get the key
//
KeyEvent = MachConsGetCh();
//
// Is it extended? Then get the extended key
//
if (!KeyEvent) KeyEvent = MachConsGetCh();
//
// Is it extended?
//
if (KeyEvent == 0)
KeyEvent = MachConsGetCh(); // Yes - so get the extended key
//
// Call the supplied key filter callback function to see
// if it is going to handle this keypress.
//
if ((KeyPressFilter) && (KeyPressFilter(KeyEvent)))
{
//
// It processed the key character, so redraw and exit
//
TuiDrawMenu(MenuInfo);
return 0;
}
//
// Call the supplied key filter callback function to see
// if it is going to handle this keypress.
//
if (KeyPressFilter != NULL)
{
if (KeyPressFilter(KeyEvent))
{
// It processed the key character
TuiDrawMenu(MenuInfo);
//
// Process the key
//
if ((KeyEvent == KEY_UP) || (KeyEvent == KEY_DOWN))
{
//
// Get the current selected item and count
//
Selected = MenuInfo->SelectedMenuItem;
Count = MenuInfo->MenuItemCount - 1;
return 0;
}
}
//
// Check if this was a key up and there's a selected menu item
//
if ((KeyEvent == KEY_UP) && (Selected))
{
//
// Update the menu (Deselect previous item)
//
MenuInfo->SelectedMenuItem--;
TuiDrawMenuItem(MenuInfo, Selected);
Selected--;
//
// Process the key
//
switch (KeyEvent)
{
case KEY_UP:
// Skip past any separators
if ((Selected) &&
!(_stricmp(MenuInfo->MenuItemList[Selected], "SEPARATOR")))
{
MenuInfo->SelectedMenuItem--;
}
}
else if ((KeyEvent == KEY_DOWN) && (Selected < Count))
{
//
// Update the menu (deselect previous item)
//
MenuInfo->SelectedMenuItem++;
TuiDrawMenuItem(MenuInfo, Selected);
Selected++;
if (MenuInfo->SelectedMenuItem > 0)
{
MenuInfo->SelectedMenuItem--;
// Skip past any separators
if ((Selected < Count) &&
!(_stricmp(MenuInfo->MenuItemList[Selected], "SEPARATOR")))
{
MenuInfo->SelectedMenuItem++;
}
}
//
// Update the menu
//
TuiDrawMenuItem(MenuInfo, MenuInfo->SelectedMenuItem + 1); // Deselect previous item
//
// Select new item and update video buffer
//
TuiDrawMenuItem(MenuInfo, MenuInfo->SelectedMenuItem);
VideoCopyOffScreenBufferToVRAM();
}
}
// Skip past any separators
if (MenuInfo->SelectedMenuItem > 0 && _stricmp(MenuInfo->MenuItemList[MenuInfo->SelectedMenuItem], "SEPARATOR") == 0)
{
MenuInfo->SelectedMenuItem--;
}
//
// Return the pressed key
//
return KeyEvent;
TuiDrawMenuItem(MenuInfo, MenuInfo->SelectedMenuItem); // Select new item
}
break;
case KEY_DOWN:
if (MenuInfo->SelectedMenuItem < (MenuInfo->MenuItemCount - 1))
{
MenuInfo->SelectedMenuItem++;
//
// Update the menu
//
TuiDrawMenuItem(MenuInfo, MenuInfo->SelectedMenuItem - 1); // Deselect previous item
// Skip past any separators
if (MenuInfo->SelectedMenuItem < (MenuInfo->MenuItemCount - 1) && _stricmp(MenuInfo->MenuItemList[MenuInfo->SelectedMenuItem], "SEPARATOR") == 0)
{
MenuInfo->SelectedMenuItem++;
}
TuiDrawMenuItem(MenuInfo, MenuInfo->SelectedMenuItem); // Select new item
}
break;
}
VideoCopyOffScreenBufferToVRAM();
}
return KeyEvent;
}

View File

@@ -50,11 +50,6 @@ BOOL UserInterfaceUp = FALSE; // Tells us if the user interface is display
VIDEODISPLAYMODE UiDisplayMode = VideoTextMode; // Tells us if we are in text or graphics mode
BOOL UiUseSpecialEffects = FALSE; // Tells us if we should use fade effects
BOOL UiDrawTime = TRUE; // Tells us if we should draw the time
BOOL UiMinimal = FALSE; // Tells us if we should use a minimal console-like UI
BOOL UiCenterMenu = TRUE; // Tells us if we should use a centered or left-aligned menu
BOOL UiMenuBox = TRUE; // Tells us if we shuld draw a box around the menu
CHAR UiTimeText[260] = "[Time Remaining: ] ";
const CHAR UiMonthNames[12][15] = { "January ", "February ", "March ", "April ", "May ", "June ", "July ", "August ", "September ", "October ", "November ", "December " };
@@ -92,10 +87,6 @@ BOOL UiInitialize(BOOLEAN ShowGui)
{
strcpy(UiTitleBoxTitleText, SettingText);
}
if (IniReadSettingByName(SectionId, "TimeText", SettingText, 260))
{
strcpy(UiTimeText, SettingText);
}
if (IniReadSettingByName(SectionId, "StatusBarColor", SettingText, 260))
{
UiStatusBarBgColor = UiTextToColor(SettingText);
@@ -171,50 +162,6 @@ BOOL UiInitialize(BOOLEAN ShowGui)
UiUseSpecialEffects = FALSE;
}
}
if (IniReadSettingByName(SectionId, "ShowTime", SettingText, 260))
{
if (_stricmp(SettingText, "Yes") == 0 && strlen(SettingText) == 3)
{
UiDrawTime = TRUE;
}
else
{
UiDrawTime = FALSE;
}
}
if (IniReadSettingByName(SectionId, "MinimalUI", SettingText, 260))
{
if (_stricmp(SettingText, "Yes") == 0 && strlen(SettingText) == 3)
{
UiMinimal = TRUE;
}
else
{
UiMinimal = FALSE;
}
}
if (IniReadSettingByName(SectionId, "MenuBox", SettingText, 260))
{
if (_stricmp(SettingText, "Yes") == 0 && strlen(SettingText) == 3)
{
UiMenuBox = TRUE;
}
else
{
UiMenuBox = FALSE;
}
}
if (IniReadSettingByName(SectionId, "CenterMenu", SettingText, 260))
{
if (_stricmp(SettingText, "Yes") == 0 && strlen(SettingText) == 3)
{
UiCenterMenu = TRUE;
}
else
{
UiCenterMenu = FALSE;
}
}
}
UiDisplayMode = MachVideoSetDisplayMode(DisplayModeText, TRUE);

View File

@@ -27,7 +27,7 @@ HKCU,"SOFTWARE\Microsoft\DirectX","Debug",0x00010001,0x00000000
HKCU,"SOFTWARE\Microsoft\DirectX","InstalledVersion",0x00000001,0x00,0x00,0x00,0x09,0x00,0x00,0x00,0x00
HKCU,"SOFTWARE\Microsoft\DirectX","InstallMDX",0x00010001,0x00000001
HKCU,"SOFTWARE\Microsoft\DirectX","RC",0x00010001,0x00000000
HKCU,"SOFTWARE\Microsoft\DirectX","Version",0x00000000,"5.03.2600.2180"
HKCU,"SOFTWARE\Microsoft\DirectX","Version",0x00000000,"4.09.00.0904"

View File

@@ -41,7 +41,6 @@ HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\SysFontSubstitutes","Arial",0
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\SysFontSubstitutes","Courier New",0x00000000,"Bitstream Vera Sans Mono"
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\SysFontSubstitutes","Marlett",0x00000000,"TGMarlett"
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\SysFontSubstitutes","Times New Roman",0x00000000,"Bitstream Vera Serif"
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\SysFontSubstitutes","Tahoma",0x00000000,"Bitstream Vera Sans"
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\SysFontSubstitutes","MS Sans Serif",0x00000000,"Bitstream Vera Sans"
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\SysFontSubstitutes","MS Shell Dlg",0x00000000,"Bitstream Vera Sans"
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\SysFontSubstitutes","MS Shell Dlg 2",0x00000000,"Bitstream Vera Sans"

View File

@@ -54,8 +54,6 @@ HKLM,"SYSTEM\CurrentControlSet\Control\KeyboardLayouts\00000419","Layout File",0
HKLM,"SYSTEM\CurrentControlSet\Control\KeyboardLayouts\00000419","Layout Text",0x00000000,"Russian"
HKLM,"SYSTEM\CurrentControlSet\Control\KeyboardLayouts\0000041d","Layout File",0x00000000,"kbdse.dll"
HKLM,"SYSTEM\CurrentControlSet\Control\KeyboardLayouts\0000041d","Layout Text",0x00000000,"SE"
HKLM,"SYSTEM\CurrentControlSet\Control\KeyboardLayouts\00000422","Layout File",0x00000000,"kbdur.dll"
HKLM,"SYSTEM\CurrentControlSet\Control\KeyboardLayouts\00000422","Layout Text",0x00000000,"Ukrainian"
HKLM,"SYSTEM\CurrentControlSet\Control\KeyboardLayouts\00000809","Layout File",0x00000000,"kbduk.dll"
HKLM,"SYSTEM\CurrentControlSet\Control\KeyboardLayouts\00000809","Layout Text",0x00000000,"UK"
HKLM,"SYSTEM\CurrentControlSet\Control\KeyboardLayouts\00000807","Layout File",0x00000000,"kbdsg.dll"
@@ -535,7 +533,7 @@ HKLM,"SYSTEM\CurrentControlSet\Services\Disk","Type",0x00010001,0x00000001
HKLM,"SYSTEM\CurrentControlSet\Services\EventLog","ErrorControl",0x00010001,0x00000000
HKLM,"SYSTEM\CurrentControlSet\Services\EventLog","Group",0x00000000,"Event log"
HKLM,"SYSTEM\CurrentControlSet\Services\EventLog","ImagePath",0x00020000,"%SystemRoot%\system32\eventlog.exe"
HKLM,"SYSTEM\CurrentControlSet\Services\EventLog","Start",0x00010001,0x00000002
HKLM,"SYSTEM\CurrentControlSet\Services\EventLog","Start",0x00010001,0x00000004
HKLM,"SYSTEM\CurrentControlSet\Services\EventLog","Type",0x00010001,0x00000010
; DHCP client service
@@ -784,4 +782,136 @@ HKLM,"SYSTEM\Setup","OsLoaderPath",0x00000000,"\"
HKLM,"SYSTEM\Setup","SetupType",0x00010001,0x00000001
HKLM,"SYSTEM\Setup","SystemPartition",0x00000000,"\Device\Harddisk0\Partition1"
HKLM,"SYSTEM\Setup","SystemSetupInProgress",0x00010001,0x00000001
; Static entries to get networking on the LiveCD working
; PCnet (VMware)
HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}\0000","NetCfgInstanceId",0x00000000,"{bf3401a0-6e70-11da-2d80-4fc4ac68929a}"
HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}\0000","BUS_TO_SCAN",0x00000000,"ALL"
HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}\0000","BUSTIMER",0x00000000,"0"
HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}\0000","BUSTYPE",0x00000000,"5"
HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}\0000","EXTPHY",0x00000000,"0"
HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}\0000","FDUP",0x00000000,"0"
HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}\0000","LED0",0x00000000,"10000"
HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}\0000","LED1",0x00000000,"10000"
HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}\0000","LED2",0x00000000,"10000"
HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}\0000","LED3",0x00000000,"10000"
HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}\0000","MPMODE",0x00000000,"0"
HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}\0000","TP",0x00000000,"1"
HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}\0000","DriverDate",0x00000000,"10-8-2005"
HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}\0000","DriverDateData",0x00000001,00,80,cc,39,9b,cb,c5,01
HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}\0000","DriverDesc",0x00000000,"AMD 79c970 [PCnet32 LANCE]"
HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}\0000","DriverVersion",0x00000000,"0.0.0.0"
HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}\0000","InfPath",0x00000000,"netamd.inf"
HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}\0000","InfSection",0x00000000,"PCNet_Inst"
HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}\0000","InfSectionExt",0x00000000,".NT"
HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}\0000","MatchingDeviceId",0x00000000,"PCI\VEN_1022&DEV_2000"
HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}\0000","ProviderName",0x00000000,"ReactOS Team"
HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}\0000\Linkage","Export",0x00000000,"\Device\{bf3401a0-6e70-11da-2d80-4fc4ac68929a}"
HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}\0000\Linkage","RootDevice",0x00000000,"{bf3401a0-6e70-11da-2d80-4fc4ac68929a}"
HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}\0000\Linkage","UpperBind",0x00000000,"Tcpip"
HKLM,"SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}\{bf3401a0-6e70-11da-2d80-4fc4ac68929a}\Connection","Name",0x00000000,"Network connection"
HKLM,"SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}\{bf3401a0-6e70-11da-2d80-4fc4ac68929a}\Connection","PnpInstanceId",0x00000000,"PCI\VEN_1022&DEV_2000&SUBSYS_20001022&REV_10\1&644af68e&11"
HKLM,"SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}\{bf3401a0-6e70-11da-2d80-4fc4ac68929a}\Connection","ShowIcon",0x00010001,0x00000001
HKLM,"SYSTEM\CurrentControlSet\Enum\PCI\VEN_1022&DEV_2000&SUBSYS_20001022&REV_10\1&644af68e&11","Capabilities",0x00010001,0x00000000
HKLM,"SYSTEM\CurrentControlSet\Enum\PCI\VEN_1022&DEV_2000&SUBSYS_20001022&REV_10\1&644af68e&11","HardwareID",0x00010000,\
"PCI\VEN_1022&DEV_2000&SUBSYS_20001022&REV_10",\
"PCI\VEN_1022&DEV_2000&SUBSYS_20001022",\
"PCI\VEN_1022&DEV_2000&CC_020000",\
"PCI\VEN_1022&DEV_2000&CC_0200"
HKLM,"SYSTEM\CurrentControlSet\Enum\PCI\VEN_1022&DEV_2000&SUBSYS_20001022&REV_10\1&644af68e&11","CompatibleIDs",0x00010000,\
"PCI\VEN_1022&DEV_2000&SUBSYS_20001022&REV_10",\
"PCI\VEN_1022&DEV_2000&SUBSYS_20001022",\
"PCI\VEN_1022&DEV_2000&CC_020000",\
"PCI\VEN_1022&DEV_2000&CC_0200",\
"PCI\VEN_1022",\
"PCI\CC_020000",\
"PCI\CC_0200"
HKLM,"SYSTEM\CurrentControlSet\Enum\PCI\VEN_1022&DEV_2000&SUBSYS_20001022&REV_10\1&644af68e&11","DeviceDesc",0x00000000,"AMD 79c970 [PCnet32 LANCE]"
HKLM,"SYSTEM\CurrentControlSet\Enum\PCI\VEN_1022&DEV_2000&SUBSYS_20001022&REV_10\1&644af68e&11","LocationInformation",0x00000000,"PCI-Bus 0, Device 17, Function 0"
HKLM,"SYSTEM\CurrentControlSet\Enum\PCI\VEN_1022&DEV_2000&SUBSYS_20001022&REV_10\1&644af68e&11","Driver",0x00000000,"{4d36e972-e325-11ce-bfc1-08002be10318}\0000"
HKLM,"SYSTEM\CurrentControlSet\Enum\PCI\VEN_1022&DEV_2000&SUBSYS_20001022&REV_10\1&644af68e&11","Class",0x00000000,"Net"
HKLM,"SYSTEM\CurrentControlSet\Enum\PCI\VEN_1022&DEV_2000&SUBSYS_20001022&REV_10\1&644af68e&11","ClassGUID",0x00000000,"{4d36e972-e325-11ce-bfc1-08002be10318}"
HKLM,"SYSTEM\CurrentControlSet\Enum\PCI\VEN_1022&DEV_2000&SUBSYS_20001022&REV_10\1&644af68e&11","Mfg",0x00000000,"Advanced Micro Devices (AMD)"
HKLM,"SYSTEM\CurrentControlSet\Enum\PCI\VEN_1022&DEV_2000&SUBSYS_20001022&REV_10\1&644af68e&11","Service",0x00000000,"PCNet"
HKLM,"SYSTEM\CurrentControlSet\Services\{bf3401a0-6e70-11da-2d80-4fc4ac68929a}\Parameters\Tcpip","DefaultGateway",0x00000000,"0.0.0.0"
HKLM,"SYSTEM\CurrentControlSet\Services\{bf3401a0-6e70-11da-2d80-4fc4ac68929a}\Parameters\Tcpip","IPAddress",0x00000000,"0.0.0.0"
HKLM,"SYSTEM\CurrentControlSet\Services\{bf3401a0-6e70-11da-2d80-4fc4ac68929a}\Parameters\Tcpip","SubnetMask",0x00000000,"0.0.0.0"
HKLM,"SYSTEM\CurrentControlSet\Services\PCNet","Type",0x00010001,0x00000001
HKLM,"SYSTEM\CurrentControlSet\Services\PCNet","Start",0x00010001,0x00000003
HKLM,"SYSTEM\CurrentControlSet\Services\PCNet","ErrorControl",0x00010001,00000000
HKLM,"SYSTEM\CurrentControlSet\Services\PCNet","ImagePath",0x00000000,"System32\drivers\pcnet.sys"
HKLM,"SYSTEM\CurrentControlSet\Services\PCNet","Group",0x00000000,"NDIS"
; NE1000 (QEmu)
HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}\0001","NetCfgInstanceId",0x00000000,"{7f14fc20-6e7d-11da-2d80-4fc4ac68929a}"
HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}\0001","BusType",0x00000000,"5"
HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}\0001","DriverDate",0x00000000,"11-14-2005"
HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}\0001","DriverDateData",0x00000001,00,40,15,5b,ae,e8,c5,01,00,00,00,00,00,00,00,00
HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}\0001","DriverDesc",0x00000000,"RTL-8029(AS)"
HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}\0001","DriverVersion",0x00000000,"0.0.0.0"
HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}\0001","InfPath",0x00000000,"netrtpnt.inf"
HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}\0001","InfSection",0x00000000,"NE2000_Inst"
HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}\0001","InfSectionExt",0x00000000,".NT"
HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}\0001","Irq",0x00000000,"B"
HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}\0001","MatchingDeviceId",0x00000000,"PCI\VEN_10EC&DEV_8029"
HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}\0001","NetworkAddress",0x00000000,"001122334455"
HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}\0001","Port",0x00000000,"c100"
HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}\0001","ProviderName",0x00000000,"ReactOS Team"
HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}\0001\Linkage","Export",0x00000000,"\Device\{7f14fc20-6e7d-11da-2d80-4fc4ac68929a}"
HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}\0001\Linkage","RootDevice",0x00000000,"{7f14fc20-6e7d-11da-2d80-4fc4ac68929a}"
HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}\0001\Linkage","UpperBind",0x00000000,"Tcpip"
HKLM,"SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}\{7f14fc20-6e7d-11da-2d80-4fc4ac68929a}\Connection","Name",0x00000000,"Network connection"
HKLM,"SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}\{7f14fc20-6e7d-11da-2d80-4fc4ac68929a}\Connection","PnpInstanceId",0x00000000,"PCI\VEN_10EC&DEV_8029&SUBSYS_00000000&REV_00\1&644af68e&03"
HKLM,"SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}\{7f14fc20-6e7d-11da-2d80-4fc4ac68929a}\Connection","ShowIcon",0x00010001,0x00000001
HKLM,"SYSTEM\CurrentControlSet\Enum\PCI\VEN_10EC&DEV_8029&SUBSYS_00000000&REV_00\1&644af68e&03","Capabilities",0x00010001,0x00000000
HKLM,"SYSTEM\CurrentControlSet\Enum\PCI\VEN_10EC&DEV_8029&SUBSYS_00000000&REV_00\1&644af68e&03","HardwareID",0x00010000,\
"PCI\VEN_10EC&DEV_8029&SUBSYS_00000000&REV_00",\
"PCI\VEN_10EC&DEV_8029&SUBSYS_00000000",\
"PCI\VEN_10EC&DEV_8029&CC_020000",\
"PCI\VEN_10EC&DEV_8029&CC_0200"
HKLM,"SYSTEM\CurrentControlSet\Enum\PCI\VEN_10EC&DEV_8029&SUBSYS_00000000&REV_00\1&644af68e&03","CompatibleIDs",0x00010000,\
"PCI\VEN_10EC&DEV_8029&REV_00",\
"PCI\VEN_10EC&DEV_8029&",\
"PCI\VEN_10EC&CC_020000",\
"PCI\VEN_10EC&CC_0200",\
"PCI\VEN_10EC",\
"PCI\CC_020000",\
"PCI\CC_0200"
HKLM,"SYSTEM\CurrentControlSet\Enum\PCI\VEN_10EC&DEV_8029&SUBSYS_00000000&REV_00\1&644af68e&03","DeviceDesc",0x00000000,"RTL-8029(AS)"
HKLM,"SYSTEM\CurrentControlSet\Enum\PCI\VEN_10EC&DEV_8029&SUBSYS_00000000&REV_00\1&644af68e&03","LocationInformation",0x00000000,"PCI-Bus 0, Device 3, Function 0"
HKLM,"SYSTEM\CurrentControlSet\Enum\PCI\VEN_10EC&DEV_8029&SUBSYS_00000000&REV_00\1&644af68e&03","Driver",0x00000000,"{4d36e972-e325-11ce-bfc1-08002be10318}\0001"
HKLM,"SYSTEM\CurrentControlSet\Enum\PCI\VEN_10EC&DEV_8029&SUBSYS_00000000&REV_00\1&644af68e&03","Class",0x00000000,"Net"
HKLM,"SYSTEM\CurrentControlSet\Enum\PCI\VEN_10EC&DEV_8029&SUBSYS_00000000&REV_00\1&644af68e&03","ClassGUID",0x00000000,"{4d36e972-e325-11ce-bfc1-08002be10318}"
HKLM,"SYSTEM\CurrentControlSet\Enum\PCI\VEN_10EC&DEV_8029&SUBSYS_00000000&REV_00\1&644af68e&03","Mfg",0x00000000,"Realtek Semiconductor"
HKLM,"SYSTEM\CurrentControlSet\Enum\PCI\VEN_10EC&DEV_8029&SUBSYS_00000000&REV_00\1&644af68e&03","Service",0x00000000,"ne2000"
HKLM,"SYSTEM\CurrentControlSet\Services\{7f14fc20-6e7d-11da-2d80-4fc4ac68929a}\Parameters\Tcpip","DefaultGateway",0x00000000,"0.0.0.0"
HKLM,"SYSTEM\CurrentControlSet\Services\{7f14fc20-6e7d-11da-2d80-4fc4ac68929a}\Parameters\Tcpip","IPAddress",0x00000000,"0.0.0.0"
HKLM,"SYSTEM\CurrentControlSet\Services\{7f14fc20-6e7d-11da-2d80-4fc4ac68929a}\Parameters\Tcpip","SubnetMask",0x00000000,"0.0.0.0"
HKLM,"SYSTEM\CurrentControlSet\Services\ne2000","Type",0x00010001,0x00000001
HKLM,"SYSTEM\CurrentControlSet\Services\ne2000","Start",0x00010001,0x00000003
HKLM,"SYSTEM\CurrentControlSet\Services\ne2000","ErrorControl",0x00010001,00000000
HKLM,"SYSTEM\CurrentControlSet\Services\ne2000","ImagePath",0x00000000,"System32\drivers\ne2000.sys"
HKLM,"SYSTEM\CurrentControlSet\Services\ne2000","Group",0x00000000,"NDIS"
; Common info
HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Linkage","Bind",0x00010000,\
"\Device\{bf3401a0-6e70-11da-2d80-4fc4ac68929a}",\
"\Device\{7f14fc20-6e7d-11da-2d80-4fc4ac68929a}"
HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Linkage","Export",0x00010000,\
"\Device\Tcpip_{bf3401a0-6e70-11da-2d80-4fc4ac68929a}",\
"\Device\Tcpip_{7f14fc20-6e7d-11da-2d80-4fc4ac68929a}"
HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Linkage","Route",0x00010000,\
"{bf3401a0-6e70-11da-2d80-4fc4ac68929a}",\
"{7f14fc20-6e7d-11da-2d80-4fc4ac68929a}"
; EOF

View File

@@ -137,7 +137,6 @@ lib\ntdll\ntdll.dll 1
lib\ntmarta\ntmarta.dll 1
lib\objsel\objsel.dll 1
lib\ole32\ole32.dll 1
lib\oleacc\oleacc.dll 1
lib\oleaut32\oleaut32.dll 1
lib\oledlg\oledlg.dll 1
lib\olepro32\olepro32.dll 1
@@ -188,7 +187,6 @@ subsys\system\explorer\explorer-cfg-template.xml 4
subsys\system\explorer\notifyhook\notifyhook.dll 1
subsys\system\format\format.exe 1
subsys\system\ibrowser\ibrowser.exe 1
subsys\system\msconfig\msconfig.exe 1
subsys\system\msiexec\msiexec.exe 1
subsys\system\notepad\notepad.exe 1
subsys\system\gettype\gettype.exe 1
@@ -228,7 +226,6 @@ apps\utils\net\whois\whois.exe 1
apps\utils\ps\ps.exe 1
apps\utils\rosperf\rosperf.exe 1
apps\utils\shutdown\shutdown.exe 1
apps\utils\getfirefox\getfirefox.exe 1
media\fonts\c0419bt_.ttf 3
media\fonts\c0582bt_.ttf 3
media\fonts\c0583bt_.ttf 3
@@ -314,7 +311,7 @@ media\inf\display.inf 6
media\inf\hdc.inf 6
media\inf\layout.inf 6
media\inf\machine.inf 6
media\inf\msmouse.inf 6
media\inf\mouse.inf 6
media\inf\keyboard.inf 6
media\inf\NET_NIC.inf 6
media\inf\netamd.inf 6

View File

@@ -66,15 +66,9 @@ hal.dll = 2
halmp.dll = 2,hal.dll
[Display]
;<id> = <user friendly name>,<spare>,<service key name>,<hight>,<width>,<bpp>
vga = "VGA Display (640x680x8)",,Vga,640,480,8
vbe_640x480x8 = "VESA Display (640x680x8)",,VBE,640,480,8
vbe_640x480x16 = "VESA Display (640x680x16)",,VBE,640,480,16
vbe_800x600x8 = "VESA Display (800x600x8)",,VBE,800,600,8
vbe = "VESA Display (800x600x16)",,VBE,800,600,16
vbe_1024x768x8 = "VESA Display (1024x768x8)",,VBE,1024,768,8
vbe_1024x768x16 = "VESA Display (1024x768x16)",,VBE,1024,768,16
;<id> = <user friendly name>,<spare>,<service key name>
vga = "VGA Display",,Vga
vbe = "VESA Display",,VBE
[Map.Display]
;<id> = <pnp id string>
@@ -98,7 +92,6 @@ Default = "XT-, AT- or extended keyboard (83-105 keys)"
0000041D = "Swedish (Sweden)"
00000807 = "German (Swiss)"
00000408 = "Greek"
00000422 = "Ukrainian"
00010408 = "Greek 220"
[Files.KeyboardLayout]
@@ -111,7 +104,6 @@ Default = "XT-, AT- or extended keyboard (83-105 keys)"
0000040E = kbdhu.dll
00000419 = kbdru.dll
0000041D = kbdse.dll
00000422 = kbdur.dll
00000809 = kbduk.dll
00000807 = kbdsg.dll
00000813 = kbdbe.dll

View File

@@ -48,4 +48,4 @@
Whether to compile for debugging. No compiler optimizations will be
performed.
-->
<property name="DBG" value="1" />
<property name="DBG" value="0" />

View File

@@ -45,7 +45,7 @@
* Set to Write Mode 2 and Read Mode 0.
*/
static const VGA_REGISTERS Mode12Regs =
static VGA_REGISTERS Mode12Regs =
{
/* CRT Controller Registers */
{0x5F, 0x4F, 0x50, 0x82, 0x54, 0x80, 0x0B, 0x3E, 0x00, 0x40, 0x00, 0x00,
@@ -69,9 +69,6 @@ long maskbit[640];
static CLIENT_ID BitmapThreadId;
static PUCHAR BootimageBitmap;
static LONG ShutdownNotify;
static KEVENT ShutdownCompleteEvent;
/* DATA **********************************************************************/
static PDRIVER_OBJECT BootVidDriverObject = NULL;
@@ -159,7 +156,7 @@ vgaPreCalc()
STATIC VOID FASTCALL
vgaSetRegisters(const VGA_REGISTERS *Registers)
vgaSetRegisters(PVGA_REGISTERS Registers)
{
UINT i;
@@ -240,9 +237,6 @@ static VOID STDCALL
VidCleanUp(VOID)
{
InbvUnmapVideoMemory();
InterlockedIncrement(&ShutdownNotify);
KeWaitForSingleObject(&ShutdownCompleteEvent, Executive, KernelMode,
FALSE, NULL);
}
@@ -501,7 +495,7 @@ InbvFadeUpPalette()
FaderPaletteDelta[i].b = ((Palette[i].rgbBlue << 8) / PALETTE_FADE_STEPS);
}
for (i = 0; i < PALETTE_FADE_STEPS && !ShutdownNotify; i++)
for (i = 0; i < PALETTE_FADE_STEPS; i++)
{
/* Disable screen and enable palette access. */
READ_PORT_UCHAR(STATUS);
@@ -554,7 +548,6 @@ InbvBitmapThreadMain(PVOID Ignored)
{
DbgPrint("Warning: Cannot find boot image\n");
}
KeSetEvent(&ShutdownCompleteEvent, 0, FALSE);
}
@@ -646,9 +639,6 @@ DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath)
BootVidDriverObject = DriverObject;
ShutdownNotify = 0;
KeInitializeEvent(&ShutdownCompleteEvent, NotificationEvent, FALSE);
/* Register driver routines */
DriverObject->MajorFunction[IRP_MJ_CLOSE] = VidDispatch;
DriverObject->MajorFunction[IRP_MJ_CREATE] = VidDispatch;

View File

@@ -29,7 +29,7 @@ DriverEntry(
DriverObject->DriverUnload = DriverUnload;
DriverObject->DriverExtension->AddDevice = SerialAddDevice;
for (i = 0; i <= IRP_MJ_MAXIMUM_FUNCTION; i++)
for (i = 0; i < IRP_MJ_MAXIMUM_FUNCTION; i++)
DriverObject->MajorFunction[i] = ForwardIrpAndForget;
DriverObject->MajorFunction[IRP_MJ_CREATE] = SerialCreate;
DriverObject->MajorFunction[IRP_MJ_CLOSE] = SerialClose;

View File

@@ -50,11 +50,6 @@ CdfsSwapString(PWCHAR Out,
if (t[i+1] == 0 && t[i] == ';')
break;
}
if ((i>2)&&(t[i-2] == '.'))
{
t[i-2] = 0;
t[i-1] = 0;
}
t[i] = 0;
t[i+1] = 0;
}

View File

@@ -798,7 +798,7 @@ DriverEntry(
DriverObject->DriverExtension->AddDevice = ClassAddDevice;
DriverObject->DriverUnload = DriverUnload;
for (i = 0; i <= IRP_MJ_MAXIMUM_FUNCTION; i++)
for (i = 0; i < IRP_MJ_MAXIMUM_FUNCTION; i++)
DriverObject->MajorFunction[i] = IrpStub;
DriverObject->MajorFunction[IRP_MJ_CREATE] = ClassCreate;

View File

@@ -108,8 +108,7 @@ VOID LoopSubmitReceiveWork(
TI_DbgPrint(DEBUG_DATALINK,
("Work item inserted %x %x\n", &LoopWorkItem, WQItem));
} else {
TI_DbgPrint(DEBUG_DATALINK,
("LOOP WORKER BUSY %x %x\n", &LoopWorkItem, WQItem));
DbgPrint("LOOP WORKER BUSY %x %x\n", &LoopWorkItem, WQItem);
}
TcpipReleaseSpinLock( &LoopWorkLock, OldIrql );
}

View File

@@ -15,8 +15,6 @@ VOID PortsStartup( PPORT_SET PortSet,
UINT PortsToManage ) {
PortSet->StartingPort = StartingPort;
PortSet->PortsToOversee = PortsToManage;
PortSet->LastAllocatedPort = PortSet->StartingPort +
PortSet->PortsToOversee - 1;
PortSet->ProtoBitBuffer =
PoolAllocateBuffer( (PortSet->PortsToOversee + 7) / 8 );
RtlInitializeBitMap( &PortSet->ProtoBitmap,
@@ -54,22 +52,12 @@ BOOLEAN AllocatePort( PPORT_SET PortSet, ULONG Port ) {
ULONG AllocateAnyPort( PPORT_SET PortSet ) {
ULONG AllocatedPort;
ULONG Next;
if (PortSet->StartingPort + PortSet->PortsToOversee <=
PortSet->LastAllocatedPort + 1) {
Next = PortSet->StartingPort;
} else {
Next = PortSet->LastAllocatedPort + 1;
}
Next -= PortSet->StartingPort;
ExAcquireFastMutex( &PortSet->Mutex );
AllocatedPort = RtlFindClearBits( &PortSet->ProtoBitmap, 1, 0 );
if( AllocatedPort != (ULONG)-1 ) {
RtlSetBit( &PortSet->ProtoBitmap, AllocatedPort );
AllocatedPort += PortSet->StartingPort;
PortSet->LastAllocatedPort = AllocatedPort;
}
ExReleaseFastMutex( &PortSet->Mutex );
@@ -80,28 +68,16 @@ ULONG AllocateAnyPort( PPORT_SET PortSet ) {
ULONG AllocatePortFromRange( PPORT_SET PortSet, ULONG Lowest, ULONG Highest ) {
ULONG AllocatedPort;
ULONG Next;
if (PortSet->StartingPort + PortSet->PortsToOversee <=
PortSet->LastAllocatedPort + 1) {
Next = PortSet->StartingPort;
} else {
Next = PortSet->LastAllocatedPort + 1;
}
if (Next < Lowest || Highest <= Next) {
Next = Lowest;
}
Next -= PortSet->StartingPort;
Lowest -= PortSet->StartingPort;
Highest -= PortSet->StartingPort;
ExAcquireFastMutex( &PortSet->Mutex );
AllocatedPort = RtlFindClearBits( &PortSet->ProtoBitmap, 1, Next );
AllocatedPort = RtlFindClearBits( &PortSet->ProtoBitmap, 1, Lowest );
if( AllocatedPort != (ULONG)-1 && AllocatedPort >= Lowest &&
AllocatedPort <= Highest) {
RtlSetBit( &PortSet->ProtoBitmap, AllocatedPort );
AllocatedPort += PortSet->StartingPort;
PortSet->LastAllocatedPort = AllocatedPort;
}
ExReleaseFastMutex( &PortSet->Mutex );

View File

@@ -89,7 +89,7 @@ int TCPPacketSend(void *ClientData, OSK_PCHAR data, OSK_UINT len ) {
if (NdisStatus != NDIS_STATUS_SUCCESS) {
TI_DbgPrint(DEBUG_TCP, ("Error from NDIS: %08x\n", NdisStatus));
return OSK_ENOBUFS;
return STATUS_NO_MEMORY;
}
GetDataPtr( Packet.NdisPacket, MaxLLHeaderSize,

View File

@@ -307,68 +307,6 @@ OSKITTCP_EVENT_HANDLERS EventHandlers = {
TCPWakeup /* Wakeup */
};
static KEVENT TimerLoopEvent;
static HANDLE TimerThreadHandle;
/*
* We are running 2 timers here, one with a 200ms interval (fast) and the other
* with a 500ms interval (slow). So we need to time out at 200, 400, 500, 600,
* 800, 1000 and process the "fast" events at 200, 400, 600, 800, 1000 and the
* "slow" events at 500 and 1000.
*/
static VOID DDKAPI
TimerThread(PVOID Context)
{
LARGE_INTEGER Timeout;
NTSTATUS Status;
unsigned Current, NextFast, NextSlow, Next;
Current = 0;
Next = 0;
NextFast = 0;
NextSlow = 0;
while ( 1 ) {
if (Next == NextFast) {
NextFast += 2;
}
if (Next == NextSlow) {
NextSlow += 5;
}
Next = min(NextFast, NextSlow);
Timeout.QuadPart = (LONGLONG) (Next - Current) * -1000000; /* 100 ms */
Status = KeWaitForSingleObject(&TimerLoopEvent, Executive, KernelMode,
FALSE, &Timeout);
if (STATUS_SUCCESS == Status) {
PsTerminateSystemThread(STATUS_SUCCESS);
}
ASSERT(STATUS_TIMEOUT == Status);
TcpipRecursiveMutexEnter( &TCPLock, TRUE );
TimerOskitTCP( Next == NextFast, Next == NextSlow );
if (Next == NextSlow) {
DrainSignals();
}
TcpipRecursiveMutexLeave( &TCPLock );
Current = Next;
if (10 <= Current) {
Current = 0;
Next = 0;
NextFast = 0;
NextSlow = 0;
}
}
}
static VOID
StartTimer(VOID)
{
KeInitializeEvent(&TimerLoopEvent, NotificationEvent, FALSE);
PsCreateSystemThread(&TimerThreadHandle, THREAD_ALL_ACCESS, 0, 0, 0,
TimerThread, NULL);
}
NTSTATUS TCPStartup(VOID)
/*
* FUNCTION: Initializes the TCP subsystem
@@ -398,8 +336,6 @@ NTSTATUS TCPStartup(VOID)
TAG('T','C','P','S'), /* Tag */
0); /* Depth */
StartTimer();
TCPInitialized = TRUE;
return STATUS_SUCCESS;
@@ -413,15 +349,9 @@ NTSTATUS TCPShutdown(VOID)
* Status of operation
*/
{
LARGE_INTEGER WaitForThread;
if (!TCPInitialized)
return STATUS_SUCCESS;
WaitForThread.QuadPart = -2500000; /* 250 ms */
KeSetEvent(&TimerLoopEvent, IO_NO_INCREMENT, FALSE);
ZwWaitForSingleObject(TimerThreadHandle, FALSE, &WaitForThread);
/* Deregister this protocol with IP layer */
IPRegisterProtocol(IPPROTO_TCP, NULL);
@@ -668,7 +598,13 @@ NTSTATUS TCPSendData
}
VOID TCPTimeout(VOID) {
/* Now handled by TimerThread */
static int Times = 0;
TcpipRecursiveMutexEnter( &TCPLock, TRUE );
if( (Times++ % 5) == 0 ) {
TimerOskitTCP();
}
DrainSignals();
TcpipRecursiveMutexLeave( &TCPLock );
}
UINT TCPAllocatePort( UINT HintPort ) {

View File

@@ -304,12 +304,9 @@ union mcluster {
#ifdef __REACTOS__
#define MCLGET(m, how) { \
OS_DbgPrint(OSK_MID_TRACE,("(MCLGET) m = %x\n", m)); \
(m)->m_ext.ext_buf = malloc(MCLBYTES); \
if ((m)->m_ext.ext_buf != NULL) { \
(m)->m_data = (m)->m_ext.ext_buf; \
(m)->m_flags |= M_EXT; \
(m)->m_ext.ext_size = MCLBYTES; \
} \
(m)->m_data = (m)->m_ext.ext_buf = malloc(MCLBYTES); \
(m)->m_flags |= M_EXT; \
(m)->m_ext.ext_size = MCLBYTES; \
}
#define MCLFREE(p) { \

View File

@@ -105,7 +105,7 @@ extern OSKITTCP_EVENT_HANDLERS OtcpEvent;
extern void InitOskitTCP();
extern void DeinitOskitTCP();
extern void TimerOskitTCP( int FastTimer, int SlowTimer );
extern void TimerOskitTCP();
extern void OskitDumpBuffer( OSK_PCHAR Data, OSK_UINT Len );
extern int OskitTCPShutdown( void *socket, int disconn_type );
extern int OskitTCPSocket( void *Connection, void **ConnectionContext,

View File

@@ -66,13 +66,9 @@ void InitOskitTCP() {
void DeinitOskitTCP() {
}
void TimerOskitTCP( int FastTimer, int SlowTimer ) {
if ( SlowTimer ) {
tcp_slowtimo();
}
if ( FastTimer ) {
tcp_fasttimo();
}
void TimerOskitTCP() {
tcp_slowtimo();
tcp_fasttimo();
}
void RegisterOskitTCPEventHandlers( POSKITTCP_EVENT_HANDLERS EventHandlers ) {

View File

@@ -366,17 +366,8 @@ sendit:
#ifdef __REACTOS__
if( OtcpEvent.PacketSend ) {
struct mbuf *new_m;
new_m = m_get( M_DONTWAIT, 0 );
if ( NULL == new_m ) {
error = ENOBUFS;
goto done;
}
MGET( new_m, M_DONTWAIT, 0 );
MCLGET( new_m, M_DONTWAIT );
if (0 == (new_m->m_flags & M_EXT)) {
m_free( new_m );
error = ENOBUFS;
goto done;
}
m_copydata( m, 0, htons(ip->ip_len), new_m->m_data );
new_m->m_len = htons(ip->ip_len);
error = OtcpEvent.PacketSend( OtcpEvent.ClientData,
@@ -507,16 +498,7 @@ sendorfree:
if( error == 0 && OtcpEvent.PacketSend ) {
struct mbuf *new_m;
MGET( new_m, M_DONTWAIT, 0 );
if ( NULL == new_m ) {
error = ENOBUFS;
goto done;
}
MCLGET( new_m, M_DONTWAIT );
if (0 == (new_m->m_flags & M_EXT)) {
m_free( new_m );
error = ENOBUFS;
goto done;
}
m_copydata( m, 0, htons(ip->ip_len), new_m->m_data );
new_m->m_len = htons(ip->ip_len);
error = OtcpEvent.PacketSend( OtcpEvent.ClientData,

View File

@@ -66,9 +66,6 @@
extern struct mbuf *m_copypack();
#endif
#define IS_LOOPBACK_ADDR(addr) \
((ntohl(addr) & IN_CLASSA_NET) == (IN_LOOPBACKNET << IN_CLASSA_NSHIFT))
/*
* Tcp output routine: figure out what should be sent and send it.
@@ -218,8 +215,8 @@ again:
win = sbspace(&so->so_rcv);
/*
* Sender silly window avoidance. If connection is idle or using
* the loopback interface and can send all data, a maximum segment,
* Sender silly window avoidance. If connection is idle
* and can send all data, a maximum segment,
* at least a maximum default-size segment do it,
* or are forced, do it; otherwise don't bother.
* If peer's buffer is tiny, then send
@@ -230,8 +227,7 @@ again:
if (len) {
if (len == tp->t_maxseg)
goto send;
if ((idle || tp->t_flags & TF_NODELAY ||
IS_LOOPBACK_ADDR(tp->t_inpcb->inp_laddr.s_addr)) &&
if ((idle || tp->t_flags & TF_NODELAY) &&
(tp->t_flags & TF_NOPUSH) == 0 &&
len + off >= so->so_snd.sb_cc)
goto send;

View File

@@ -180,7 +180,7 @@ NdisOpenConfiguration(
NDIS_DbgPrint(MAX_TRACE, ("Called\n"));
*Status = ZwDuplicateObject(NtCurrentProcess(), RootKeyHandle,
NtCurrentProcess(), &KeyHandle, 0, 0,
NtCurrentProcess(), &KeyHandle, 0, FALSE,
DUPLICATE_SAME_ACCESS);
if(!NT_SUCCESS(*Status))
{

View File

@@ -16,7 +16,6 @@ typedef struct _PORT_SET {
PVOID ProtoBitBuffer;
UINT StartingPort;
UINT PortsToOversee;
UINT LastAllocatedPort;
FAST_MUTEX Mutex;
} PORT_SET, *PPORT_SET;

View File

@@ -50,7 +50,7 @@ PciIdeXInitialize(
DriverObject->DriverExtension->AddDevice = PciIdeXAddDevice;
for (i = 0; i <= IRP_MJ_MAXIMUM_FUNCTION; i++)
for (i = 0; i < IRP_MJ_MAXIMUM_FUNCTION; i++)
DriverObject->MajorFunction[i] = ForwardIrpAndForget;
DriverObject->MajorFunction[IRP_MJ_PNP] = PciIdeXPnpDispatch;

View File

@@ -8,6 +8,8 @@
*/
#define NDEBUG
#include <debug.h>
#include "usbcommon.h"
NTSTATUS STDCALL

View File

@@ -8,6 +8,8 @@
*/
#define NDEBUG
#include <debug.h>
#include "usbcommon.h"
NTSTATUS STDCALL

View File

@@ -1,5 +1,6 @@
<module name="usbminiportcommon" type="objectlibrary" allowwarnings="true">
<module name="usbminiportcommon" type="objectlibrary">
<define name="__USE_W32API" />
<define name="DEBUG_MODE" />
<include>../linux</include>
<include base="usbport">.</include>
<file>cleanup.c</file>

View File

@@ -8,6 +8,8 @@
*/
#define NDEBUG
#include <debug.h>
#include "usbcommon.h"
NTSTATUS STDCALL

View File

@@ -8,7 +8,9 @@
* James Tabor (jimtabor@adsl-64-217-116-74.dsl.hstntx.swbell.net)
*/
//#define NDEBUG
#define NDEBUG
#include <debug.h>
#include "usbcommon.h"
#define IO_METHOD_FROM_CTL_CODE(ctlCode) (ctlCode&0x00000003)
@@ -46,35 +48,6 @@ UsbMpGetUserBuffers(
}
}
BOOLEAN STDCALL
HciInterruptService(IN PKINTERRUPT Interrupt,
IN OUT PVOID ServiceContext)
{
DPRINT1("USBMP Interrupt\n");
return FALSE;
}
static VOID
UsbMpRegisterIsr(PDEVICE_OBJECT DeviceObject)
{
NTSTATUS Status;
PUSBMP_DEVICE_EXTENSION DeviceExtension = (PUSBMP_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
/* Connect interrupt and enable them */
DPRINT("IoConnectInterrupt: vec=0x%x,lev=0x%x,mode=0x%x,aff=0x%x\n", DeviceExtension->InterruptVector, DeviceExtension->InterruptLevel, DeviceExtension->InterruptMode, DeviceExtension->InterruptAffinity);
Status = IoConnectInterrupt(
&DeviceExtension->InterruptObject, (PKSERVICE_ROUTINE)HciInterruptService,
DeviceObject, NULL,
DeviceExtension->InterruptVector, DeviceExtension->InterruptLevel, DeviceExtension->InterruptLevel,
DeviceExtension->InterruptMode, DeviceExtension->InterruptShare,
DeviceExtension->InterruptAffinity, FALSE);
if (!NT_SUCCESS(Status))
{
DPRINT1("usbmp: IoConnectInterrupt() failed with status 0x%08x\n", Status);
return;
}
}
NTSTATUS STDCALL
UsbMpFdoStartDevice(
IN PDEVICE_OBJECT DeviceObject,
@@ -85,10 +58,6 @@ UsbMpFdoStartDevice(
PUSBMP_DRIVER_EXTENSION DriverExtension;
PUSBMP_DEVICE_EXTENSION DeviceExtension;
PCM_RESOURCE_LIST AllocatedResources;
ULONG Size;
USHORT FunctionNum, DeviceNum;
ULONG propAddress;
NTSTATUS Status;
if (DeviceObject == KeyboardFdo || DeviceObject == MouseFdo)
return STATUS_SUCCESS;
@@ -103,7 +72,7 @@ UsbMpFdoStartDevice(
/*
* Store some resources in the DeviceExtension.
*/
AllocatedResources = Stack->Parameters.StartDevice.AllocatedResourcesTranslated;
AllocatedResources = Stack->Parameters.StartDevice.AllocatedResources;
if (AllocatedResources != NULL)
{
CM_FULL_RESOURCE_DESCRIPTOR *FullList;
@@ -145,14 +114,6 @@ UsbMpFdoStartDevice(
{
DeviceExtension->InterruptLevel = Descriptor->u.Interrupt.Level;
DeviceExtension->InterruptVector = Descriptor->u.Interrupt.Vector;
DeviceExtension->InterruptAffinity = Descriptor->u.Interrupt.Affinity;
if (Descriptor->Flags & CM_RESOURCE_INTERRUPT_LATCHED)
DeviceExtension->InterruptMode = Latched;
else
DeviceExtension->InterruptMode = LevelSensitive;
DeviceExtension->InterruptShare = (Descriptor->ShareDisposition == CmResourceShareShared);
}
else if (Descriptor->Type == CmResourceTypePort)
{
@@ -181,52 +142,6 @@ UsbMpFdoStartDevice(
DeviceExtension->BaseAddress,
DeviceExtension->BaseAddrLength);
/* Register Interrupt Service Routine */
UsbMpRegisterIsr(DeviceObject);
/* Acquire some information about the placement of the controller in the bus */
/* Get bus number from the upper level bus driver. */
Size = sizeof(ULONG);
Status = IoGetDeviceProperty(
DeviceExtension->PhysicalDeviceObject,
DevicePropertyBusNumber,
Size,
&DeviceExtension->SystemIoBusNumber,
&Size);
if (!NT_SUCCESS(Status))
{
DPRINT1("USBMP: IoGetDeviceProperty DevicePropertyBusNumber failed\n");
DeviceExtension->SystemIoBusNumber = 0;
}
DPRINT("USBMP: Busnumber %d\n", DeviceExtension->SystemIoBusNumber);
/* Get bus device address from the upper level bus driver. */
Size = sizeof(ULONG);
IoGetDeviceProperty(
DeviceExtension->PhysicalDeviceObject,
DevicePropertyAddress,
Size,
&propAddress,
&Size);
DeviceExtension->SystemIoSlotNumber.u.AsULONG = 0;
if (!NT_SUCCESS(Status))
{
DPRINT1("USBMP: IoGetDeviceProperty DevicePropertyAddress failed\n");
}
FunctionNum = (USHORT)((propAddress) & 0x0000FFFF);
DeviceNum = (USHORT)(((propAddress) >> 16) & 0x0000FFFF);
DeviceExtension->SystemIoSlotNumber.u.bits.DeviceNumber = DeviceNum;
DeviceExtension->SystemIoSlotNumber.u.bits.FunctionNumber = FunctionNum;
DPRINT("USBMP: Slotnumber 0x%x, Device: 0x%x, Func: 0x%x\n", DeviceExtension->SystemIoSlotNumber.u.AsULONG, DeviceNum, FunctionNum);
/* Init wrapper with this object */
return InitLinuxWrapper(DeviceObject);
}

View File

@@ -12,6 +12,8 @@
*/
#define NDEBUG
#include <debug.h>
#define INITGUID
#include "usbcommon.h"
@@ -396,19 +398,19 @@ DriverEntry(IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegPath)
USBPORT_INTERFACE UsbPortInterface;
ULONG i;
DriverObject->DriverUnload = (PDRIVER_UNLOAD)DriverUnload;
DriverObject->DriverExtension->AddDevice = (PDRIVER_ADD_DEVICE)AddDevice;
DriverObject->DriverUnload = DriverUnload;
DriverObject->DriverExtension->AddDevice = AddDevice;
for (i = 0; i < IRP_MJ_MAXIMUM_FUNCTION; i++)
DriverObject->MajorFunction[i] = (PDRIVER_DISPATCH)IrpStub;
DriverObject->MajorFunction[i] = IrpStub;
DriverObject->MajorFunction[IRP_MJ_CREATE] = (PDRIVER_DISPATCH)DispatchCreate;
DriverObject->MajorFunction[IRP_MJ_CLOSE] = (PDRIVER_DISPATCH)DispatchClose;
DriverObject->MajorFunction[IRP_MJ_CLEANUP] = (PDRIVER_DISPATCH)DispatchCleanup;
DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = (PDRIVER_DISPATCH)DispatchDeviceControl;
DriverObject->MajorFunction[IRP_MJ_INTERNAL_DEVICE_CONTROL] = (PDRIVER_DISPATCH)DispatchInternalDeviceControl;
DriverObject->MajorFunction[IRP_MJ_PNP] = (PDRIVER_DISPATCH)DispatchPnp;
DriverObject->MajorFunction[IRP_MJ_POWER] = (PDRIVER_DISPATCH)DispatchPower;
DriverObject->MajorFunction[IRP_MJ_CREATE] = DispatchCreate;
DriverObject->MajorFunction[IRP_MJ_CLOSE] = DispatchClose;
DriverObject->MajorFunction[IRP_MJ_CLEANUP] = DispatchCleanup;
DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = DispatchDeviceControl;
DriverObject->MajorFunction[IRP_MJ_INTERNAL_DEVICE_CONTROL] = DispatchInternalDeviceControl;
DriverObject->MajorFunction[IRP_MJ_PNP] = DispatchPnp;
DriverObject->MajorFunction[IRP_MJ_POWER] = DispatchPower;
// Register in usbcore.sys
UsbPortInterface.KbdConnectData = &KbdClassInformation;

View File

@@ -8,6 +8,8 @@
*/
#define NDEBUG
#include <debug.h>
#include "usbcommon.h"
#include <stdarg.h>
@@ -37,7 +39,7 @@ ForwardIrpAndWait(
IoCopyCurrentIrpStackLocationToNext(Irp);
DPRINT("USBMP: Calling lower device %p [%wZ]\n", LowerDevice, &LowerDevice->DriverObject->DriverName);
IoSetCompletionRoutine(Irp, (PIO_COMPLETION_ROUTINE)ForwardIrpAndWaitCompletion, &Event, TRUE, TRUE, TRUE);
IoSetCompletionRoutine(Irp, ForwardIrpAndWaitCompletion, &Event, TRUE, TRUE, TRUE);
Status = IoCallDriver(LowerDevice, Irp);
if (Status == STATUS_PENDING)

View File

@@ -9,6 +9,8 @@
*/
#define NDEBUG
#include <debug.h>
#include "usbcommon.h"
extern struct usb_driver hub_driver;
@@ -85,8 +87,7 @@ UsbMpPdoQueryId(
DeviceExtension = (PUSBMP_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
RtlInitUnicodeString(&String, NULL);
DeviceExtension = (PUSBMP_DEVICE_EXTENSION)DeviceExtension->FunctionalDeviceObject->DeviceExtension;
//roothub = ((struct usb_hcd*)DeviceExtension->pdev->data)->self.root_hub;
roothub = hcd_to_bus(DeviceExtension->pdev->data)->root_hub;
roothub = ((struct usb_hcd*)DeviceExtension->pdev->data)->self.root_hub;
switch (IdType)
{
@@ -169,8 +170,8 @@ UsbMpPdoQueryId(
case BusQueryInstanceID:
{
DPRINT("USBMP: IRP_MJ_PNP / IRP_MN_QUERY_ID / BusQueryInstanceID\n");
*Information = 0;
return Status;
RtlInitUnicodeString(&SourceString, L"");
break;
}
default:
DPRINT1("USBMP: IRP_MJ_PNP / IRP_MN_QUERY_ID / unknown query id type 0x%lx\n", IdType);
@@ -296,7 +297,7 @@ UsbMpPnpPdo(
DPRINT("USBMP: IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_TEXT / DeviceTextDescription\n");
Status = _RtlDuplicateUnicodeString(RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE, &SourceString, &Description);
Status = RtlDuplicateUnicodeString(RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE, &SourceString, &Description);
if (NT_SUCCESS(Status))
Information = (ULONG_PTR)Description.Buffer;
break;

View File

@@ -12,10 +12,6 @@
#define TAG(A, B, C, D) (ULONG)(((A)<<0) + ((B)<<8) + ((C)<<16) + ((D)<<24))
#define USB_MINIPORT_TAG TAG('u','s','b','m')
#ifndef RTL_CONSTANT_STRING
#define RTL_CONSTANT_STRING(s) { sizeof(s) - sizeof((s)[0]), sizeof(s), s }
#endif
#include "../../usbport/hcd.h"
#include "usbcommon_types.h"

View File

@@ -6,7 +6,7 @@ typedef struct _USBMP_DRIVER_EXTENSION
//OHCI_HW_INITIALIZATION_DATA InitializationData;
//PVOID HwContext;
//UNICODE_STRING RegistryPath;
void *dummy;
} USBMP_DRIVER_EXTENSION, *PUSBMP_DRIVER_EXTENSION;
typedef struct _USBMP_DEVICE_EXTENSTION
@@ -17,23 +17,17 @@ typedef struct _USBMP_DEVICE_EXTENSTION
PDEVICE_OBJECT NextDeviceObject;
//UNICODE_STRING RegistryPath;
UNICODE_STRING HcdInterfaceName;
//PKINTERRUPT InterruptObject;
//KSPIN_LOCK InterruptSpinLock;
PCM_RESOURCE_LIST AllocatedResources;
/* Interrupt-related info */
PKINTERRUPT InterruptObject;
ULONG InterruptVector;
ULONG InterruptLevel;
KINTERRUPT_MODE InterruptMode;
BOOLEAN InterruptShare;
KAFFINITY InterruptAffinity;
PHYSICAL_ADDRESS BaseAddress;
ULONG BaseAddrLength;
ULONG Flags;
//ULONG AdapterInterfaceType;
ULONG SystemIoBusNumber;
PCI_SLOT_NUMBER SystemIoSlotNumber;
//ULONG SystemIoBusNumber;
ULONG SystemIoSlotNumber;
//LIST_ENTRY AddressMappingListHead;
// DMA stuff, and buffers

View File

@@ -6,10 +6,10 @@
</directory>
<!--directory name="usbehci">
<xi:include href="usbehci/usbehci.xml" />
</directory
</directory-->
<directory name="usbohci">
<xi:include href="usbohci/usbohci.xml" />
</directory>-->
</directory>
<directory name="usbuhci">
<xi:include href="usbuhci/usbuhci.xml" />
</directory>

View File

@@ -33,18 +33,12 @@
* Note that @nr may be almost arbitrarily large; this function is not
* restricted to acting on a single-word quantity.
*/
static __inline void set_bit(int nr, volatile void * addr)
static __inline__ void set_bit(int nr, volatile void * addr)
{
#if defined(__GNUC__)
__asm__ __volatile__( LOCK_PREFIX
"btsl %1,%0"
:"=m" (ADDR)
:"Ir" (nr));
#elif defined(_MSC_VER)
InterlockedBitTestAndSet(addr, nr);
#else
#error Unknown compiler for inline assembler!
#endif
}
/**
@@ -56,18 +50,12 @@ static __inline void set_bit(int nr, volatile void * addr)
* If it's called on the same region of memory simultaneously, the effect
* may be that only one operation succeeds.
*/
static __inline void __set_bit(int nr, volatile void * addr)
static __inline__ void __set_bit(int nr, volatile void * addr)
{
#if defined(__GNUC__)
__asm__(
"btsl %1,%0"
:"=m" (ADDR)
:"Ir" (nr));
#elif defined(_MSC_VER)
set_bit(nr, addr);
#else
#error Unknown compiler for inline assembler
#endif
}
/**
@@ -80,22 +68,12 @@ static __inline void __set_bit(int nr, volatile void * addr)
* you should call smp_mb__before_clear_bit() and/or smp_mb__after_clear_bit()
* in order to ensure changes are visible on other processors.
*/
static __inline void clear_bit(int nr, volatile void * addr)
static __inline__ void clear_bit(int nr, volatile void * addr)
{
#if defined(__GNUC__)
__asm__ __volatile__( LOCK_PREFIX
"btrl %1,%0"
:"=m" (ADDR)
:"Ir" (nr));
#elif defined(_MSC_VER)
__asm {
mov eax, nr
mov ecx, addr
lock btr [ecx], eax
};
#else
#error Unknown compiler for inline assembler
#endif
}
#define smp_mb__before_clear_bit() barrier()
#define smp_mb__after_clear_bit() barrier()
@@ -109,22 +87,12 @@ static __inline void clear_bit(int nr, volatile void * addr)
* If it's called on the same region of memory simultaneously, the effect
* may be that only one operation succeeds.
*/
static __inline void __change_bit(int nr, volatile void * addr)
static __inline__ void __change_bit(int nr, volatile void * addr)
{
#if defined(__GNUC__)
__asm__ __volatile__(
"btcl %1,%0"
:"=m" (ADDR)
:"Ir" (nr));
#elif defined(_MSC_VER)
__asm {
mov eax, nr
mov ecx, addr
btc [ecx], eax
};
#else
#error Unknown compiler for inline assembler
#endif
}
/**
@@ -136,22 +104,12 @@ static __inline void __change_bit(int nr, volatile void * addr)
* Note that @nr may be almost arbitrarily large; this function is not
* restricted to acting on a single-word quantity.
*/
static __inline void change_bit(int nr, volatile void * addr)
static __inline__ void change_bit(int nr, volatile void * addr)
{
#if defined(__GNUC__)
__asm__ __volatile__( LOCK_PREFIX
"btcl %1,%0"
:"=m" (ADDR)
:"Ir" (nr));
#elif defined(_MSC_VER)
__asm {
mov eax, nr
mov ecx, addr
lock btc [ecx], eax
};
#else
#error Unknown compiler for inline assembler
#endif
}
/**
@@ -162,22 +120,15 @@ static __inline void change_bit(int nr, volatile void * addr)
* This operation is atomic and cannot be reordered.
* It also implies a memory barrier.
*/
static __inline int test_and_set_bit(int nr, volatile void * addr)
static __inline__ int test_and_set_bit(int nr, volatile void * addr)
{
#if defined(__GNUC__)
int oldbit;
__asm__ __volatile__( LOCK_PREFIX
"btsl %2,%1\n\tsbbl %0,%0"
:"=r" (oldbit),"=m" (ADDR)
:"Ir" (nr) : "memory");
return oldbit;
#elif defined(_MSC_VER)
return InterlockedBitTestAndSet(addr, nr);
#else
#error Unknown compiler for inline assembler
#endif
}
/**
@@ -189,9 +140,8 @@ static __inline int test_and_set_bit(int nr, volatile void * addr)
* If two examples of this operation race, one can appear to succeed
* but actually fail. You must protect multiple accesses with a lock.
*/
static __inline int __test_and_set_bit(int nr, volatile void * addr)
static __inline__ int __test_and_set_bit(int nr, volatile void * addr)
{
#if defined(__GNUC__)
int oldbit;
__asm__(
@@ -199,11 +149,6 @@ static __inline int __test_and_set_bit(int nr, volatile void * addr)
:"=r" (oldbit),"=m" (ADDR)
:"Ir" (nr));
return oldbit;
#elif defined(_MSC_VER)
return test_and_set_bit(nr, addr);
#else
#error Unknown compiler for inline assembler
#endif
}
/**
@@ -214,9 +159,8 @@ static __inline int __test_and_set_bit(int nr, volatile void * addr)
* This operation is atomic and cannot be reordered.
* It also implies a memory barrier.
*/
static __inline int test_and_clear_bit(int nr, volatile void * addr)
static __inline__ int test_and_clear_bit(int nr, volatile void * addr)
{
#if defined(__GNUC__)
int oldbit;
__asm__ __volatile__( LOCK_PREFIX
@@ -224,11 +168,6 @@ static __inline int test_and_clear_bit(int nr, volatile void * addr)
:"=r" (oldbit),"=m" (ADDR)
:"Ir" (nr) : "memory");
return oldbit;
#elif defined(_MSC_VER)
return InterlockedBitTestAndReset(addr, nr);
#else
#error Unknown compiler for inline assembler
#endif
}
/**
@@ -240,9 +179,8 @@ static __inline int test_and_clear_bit(int nr, volatile void * addr)
* If two examples of this operation race, one can appear to succeed
* but actually fail. You must protect multiple accesses with a lock.
*/
static __inline int __test_and_clear_bit(int nr, volatile void * addr)
static __inline__ int __test_and_clear_bit(int nr, volatile void * addr)
{
#if defined(__GNUC__)
int oldbit;
__asm__(
@@ -250,18 +188,11 @@ static __inline int __test_and_clear_bit(int nr, volatile void * addr)
:"=r" (oldbit),"=m" (ADDR)
:"Ir" (nr));
return oldbit;
#elif defined(_MSC_VER)
test_and_clear_bit(nr, addr);
#else
#error Unknown compiler for inline assembler
#endif
}
#ifdef THIS_IS_NOT_USED
/* WARNING: non atomic and it can be reordered! */
static __inline int __test_and_change_bit(int nr, volatile void * addr)
static __inline__ int __test_and_change_bit(int nr, volatile void * addr)
{
#if defined(__GNUC__)
int oldbit;
__asm__ __volatile__(
@@ -269,16 +200,6 @@ static __inline int __test_and_change_bit(int nr, volatile void * addr)
:"=r" (oldbit),"=m" (ADDR)
:"Ir" (nr) : "memory");
return oldbit;
#elif defined(_MSC_VER)
__asm {
mov eax, nr
mov ecx, addr
btc [ecx], eax
setc al
};
#else
#error Unknown compiler for inline assembler
#endif
}
/**
@@ -289,9 +210,8 @@ static __inline int __test_and_change_bit(int nr, volatile void * addr)
* This operation is atomic and cannot be reordered.
* It also implies a memory barrier.
*/
static __inline int test_and_change_bit(int nr, volatile void * addr)
static __inline__ int test_and_change_bit(int nr, volatile void * addr)
{
#if defined(__GNUC__)
int oldbit;
__asm__ __volatile__( LOCK_PREFIX
@@ -299,20 +219,8 @@ static __inline int test_and_change_bit(int nr, volatile void * addr)
:"=r" (oldbit),"=m" (ADDR)
:"Ir" (nr) : "memory");
return oldbit;
#elif defined(_MSC_VER)
__asm {
mov eax, nr
mov ecx, addr
btc [ecx], eax
setc al
};
#else
#error Unknown compiler for inline assembler
#endif
}
#endif /* THIS_IS_NOT_USED */
#if 0 /* Fool kernel-doc since it doesn't do macros yet */
/**
* test_bit - Determine whether a bit is set
@@ -322,42 +230,26 @@ static __inline int test_and_change_bit(int nr, volatile void * addr)
static int test_bit(int nr, const volatile void * addr);
#endif
static __inline int constant_test_bit(int nr, const volatile void * addr)
static __inline__ int constant_test_bit(int nr, const volatile void * addr)
{
return ((1UL << (nr & 31)) & (((const volatile unsigned int *) addr)[nr >> 5])) != 0;
}
static __inline int variable_test_bit(int nr, volatile void * addr)
static __inline__ int variable_test_bit(int nr, volatile void * addr)
{
int oldbit;
#if defined(__GNUC__)
__asm__ __volatile__(
"btl %2,%1\n\tsbbl %0,%0"
:"=r" (oldbit)
:"m" (ADDR),"Ir" (nr));
#elif defined(_MSC_VER)
__asm {
mov eax, nr
mov ecx, addr
bt [ecx], eax
setc al
//mov oldbit, al
};
#else
#error Unknown compiler for inline assembler
#endif
return oldbit;
}
/*
#define test_bit(nr,addr) \
(__builtin_constant_p(nr) ? \
constant_test_bit((nr),(addr)) : \
variable_test_bit((nr),(addr)))
*/
#define test_bit(nr,addr) \
( variable_test_bit( (nr),(addr) ) )
/**
* find_first_zero_bit - find the first zero bit in a memory region
@@ -367,8 +259,7 @@ static __inline int variable_test_bit(int nr, volatile void * addr)
* Returns the bit-number of the first zero bit, not the number of the byte
* containing a bit.
*/
#if defined(__GNUC__)
static __inline int find_first_zero_bit(void * addr, unsigned size)
static __inline__ int find_first_zero_bit(void * addr, unsigned size)
{
int d0, d1, d2;
int res;
@@ -391,34 +282,6 @@ static __inline int find_first_zero_bit(void * addr, unsigned size)
:"1" ((size + 31) >> 5), "2" (addr), "b" (addr));
return res;
}
#elif defined(_MSC_VER)
#define find_first_zero_bit(addr, size) \
find_next_zero_bit((addr), (size), 0)
#else
#error Unknown compiler for inline assembler
#endif
/**
* ffz - find first zero in word.
* @word: The word to search
*
* Undefined if no zero exists, so code should check against ~0UL first.
*/
static __inline unsigned long ffz(unsigned long word)
{
#if defined(__GNUC__)
__asm__("bsfl %1,%0"
:"=r" (word)
:"r" (~word));
return word;
#elif defined(_MSC_VER)
ULONG index;
BitScanForward(&index, ~word);
return index;
#else
#error Unknown compiler for inline assembler
#endif
}
/**
* find_next_zero_bit - find the first zero bit in a memory region
@@ -426,8 +289,7 @@ static __inline unsigned long ffz(unsigned long word)
* @offset: The bitnumber to start searching at
* @size: The maximum size to search
*/
#if defined(__GNUC__)
static __inline int find_next_zero_bit (void * addr, int size, int offset)
static __inline__ int find_next_zero_bit (void * addr, int size, int offset)
{
unsigned long * p = ((unsigned long *) addr) + (offset >> 5);
int set = 0, bit = offset & 31, res;
@@ -453,47 +315,20 @@ static __inline int find_next_zero_bit (void * addr, int size, int offset)
res = find_first_zero_bit (p, size - 32 * (p - (unsigned long *) addr));
return (offset + set + res);
}
#elif defined(_MSC_VER)
static __inline unsigned long find_next_zero_bit(const void *addr, unsigned long size, unsigned long offset)
{
const unsigned long *p = addr;
unsigned long result = offset & ~63UL;
unsigned long tmp;
p += offset >> 6;
if (offset >= size)
return size;
size -= result;
offset &= 63UL;
if (offset) {
tmp = *(p++);
tmp |= ~0UL >> (64-offset);
if (size < 64)
goto found_first;
if (~tmp)
goto found_middle;
size -= 64;
result += 64;
}
while (size & ~63UL) {
if (~(tmp = *(p++)))
goto found_middle;
result += 64;
size -= 64;
}
if (!size)
return result;
tmp = *p;
found_first:
tmp |= ~0UL << size;
if (tmp == ~0UL) /* Are any bits zero? */
return result + size; /* Nope. */
found_middle:
return result + ffz(tmp);
/**
* ffz - find first zero in word.
* @word: The word to search
*
* Undefined if no zero exists, so code should check against ~0UL first.
*/
static __inline__ unsigned long ffz(unsigned long word)
{
__asm__("bsfl %1,%0"
:"=r" (word)
:"r" (~word));
return word;
}
#else
#error Unknown compiler for inline assembler
#endif
#ifdef __KERNEL__

View File

@@ -1,27 +1,6 @@
#ifndef _LINUX_BITOPS_H
#define _LINUX_BITOPS_H
/**
* __ffs - find first bit in word.
* @word: The word to search
*
* Undefined if no bit exists, so code should check against 0 first.
*/
static __inline unsigned long __ffs(unsigned long wrd)
{
#if defined(__GNUC__)
__asm__("bsfl %1,%0"
:"=r" (wrd)
:"rm" (wrd));
#elif defined(_MSC_VER)
__asm mov eax, wrd;
__asm bsf eax, eax;
__asm mov wrd, eax;
#else
#error Unknown compiler for inline assembler
#endif
return wrd;
}
/*
* ffs: find first bit set. This is defined the same way as
@@ -29,7 +8,7 @@ static __inline unsigned long __ffs(unsigned long wrd)
* differs in spirit from the above ffz (man ffs).
*/
static __inline int generic_ffs(int x)
static inline int generic_ffs(int x)
{
int r = 1;
@@ -63,7 +42,7 @@ static __inline int generic_ffs(int x)
* of bits set) of a N-bit word
*/
static __inline unsigned int generic_hweight32(unsigned int w)
static inline unsigned int generic_hweight32(unsigned int w)
{
unsigned int res = (w & 0x55555555) + ((w >> 1) & 0x55555555);
res = (res & 0x33333333) + ((res >> 2) & 0x33333333);
@@ -72,7 +51,7 @@ static __inline unsigned int generic_hweight32(unsigned int w)
return (res & 0x0000FFFF) + ((res >> 16) & 0x0000FFFF);
}
static __inline unsigned int generic_hweight16(unsigned int w)
static inline unsigned int generic_hweight16(unsigned int w)
{
unsigned int res = (w & 0x5555) + ((w >> 1) & 0x5555);
res = (res & 0x3333) + ((res >> 2) & 0x3333);
@@ -80,7 +59,7 @@ static __inline unsigned int generic_hweight16(unsigned int w)
return (res & 0x00FF) + ((res >> 8) & 0x00FF);
}
static __inline unsigned int generic_hweight8(unsigned int w)
static inline unsigned int generic_hweight8(unsigned int w)
{
unsigned int res = (w & 0x55) + ((w >> 1) & 0x55);
res = (res & 0x33) + ((res >> 2) & 0x33);

View File

@@ -5,25 +5,9 @@
// some typedefs to make for easy sizing
//typedef unsigned long ULONG;
typedef long long u64;
typedef unsigned int u32;
typedef unsigned short u16;
typedef unsigned char u8;
typedef unsigned int __u32;
typedef unsigned short __u16;
typedef unsigned char __u8;
// we don't care much about big-endian
typedef unsigned int __le32;
typedef unsigned short __le16;
typedef unsigned char __le8;
typedef short s16;
typedef u32 dma_addr_t;
#ifndef bool_already_defined_
typedef int bool;
#endif
@@ -40,9 +24,4 @@ typedef unsigned long RGBA; // LSB=R -> MSB = A
#define NULL ((void *)0)
#endif
#define __iomem
#define __user
typedef u32 uid_t;
#endif /* #ifndef cromwell_types_h */

View File

@@ -11,7 +11,6 @@
* macros
*
* All structs and prototypes are based on kernel source 2.5.72
* 2.6.14.3
*
* Modified by Aleksey Bragin (aleksey@reactos.com) for ReactOS needs
*
@@ -24,6 +23,17 @@
/*------------------------------------------------------------------------*/
#include "cromwell_types.h"
typedef unsigned int __u32;
//typedef __u32 u32;
typedef unsigned short __u16;
//typedef __u16 u16;
typedef unsigned char __u8;
//typedef __u8 u8;
typedef short s16;
typedef u32 dma_addr_t;
typedef struct
{
KSPIN_LOCK SpinLock;
@@ -48,9 +58,8 @@ typedef int ssize_t;
#endif
typedef int irqreturn_t;
typedef unsigned long kernel_ulong_t;
typedef unsigned long gfp_t;
typedef KEVENT wait_queue_head_t;
typedef int wait_queue_head_t;
/*------------------------------------------------------------------------*/
/* Stuff from xbox/linux environment */
/*------------------------------------------------------------------------*/
@@ -84,7 +93,7 @@ extern size_t strlen(const char *);
extern int memcmp(const void *,const void *,unsigned int);
#else
//#include "boot.h"
#include "boot.h"
#include "config.h"
#endif
#else
@@ -100,9 +109,6 @@ extern int memcmp(const void *,const void *,unsigned int);
/*------------------------------------------------------------------------*/
struct timer_list {
PKTIMER kTimer;
PKDPC kDPC;
// usual stuff
void (*function)(unsigned long);
unsigned long data;
int expires;
@@ -131,25 +137,17 @@ struct semaphore{int a;};
struct device_driver{
char *name;
struct bus_type *bus;
int owner;
int (*probe) (struct device * dev);
int (*remove) (struct device * dev);
struct list_head devices;
};
typedef struct pm_message {
int event;
} pm_message_t;
struct bus_type {
char * name;
int (*match)(struct device * dev, struct device_driver * drv);
struct device * (*add) (struct device * parent, char * bus_id);
int (*hotplug) (struct device *dev, char **envp,
int num_envp, char *buffer, int buffer_size);
int (*suspend)(struct device * dev, pm_message_t state);
int (*resume)(struct device * dev);
struct device * (*add) (struct device * parent, char * bus_id);
int (*hotplug) (struct device *dev, char **envp,
int num_envp, char *buffer, int buffer_size);
};
struct dummy_process
@@ -170,9 +168,9 @@ struct completion {
// windows lookaside list head
typedef void* kmem_cache_t;
// misc stuff
struct kref {
atomic_t refcount;
struct dma_pool
{
int dummy;
};
/* These definitions mirror those in pci.h, so they can be used
@@ -235,17 +233,7 @@ struct usb_device_id {
/*------------------------------------------------------------------------*/
/* PCI structs (taken from linux/pci.h et al., but slightly modified) */
/*------------------------------------------------------------------------*/
typedef int pci_power_t;
#define PCI_D0 ((pci_power_t) 0)
#define PCI_D1 ((pci_power_t) 1)
#define PCI_D2 ((pci_power_t) 2)
#define PCI_D3hot ((pci_power_t) 3)
#define PCI_D3cold ((pci_power_t) 4)
#define PCI_UNKNOWN ((pci_power_t) 5)
#define PCI_POWER_ERROR ((pci_power_t) -1)
/*------------------------------------------------------------------------*/
struct pci_dev {
int vendor;
@@ -253,9 +241,6 @@ struct pci_dev {
struct pci_bus *bus;
int irq;
char *slot_name;
pci_power_t current_state; /* Current operating state. In ACPI-speak,
this is D0-D3, D0 being fully functional,
and D3 being off. */
struct device dev;
int base[4];
int flags[4];
@@ -278,13 +263,12 @@ struct pci_driver {
struct list_head node;
char *name;
const struct pci_device_id *id_table; /* must be non-NULL for probe to be called */
int (STDCALL *probe) (struct pci_dev *dev, const struct pci_device_id *id); /* New device inserted */
void (STDCALL *remove) (struct pci_dev *dev); /* Device removed (NULL if not a hot-plug capable driver) */
int STDCALL (*probe) (struct pci_dev *dev, const struct pci_device_id *id); /* New device inserted */
void STDCALL (*remove) (struct pci_dev *dev); /* Device removed (NULL if not a hot-plug capable driver) */
int (*save_state) (struct pci_dev *dev, u32 state); /* Save Device Context */
int (*suspend) (struct pci_dev *dev, u32 state); /* Device suspended */
int (*resume) (struct pci_dev *dev); /* Device woken up */
int (*enable_wake) (struct pci_dev *dev, u32 state, int enable); /* Enable wake event */
void (*shutdown) (struct pci_dev *dev);
};
struct scatterlist
@@ -316,7 +300,7 @@ struct usbdevfs_hub_portinfo
#define SLAB_ATOMIC 0
#define PCI_ANY_ID (~0)
#define SIGKILL 9
#define THIS_MODULE NULL
#define THIS_MODULE 0
//#define PAGE_SIZE 4096
@@ -351,7 +335,6 @@ struct usbdevfs_hub_portinfo
#define __devinitdata
#define module_init(x) static void module_init_##x(void){ x();}
#define module_exit(x) void module_exit_##x(void){ x();}
#define module_param(a,b,c) //
#define EXPORT_SYMBOL_GPL(x)
#define EXPORT_SYMBOL(x)
@@ -361,6 +344,7 @@ struct usbdevfs_hub_portinfo
/*------------------------------------------------------------------------*/
/* Access macros */
/*------------------------------------------------------------------------*/
#define dev_get_drvdata(a) (a)->driver_data
#define dev_set_drvdata(a,b) (a)->driver_data=(b)
@@ -372,96 +356,38 @@ struct usbdevfs_hub_portinfo
#define prefetch(x) 1
#define inw(x) READ_PORT_USHORT((PUSHORT)(x))
#define outb(x,p) WRITE_PORT_UCHAR((PUCHAR)(p),(x))
#define outw(x,p) WRITE_PORT_USHORT((PUSHORT)(p),(x))
#define outl(x,p) WRITE_PORT_ULONG((PULONG)(p),(x))
/* The kernel macro for list_for_each_entry makes nonsense (have no clue
* why, this is just the same definition...) */
/*#undef list_for_each_entry
#undef list_for_each_entry
#define list_for_each_entry(pos, head, member) \
for (pos = list_entry((head)->next, typeof(*pos), member), \
prefetch(pos->member.next); \
&pos->member != (head); \
pos = list_entry(pos->member.next, typeof(*pos), member), \
prefetch(pos->member.next))*/
#define list_for_each_entry_safe(pos, type, n, typen, head, member) \
for (pos = list_entry((head)->next, type, member), \
n = list_entry(pos->member.next, type, member); \
&pos->member != (head); \
pos = n, n = list_entry(n->member.next, typen, member))
/*------------------------------------------------------------------------*/
/* Misc stuff (to be categorized later) */
/*------------------------------------------------------------------------*/
#define IS_ERR_VALUE(x) unlikely((x) > (unsigned long)-1000L)
static __inline long IS_ERR(const void *ptr)
{
return (long)IS_ERR_VALUE((unsigned long)ptr);
}
#define usbdev_add(x) do {} while(0)
#define usbdev_remove(x) do {} while(0)
#define usb_remove_sysfs_dev_files(x) do {} while(0)
#define usb_create_sysfs_dev_files(x) do {} while(0)
#define usbdev_init(x) 0
#define usbdev_cleanup(x) do {} while(0)
#define debugfs_remove(x) do {} while(0)
#define __acquires(x)
#define __releases(x)
prefetch(pos->member.next))
/*------------------------------------------------------------------------*/
/* function wrapper macros */
/*------------------------------------------------------------------------*/
#define kmalloc(x,y) ExAllocatePool(NonPagedPool,x)
#define kmalloc(x,y) ExAllocatePool(PagedPool,x)
#define kfree(x) ExFreePool(x)
#define kzalloc(x, y) my_kzalloc(x)
void *my_kzalloc(size_t size/*, gfp_t flags*/);
#if defined(__GNUC__)
int memcmp(const void * cs,const void * ct,size_t count);
#else
int __cdecl memcmp(const void * cs,const void * ct,size_t count);
#endif
// kernel reference counting
#define kref_init(a) do {} while(0)
#define kref_get(a) do {} while(0)
#define kref_put(a, b) my_kref_put(a, b)
static int __inline my_kref_put(struct kref *kref, void (*release) (struct kref *kref))
{
return 0;
}
//#define sprintf(a,b,format, arg...) zxsprintf((a),(b),format, ## arg)
//#define snprintf(a,b,format, arg...) zxsnprintf((a),(b),format, ##arg)
//#define printk(format, arg...) zxprintf(format, ## arg)
#ifdef _MSC_VER
#define snprintf(...) _snprintf(__VA_ARGS__)
#define printk(format,...) DPRINT1(format, __VA_ARGS__)
#else
#define snprintf(a,b,format, arg...) _snprintf((a),(b),format, ## arg)
#define snprintf(a,b,format, arg...) _snprintf((a),(b),format, ##arg)
#define printk(format, arg...) DPRINT1(format, ## arg)
#endif
#define BUG(...) do {} while(0)
size_t strlcpy(char *dest, const char *src, size_t size);
/* Locks & friends */
#define DECLARE_MUTEX(x) struct semaphore x
#define init_MUTEX(x)
#define DEFINE_SPINLOCK(x) spinlock_t x
#define SPIN_LOCK_UNLOCKED 0
#define spin_lock_init(a) my_spin_lock_init(a)
@@ -475,25 +401,16 @@ void my_spin_unlock(spinlock_t *sl);
#define spin_lock_irqsave(a,b) b=0, my_spin_lock_irqsave(a,b)
void my_spin_lock_irqsave(spinlock_t *sl, int flags);
#define spin_unlock_irqrestore(a,b) my_spin_unlock_irqrestore(a,b)
void my_spin_unlock_irqrestore(spinlock_t *sl, int flags);
#define spin_lock_irq(x) my_spin_lock_irq(x)
void my_spin_lock_irq(spinlock_t *sl);
#define spin_unlock_irq(x) my_spin_unlock_irq(x)
void my_spin_unlock_irq(spinlock_t *sl);
#define spin_unlock_irqrestore(a,b) my_spin_unlock(a)
#if 0
#define local_irq_save(x) __asm__ __volatile__("pushfl ; popl %0 ; cli":"=g" (x): /* no input */ :"memory")
#define local_irq_restore(x) __asm__ __volatile__("pushl %0 ; popfl": /* no output */ :"g" (x):"memory", "cc")
#else
static void __inline local_irq_save(unsigned long flags) {}
static void __inline local_irq_restore(unsigned long flags) {}
#define local_irq_save(x) do {} while(0)
#define local_irq_restore(x) do {} while(0)
#endif
#define local_irq_enable() do {} while(0)
#define local_irq_disable() do {} while(0)
#define atomic_inc(x) *(x)+=1
#define atomic_dec(x) *(x)-=1
#define atomic_dec_and_test(x) (*(x)-=1,(*(x))==0)
@@ -504,15 +421,11 @@ static void __inline local_irq_restore(unsigned long flags) {}
#define down(x) do {} while(0)
#define up(x) do {} while(0)
#define down_trylock(a) 0
#define down_read_trylock(a) TRUE
#define down_read(a) do {} while(0)
#define up_read(a) do {} while(0)
#define down_write(a) do {} while(0)
#define up_write(a) do {} while(0)
#define DECLARE_WAIT_QUEUE_HEAD(x) wait_queue_head_t x // YOU MUST INITIALIZE ALL GLOBAL VARIABLES OF THIS TYPE!
#define DECLARE_WAIT_QUEUE_HEAD(x) KEVENT x
#define DECLARE_COMPLETION(x) struct completion x
@@ -549,13 +462,10 @@ struct pci_pool
struct pci_page pages[MAX_POOL_PAGES];
};
#define dma_pool pci_pool
//#define to_pci_dev(n) container_of(n, struct pci_dev, dev)
#define to_pci_dev(n) CONTAINING_RECORD(n, struct pci_dev, dev)
#define to_pci_dev(n) container_of(n, struct pci_dev, dev)
#define pci_pool_create(a,b,c,d,e) my_pci_pool_create(a,b,c,d,e)
struct pci_pool *my_pci_pool_create(const char * name, struct device * pdev, size_t size, size_t align, size_t allocation);
struct pci_pool *my_pci_pool_create(const char * name, struct pci_dev * pdev, size_t size, size_t align, size_t allocation);
#define pci_pool_alloc(a,b,c) my_pci_pool_alloc(a,b,c)
void *my_pci_pool_alloc(struct pci_pool * pool, int mem_flags, dma_addr_t *dma_handle);
@@ -575,18 +485,11 @@ int my_pci_module_init(struct pci_driver *x);
#define pci_unregister_driver(a) do {} while(0)
#define pci_read_config_word(a,b,c) my_pci_read_config_word(a,b,c)
int my_pci_read_config_word(struct pci_dev *, int, u16*);
#define pci_write_config_word(a,b,c) my_pci_write_config_word(a,b,c)
int my_pci_write_config_word(struct pci_dev *, int, u16);
#define bus_register(a) 0
#define bus_register(a) do {} while(0)
#define bus_unregister(a) do {} while(0)
static __inline char *pci_name(struct pci_dev *pdev) { return pdev->dev.bus_id; };
/* DMA */
//#define dma_pool_alloc(a,b,c) my_dma_pool_alloc((a),(b),(c))
#define dma_pool_alloc(a,b,c) pci_pool_alloc(a,b,c)
@@ -594,10 +497,8 @@ static __inline char *pci_name(struct pci_dev *pdev) { return pdev->dev.bus_id;
#define dma_pool_free(a,b,c) pci_pool_free(a,b,c)
#define dma_pool_destroy(a) pci_pool_destroy(a)
#define dma_alloc_coherent(dev,sz,dma_handle,gfp) my_dma_alloc_coherent(dev, sz, dma_handle, gfp)
void *my_dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, gfp_t flag);
#define dma_free_coherent(dev,sz,vaddr,dma_handle) DPRINT1("dma_free_coherent UNIMPLEMENTED!\n");
//#define dma_alloc_coherent(a,b,c,d) NULL
//#define dma_free_coherent(a,b,c,d) do {} while(0)
#define dma_map_single(a,b,c,d) my_dma_map_single(a,b,c,d)
dma_addr_t my_dma_map_single(struct device *hwdev, void *ptr, size_t size, enum dma_data_direction direction);
@@ -621,13 +522,10 @@ void my_dma_unmap_sg(struct device *hwdev, struct scatterlist *sg, int nents, en
#define usb_create_driverfs_dev_files(a) do {} while(0)
#define usb_create_driverfs_intf_files(a) do {} while(0)
#define usb_create_sysfs_intf_files(a) do {} while(0)
#define usb_remove_sysfs_intf_files(a) do {} while(0)
#define sg_dma_address(x) ((u32)((x)->page*4096 + (x)->offset))
#define sg_dma_len(x) ((x)->length)
#define page_address(x) ((u8 *)(x/4096))
#define page_address(x) ((void*)(x/4096))
#define PCI_ROM_RESOURCE 1
#define IORESOURCE_IO CM_RESOURCE_PORT_IO
@@ -642,10 +540,7 @@ VOID KeMemoryBarrier(VOID);
#define mb() KeMemoryBarrier()
#define wmb() do {} while (0)
#define smp_wmb() do {} while (0)
#define rmb() do {} while (0)
#define smp_rmb() do {} while (0)
#define barrier() KeMemoryBarrier() //FIXME: Is this right?
/*#define wmb() __asm__ __volatile__ ("": : :"memory")
#define rmb() __asm__ __volatile__ ("lock; addl $0,0(%%esp)": : :"memory")*/
@@ -667,7 +562,6 @@ void my_wait_for_completion(struct completion*);
#define daemonize(a) do {} while(0)
#define allow_signal(a) do {} while(0)
#define wait_event_interruptible(x,y) do {} while(0)
#define wait_event(x,y) do {} while(0)
#define interruptible_sleep_on(a) my_interruptible_sleep_on(a)
void my_interruptible_sleep_on(PKEVENT evnt);
@@ -712,28 +606,16 @@ void my_kmem_cache_free(kmem_cache_t *co, void *ptr);
#define UTS_RELEASE "----"
/* from linux/kernel.h */
#if defined(__GNUC__)
#define max_t(type,x,y) \
({ type __x = (x); type __y = (y); __x > __y ? __x: __y; })
#else
#define max_t(type,x,y) \
( ((type)(x) > (type)(y)) ? (type)(x): (type)(y) )
#endif
#if defined(__GNUC__)
#define min_t(type,x,y) \
({ type __x = (x); type __y = (y); __x < __y ? __x: __y; })
#else
#define min_t(type,x,y) \
( ((type)(x) < (type)(y)) ? (type)(x): (type)(y) )
#endif
#define container_of(ptr, type, member) ({ \
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
(type *)( (char *)__mptr - offsetof(type,member) );})
//#define container_of(ptr, type, member) CONTAINING_RECORD(ptr, type, member)
/* from linux/stddef.h */
#undef offsetof
@@ -744,7 +626,6 @@ void my_kmem_cache_free(kmem_cache_t *co, void *ptr);
/*------------------------------------------------------------------------*/
#define __constant_cpu_to_le32(x) (x)
#define __constant_cpu_to_le16(x) (__le16)(x)
#define cpu_to_le16(x) (x)
#define le16_to_cpu(x) (x)
#define cpu_to_le32(x) (x)
@@ -754,29 +635,17 @@ void my_kmem_cache_free(kmem_cache_t *co, void *ptr);
#define le16_to_cpus(x) do {} while (0)
#define le16_to_cpup(x) (*(__u16*)(x))
#define cpu_to_le16p(x) (*(__u16*)(x))
#define cpu_to_le16s(x) // nothing here
/*------------------------------------------------------------------------*/
/* Debug output */
/*------------------------------------------------------------------------*/
#ifdef DEBUG_MODE
#if defined(_MSC_VER)
#define dev_printk(lvl,x,f,...) { DPRINT(f, __VA_ARGS__); }
#define dev_dbg(x,f,...) { DPRINT(f, __VA_ARGS__); }
#define dev_info(x,f,...) { DPRINT1(f,__VA_ARGS__); }
#define dev_warn(x,f,...) { DPRINT1(f,__VA_ARGS__); }
#define dev_err(x,f,...) { DPRINT1(f,__VA_ARGS__); }
#define pr_debug(f,...) { DPRINT(f,__VA_ARGS__); }
#define pr_info(f,...) { DPRINT1(f,__VA_ARGS__); }
#else
#define dev_printk(lvl,x,f,arg...) printk(f, ## arg)
#define dev_dbg(x,f,arg...) printk(f, ## arg)
#define dev_info(x,f,arg...) printk(f,## arg)
#define dev_warn(x,f,arg...) printk(f,## arg)
#define dev_err(x,f,arg...) printk(f,## arg)
#define pr_debug(f,arg...) printk(f,## arg)
#define pr_info(f,arg...) printk(f,## arg)
#endif
#define pr_debug(x,f,arg...) printk(f,## arg)
#define usbprintk printk
#endif
@@ -786,11 +655,12 @@ void my_kmem_cache_free(kmem_cache_t *co, void *ptr);
#define dev_info(x,f,arg...) do {} while (0)
#define dev_warn(x,f,arg...) do {} while (0)
#define dev_err(x,f,arg...) do {} while (0)
#define pr_debug(f,arg...) do {} while (0)
#define pr_info(f,arg...) do {} while (0)
#define pr_debug(x,f,arg...) do {} while (0)
#define usbprintk(arg...) dev_printk(0,0,0,## arg)
#endif
#define PCI_DEVFN(a,b) 0
#define PCI_SLOT(a) 0
@@ -834,230 +704,78 @@ extern struct list_head interrupt_list;
void STDCALL usb_hcd_pci_remove (struct pci_dev *dev);
#define my_wait_ms(x) wait_ms(x) // milliseconds
#define udelay(x) my_udelay(x) // microseconds
//#define my_mdelay(x) wait_ms(1+x/1000)
#define mdelay(x) wait_ms(x) // milliseconds = udelay(1000*x)
#define msleep(x) wait_ms(x)
#define my_mdelay(x) wait_ms(1+x/1000);
#define mdelay(x) my_mdelay(x); // milliseconds = udelay(1000*x)
#define pci_find_slot(a,b) my_pci_find_slot(a,b)
struct pci_dev *my_pci_find_slot(int a,int b);
#define pci_find_capability(a,b) FALSE
/*------------------------------------------------------------------------*/
/* Timer management */
/*------------------------------------------------------------------------*/
#define MAX_TIMERS 5
#define MAX_TIMERS 20
extern struct timer_list *main_timer_list[MAX_TIMERS];
extern PKDEFERRED_ROUTINE timer_dpcs[MAX_TIMERS];
void STDCALL _TimerDpc0(IN PKDPC Dpc, IN PVOID DeferredContext, IN PVOID SystemArgument1, IN PVOID SystemArgument2);
void STDCALL _TimerDpc1(IN PKDPC Dpc, IN PVOID DeferredContext, IN PVOID SystemArgument1, IN PVOID SystemArgument2);
void STDCALL _TimerDpc2(IN PKDPC Dpc, IN PVOID DeferredContext, IN PVOID SystemArgument1, IN PVOID SystemArgument2);
void STDCALL _TimerDpc3(IN PKDPC Dpc, IN PVOID DeferredContext, IN PVOID SystemArgument1, IN PVOID SystemArgument2);
void STDCALL _TimerDpc4(IN PKDPC Dpc, IN PVOID DeferredContext, IN PVOID SystemArgument1, IN PVOID SystemArgument2);
static __inline unsigned int jiffies_to_msecs(const unsigned long j);
static __inline unsigned long msecs_to_jiffies(const unsigned int m);
static void __inline init_timer(struct timer_list* t)
static void __inline__ init_timer(struct timer_list* t)
{
INIT_LIST_HEAD(&t->timer_list);
t->function=NULL;
t->expires=0;
t->kDPC = NULL;
t->kTimer = NULL;
//printk("init_timer %p\n", t);
}
static void __inline add_timer(struct timer_list* t)
static void __inline__ add_timer(struct timer_list* t)
{
int n;
//printk("add_timer %p, expires-jiffies=%d, 100nsec intervals=%d\n", t, t->expires-jiffies, -10000 * jiffies_to_msecs(t->expires - jiffies));
for(n=0;n<MAX_TIMERS;n++)
if (main_timer_list[n]==0)
{
LARGE_INTEGER delay;
//delay.QuadPart = -10*1000000; // 10 seconds
delay.QuadPart = -10000 * jiffies_to_msecs(t->expires - jiffies);// convert msecs to 100nsec intervals
if (delay.QuadPart == 0)
DPRINT1("add_timer with 0 expire time!");
main_timer_list[n]=t;
// Allocate non-paged buffers if needed
//FIXME: Not optimal to allocate such small things!
if (!t->kDPC)
t->kDPC = ExAllocatePool(NonPagedPool, sizeof(KDPC));
if (!t->kTimer)
t->kTimer = ExAllocatePool(NonPagedPool, sizeof(KTIMER));
KeInitializeTimer(t->kTimer);
switch(n)
{
case 0:
KeInitializeDpc(t->kDPC, (PKDEFERRED_ROUTINE)_TimerDpc0, NULL);
break;
case 1:
KeInitializeDpc(t->kDPC, (PKDEFERRED_ROUTINE)_TimerDpc1, NULL);
break;
case 2:
KeInitializeDpc(t->kDPC, (PKDEFERRED_ROUTINE)_TimerDpc2, NULL);
break;
case 3:
KeInitializeDpc(t->kDPC, (PKDEFERRED_ROUTINE)_TimerDpc3, NULL);
break;
case 4:
KeInitializeDpc(t->kDPC, (PKDEFERRED_ROUTINE)_TimerDpc4, NULL);
break;
default:
printk("No more timer DPCs left, panic!!\n");
}
ASSERT_IRQL_LESS_OR_EQUAL(DISPATCH_LEVEL);
//KeDelayExecutionThread(KernelMode, FALSE, &delay);
KeSetTimer(t->kTimer, delay, t->kDPC);
break;
}
}
static void __inline del_timer(struct timer_list* t)
static void __inline__ del_timer(struct timer_list* t)
{
int n;
//printk("del_timer %p\n", t);
for(n=0;n<MAX_TIMERS;n++)
if (main_timer_list[n]==t)
{
ASSERT_IRQL_LESS_OR_EQUAL(DISPATCH_LEVEL);
KeWaitForSingleObject(t->kTimer, Executive, KernelMode, FALSE, NULL);
KeCancelTimer(t->kTimer);
main_timer_list[n]=0;
ExFreePool(t->kTimer);
ExFreePool(t->kDPC);
t->kTimer = NULL;
t->kDPC = NULL;
break;
}
}
static void __inline del_timer_sync(struct timer_list* t)
static void __inline__ del_timer_sync(struct timer_list* t)
{
int n;
//printk("del_timer_sync %p\n", t);
for(n=0;n<MAX_TIMERS;n++)
if (main_timer_list[n]==t)
{
ASSERT_IRQL_LESS_OR_EQUAL(DISPATCH_LEVEL);
KeWaitForSingleObject(t->kTimer, Executive, KernelMode, FALSE, NULL);
KeCancelTimer(t->kTimer);
main_timer_list[n]=0;
ExFreePool(t->kTimer);
ExFreePool(t->kDPC);
t->kTimer = NULL;
t->kDPC = NULL;
break;
}
}
static void __inline mod_timer(struct timer_list* t, int ex)
static void __inline__ mod_timer(struct timer_list* t, int ex)
{
LARGE_INTEGER delay;
//printk("mod_timer %p, kTimer %p, kDpc %p...\n", t, t->kTimer, t->kDPC);
//del_timer(t);
del_timer(t);
t->expires=ex;
//add_timer(t);
// Check, maybe there was no preceding add_timer call.
if (t->kTimer == NULL && t->kDPC == NULL)
{
// If not - make it
add_timer(t);
}
else
{
// Otherwise just modify existing timer
delay.QuadPart = -10000 * jiffies_to_msecs(t->expires - jiffies); // convert msecs to 100nsec intervals
if (delay.QuadPart == 0)
DPRINT1("mod_timer with 0 expire time!");
ASSERT_IRQL_LESS_OR_EQUAL(DISPATCH_LEVEL);
ASSERT(t->kTimer);
ASSERT(t->kDPC);
KeWaitForSingleObject(t->kTimer, Executive, KernelMode, FALSE, NULL);
KeSetTimer(t->kTimer, delay, t->kDPC);
}
add_timer(t);
}
#define time_after(a,b) \
((long)(b) - (long)(a) < 0)
#define time_after_eq(a,b) \
(((long)(a) - (long)(b) >= 0))
/* Parameters used to convert the timespec values */
#define MSEC_PER_SEC (1000L)
#define USEC_PER_SEC (1000000L)
#define NSEC_PER_SEC (1000000000L)
#define NSEC_PER_USEC (1000L)
/*
* Change timeval to jiffies, trying to avoid the
* most obvious overflows..
*
* And some not so obvious.
*
* Note that we don't want to return MAX_LONG, because
* for various timeout reasons we often end up having
* to wait "jiffies+1" in order to guarantee that we wait
* at _least_ "jiffies" - so "jiffies+1" had better still
* be positive.
*/
#define MAX_JIFFY_OFFSET ((~0UL >> 1)-1)
/*
* Convert jiffies to milliseconds and back.
*
* Avoid unnecessary multiplications/divisions in the
* two most common HZ cases:
*/
static __inline unsigned int jiffies_to_msecs(const unsigned long j)
{
#if HZ <= MSEC_PER_SEC && !(MSEC_PER_SEC % HZ)
return (MSEC_PER_SEC / HZ) * j;
#elif HZ > MSEC_PER_SEC && !(HZ % MSEC_PER_SEC)
return (j + (HZ / MSEC_PER_SEC) - 1)/(HZ / MSEC_PER_SEC);
#else
return (j * MSEC_PER_SEC) / HZ;
#endif
}
static __inline unsigned long msecs_to_jiffies(const unsigned int m)
{
if (m > jiffies_to_msecs(MAX_JIFFY_OFFSET))
return MAX_JIFFY_OFFSET;
#if HZ <= MSEC_PER_SEC && !(MSEC_PER_SEC % HZ)
return (m + (MSEC_PER_SEC / HZ) - 1) / (MSEC_PER_SEC / HZ);
#elif HZ > MSEC_PER_SEC && !(HZ % MSEC_PER_SEC)
return m * (HZ / MSEC_PER_SEC);
#else
return (m * HZ + MSEC_PER_SEC - 1) / MSEC_PER_SEC;
#endif
}
/*------------------------------------------------------------------------*/
/* Device driver and process related stuff */
/*------------------------------------------------------------------------*/
static int __inline usb_major_init(void){return 0;}
static void __inline usb_major_cleanup(void){}
static void __inline schedule_work(void* p){}
static void __inline schedule_delayed_work(void *p, int flags){}
static void __inline cancel_delayed_work(void *p){}
static int __inline__ usb_major_init(void){return 0;}
static void __inline__ usb_major_cleanup(void){}
static void __inline__ schedule_work(void* p){}
#define device_initialize(x) my_device_initialize(x)
void my_device_initialize(struct device *dev);
@@ -1068,54 +786,33 @@ struct device *my_get_device(struct device *dev);
#define device_add(x) my_device_add(x)
int my_device_add(struct device *dev);
#define device_del(x) do {} while(0)
#define device_bind_driver(x) do {} while(0)
#define device_release_driver(x) do {} while(0)
#define driver_for_each_device(a,b,c,d) NULL
#define driver_register(x) my_driver_register(x)
int my_driver_register(struct device_driver *driver);
#define device_unregister(a) my_device_unregister(a)
int my_device_unregister(struct device *dev);
#define device_is_registered(a) FALSE
#define DEVICE_ATTR(a,b,c,d) int xxx_##a
#define device_create_file(a,b) do {} while(0)
#define device_remove_file(a,b) do {} while(0)
/*------------------------------------------------------------------------*/
/* Scheduling, threads */
/*------------------------------------------------------------------------*/
#define schedule_timeout(x) my_schedule_timeout(x)
int my_schedule_timeout(int x);
#define wake_up(x) my_wake_up(x)
void my_wake_up(PKEVENT);
#define wake_up_all(x) do {} while(0)
#define try_to_freeze(x) my_try_to_freeze()
void my_try_to_freeze();
#define kthread_should_stop(x) FALSE
// cannot be mapped via macro due to collision with urb->complete
static void __inline complete(struct completion *p)
static void __inline__ complete(struct completion *p)
{
//printk("completing event 0x%08x\n", (ULONG)p);
printk("completing event 0x%08x\n", (ULONG)p);
/* Wake up x->wait */
p->done++;
wake_up((PKEVENT)&p->wait);
}
#define kernel_thread(a,b,c) my_kernel_thread(a,b,c)
int my_kernel_thread(int (STDCALL *handler)(void*), void* parm, int flags);
#define kthread_run(a,b,c) kernel_thread(a,b,0)
#define kthread_stop(a) DPRINT1("kthread_stop() called, UNIMPLEMENTED!\n");
int my_kernel_thread(int STDCALL (*handler)(void*), void* parm, int flags);
/*------------------------------------------------------------------------*/
/* PCI, simple and inlined... */
@@ -1151,6 +848,8 @@ void inc_jiffies(int);
void init_wrapper(struct pci_dev *pci_dev);
void do_all_timers(void);
int my_pci_write_config_word(struct pci_dev *, int, u16);
void UsbKeyBoardInit(void);
void UsbKeyBoardRemove(void);
void UsbMouseInit(void);

View File

@@ -30,14 +30,14 @@ struct list_head {
* This is only for internal list manipulation where we know
* the prev/next entries already!
*/
static __inline void __list_add(struct list_head *new_,
static inline void __list_add(struct list_head *new,
struct list_head *prev,
struct list_head *next)
{
next->prev = new_;
new_->next = next;
new_->prev = prev;
prev->next = new_;
next->prev = new;
new->next = next;
new->prev = prev;
prev->next = new;
}
/**
@@ -48,7 +48,7 @@ static __inline void __list_add(struct list_head *new_,
* Insert a new entry after the specified head.
* This is good for implementing stacks.
*/
static __inline void list_add(struct list_head *new, struct list_head *head)
static inline void list_add(struct list_head *new, struct list_head *head)
{
__list_add(new, head, head->next);
}
@@ -61,7 +61,7 @@ static __inline void list_add(struct list_head *new, struct list_head *head)
* Insert a new entry before the specified head.
* This is useful for implementing queues.
*/
static __inline void list_add_tail(struct list_head *new, struct list_head *head)
static inline void list_add_tail(struct list_head *new, struct list_head *head)
{
__list_add(new, head->prev, head);
}
@@ -73,7 +73,7 @@ static __inline void list_add_tail(struct list_head *new, struct list_head *head
* This is only for internal list manipulation where we know
* the prev/next entries already!
*/
static __inline void __list_del(struct list_head *prev, struct list_head *next)
static inline void __list_del(struct list_head *prev, struct list_head *next)
{
next->prev = prev;
prev->next = next;
@@ -84,7 +84,7 @@ static __inline void __list_del(struct list_head *prev, struct list_head *next)
* @entry: the element to delete from the list.
* Note: list_empty on entry does not return true after this, the entry is in an undefined state.
*/
static __inline void list_del(struct list_head *entry)
static inline void list_del(struct list_head *entry)
{
__list_del(entry->prev, entry->next);
entry->next = (void *) 0;
@@ -95,7 +95,7 @@ static __inline void list_del(struct list_head *entry)
* list_del_init - deletes entry from list and reinitialize it.
* @entry: the element to delete from the list.
*/
static __inline void list_del_init(struct list_head *entry)
static inline void list_del_init(struct list_head *entry)
{
__list_del(entry->prev, entry->next);
INIT_LIST_HEAD(entry);
@@ -106,7 +106,7 @@ static __inline void list_del_init(struct list_head *entry)
* @list: the entry to move
* @head: the head that will precede our entry
*/
static __inline void list_move(struct list_head *list, struct list_head *head)
static inline void list_move(struct list_head *list, struct list_head *head)
{
__list_del(list->prev, list->next);
list_add(list, head);
@@ -117,7 +117,7 @@ static __inline void list_move(struct list_head *list, struct list_head *head)
* @list: the entry to move
* @head: the head that will follow our entry
*/
static __inline void list_move_tail(struct list_head *list,
static inline void list_move_tail(struct list_head *list,
struct list_head *head)
{
__list_del(list->prev, list->next);
@@ -128,12 +128,12 @@ static __inline void list_move_tail(struct list_head *list,
* list_empty - tests whether a list is empty
* @head: the list to test.
*/
static __inline int list_empty(struct list_head *head)
static inline int list_empty(struct list_head *head)
{
return head->next == head;
}
static __inline void __list_splice(struct list_head *list,
static inline void __list_splice(struct list_head *list,
struct list_head *head)
{
struct list_head *first = list->next;
@@ -152,7 +152,7 @@ static __inline void __list_splice(struct list_head *list,
* @list: the new list to add.
* @head: the place to add it in the first list.
*/
static __inline void list_splice(struct list_head *list, struct list_head *head)
static inline void list_splice(struct list_head *list, struct list_head *head)
{
if (!list_empty(list))
__list_splice(list, head);
@@ -165,7 +165,7 @@ static __inline void list_splice(struct list_head *list, struct list_head *head)
*
* The list at @list is reinitialised
*/
static __inline void list_splice_init(struct list_head *list,
static inline void list_splice_init(struct list_head *list,
struct list_head *head)
{
if (!list_empty(list)) {
@@ -180,12 +180,8 @@ static __inline void list_splice_init(struct list_head *list,
* @type: the type of the struct this is embedded in.
* @member: the name of the list_struct within the struct.
*/
//#define list_entry(ptr, type, member) \
// ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))
#define list_entry(ptr, type, member) \
CONTAINING_RECORD(ptr, type, member)
((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))
/**
* list_for_each - iterate over a list
@@ -220,11 +216,9 @@ static __inline void list_splice_init(struct list_head *list,
* @head: the head for your list.
* @member: the name of the list_struct within the struct.
*/
// unfortunately there is no good "typeof" in msvc, thus we have
// to provide additional parameter "type"
#define list_for_each_entry(pos, type, head, member) \
for (pos = list_entry((head)->next, type, member); \
#define list_for_each_entry(pos, head, member) \
for (pos = list_entry((head)->next, typeof(*pos), member) \
&pos->member != (head); \
pos = list_entry(pos->member.next, type, member))
pos = list_entry(pos->member.next, typeof(*pos), member))
#endif

View File

@@ -8,21 +8,14 @@
Initialize device before it's used by a driver. Ask low-level code to enable I/O and memory.
Wake up the device if it was suspended. Beware, this function can fail.
*/
static int __inline pci_enable_device(struct pci_dev *dev)
static int __inline__ pci_enable_device(struct pci_dev *dev)
{
DPRINT1("pci_enable_device() called...\n");
return 0;
}
static void __inline pci_disable_device(struct pci_dev *dev)
{
DPRINT1("pci_disable_device() called...\n");
return;
}
// Get physical address where resource x resides
static PHYSICAL_ADDRESS __inline pci_resource_start (struct pci_dev *dev, int x)
static PHYSICAL_ADDRESS __inline__ pci_resource_start (struct pci_dev *dev, int x)
{
PUSBMP_DEVICE_EXTENSION dev_ext = (PUSBMP_DEVICE_EXTENSION)dev->dev_ext;
DPRINT1("pci_resource_start() called, x=0x%x\n", x);
@@ -33,7 +26,7 @@ static PHYSICAL_ADDRESS __inline pci_resource_start (struct pci_dev *dev, int x)
}
// ???
static unsigned long __inline pci_resource_len (struct pci_dev *dev, int x)
static unsigned long __inline__ pci_resource_len (struct pci_dev *dev, int x)
{
PUSBMP_DEVICE_EXTENSION ext = (PUSBMP_DEVICE_EXTENSION)dev->dev_ext;
@@ -44,7 +37,7 @@ static unsigned long __inline pci_resource_len (struct pci_dev *dev, int x)
}
// ???
static int __inline pci_resource_flags(struct pci_dev *dev, int x)
static int __inline__ pci_resource_flags(struct pci_dev *dev, int x)
{
PUSBMP_DEVICE_EXTENSION ext = (PUSBMP_DEVICE_EXTENSION)dev->dev_ext;
@@ -57,10 +50,10 @@ static int __inline pci_resource_flags(struct pci_dev *dev, int x)
/*
Enables bus-mastering for device dev
*/
static int __inline pci_set_master(struct pci_dev *dev) {return 0;}
static int __inline__ pci_set_master(struct pci_dev *dev) {return 0;}
// Store pointer to data for this device
static int __inline pci_set_drvdata(struct pci_dev *dev, void* d)
static int __inline__ pci_set_drvdata(struct pci_dev *dev, void* d)
{
DPRINT1("pci_set_drvdata() called...\n");
dev->data=(void*)d;
@@ -68,9 +61,9 @@ static int __inline pci_set_drvdata(struct pci_dev *dev, void* d)
}
// Get pointer to previously saved data
static void __inline *pci_get_drvdata(struct pci_dev *dev)
static void __inline__ *pci_get_drvdata(struct pci_dev *dev)
{
DPRINT1("pci_get_drvdata() called, dev %p...\n", dev);
DPRINT1("pci_get_drvdata() called...\n");
return dev->data;
}
@@ -88,7 +81,7 @@ start begin of region
n length of region
name name of requester
*/
static int __inline request_region(PHYSICAL_ADDRESS addr, unsigned long len, const char * d)
static int __inline__ request_region(PHYSICAL_ADDRESS addr, unsigned long len, const char * d)
{
DPRINT1("request_region(): addr=0x%lx, len=0x%lx\n", addr.u.LowPart, len);
return ~0;
@@ -101,7 +94,7 @@ Parameters:
addr virtual start address
*/
static int __inline iounmap(void* p)
static int __inline__ iounmap(void* p)
{
DPRINT1("iounmap(): p=0x%x. FIXME - how to obtain len of mapped region?\n", p);
@@ -117,7 +110,7 @@ Parameters:
start begin of region
n length of region
*/
static int __inline release_region(PHYSICAL_ADDRESS addr, unsigned long len)
static int __inline__ release_region(PHYSICAL_ADDRESS addr, unsigned long len)
{
DPRINT1("release_region(): addr=0x%lx, len=0x%lx\n", addr.u.LowPart, len);
return 0;
@@ -131,7 +124,7 @@ start begin of region
n length of region
name name of requester
*/
static int __inline request_mem_region(PHYSICAL_ADDRESS addr, unsigned long len, const char * d)
static int __inline__ request_mem_region(PHYSICAL_ADDRESS addr, unsigned long len, const char * d)
{
DPRINT1("request_mem_region(): addr=0x%lx, len=0x%lx\n", addr.u.LowPart, len);
return 1;
@@ -147,7 +140,7 @@ size size of physical address range
Returns:
virtual start address of mapped range
*/
static void __inline *ioremap_nocache(PHYSICAL_ADDRESS addr, unsigned long len)
static void __inline__ *ioremap_nocache(PHYSICAL_ADDRESS addr, unsigned long len)
{
// MmMapIoSpace with NoCache param
DPRINT1("ioremap_nocache(): addr=0x%lx, len=0x%lx\n", addr.u.LowPart, len);
@@ -162,7 +155,7 @@ Parameters:
start begin of region
n length of region
*/
static int __inline release_mem_region(PHYSICAL_ADDRESS addr, unsigned long len)
static int __inline__ release_mem_region(PHYSICAL_ADDRESS addr, unsigned long len)
{
DPRINT1("release_mem_region(): addr=0x%lx, len=0x%lx\n", addr.u.LowPart, len);
return 0;

View File

@@ -5,7 +5,6 @@
#include "usb_ch9.h"
#define USB_MAJOR 180
#define USB_DEVICE_MAJOR 189
#ifdef __KERNEL__
@@ -15,14 +14,23 @@
#include <linux/delay.h> /* for mdelay() */
#include <linux/interrupt.h> /* for in_interrupt() */
#include <linux/list.h> /* for struct list_head */
#include <linux/kref.h> /* for struct kref */
#include <linux/device.h> /* for struct device */
#include <linux/fs.h> /* for struct file_operations */
#include <linux/completion.h> /* for struct completion */
#include <linux/sched.h> /* for current && schedule_timeout */
static __inline__ void wait_ms(unsigned int ms)
{
if(!in_interrupt()) {
current->state = TASK_UNINTERRUPTIBLE;
schedule_timeout(1 + ms * HZ / 1000);
}
else
mdelay(ms);
}
#endif
struct usb_device;
struct usb_driver;
/*-------------------------------------------------------------------------*/
@@ -41,22 +49,9 @@ struct usb_driver;
* Devices may also have class-specific or vendor-specific descriptors.
*/
/**
* struct usb_host_endpoint - host-side endpoint descriptor and queue
* @desc: descriptor for this endpoint, wMaxPacketSize in native byteorder
* @urb_list: urbs queued to this endpoint; maintained by usbcore
* @hcpriv: for use by HCD; typically holds hardware dma queue head (QH)
* with one or more transfer descriptors (TDs) per urb
* @extra: descriptors following this endpoint in the configuration
* @extralen: how many bytes of "extra" are valid
*
* USB requests are always queued to a given endpoint, identified by a
* descriptor within an active interface in a given USB configuration.
*/
/* host-side wrapper for parsed endpoint descriptors */
struct usb_host_endpoint {
struct usb_endpoint_descriptor desc;
struct list_head urb_list;
void *hcpriv;
unsigned char *extra; /* Extra descriptors */
int extralen;
@@ -71,34 +66,27 @@ struct usb_host_interface {
*/
struct usb_host_endpoint *endpoint;
char *string; /* iInterface string, if present */
unsigned char *extra; /* Extra descriptors */
int extralen;
};
enum usb_interface_condition {
USB_INTERFACE_UNBOUND = 0,
USB_INTERFACE_BINDING,
USB_INTERFACE_BOUND,
USB_INTERFACE_UNBINDING,
};
/**
* struct usb_interface - what usb device drivers talk to
* @altsetting: array of interface structures, one for each alternate
* @altsetting: array of interface descriptors, one for each alternate
* setting that may be selected. Each one includes a set of
* endpoint configurations. They will be in no particular order.
* endpoint configurations and will be in numberic order,
* 0..num_altsetting.
* @num_altsetting: number of altsettings defined.
* @cur_altsetting: the current altsetting.
* @driver: the USB driver that is bound to this interface.
* @act_altsetting: index of current altsetting. this number is always
* less than num_altsetting. after the device is configured, each
* interface uses its default setting of zero.
* @max_altsetting:
* @minor: the minor number assigned to this interface, if this
* interface is bound to a driver that uses the USB major number.
* If this interface does not use the USB major, this field should
* be unused. The driver should set this value in the probe()
* function of the driver, after it has been assigned a minor
* number from the USB core by calling usb_register_dev().
* @condition: binding state of the interface: not bound, binding
* (in probe()), bound to a driver, or unbinding (in disconnect())
* @dev: driver model's view of this device
* @class_dev: driver model's class view of this device.
*
@@ -114,140 +102,78 @@ enum usb_interface_condition {
* calls such as dev_get_drvdata() on the dev member of this structure.
*
* Each interface may have alternate settings. The initial configuration
* of a device sets altsetting 0, but the device driver can change
* of a device sets the first of these, but the device driver can change
* that setting using usb_set_interface(). Alternate settings are often
* used to control the the use of periodic endpoints, such as by having
* different endpoints use different amounts of reserved USB bandwidth.
* All standards-conformant USB devices that use isochronous endpoints
* will use them in non-default settings.
*
* The USB specification says that alternate setting numbers must run from
* 0 to one less than the total number of alternate settings. But some
* devices manage to mess this up, and the structures aren't necessarily
* stored in numerical order anyhow. Use usb_altnum_to_altsetting() to
* look up an alternate setting in the altsetting array based on its number.
*/
struct usb_interface {
/* array of alternate settings for this interface,
* stored in no particular order */
/* array of alternate settings for this interface.
* these will be in numeric order, 0..num_altsettting
*/
struct usb_host_interface *altsetting;
struct usb_host_interface *cur_altsetting; /* the currently
* active alternate setting */
unsigned act_altsetting; /* active alternate setting */
unsigned num_altsetting; /* number of alternate settings */
unsigned max_altsetting; /* total memory allocated */
struct usb_driver *driver; /* driver */
int minor; /* minor number this interface is bound to */
enum usb_interface_condition condition; /* state of binding */
struct device dev; /* interface specific device info */
struct class_device class_dev;
}USB_INTERFACE, *PUSB_INTERFACE;
#define to_usb_interface(d) container_of(d, struct usb_interface, dev)
#define class_dev_to_usb_interface(d) container_of(d, struct usb_interface, class_dev)
#define interface_to_usbdev(intf) \
container_of(intf->dev.parent, struct usb_device, dev)
static __inline void *usb_get_intfdata (struct usb_interface *intf)
static inline void *usb_get_intfdata (struct usb_interface *intf)
{
return dev_get_drvdata (&intf->dev);
}
static __inline void usb_set_intfdata (struct usb_interface *intf, void *data)
static inline void usb_set_intfdata (struct usb_interface *intf, void *data)
{
dev_set_drvdata(&intf->dev, data);
}
struct usb_interface *usb_get_intf(struct usb_interface *intf);
void usb_put_intf(struct usb_interface *intf);
/* this maximum is arbitrary */
#define USB_MAXINTERFACES 32
/**
* struct usb_interface_cache - long-term representation of a device interface
* @num_altsetting: number of altsettings defined.
* @ref: reference counter.
* @altsetting: variable-length array of interface structures, one for
* each alternate setting that may be selected. Each one includes a
* set of endpoint configurations. They will be in no particular order.
/* USB_DT_CONFIG: Configuration descriptor information.
*
* These structures persist for the lifetime of a usb_device, unlike
* struct usb_interface (which persists only as long as its configuration
* is installed). The altsetting arrays can be accessed through these
* structures at any time, permitting comparison of configurations and
* providing support for the /proc/bus/usb/devices pseudo-file.
*/
struct usb_interface_cache {
unsigned num_altsetting; /* number of alternate settings */
struct kref ref; /* reference counter */
/* variable-length array of alternate settings for this interface,
* stored in no particular order */
struct usb_host_interface altsetting[0];
};
#define ref_to_usb_interface_cache(r) \
container_of(r, struct usb_interface_cache, ref)
#define altsetting_to_usb_interface_cache(a) \
container_of(a, struct usb_interface_cache, altsetting[0])
/**
* struct usb_host_config - representation of a device's configuration
* @desc: the device's configuration descriptor.
* @string: pointer to the cached version of the iConfiguration string, if
* present for this configuration.
* @interface: array of pointers to usb_interface structures, one for each
* interface in the configuration. The number of interfaces is stored
* in desc.bNumInterfaces. These pointers are valid only while the
* the configuration is active.
* @intf_cache: array of pointers to usb_interface_cache structures, one
* for each interface in the configuration. These structures exist
* for the entire life of the device.
* @extra: pointer to buffer containing all extra descriptors associated
* with this configuration (those preceding the first interface
* descriptor).
* @extralen: length of the extra descriptors buffer.
*
* USB devices may have multiple configurations, but only one can be active
* at any time. Each encapsulates a different operational environment;
* for example, a dual-speed device would have separate configurations for
* full-speed and high-speed operation. The number of configurations
* available is stored in the device descriptor as bNumConfigurations.
*
* A configuration can contain multiple interfaces. Each corresponds to
* a different function of the USB device, and all are available whenever
* the configuration is active. The USB standard says that interfaces
* are supposed to be numbered from 0 to desc.bNumInterfaces-1, but a lot
* of devices get this wrong. In addition, the interface array is not
* guaranteed to be sorted in numerical order. Use usb_ifnum_to_if() to
* look up an interface entry based on its number.
*
* Device drivers should not attempt to activate configurations. The choice
* of which configuration to install is a policy decision based on such
* considerations as available power, functionality provided, and the user's
* desires (expressed through hotplug scripts). However, drivers can call
* usb_reset_configuration() to reinitialize the current configuration and
* all its interfaces.
* USB_DT_OTHER_SPEED_CONFIG is the same descriptor, except that the
* descriptor type is different. Highspeed-capable devices can look
* different depending on what speed they're currently running. Only
* devices with a USB_DT_DEVICE_QUALIFIER have an OTHER_SPEED_CONFIG.
*/
struct usb_host_config {
struct usb_config_descriptor desc;
/* the interfaces associated with this configuration
* these will be in numeric order, 0..desc.bNumInterfaces
*/
char *string;
/* the interfaces associated with this configuration,
* stored in no particular order */
struct usb_interface *interface[USB_MAXINTERFACES];
/* Interface information available even when this is not the
* active configuration */
struct usb_interface_cache *intf_cache[USB_MAXINTERFACES];
struct usb_interface *interface;
unsigned char *extra; /* Extra descriptors */
int extralen;
};
// FIXME remove; exported only for drivers/usb/misc/auserwald.c
// prefer usb_device->epnum[0..31]
extern struct usb_endpoint_descriptor *
usb_epnum_to_ep_desc(struct usb_device *dev, unsigned epnum);
int __usb_get_extra_descriptor(char *buffer, unsigned size,
unsigned char type, void **ptr);
#define usb_get_extra_descriptor(ifpoint,type,ptr)\
__usb_get_extra_descriptor((ifpoint)->extra,(ifpoint)->extralen,\
type,(void**)ptr)
void usb_choose_address(struct usb_device *dev);
/* -------------------------------------------------------------------------- */
struct usb_operations;
@@ -264,9 +190,6 @@ struct usb_bus {
struct device *controller; /* host/master side hardware */
int busnum; /* Bus number (in order of reg) */
char *bus_name; /* stable id (PCI slot_name etc) */
u8 otg_port; /* 0, or number of OTG/HNP port */
unsigned is_b_host:1; /* true during some HNP roleswitches */
unsigned b_hnp_enable:1; /* OTG: did A-Host enable HNP? */
int devnum_next; /* Next open device number in round-robin allocation */
@@ -287,16 +210,12 @@ struct usb_bus {
int bandwidth_isoc_reqs; /* number of Isoc. requests */
struct dentry *usbfs_dentry; /* usbfs dentry entry for the bus */
struct dentry *usbdevfs_dentry; /* usbdevfs dentry entry for the bus */
struct class_device *class_dev; /* class device for this bus */
struct kref kref; /* handles reference counting this bus */
void (*release)(struct usb_bus *bus); /* function to destroy this bus's memory */
#if defined(CONFIG_USB_MON)
struct mon_bus *mon_bus; /* non-null when associated */
int monitored; /* non-zero when monitored */
#endif
atomic_t refcnt;
};
/* -------------------------------------------------------------------------- */
/* This is arbitrary.
@@ -307,14 +226,6 @@ struct usb_bus {
struct usb_tt;
/*
* struct usb_device - kernel's representation of a USB device
*
* FIXME: Write the kerneldoc!
*
* Usbcore drivers should not set usbdev->state directly. Instead use
* usb_set_device_state().
*/
struct usb_device {
int devnum; /* Address on USB bus */
char devpath [16]; /* Use in messages: /port/port/... */
@@ -327,31 +238,30 @@ struct usb_device {
struct semaphore serialize;
unsigned int toggle[2]; /* one bit for each endpoint ([0] = IN, [1] = OUT) */
unsigned int halted[2]; /* endpoint halts; one bit per endpoint # & direction; */
/* [0] = IN, [1] = OUT */
int epmaxpacketin[16]; /* INput endpoint specific maximums */
int epmaxpacketout[16]; /* OUTput endpoint specific maximums */
struct usb_device *parent; /* our hub, unless we're the root */
struct usb_bus *bus; /* Bus we're part of */
struct usb_host_endpoint ep0;
struct device dev; /* Generic device interface */
struct usb_device_descriptor descriptor;/* Descriptor */
struct usb_host_config *config; /* All of the configs */
struct usb_host_config *actconfig;/* the active configuration */
struct usb_host_endpoint *ep_in[16];
struct usb_host_endpoint *ep_out[16];
char **rawdescriptors; /* Raw descriptors for each config */
int have_langid; /* whether string_langid is valid yet */
int string_langid; /* language ID for strings */
char *product;
char *manufacturer;
char *serial; /* static strings from the device */
void *hcpriv; /* Host Controller private data */
struct list_head filelist;
struct class_device *class_dev;
struct dentry *usbfs_dentry; /* usbfs dentry entry for the device */
struct dentry *usbdevfs_dentry; /* usbdevfs dentry entry for the device */
/*
* Child devices - these can be either new devices
@@ -366,54 +276,29 @@ struct usb_device {
};
#define to_usb_device(d) container_of(d, struct usb_device, dev)
extern struct usb_device* STDCALL usb_get_dev(struct usb_device *dev);
extern struct usb_device STDCALL *usb_alloc_dev(struct usb_device *parent, struct usb_bus *);
extern struct usb_device STDCALL *usb_get_dev(struct usb_device *dev);
extern void STDCALL usb_put_dev(struct usb_device *dev);
extern void usb_lock_device(struct usb_device *udev);
extern int usb_trylock_device(struct usb_device *udev);
extern int usb_lock_device_for_reset(struct usb_device *udev,
struct usb_interface *iface);
extern void usb_unlock_device(struct usb_device *udev);
/* USB port reset for device reinitialization */
/* mostly for devices emulating SCSI over USB */
extern int usb_reset_device(struct usb_device *dev);
extern struct usb_device *usb_find_device(u16 vendor_id, u16 product_id);
/*-------------------------------------------------------------------------*/
/* for drivers using iso endpoints */
extern int usb_get_current_frame_number (struct usb_device *usb_dev);
/* used these for multi-interface device registration */
extern int usb_driver_claim_interface(struct usb_driver *driver,
extern void usb_driver_claim_interface(struct usb_driver *driver,
struct usb_interface *iface, void* priv);
/**
* usb_interface_claimed - returns true iff an interface is claimed
* @iface: the interface being checked
*
* Returns true (nonzero) iff the interface is claimed, else false (zero).
* Callers must own the driver model's usb bus readlock. So driver
* probe() entries don't need extra locking, but other call contexts
* may need to explicitly claim that lock.
*
*/
static __inline int usb_interface_claimed(struct usb_interface *iface) {
return (iface->dev.driver != NULL);
}
extern int usb_interface_claimed(struct usb_interface *iface);
extern void usb_driver_release_interface(struct usb_driver *driver,
struct usb_interface *iface);
const struct usb_device_id *usb_match_id(struct usb_interface *interface,
const struct usb_device_id *id);
extern struct usb_interface *usb_find_interface(struct usb_driver *drv,
int minor);
extern struct usb_interface *usb_ifnum_to_if(struct usb_device *dev,
unsigned ifnum);
extern struct usb_host_interface *usb_altnum_to_altsetting(
struct usb_interface *intf, unsigned int altnum);
extern struct usb_interface *usb_find_interface(struct usb_driver *drv, int minor);
extern struct usb_interface *usb_ifnum_to_if(struct usb_device *dev, unsigned ifnum);
/**
@@ -440,11 +325,11 @@ extern struct usb_host_interface *usb_altnum_to_altsetting(
* USB 2.0 root hubs (EHCI host controllers) will get one path ID if they are
* high speed, and a different one if they are full or low speed.
*/
static __inline int usb_make_path (struct usb_device *dev, char *buf, size_t size)
static inline int usb_make_path (struct usb_device *dev, char *buf, size_t size)
{
int actual;
actual = snprintf (buf, size, "usb-%s-%s", dev->bus->bus_name, dev->devpath);
return (actual >= (int)size) ? -1 : actual;
return (actual >= size) ? -1 : actual;
}
/*-------------------------------------------------------------------------*/
@@ -501,14 +386,9 @@ static __inline int usb_make_path (struct usb_device *dev, char *buf, size_t siz
* This macro is used to create a struct usb_device_id that matches a
* specific class of interfaces.
*/
#if defined(__GNUC__)
#define USB_INTERFACE_INFO(cl,sc,pr) \
.match_flags = USB_DEVICE_ID_MATCH_INT_INFO, .bInterfaceClass = (cl), .bInterfaceSubClass = (sc), .bInterfaceProtocol = (pr)
#else
#define USB_INTERFACE_INFO(cl,sc,pr) \
USB_DEVICE_ID_MATCH_INT_INFO, 0, 0, 0, 0, 0, 0, 0, \
(cl), (sc), (pr)
#endif
/* -------------------------------------------------------------------------- */
/**
@@ -530,12 +410,9 @@ static __inline int usb_make_path (struct usb_device *dev, char *buf, size_t siz
* the "usbfs" filesystem. This lets devices provide ways to
* expose information to user space regardless of where they
* do (or don't) show up otherwise in the filesystem.
* @suspend: Called when the device is going to be suspended by the system.
* @resume: Called when the device is being resumed by the system.
* @id_table: USB drivers use ID table to support hotplugging.
* Export this with MODULE_DEVICE_TABLE(usb,...). This must be set
* or your driver's probe function will never get called.
* @driver: the driver model core driver structure.
* or your driver's probe function will never get called.
*
* USB drivers must provide a name, probe() and disconnect() methods,
* and an id_table. Other driver fields are optional.
@@ -564,12 +441,11 @@ struct usb_driver {
int (*ioctl) (struct usb_interface *intf, unsigned int code, void *buf);
int (*suspend) (struct usb_interface *intf, pm_message_t message);
int (*resume) (struct usb_interface *intf);
const struct usb_device_id *id_table;
struct device_driver driver;
struct semaphore serialize;
};
#define to_usb_driver(d) container_of(d, struct usb_driver, driver)
@@ -584,8 +460,8 @@ extern struct bus_type usb_bus_type;
* @minor_base: the start of the minor range for this driver.
*
* This structure is used for the usb_register_dev() and
* usb_unregister_dev() functions, to consolidate a number of the
* parameters used for them.
* usb_unregister_dev() functions, to consolodate a number of the
* paramaters used for them.
*/
struct usb_class_driver {
char *name;
@@ -606,6 +482,8 @@ extern int usb_register_dev(struct usb_interface *intf,
extern void usb_deregister_dev(struct usb_interface *intf,
struct usb_class_driver *class_driver);
extern int usb_device_probe(struct device *dev);
extern int usb_device_remove(struct device *dev);
extern int STDCALL usb_disabled(void);
/* -------------------------------------------------------------------------- */
@@ -619,8 +497,8 @@ extern int STDCALL usb_disabled(void);
*/
#define URB_SHORT_NOT_OK 0x0001 /* report short reads as errors */
#define URB_ISO_ASAP 0x0002 /* iso-only, urb->start_frame ignored */
#define URB_NO_TRANSFER_DMA_MAP 0x0004 /* urb->transfer_dma valid on submit */
#define URB_NO_SETUP_DMA_MAP 0x0008 /* urb->setup_dma valid on submit */
#define URB_NO_DMA_MAP 0x0004 /* urb->*_dma are valid on submit */
#define URB_ASYNC_UNLINK 0x0008 /* usb_unlink_urb() returns asap */
#define URB_NO_FSBR 0x0020 /* UHCI-specific */
#define URB_ZERO_PACKET 0x0040 /* Finish bulk OUTs with short packet */
#define URB_NO_INTERRUPT 0x0080 /* HINT: no non-error interrupt needed */
@@ -642,7 +520,7 @@ typedef void (*usb_complete_t)(struct urb *, struct pt_regs *);
* @urb_list: For use by current owner of the URB.
* @pipe: Holds endpoint number, direction, type, and more.
* Create these values with the eight macros available;
* usb_{snd,rcv}TYPEpipe(dev,endpoint), where the TYPE is "ctrl"
* usb_{snd,rcv}TYPEpipe(dev,endpoint), where the type is "ctrl"
* (control), "bulk", "int" (interrupt), or "iso" (isochronous).
* For example usb_sndbulkpipe() or usb_rcvintpipe(). Endpoint
* numbers range from zero to fifteen. Note that "in" endpoint two
@@ -658,15 +536,14 @@ typedef void (*usb_complete_t)(struct urb *, struct pt_regs *);
* submission, unlinking, or operation are handled. Different
* kinds of URB can use different flags.
* @transfer_buffer: This identifies the buffer to (or from) which
* the I/O request will be performed (unless URB_NO_TRANSFER_DMA_MAP
* is set). This buffer must be suitable for DMA; allocate it with
* kmalloc() or equivalent. For transfers to "in" endpoints, contents
* of this buffer will be modified. This buffer is used for the data
* stage of control transfers.
* @transfer_dma: When transfer_flags includes URB_NO_TRANSFER_DMA_MAP,
* the device driver is saying that it provided this DMA address,
* which the host controller driver should use in preference to the
* transfer_buffer.
* the I/O request will be performed (unless URB_NO_DMA_MAP is set).
* This buffer must be suitable for DMA; allocate it with kmalloc()
* or equivalent. For transfers to "in" endpoints, contents of
* this buffer will be modified. This buffer is used for data
* phases of control transfers.
* @transfer_dma: When transfer_flags includes URB_NO_DMA_MAP, the device
* driver is saying that it provided this DMA address, which the host
* controller driver should use instead of the transfer_buffer.
* @transfer_buffer_length: How big is transfer_buffer. The transfer may
* be broken up into chunks according to the current maximum packet
* size for the endpoint, which is a function of the configuration
@@ -681,11 +558,13 @@ typedef void (*usb_complete_t)(struct urb *, struct pt_regs *);
* @setup_packet: Only used for control transfers, this points to eight bytes
* of setup data. Control transfers always start by sending this data
* to the device. Then transfer_buffer is read or written, if needed.
* @setup_dma: For control transfers with URB_NO_SETUP_DMA_MAP set, the
* device driver has provided this DMA address for the setup packet.
* The host controller driver should use this in preference to
* setup_packet.
* @start_frame: Returns the initial frame for isochronous transfers.
* (Not used when URB_NO_DMA_MAP is set.)
* @setup_dma: For control transfers with URB_NO_DMA_MAP set, the device
* driver has provided this DMA address for the setup packet. The
* host controller driver should use this instead of setup_buffer.
* If there is a data phase, its buffer is identified by transfer_dma.
* @start_frame: Returns the initial frame for interrupt or isochronous
* transfers.
* @number_of_packets: Lists the number of ISO transfer buffers.
* @interval: Specifies the polling interval for interrupt or isochronous
* transfers. The units are frames (milliseconds) for for full and low
@@ -703,7 +582,7 @@ typedef void (*usb_complete_t)(struct urb *, struct pt_regs *);
* calling usb_alloc_urb() and freed with a call to usb_free_urb().
* Initialization may be done using various usb_fill_*_urb() functions. URBs
* are submitted using usb_submit_urb(), and pending requests may be canceled
* using usb_unlink_urb() or usb_kill_urb().
* using usb_unlink_urb().
*
* Data Transfer Buffers:
*
@@ -715,20 +594,22 @@ typedef void (*usb_complete_t)(struct urb *, struct pt_regs *);
* bounce buffer or talking to an IOMMU),
* although they're cheap on commodity x86 and ppc hardware.
*
* Alternatively, drivers may pass the URB_NO_xxx_DMA_MAP transfer flags,
* which tell the host controller driver that no such mapping is needed since
* the device driver is DMA-aware. For example, a device driver might
* allocate a DMA buffer with usb_buffer_alloc() or call usb_buffer_map().
* When these transfer flags are provided, host controller drivers will
* attempt to use the dma addresses found in the transfer_dma and/or
* setup_dma fields rather than determining a dma address themselves. (Note
* that transfer_buffer and setup_packet must still be set because not all
* host controllers use DMA, nor do virtual root hubs).
* Alternatively, drivers may pass the URB_NO_DMA_MAP transfer flag, which
* tells the host controller driver that no such mapping is needed since
* the device driver is DMA-aware. For example, they might allocate a DMA
* buffer with usb_buffer_alloc(), or call usb_buffer_map().
* When this transfer flag is provided, host controller drivers will use the
* dma addresses found in the transfer_dma and/or setup_dma fields rather than
* determing a dma address themselves.
*
* Initialization:
*
* All URBs submitted must initialize the dev, pipe, transfer_flags (may be
* zero), and complete fields. All URBs must also initialize
* All URBs submitted must initialize dev, pipe,
* transfer_flags (may be zero), complete, timeout (may be zero).
* The URB_ASYNC_UNLINK transfer flag affects later invocations of
* the usb_unlink_urb() routine.
*
* All URBs must also initialize
* transfer_buffer and transfer_buffer_length. They may provide the
* URB_SHORT_NOT_OK transfer flag, indicating that short reads are
* to be treated as errors; that flag is invalid for write requests.
@@ -738,23 +619,18 @@ typedef void (*usb_complete_t)(struct urb *, struct pt_regs *);
* should always terminate with a short packet, even if it means adding an
* extra zero length packet.
*
* Control URBs must provide a setup_packet. The setup_packet and
* transfer_buffer may each be mapped for DMA or not, independently of
* the other. The transfer_flags bits URB_NO_TRANSFER_DMA_MAP and
* URB_NO_SETUP_DMA_MAP indicate which buffers have already been mapped.
* URB_NO_SETUP_DMA_MAP is ignored for non-control URBs.
* Control URBs must provide a setup_packet.
*
* Interrupt URBs must provide an interval, saying how often (in milliseconds
* Interrupt UBS must provide an interval, saying how often (in milliseconds
* or, for highspeed devices, 125 microsecond units)
* to poll for transfers. After the URB has been submitted, the interval
* field reflects how the transfer was actually scheduled.
* and start_frame fields reflect how the transfer was actually scheduled.
* The polling interval may be more frequent than requested.
* For example, some controllers have a maximum interval of 32 milliseconds,
* while others support intervals of up to 1024 milliseconds.
* For example, some controllers have a maximum interval of 32 microseconds,
* while others support intervals of up to 1024 microseconds.
* Isochronous URBs also have transfer intervals. (Note that for isochronous
* endpoints, as well as high speed interrupt endpoints, the encoding of
* the transfer interval in the endpoint descriptor is logarithmic.
* Device drivers must convert that value to linear units themselves.)
* the transfer interval in the endpoint descriptor is logarithmic.)
*
* Isochronous URBs normally use the URB_ISO_ASAP transfer flag, telling
* the host controller to schedule the transfer as soon as bandwidth
@@ -787,31 +663,20 @@ typedef void (*usb_complete_t)(struct urb *, struct pt_regs *);
* The context field is normally used to link URBs back to the relevant
* driver or request state.
*
* When the completion callback is invoked for non-isochronous URBs, the
* actual_length field tells how many bytes were transferred. This field
* is updated even when the URB terminated with an error or was unlinked.
* When completion callback is invoked for non-isochronous URBs, the
* actual_length field tells how many bytes were transferred.
*
* ISO transfer status is reported in the status and actual_length fields
* of the iso_frame_desc array, and the number of errors is reported in
* error_count. Completion callbacks for ISO transfers will normally
* (re)submit URBs to ensure a constant transfer rate.
*
* Note that even fields marked "public" should not be touched by the driver
* when the urb is owned by the hcd, that is, since the call to
* usb_submit_urb() till the entry into the completion routine.
*/
struct urb
{
/* private, usb core and host controller only fields in the urb */
struct kref kref; /* reference count of the URB */
spinlock_t lock; /* lock for the URB */
atomic_t count; /* reference count of the URB */
void *hcpriv; /* private data for host controller */
int bandwidth; /* bandwidth for INT/ISO request */
atomic_t use_count; /* concurrent submissions counter */
u8 reject; /* submissions will fail */
/* public, documented fields in the urb that can be used by drivers */
struct list_head urb_list; /* list head for use by the urb owner */
struct list_head urb_list; /* list pointer to all active urbs */
struct usb_device *dev; /* (in) pointer to associated device */
unsigned int pipe; /* (in) pipe information */
int status; /* (return) non-ISO status */
@@ -820,12 +685,14 @@ struct urb
dma_addr_t transfer_dma; /* (in) dma addr for transfer_buffer */
int transfer_buffer_length; /* (in) data buffer length */
int actual_length; /* (return) actual transfer length */
int bandwidth; /* bandwidth for INT/ISO request */
unsigned char *setup_packet; /* (in) setup packet (control only) */
dma_addr_t setup_dma; /* (in) dma addr for setup_packet */
int start_frame; /* (modify) start frame (ISO) */
int start_frame; /* (modify) start frame (INT/ISO) */
int number_of_packets; /* (in) number of ISO packets */
int interval; /* (modify) transfer interval (INT/ISO) */
int interval; /* (in) transfer interval (INT/ISO) */
int error_count; /* (return) number of ISO errors */
int timeout; /* (in) timeout, in jiffies */
void *context; /* (in) context for completion */
usb_complete_t complete; /* (in) completion routine */
struct usb_iso_packet_descriptor iso_frame_desc[0]; /* (in) ISO ONLY */
@@ -847,7 +714,7 @@ struct urb
* Initializes a control urb with the proper information needed to submit
* it to a device.
*/
static __inline void usb_fill_control_urb (struct urb *urb,
static inline void usb_fill_control_urb (struct urb *urb,
struct usb_device *dev,
unsigned int pipe,
unsigned char *setup_packet,
@@ -879,7 +746,7 @@ static __inline void usb_fill_control_urb (struct urb *urb,
* Initializes a bulk urb with the proper information needed to submit it
* to a device.
*/
static __inline void usb_fill_bulk_urb (struct urb *urb,
static inline void usb_fill_bulk_urb (struct urb *urb,
struct usb_device *dev,
unsigned int pipe,
void *transfer_buffer,
@@ -914,7 +781,7 @@ static __inline void usb_fill_bulk_urb (struct urb *urb,
* the endpoint interval, and express polling intervals in microframes
* (eight per millisecond) rather than in frames (one per millisecond).
*/
static __inline void usb_fill_int_urb (struct urb *urb,
static inline void usb_fill_int_urb (struct urb *urb,
struct usb_device *dev,
unsigned int pipe,
void *transfer_buffer,
@@ -938,33 +805,28 @@ static __inline void usb_fill_int_urb (struct urb *urb,
}
extern void STDCALL usb_init_urb(struct urb *urb);
extern struct urb* STDCALL usb_alloc_urb(int iso_packets, unsigned mem_flags);
extern struct urb STDCALL *usb_alloc_urb(int iso_packets, int mem_flags);
extern void STDCALL usb_free_urb(struct urb *urb);
#define usb_put_urb usb_free_urb
extern struct urb* STDCALL usb_get_urb(struct urb *urb);
extern int STDCALL usb_submit_urb(struct urb *urb, unsigned mem_flags);
extern struct urb STDCALL *usb_get_urb(struct urb *urb);
extern int STDCALL usb_submit_urb(struct urb *urb, int mem_flags);
extern int STDCALL usb_unlink_urb(struct urb *urb);
extern void STDCALL usb_kill_urb(struct urb *urb);
#define HAVE_USB_BUFFERS
void *usb_buffer_alloc (struct usb_device *dev, size_t size,
unsigned mem_flags, dma_addr_t *dma);
int mem_flags, dma_addr_t *dma);
void usb_buffer_free (struct usb_device *dev, size_t size,
void *addr, dma_addr_t dma);
#if 0
struct urb *usb_buffer_map (struct urb *urb);
void usb_buffer_dmasync (struct urb *urb);
void usb_buffer_unmap (struct urb *urb);
#endif
struct scatterlist;
int usb_buffer_map_sg (struct usb_device *dev, unsigned pipe,
struct scatterlist *sg, int nents);
#if 0
void usb_buffer_dmasync_sg (struct usb_device *dev, unsigned pipe,
struct scatterlist *sg, int n_hw_ents);
#endif
void usb_buffer_unmap_sg (struct usb_device *dev, unsigned pipe,
struct scatterlist *sg, int n_hw_ents);
@@ -979,14 +841,10 @@ extern int usb_bulk_msg(struct usb_device *usb_dev, unsigned int pipe,
void *data, int len, int *actual_length,
int timeout);
/* selective suspend/resume */
extern int usb_suspend_device(struct usb_device *dev, pm_message_t message);
extern int usb_resume_device(struct usb_device *dev);
/* wrappers around usb_control_msg() for the most common standard requests */
extern int usb_get_descriptor(struct usb_device *dev, unsigned char desctype,
unsigned char descindex, void *buf, int size);
extern int usb_get_device_descriptor(struct usb_device *dev);
extern int usb_get_status(struct usb_device *dev,
int type, int target, void *data);
extern int usb_get_string(struct usb_device *dev,
@@ -996,17 +854,17 @@ extern int usb_string(struct usb_device *dev, int index,
/* wrappers that also update important state inside usbcore */
extern int usb_clear_halt(struct usb_device *dev, int pipe);
extern int usb_reset_configuration(struct usb_device *dev);
extern int usb_set_configuration(struct usb_device *dev, int configuration);
extern int usb_set_interface(struct usb_device *dev, int ifnum, int alternate);
/*
* timeouts, in milliseconds, used for sending/receiving control messages
* timeouts, in seconds, used for sending/receiving control messages
* they typically complete within a few frames (msec) after they're issued
* USB identifies 5 second timeouts, maybe more in a few cases, and a few
* slow devices (like some MGE Ellipse UPSes) actually push that limit.
*/
#define USB_CTRL_GET_TIMEOUT 5000
#define USB_CTRL_SET_TIMEOUT 5000
#define USB_CTRL_GET_TIMEOUT 5
#define USB_CTRL_SET_TIMEOUT 5
/**
@@ -1029,10 +887,8 @@ struct usb_sg_request {
int status;
size_t bytes;
/*
* members below are private to usbcore,
* and are not provided for driver access!
*/
// members not documented above are private to usbcore,
// and are not provided for driver access!
spinlock_t lock;
struct usb_device *dev;
@@ -1055,7 +911,7 @@ int usb_sg_init (
struct scatterlist *sg,
int nents,
size_t length,
unsigned mem_flags
int mem_flags
);
void usb_sg_cancel (struct usb_sg_request *io);
void usb_sg_wait (struct usb_sg_request *io);
@@ -1064,35 +920,55 @@ void usb_sg_wait (struct usb_sg_request *io);
/* -------------------------------------------------------------------------- */
/*
* For various legacy reasons, Linux has a small cookie that's paired with
* a struct usb_device to identify an endpoint queue. Queue characteristics
* are defined by the endpoint's descriptor. This cookie is called a "pipe",
* an unsigned int encoded as:
* Calling this entity a "pipe" is glorifying it. A USB pipe
* is something embarrassingly simple: it basically consists
* of the following information:
* - device number (7 bits)
* - endpoint number (4 bits)
* - current Data0/1 state (1 bit) [Historical; now gone]
* - direction (1 bit)
* - speed (1 bit) [Historical and specific to USB 1.1; now gone.]
* - max packet size (2 bits: 8, 16, 32 or 64) [Historical; now gone.]
* - pipe type (2 bits: control, interrupt, bulk, isochronous)
*
* That's 18 bits. Really. Nothing more. And the USB people have
* documented these eighteen bits as some kind of glorious
* virtual data structure.
*
* Let's not fall in that trap. We'll just encode it as a simple
* unsigned int. The encoding is:
*
* - max size: bits 0-1 [Historical; now gone.]
* - direction: bit 7 (0 = Host-to-Device [Out],
* 1 = Device-to-Host [In] ...
* like endpoint bEndpointAddress)
* - device address: bits 8-14 ... bit positions known to uhci-hcd
* - device: bits 8-14 ... bit positions known to uhci-hcd
* - endpoint: bits 15-18 ... bit positions known to uhci-hcd
* - Data0/1: bit 19 [Historical; now gone. ]
* - lowspeed: bit 26 [Historical; now gone. ]
* - pipe type: bits 30-31 (00 = isochronous, 01 = interrupt,
* 10 = control, 11 = bulk)
*
* Given the device address and endpoint descriptor, pipes are redundant.
* Why? Because it's arbitrary, and whatever encoding we select is really
* up to us. This one happens to share a lot of bit positions with the UHCI
* specification, so that much of the uhci driver can just mask the bits
* appropriately.
*/
/* NOTE: these are not the standard USB_ENDPOINT_XFER_* values!! */
/* (yet ... they're the values used by usbfs) */
#define PIPE_ISOCHRONOUS 0
#define PIPE_INTERRUPT 1
#define PIPE_CONTROL 2
#define PIPE_BULK 3
#define usb_maxpacket(dev, pipe, out) (out \
? (dev)->epmaxpacketout[usb_pipeendpoint(pipe)] \
: (dev)->epmaxpacketin [usb_pipeendpoint(pipe)] )
#define usb_pipein(pipe) ((pipe) & USB_DIR_IN)
#define usb_pipeout(pipe) (!usb_pipein(pipe))
#define usb_pipedevice(pipe) (((pipe) >> 8) & 0x7f)
#define usb_pipeendpoint(pipe) (((pipe) >> 15) & 0xf)
#define usb_pipetype(pipe) (((pipe) >> 30) & 3)
#define usb_pipeisoc(pipe) (usb_pipetype((pipe)) == PIPE_ISOCHRONOUS)
#define usb_pipeint(pipe) (usb_pipetype((pipe)) == PIPE_INTERRUPT)
@@ -1104,8 +980,12 @@ void usb_sg_wait (struct usb_sg_request *io);
#define usb_dotoggle(dev, ep, out) ((dev)->toggle[out] ^= (1 << (ep)))
#define usb_settoggle(dev, ep, out, bit) ((dev)->toggle[out] = ((dev)->toggle[out] & ~(1 << (ep))) | ((bit) << (ep)))
/* Endpoint halt control/status ... likewise USE WITH CAUTION */
#define usb_endpoint_running(dev, ep, out) ((dev)->halted[out] &= ~(1 << (ep)))
#define usb_endpoint_halted(dev, ep, out) ((dev)->halted[out] & (1 << (ep)))
static __inline unsigned int __create_pipe(struct usb_device *dev, unsigned int endpoint)
static inline unsigned int __create_pipe(struct usb_device *dev, unsigned int endpoint)
{
return (dev->devnum << 8) | (endpoint << 15);
}
@@ -1120,50 +1000,35 @@ static __inline unsigned int __create_pipe(struct usb_device *dev, unsigned int
#define usb_sndintpipe(dev,endpoint) ((PIPE_INTERRUPT << 30) | __create_pipe(dev,endpoint))
#define usb_rcvintpipe(dev,endpoint) ((PIPE_INTERRUPT << 30) | __create_pipe(dev,endpoint) | USB_DIR_IN)
/*-------------------------------------------------------------------------*/
static __inline __u16
usb_maxpacket(struct usb_device *udev, int pipe, int is_out)
{
struct usb_host_endpoint *ep;
unsigned epnum = usb_pipeendpoint(pipe);
if (is_out) {
WARN_ON(usb_pipein(pipe));
ep = udev->ep_out[epnum];
} else {
WARN_ON(usb_pipeout(pipe));
ep = udev->ep_in[epnum];
}
if (!ep)
return 0;
/* NOTE: only 0x07ff bits are for packet size... */
return le16_to_cpu(ep->desc.wMaxPacketSize);
}
/* -------------------------------------------------------------------------- */
#ifdef DEBUG_MODE
#if defined(__GNUC__)
/*
* Debugging and troubleshooting/diagnostic helpers.
*/
void usb_show_device_descriptor(struct usb_device_descriptor *);
void usb_show_config_descriptor(struct usb_config_descriptor *);
void usb_show_interface_descriptor(struct usb_interface_descriptor *);
void usb_show_endpoint_descriptor(struct usb_endpoint_descriptor *);
void usb_show_device(struct usb_device *);
void usb_show_string(struct usb_device *dev, char *id, int index);
#ifdef DEBUG
#define dbg(format, arg...) printk(KERN_DEBUG "%s: " format "\n" , __FILE__ , ## arg)
#define err(format, arg...) printk(KERN_ERR "%s: " format "\n" , __FILE__ , ## arg)
#define info(format, arg...) printk(KERN_INFO "%s: " format "\n" , __FILE__ , ## arg)
#define warn(format, arg...) printk(KERN_WARNING "%s: " format "\n" , __FILE__ , ## arg)
#elif defined(_MSC_VER)
#define dbg DPRINT
#define err(...) DPRINT1(__VA_ARGS__)
#define info DPRINT
#define warn DPRINT1
#else
#error Unrecognized compiler!
#define dbg(format, arg...) do {} while (0)
#endif
#ifdef DEBUG_MODE
#define info(format, arg...) printk(KERN_INFO __FILE__ ": " format "\n" , ## arg)
#define err(format, arg...) printk(KERN_ERR __FILE__ ": " format "\n" , ## arg)
#define warn(format, arg...) printk(KERN_WARNING __FILE__ ": " format "\n" , ## arg)
#endif
#ifndef DEBUG_MODE
#define dbg(format, arg...) do {} while (0)
#define err(format, arg...) do {} while (0)
#define info(format, arg...) do {} while (0)
#define err(format, arg...) do {} while (0)
#define warn(format, arg...) do {} while (0)
#endif

View File

@@ -6,14 +6,11 @@
*
* - the master/host side Linux-USB kernel driver API;
* - the "usbfs" user space API; and
* - the Linux "gadget" slave/device/peripheral side driver API.
* - (eventually) a Linux "gadget" slave/device side driver API.
*
* USB 2.0 adds an additional "On The Go" (OTG) mode, which lets systems
* act either as a USB master/host or as a USB slave/device. That means
* the master and slave side APIs benefit from working well together.
*
* There's also "Wireless USB", using low power short range radios for
* peripheral interconnection but otherwise building on the USB framework.
* the master and slave side APIs will benefit from working well together.
*/
#ifndef __LINUX_USB_CH9_H
@@ -71,35 +68,6 @@
#define USB_REQ_SET_INTERFACE 0x0B
#define USB_REQ_SYNCH_FRAME 0x0C
#define USB_REQ_SET_ENCRYPTION 0x0D /* Wireless USB */
#define USB_REQ_GET_ENCRYPTION 0x0E
#define USB_REQ_SET_HANDSHAKE 0x0F
#define USB_REQ_GET_HANDSHAKE 0x10
#define USB_REQ_SET_CONNECTION 0x11
#define USB_REQ_SET_SECURITY_DATA 0x12
#define USB_REQ_GET_SECURITY_DATA 0x13
#define USB_REQ_SET_WUSB_DATA 0x14
#define USB_REQ_LOOPBACK_DATA_WRITE 0x15
#define USB_REQ_LOOPBACK_DATA_READ 0x16
#define USB_REQ_SET_INTERFACE_DS 0x17
/*
* USB feature flags are written using USB_REQ_{CLEAR,SET}_FEATURE, and
* are read as a bit array returned by USB_REQ_GET_STATUS. (So there
* are at most sixteen features of each type.)
*/
#define USB_DEVICE_SELF_POWERED 0 /* (read only) */
#define USB_DEVICE_REMOTE_WAKEUP 1 /* dev may initiate wakeup */
#define USB_DEVICE_TEST_MODE 2 /* (wired high speed only) */
#define USB_DEVICE_BATTERY 2 /* (wireless) */
#define USB_DEVICE_B_HNP_ENABLE 3 /* (otg) dev may initiate HNP */
#define USB_DEVICE_WUSB_DEVICE 3 /* (wireless)*/
#define USB_DEVICE_A_HNP_SUPPORT 4 /* (otg) RH port supports HNP */
#define USB_DEVICE_A_ALT_HNP_SUPPORT 5 /* (otg) other RH port does */
#define USB_DEVICE_DEBUG_MODE 6 /* (special devices only) */
#define USB_ENDPOINT_HALT 0 /* IN/OUT will STALL */
/**
* struct usb_ctrlrequest - SETUP data for a USB device control request
@@ -118,15 +86,14 @@
* For most devices, interfaces don't coordinate with each other, so
* such requests may be made at any time.
*/
#include <pshpack1.h>
struct usb_ctrlrequest {
__u8 bRequestType;
__u8 bRequest;
__le16 wValue;
__le16 wIndex;
__le16 wLength;
};
#include <poppack.h>
__u16 wValue;
__u16 wIndex;
__u16 wLength;
} __attribute__ ((packed));
/*-------------------------------------------------------------------------*/
/*
@@ -149,31 +116,12 @@ struct usb_ctrlrequest {
#define USB_DT_DEVICE_QUALIFIER 0x06
#define USB_DT_OTHER_SPEED_CONFIG 0x07
#define USB_DT_INTERFACE_POWER 0x08
/* these are from a minor usb 2.0 revision (ECN) */
#define USB_DT_OTG 0x09
#define USB_DT_DEBUG 0x0a
#define USB_DT_INTERFACE_ASSOCIATION 0x0b
/* these are from the Wireless USB spec */
#define USB_DT_SECURITY 0x0c
#define USB_DT_KEY 0x0d
#define USB_DT_ENCRYPTION_TYPE 0x0e
#define USB_DT_BOS 0x0f
#define USB_DT_DEVICE_CAPABILITY 0x10
#define USB_DT_WIRELESS_ENDPOINT_COMP 0x11
/* conventional codes for class-specific descriptors */
#define USB_DT_CS_DEVICE 0x21
#define USB_DT_CS_CONFIG 0x22
#define USB_DT_CS_STRING 0x23
#define USB_DT_CS_INTERFACE 0x24
#define USB_DT_CS_ENDPOINT 0x25
/* All standard descriptors have these 2 fields at the beginning */
#include <pshpack1.h>
struct usb_descriptor_header {
__u8 bLength;
__u8 bDescriptorType;
};
} __attribute__ ((packed));
/*-------------------------------------------------------------------------*/
@@ -183,19 +131,19 @@ struct usb_device_descriptor {
__u8 bLength;
__u8 bDescriptorType;
__le16 bcdUSB;
__u16 bcdUSB;
__u8 bDeviceClass;
__u8 bDeviceSubClass;
__u8 bDeviceProtocol;
__u8 bMaxPacketSize0;
__le16 idVendor;
__le16 idProduct;
__le16 bcdDevice;
__u16 idVendor;
__u16 idProduct;
__u16 bcdDevice;
__u8 iManufacturer;
__u8 iProduct;
__u8 iSerialNumber;
__u8 bNumConfigurations;
};
} __attribute__ ((packed));
#define USB_DT_DEVICE_SIZE 18
@@ -217,8 +165,6 @@ struct usb_device_descriptor {
#define USB_CLASS_CDC_DATA 0x0a
#define USB_CLASS_CSCID 0x0b /* chip+ smart card */
#define USB_CLASS_CONTENT_SEC 0x0d /* content security */
#define USB_CLASS_VIDEO 0x0e
#define USB_CLASS_WIRELESS_CONTROLLER 0xe0
#define USB_CLASS_APP_SPEC 0xfe
#define USB_CLASS_VENDOR_SPEC 0xff
@@ -236,13 +182,13 @@ struct usb_config_descriptor {
__u8 bLength;
__u8 bDescriptorType;
__le16 wTotalLength;
__u16 wTotalLength;
__u8 bNumInterfaces;
__u8 bConfigurationValue;
__u8 iConfiguration;
__u8 bmAttributes;
__u8 bMaxPower;
};
} __attribute__ ((packed));
#define USB_DT_CONFIG_SIZE 9
@@ -250,7 +196,6 @@ struct usb_config_descriptor {
#define USB_CONFIG_ATT_ONE (1 << 7) /* must be set */
#define USB_CONFIG_ATT_SELFPOWER (1 << 6) /* self powered */
#define USB_CONFIG_ATT_WAKEUP (1 << 5) /* can wakeup */
#define USB_CONFIG_ATT_BATTERY (1 << 4) /* battery powered */
/*-------------------------------------------------------------------------*/
@@ -259,8 +204,8 @@ struct usb_string_descriptor {
__u8 bLength;
__u8 bDescriptorType;
__le16 wData[1]; /* UTF-16LE encoded */
};
__u16 wData[1]; /* UTF-16LE encoded */
} __attribute__ ((packed));
/* note that "string" zero is special, it holds language codes that
* the device supports, not Unicode characters.
@@ -280,7 +225,7 @@ struct usb_interface_descriptor {
__u8 bInterfaceSubClass;
__u8 bInterfaceProtocol;
__u8 iInterface;
};
} __attribute__ ((packed));
#define USB_DT_INTERFACE_SIZE 9
@@ -293,14 +238,14 @@ struct usb_endpoint_descriptor {
__u8 bEndpointAddress;
__u8 bmAttributes;
__le16 wMaxPacketSize;
__u16 wMaxPacketSize;
__u8 bInterval;
/* NOTE: these two are _only_ in audio endpoints. */
/* use USB_DT_ENDPOINT*_SIZE in bLength, not sizeof. */
// NOTE: these two are _only_ in audio endpoints.
// use USB_DT_ENDPOINT*_SIZE in bLength, not sizeof.
__u8 bRefresh;
__u8 bSynchAddress;
};
} __attribute__ ((packed));
#define USB_DT_ENDPOINT_SIZE 7
#define USB_DT_ENDPOINT_AUDIO_SIZE 9 /* Audio extension */
@@ -317,7 +262,6 @@ struct usb_endpoint_descriptor {
#define USB_ENDPOINT_XFER_ISOC 1
#define USB_ENDPOINT_XFER_BULK 2
#define USB_ENDPOINT_XFER_INT 3
#define USB_ENDPOINT_MAX_ADJUSTABLE 0x80
/*-------------------------------------------------------------------------*/
@@ -327,199 +271,16 @@ struct usb_qualifier_descriptor {
__u8 bLength;
__u8 bDescriptorType;
__le16 bcdUSB;
__u16 bcdUSB;
__u8 bDeviceClass;
__u8 bDeviceSubClass;
__u8 bDeviceProtocol;
__u8 bMaxPacketSize0;
__u8 bNumConfigurations;
__u8 bRESERVED;
};
} __attribute__ ((packed));
/*-------------------------------------------------------------------------*/
/* USB_DT_OTG (from OTG 1.0a supplement) */
struct usb_otg_descriptor {
__u8 bLength;
__u8 bDescriptorType;
__u8 bmAttributes; /* support for HNP, SRP, etc */
};
#include <poppack.h>
/* from usb_otg_descriptor.bmAttributes */
#define USB_OTG_SRP (1 << 0)
#define USB_OTG_HNP (1 << 1) /* swap host/device roles */
/*-------------------------------------------------------------------------*/
/* USB_DT_DEBUG: for special highspeed devices, replacing serial console */
struct usb_debug_descriptor {
__u8 bLength;
__u8 bDescriptorType;
/* bulk endpoints with 8 byte maxpacket */
__u8 bDebugInEndpoint;
__u8 bDebugOutEndpoint;
};
/*-------------------------------------------------------------------------*/
#include <pshpack1.h>
/* USB_DT_INTERFACE_ASSOCIATION: groups interfaces */
struct usb_interface_assoc_descriptor {
__u8 bLength;
__u8 bDescriptorType;
__u8 bFirstInterface;
__u8 bInterfaceCount;
__u8 bFunctionClass;
__u8 bFunctionSubClass;
__u8 bFunctionProtocol;
__u8 iFunction;
};
#include <poppack.h>
/*-------------------------------------------------------------------------*/
/* USB_DT_SECURITY: group of wireless security descriptors, including
* encryption types available for setting up a CC/association.
*/
struct usb_security_descriptor {
__u8 bLength;
__u8 bDescriptorType;
__le16 wTotalLength;
__u8 bNumEncryptionTypes;
};
/*-------------------------------------------------------------------------*/
/* USB_DT_KEY: used with {GET,SET}_SECURITY_DATA; only public keys
* may be retrieved.
*/
struct usb_key_descriptor {
__u8 bLength;
__u8 bDescriptorType;
__u8 tTKID[3];
__u8 bReserved;
__u8 bKeyData[0];
};
/*-------------------------------------------------------------------------*/
/* USB_DT_ENCRYPTION_TYPE: bundled in DT_SECURITY groups */
struct usb_encryption_descriptor {
__u8 bLength;
__u8 bDescriptorType;
__u8 bEncryptionType;
#define USB_ENC_TYPE_UNSECURE 0
#define USB_ENC_TYPE_WIRED 1 /* non-wireless mode */
#define USB_ENC_TYPE_CCM_1 2 /* aes128/cbc session */
#define USB_ENC_TYPE_RSA_1 3 /* rsa3072/sha1 auth */
__u8 bEncryptionValue; /* use in SET_ENCRYPTION */
__u8 bAuthKeyIndex;
};
/*-------------------------------------------------------------------------*/
/* USB_DT_BOS: group of wireless capabilities */
struct usb_bos_descriptor {
__u8 bLength;
__u8 bDescriptorType;
__le16 wTotalLength;
__u8 bNumDeviceCaps;
};
/*-------------------------------------------------------------------------*/
/* USB_DT_DEVICE_CAPABILITY: grouped with BOS */
struct usb_dev_cap_header {
__u8 bLength;
__u8 bDescriptorType;
__u8 bDevCapabilityType;
};
#define USB_CAP_TYPE_WIRELESS_USB 1
struct usb_wireless_cap_descriptor { /* Ultra Wide Band */
__u8 bLength;
__u8 bDescriptorType;
__u8 bDevCapabilityType;
__u8 bmAttributes;
#define USB_WIRELESS_P2P_DRD (1 << 1)
#define USB_WIRELESS_BEACON_MASK (3 << 2)
#define USB_WIRELESS_BEACON_SELF (1 << 2)
#define USB_WIRELESS_BEACON_DIRECTED (2 << 2)
#define USB_WIRELESS_BEACON_NONE (3 << 2)
__le16 wPHYRates; /* bit rates, Mbps */
#define USB_WIRELESS_PHY_53 (1 << 0) /* always set */
#define USB_WIRELESS_PHY_80 (1 << 1)
#define USB_WIRELESS_PHY_107 (1 << 2) /* always set */
#define USB_WIRELESS_PHY_160 (1 << 3)
#define USB_WIRELESS_PHY_200 (1 << 4) /* always set */
#define USB_WIRELESS_PHY_320 (1 << 5)
#define USB_WIRELESS_PHY_400 (1 << 6)
#define USB_WIRELESS_PHY_480 (1 << 7)
__u8 bmTFITXPowerInfo; /* TFI power levels */
__u8 bmFFITXPowerInfo; /* FFI power levels */
__le16 bmBandGroup;
__u8 bReserved;
};
/*-------------------------------------------------------------------------*/
/* USB_DT_WIRELESS_ENDPOINT_COMP: companion descriptor associated with
* each endpoint descriptor for a wireless device
*/
struct usb_wireless_ep_comp_descriptor {
__u8 bLength;
__u8 bDescriptorType;
__u8 bMaxBurst;
__u8 bMaxSequence;
__le16 wMaxStreamDelay;
__le16 wOverTheAirPacketSize;
__u8 bOverTheAirInterval;
__u8 bmCompAttributes;
#define USB_ENDPOINT_SWITCH_MASK 0x03 /* in bmCompAttributes */
#define USB_ENDPOINT_SWITCH_NO 0
#define USB_ENDPOINT_SWITCH_SWITCH 1
#define USB_ENDPOINT_SWITCH_SCALE 2
};
/*-------------------------------------------------------------------------*/
/* USB_REQ_SET_HANDSHAKE is a four-way handshake used between a wireless
* host and a device for connection set up, mutual authentication, and
* exchanging short lived session keys. The handshake depends on a CC.
*/
struct usb_handshake {
__u8 bMessageNumber;
__u8 bStatus;
__u8 tTKID[3];
__u8 bReserved;
__u8 CDID[16];
__u8 nonce[16];
__u8 MIC[8];
};
/*-------------------------------------------------------------------------*/
/* USB_REQ_SET_CONNECTION modifies or revokes a connection context (CC).
* A CC may also be set up using non-wireless secure channels (including
* wired USB!), and some devices may support CCs with multiple hosts.
*/
struct usb_connection_context {
__u8 CHID[16]; /* persistent host id */
__u8 CDID[16]; /* device id (unique w/in host context) */
__u8 CK[16]; /* connection key */
};
/*-------------------------------------------------------------------------*/
/* USB 2.0 defines three speeds, here's how Linux identifies them */
@@ -527,8 +288,7 @@ struct usb_connection_context {
enum usb_device_speed {
USB_SPEED_UNKNOWN = 0, /* enumerating */
USB_SPEED_LOW, USB_SPEED_FULL, /* usb 1.1 */
USB_SPEED_HIGH, /* usb 2.0 */
USB_SPEED_VARIABLE, /* wireless (usb 2.5) */
USB_SPEED_HIGH /* usb 2.0 */
};
enum usb_device_state {

View File

@@ -32,7 +32,6 @@ int need_wakeup;
int my_jiffies;
struct timer_list *main_timer_list[MAX_TIMERS];
PKDEFERRED_ROUTINE timer_dpcs[MAX_TIMERS];
struct dummy_process act_cur={0};
struct dummy_process *my_current;
@@ -59,13 +58,6 @@ void init_wrapper(struct pci_dev *probe_dev)
main_timer_list[n]=NULL;
}
// FIXME: Change if more than 5 timers
timer_dpcs[0] = (PKDEFERRED_ROUTINE)_TimerDpc0;
timer_dpcs[1] = (PKDEFERRED_ROUTINE)_TimerDpc1;
timer_dpcs[2] = (PKDEFERRED_ROUTINE)_TimerDpc2;
timer_dpcs[3] = (PKDEFERRED_ROUTINE)_TimerDpc3;
timer_dpcs[4] = (PKDEFERRED_ROUTINE)_TimerDpc4;
my_jiffies=0;
num_irqs=0;
my_current=&act_cur;
@@ -125,7 +117,7 @@ void do_all_timers(void)
/*------------------------------------------------------------------------*/
// Purpose: Remember thread procedure and data in global var
// ReactOS Purpose: Create real kernel thread
int my_kernel_thread(int (STDCALL *handler)(void*), void* parm, int flags)
int my_kernel_thread(int STDCALL (*handler)(void*), void* parm, int flags)
{
HANDLE hThread = NULL;
//thread_handler=handler;
@@ -168,12 +160,11 @@ int my_kill_proc(int pid, int signal, int unk)
/* calls probe function for hotplug (which does device matching), this is the
only link between usbcore and the registered device drivers! */
only link between usbcore and the registered device drivers! */
int my_device_add(struct device *dev)
{
int n,found=0;
//printk("drv_num %i %p %p\n",drvs_num,m_drivers[0]->probe,m_drivers[1]->probe);
printk("drv_num %i %p\n",drvs_num,m_drivers[0]->probe);
printk("drv_num %i %p %p\n",drvs_num,m_drivers[0]->probe,m_drivers[1]->probe);
if (dev->driver)
{
@@ -188,6 +179,7 @@ int my_device_add(struct device *dev)
{
dev->driver=m_drivers[n];
printk("probe%i %p\n",n,m_drivers[n]->probe);
if (m_drivers[n]->probe(dev) == 0)
{
// return 0;
@@ -233,7 +225,6 @@ void my_device_initialize(struct device *dev)
/*------------------------------------------------------------------------*/
void my_wake_up(PKEVENT evnt)
{
//DPRINT1("wake_up(), evnt=%p\n", evnt);
need_wakeup=1;
KeSetEvent(evnt, 0, FALSE); // Signal event
@@ -243,7 +234,6 @@ void my_init_waitqueue_head(PKEVENT evnt)
{
// this is used only in core/message.c, and it isn't needed there
//KeInitializeEvent(evnt, NotificationEvent, TRUE); // signalled state
DPRINT1("init_waitqueue_head(), evnt=%p\n", evnt);
}
/*------------------------------------------------------------------------*/
/* wait until woken up (only one wait allowed!) */
@@ -252,7 +242,12 @@ extern unsigned int LAST_USB_IRQ;
int my_schedule_timeout(int x)
{
LONGLONG HH;
//LONGLONG temp;
LARGE_INTEGER delay;
//PULONG tmp_debug=NULL;
//extern unsigned int LAST_USB_EVENT_TICK;
//*tmp_debug = 0xFFAAFFAA;
printk("schedule_timeout: %d ms\n", x);
@@ -268,8 +263,14 @@ int my_schedule_timeout(int x)
while(x>0)
{
KeQueryTickCount((LARGE_INTEGER *)&HH);//IoInputDword(0x8008);
//temp = HH - LAST_USB_EVENT_TICK;
//if (temp>(3579)) { //3579 = 1ms!
//if (temp>1000) {
do_all_timers();
// LAST_USB_EVENT_TICK = HH;
//}
do_all_timers();
handle_irqs(-1);
if (need_wakeup)
@@ -289,35 +290,49 @@ int my_schedule_timeout(int x)
/*------------------------------------------------------------------------*/
void my_wait_for_completion(struct completion *x)
{
//printk("wait for completion, x=0x%08x, x->done=%d\n", (DWORD)x, x->done);
KeWaitForSingleObject(&x->wait, Executive, KernelMode, FALSE, NULL);
KeClearEvent(&x->wait);
x->done--;
//printk("wait for completion done %i\n",x->done);
// LONGLONG HH;
// LONGLONG temp;
LARGE_INTEGER delay;
//extern unsigned int LAST_USB_EVENT_TICK;
printk("wait for completion, x=0x%08x\n", (DWORD)x);
int n=10;
n = n*1000; // to us format
while(!x->done && (n>0))
{
//KeQueryTickCount((LARGE_INTEGER *)&HH);//IoInputDword(0x8008);
//temp = HH - LAST_USB_EVENT_TICK;
//if (temp>(3579)) {
//if (temp>(1000)) {
do_all_timers();
// LAST_USB_EVENT_TICK = HH;
//}
handle_irqs(-1);
delay.QuadPart = -10;
KeDelayExecutionThread(KernelMode, FALSE, &delay); //wait_us(1);
n--;
}
printk("wait for completion done %i\n",x->done);
}
/*------------------------------------------------------------------------*/
void my_init_completion(struct completion *x)
{
//DPRINT1("init_completion(), x=%p\n", x);
x->done=0;
KeInitializeEvent(&x->wait, NotificationEvent, FALSE);
}
/*------------------------------------------------------------------------*/
void my_interruptible_sleep_on(PKEVENT evnt)
{
DPRINT1("interruptible_sleep_on(), evnt=%p\n", evnt);
KeWaitForSingleObject(evnt, Executive, KernelMode, FALSE, NULL);
KeClearEvent(evnt); // reset to not-signalled
}
// Some kind of a hack currently
void my_try_to_freeze()
{
LARGE_INTEGER delay;
delay.QuadPart = -100000; // 0.1 seconds
KeDelayExecutionThread(KernelMode, FALSE, &delay);
}
/*------------------------------------------------------------------------*/
// Helper for pci_module_init
/*------------------------------------------------------------------------*/
@@ -339,6 +354,16 @@ struct pci_dev *my_pci_find_slot(int a,int b)
return NULL;
}
/*------------------------------------------------------------------------*/
int my_pci_write_config_word(struct pci_dev *dev, int where, u16 val)
{
//dev->bus, dev->devfn, where, val
PUSBMP_DEVICE_EXTENSION dev_ext = (PUSBMP_DEVICE_EXTENSION)dev->dev_ext;
//FIXME: Is returning this value correct?
//FIXME: Mixing pci_dev and win structs isn't a good thing at all
return HalSetBusDataByOffset(PCIConfiguration, dev->bus->number, dev_ext->SystemIoSlotNumber, &val, where, sizeof(val));
}
/*------------------------------------------------------------------------*/
int my_request_irq(unsigned int irq,
int (*handler)(int,void *, struct pt_regs *),
unsigned long mode, const char *desc, void *data)
@@ -419,6 +444,11 @@ init_dma(PUSBMP_DEVICE_EXTENSION pDevExt)
{
// Prepare device descriptor structure
DEVICE_DESCRIPTION dd;
#ifdef USB_DMA_SINGLE_SUPPORT
KEVENT DMAEvent;
KIRQL OldIrql;
NTSTATUS Status;
#endif
RtlZeroMemory( &dd, sizeof(dd) );
dd.Version = DEVICE_DESCRIPTION_VERSION;
@@ -452,57 +482,89 @@ init_dma(PUSBMP_DEVICE_EXTENSION pDevExt)
if (pDevExt->pDmaAdapter == NULL)
return STATUS_INSUFFICIENT_RESOURCES;
#ifdef USB_DMA_SINGLE_SUPPORT
/* Allocate buffer now */
pDevExt->BufferSize = pDevExt->mapRegisterCount * PAGE_SIZE;
DPRINT1("Bufsize = %u\n", pDevExt->BufferSize);
pDevExt->VirtualBuffer = pDevExt->pDmaAdapter->DmaOperations->AllocateCommonBuffer(
pDevExt->pDmaAdapter, pDevExt->BufferSize, &pDevExt->Buffer, FALSE);
DPRINT1("Bufsize = %u, Buffer = 0x%x", pDevExt->BufferSize, pDevExt->Buffer.LowPart);
if (!pDevExt->VirtualBuffer)
{
DPRINT1("Could not allocate buffer\n");
// should try again with smaller buffer...
return STATUS_INSUFFICIENT_RESOURCES;
}
DPRINT1("Calling IoAllocateMdl()\n");
pDevExt->Mdl = IoAllocateMdl(pDevExt->VirtualBuffer, pDevExt->BufferSize, FALSE, FALSE, NULL);
DPRINT1("Bufsize == %u\n", pDevExt->BufferSize);
if (!pDevExt->Mdl)
{
DPRINT1("IoAllocateMdl() FAILED\n");
//TODO: Free the HAL buffer
return STATUS_INSUFFICIENT_RESOURCES;
}
DPRINT1("VBuffer == 0x%x Mdl == %u Bufsize == %u\n", pDevExt->VirtualBuffer, pDevExt->Mdl, pDevExt->BufferSize);
DPRINT1("Calling MmBuildMdlForNonPagedPool\n");
MmBuildMdlForNonPagedPool(pDevExt->Mdl);
/* Get map registers for DMA */
KeInitializeEvent(&DMAEvent, SynchronizationEvent, FALSE);
KeRaiseIrql(DISPATCH_LEVEL, &OldIrql);
// TODO: Free adapter channel somewhere
Status = pDevExt->pDmaAdapter->DmaOperations->AllocateAdapterChannel(pDevExt->pDmaAdapter,
pDevExt->PhysicalDeviceObject, pDevExt->mapRegisterCount, MapRegisterCallback, &DMAEvent);
KeLowerIrql(OldIrql);
DPRINT1("VBuffer == 0x%x Bufsize == %u\n", pDevExt->VirtualBuffer, pDevExt->BufferSize);
KeWaitForSingleObject(&DMAEvent, Executive, KernelMode, FALSE, NULL);
if(Status != STATUS_SUCCESS)
{
DPRINT("init_dma(): unable to allocate adapter channels\n");
return STATUS_INSUFFICIENT_RESOURCES;
}
#endif
return STATUS_SUCCESS;
}
/*
Timer DPCs
*/
void STDCALL _TimerDpc0(IN PKDPC Dpc, IN PVOID DeferredContext, IN PVOID SystemArgument1, IN PVOID SystemArgument2)
* FUNCTION: Acquire map registers in prep for DMA
* ARGUMENTS:
* DeviceObject: unused
* Irp: unused
* MapRegisterBase: returned to blocked thread via a member var
* Context: contains a pointer to the right ControllerInfo
* struct
* RETURNS:
* KeepObject, because that's what the DDK says to do
*/
#ifdef USB_DMA_SINGLE_SUPPORT
static IO_ALLOCATION_ACTION NTAPI MapRegisterCallback(PDEVICE_OBJECT DeviceObject,
PIRP Irp,
PVOID MapRegisterBase,
PVOID Context)
{
int n = 0;
void (*function)(unsigned long)=main_timer_list[n]->function;
unsigned long data=main_timer_list[n]->data;
//printk("TimerDpc0\n");
function(data);
//handle_irqs(-1);
}
PUSBMP_DEVICE_EXTENSION pDevExt = (PUSBMP_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
UNREFERENCED_PARAMETER(Irp);
void STDCALL _TimerDpc1(IN PKDPC Dpc, IN PVOID DeferredContext, IN PVOID SystemArgument1, IN PVOID SystemArgument2)
{
int n = 1;
void (*function)(unsigned long)=main_timer_list[n]->function;
unsigned long data=main_timer_list[n]->data;
printk("TimerDpc1\n");
function(data);
}
DPRINT("usb_linuxwrapper: MapRegisterCallback Called, base=0x%08x\n", MapRegisterBase);
void STDCALL _TimerDpc2(IN PKDPC Dpc, IN PVOID DeferredContext, IN PVOID SystemArgument1, IN PVOID SystemArgument2)
{
int n = 2;
void (*function)(unsigned long)=main_timer_list[n]->function;
unsigned long data=main_timer_list[n]->data;
printk("TimerDpc2\n");
//function(data);
}
pDevExt->MapRegisterBase = MapRegisterBase;
void STDCALL _TimerDpc3(IN PKDPC Dpc, IN PVOID DeferredContext, IN PVOID SystemArgument1, IN PVOID SystemArgument2)
{
int n = 3;
void (*function)(unsigned long)=main_timer_list[n]->function;
unsigned long data=main_timer_list[n]->data;
printk("TimerDpc3\n");
//function(data);
}
// signal that we are finished
KeSetEvent(Context, 0, FALSE);
void STDCALL _TimerDpc4(IN PKDPC Dpc, IN PVOID DeferredContext, IN PVOID SystemArgument1, IN PVOID SystemArgument2)
{
int n = 4;
void (*function)(unsigned long)=main_timer_list[n]->function;
unsigned long data=main_timer_list[n]->data;
printk("TimerDpc4\n");
//function(data);
return KeepObject;//DeallocateObjectKeepRegisters;
}
#endif
void *my_dma_pool_alloc(struct dma_pool *pool, int gfp_flags, dma_addr_t *dma_handle)
{
@@ -535,7 +597,7 @@ If allocation is nonzero, objects returned from pci_pool_alloc won't cross that
This is useful for devices which have addressing restrictions on individual DMA transfers, such
as not crossing boundaries of 4KBytes.
*/
struct pci_pool *my_pci_pool_create(const char * name, struct device * pdev, size_t size, size_t align, size_t allocation)
struct pci_pool *my_pci_pool_create(const char * name, struct pci_dev * pdev, size_t size, size_t align, size_t allocation)
{
struct pci_pool *retval;
@@ -575,7 +637,7 @@ struct pci_pool *my_pci_pool_create(const char * name, struct device * pdev, siz
retval->blocks_allocated = 0;
DPRINT("pci_pool_create(): %s/%s size %d, %d/page (%d alloc)\n",
pdev ? pdev->name : NULL, retval->name, size,
pdev ? pdev->slot_name : NULL, retval->name, size,
retval->blocks_per_page, allocation);
return retval;
@@ -602,7 +664,7 @@ address through the handle. If such a memory block can't be allocated, null is r
void * my_pci_pool_alloc(struct pci_pool * pool, int mem_flags, dma_addr_t *dma_handle)
{
PVOID result;
PUSBMP_DEVICE_EXTENSION devExt = (PUSBMP_DEVICE_EXTENSION)to_pci_dev(pool->pdev)->dev_ext;
PUSBMP_DEVICE_EXTENSION devExt = (PUSBMP_DEVICE_EXTENSION)pool->pdev->dev_ext;
int page=0, offset;
int map, i, block;
@@ -701,7 +763,7 @@ void my_pci_pool_free (struct pci_pool * pool, void * vaddr, dma_addr_t dma)
set_bit (block, &pool->pages[page].bitmap[map]);
pool->blocks_allocated--;
DPRINT("pci_pool_free(): alloc'd: %d\n", pool->blocks_allocated);
//DPRINT("pci_pool_free(): alloc'd: %d\n", pool->blocks_allocated);
}
/*
@@ -718,18 +780,17 @@ Description
Caller guarantees that no more memory from the pool is in use, and that nothing will try to
use the pool after this call.
*/
void my_pci_pool_destroy (struct pci_pool * pool)
void __inline__ my_pci_pool_destroy (struct pci_pool * pool)
{
DPRINT1("pci_pool_destroy(): alloc'd: %d, UNIMPLEMENTED\n", pool->blocks_allocated);
ExFreePool(pool);
}
// the code here is identical to dma_alloc_coherent
void *my_pci_alloc_consistent(struct pci_dev *hwdev, size_t size, dma_addr_t *dma_handle)
{
PUSBMP_DEVICE_EXTENSION devExt = (PUSBMP_DEVICE_EXTENSION)hwdev->dev_ext;
DPRINT1("pci_alloc_consistent() size=%d, dma_handle=%p\n", size, (PPHYSICAL_ADDRESS)dma_handle);
DPRINT1("pci_alloc_consistent() size=%d\n", size);
return devExt->pDmaAdapter->DmaOperations->AllocateCommonBuffer(devExt->pDmaAdapter, size, (PPHYSICAL_ADDRESS)dma_handle, FALSE); //FIXME: Cache-enabled?
}
@@ -820,198 +881,26 @@ void my_pci_unmap_single(struct pci_dev *hwdev, dma_addr_t dma_addr, size_t size
my_dma_unmap_single(&hwdev->dev, dma_addr, size, direction);
}
// the code here is very similar to pci_alloc_consistent()
void *my_dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, gfp_t flag)
{
//struct pci_dev *pdev = to_pci_dev(dev);
//return my_pci_alloc_consistent(pdev, sz, dma_handle);
PUSBMP_DEVICE_EXTENSION devExt = (PUSBMP_DEVICE_EXTENSION)dev->dev_ext;
DPRINT1("dma_alloc_coherent() size=%d, dev=%p, dev_ext=%p, dma_handle=%p, DmaAdapter=%p\n", size, dev, dev->dev_ext, (PPHYSICAL_ADDRESS)dma_handle, devExt->pDmaAdapter);
return devExt->pDmaAdapter->DmaOperations->AllocateCommonBuffer(devExt->pDmaAdapter, size, (PPHYSICAL_ADDRESS)dma_handle, FALSE); //FIXME: Cache-enabled?
}
/*
void dma_free_coherent(struct device *dev, size_t size,
void *vaddr, dma_addr_t dma_handle); */
/*------------------------------------------------------------------------*/
/* SPINLOCK routines */
/*------------------------------------------------------------------------*/
void my_spin_lock_init(spinlock_t *sl)
{
//DPRINT("spin_lock_init: %p\n", sl);
KeInitializeSpinLock(&sl->SpinLock);
}
void my_spin_lock(spinlock_t *sl)
{
//DPRINT("spin_lock_: %p\n", sl);
KeAcquireSpinLock(&sl->SpinLock, &sl->OldIrql);
//KeAcquireSpinLock(&sl->SpinLock, &sl->OldIrql);
}
void my_spin_unlock(spinlock_t *sl)
{
//DPRINT("spin_unlock: %p\n", sl);
KeReleaseSpinLock(&sl->SpinLock, sl->OldIrql);
//KeReleaseSpinLock(&sl->SpinLock, sl->OldIrql);
}
void my_spin_lock_irqsave(spinlock_t *sl, int flags)
{
//DPRINT("spin_lock_irqsave: %p\n", sl);
//my_spin_lock(sl);
KeAcquireSpinLock(&sl->SpinLock, &sl->OldIrql);
}
void my_spin_unlock_irqrestore(spinlock_t *sl, int flags)
{
//DPRINT("spin_unlock_irqrestore: %p\n", sl);
//my_spin_unlock(sl);
KeReleaseSpinLock(&sl->SpinLock, sl->OldIrql);
}
void my_spin_lock_irq(spinlock_t *sl)
{
//DPRINT("spin_lock_irq: %p\n", sl);
//my_spin_lock(sl);
KeAcquireSpinLock(&sl->SpinLock, &sl->OldIrql);
}
void my_spin_unlock_irq(spinlock_t *sl)
{
//DPRINT("spin_unlock_irq: %p\n", sl);
//my_spin_unlock(sl);
KeReleaseSpinLock(&sl->SpinLock, sl->OldIrql);
}
/*------------------------------------------------------------------------*/
/* Misc routines */
/*------------------------------------------------------------------------*/
/**
* strlcpy - Copy a %NUL terminated string into a sized buffer
* @dest: Where to copy the string to
* @src: Where to copy the string from
* @size: size of destination buffer
*
* Compatible with *BSD: the result is always a valid
* NUL-terminated string that fits in the buffer (unless,
* of course, the buffer size is zero). It does not pad
* out the result like strncpy() does.
*/
size_t strlcpy(char *dest, const char *src, size_t size)
{
size_t ret = strlen(src);
if (size) {
size_t len = (ret >= size) ? size-1 : ret;
memcpy(dest, src, len);
dest[len] = '\0';
}
return ret;
}
/**
* kzalloc - allocate memory. The memory is set to zero.
* @size: how many bytes of memory are required.
* @flags: the type of memory to allocate.
*/
void *my_kzalloc(size_t size/*, gfp_t flags*/)
{
void *ret = kmalloc(size, flags);
if (ret)
memset(ret, 0, size);
return ret;
}
/**
* memcmp - Compare two areas of memory
* @cs: One area of memory
* @ct: Another area of memory
* @count: The size of the area.
*/
int __cdecl memcmp(const void * cs,const void * ct,size_t count)
{
const unsigned char *su1, *su2;
int res = 0;
for( su1 = cs, su2 = ct; 0 < count; ++su1, ++su2, count--)
if ((res = *su1 - *su2) != 0)
break;
return res;
}
/*------------------------------------------------------------------------*/
int my_pci_write_config_word(struct pci_dev *dev, int where, u16 val)
{
//dev->bus, dev->devfn, where, val
PUSBMP_DEVICE_EXTENSION dev_ext = (PUSBMP_DEVICE_EXTENSION)dev->dev_ext;
//FIXME: Is returning this value correct?
//FIXME: Mixing pci_dev and win structs isn't a good thing at all (though I doubt it wants to access device in another slot/bus)
DPRINT1("pci_write_config_word: BusNum: %d, SlotNum: 0x%x, value: 0x%x, where: 0x%x\n",
dev_ext->SystemIoBusNumber, dev_ext->SystemIoSlotNumber.u.AsULONG, val, where);
return HalSetBusDataByOffset(PCIConfiguration, dev_ext->SystemIoBusNumber, dev_ext->SystemIoSlotNumber.u.AsULONG, &val, where, sizeof(val));
}
/*------------------------------------------------------------------------*/
int my_pci_read_config_word(struct pci_dev *dev, int where, u16 *val)
{
ULONG result;
//dev->bus, dev->devfn, where, val
PUSBMP_DEVICE_EXTENSION dev_ext = (PUSBMP_DEVICE_EXTENSION)dev->dev_ext;
//FIXME: Is returning this value correct?
//FIXME: Mixing pci_dev and win structs isn't a good thing at all
result = HalGetBusDataByOffset(PCIConfiguration, dev_ext->SystemIoBusNumber, dev_ext->SystemIoSlotNumber.u.AsULONG, val, where, sizeof(*val));
DPRINT1("pci_read_config_word: BusNum: %d, SlotNum: 0x%x, value: 0x%x, where: 0x%x\n",
dev_ext->SystemIoBusNumber, dev_ext->SystemIoSlotNumber.u.AsULONG, *val, where);
return result;
}
/* For compatibility with Windows XP */
NTSTATUS
_RtlDuplicateUnicodeString(
IN ULONG Flags,
IN PCUNICODE_STRING SourceString,
OUT PUNICODE_STRING DestinationString)
{
if (SourceString == NULL || DestinationString == NULL)
return STATUS_INVALID_PARAMETER;
if ((SourceString->Length == 0) &&
(Flags != (RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE |
RTL_DUPLICATE_UNICODE_STRING_ALLOCATE_NULL_STRING)))
{
DestinationString->Length = 0;
DestinationString->MaximumLength = 0;
DestinationString->Buffer = NULL;
}
else
{
ULONG DestMaxLength = SourceString->Length;
if (Flags & RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE)
DestMaxLength += sizeof(UNICODE_NULL);
DestinationString->Buffer = ExAllocatePool(PagedPool, DestMaxLength);
if (DestinationString->Buffer == NULL)
return STATUS_NO_MEMORY;
RtlCopyMemory(DestinationString->Buffer, SourceString->Buffer, SourceString->Length);
DestinationString->Length = SourceString->Length;
DestinationString->MaximumLength = DestMaxLength;
if (Flags & RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE)
DestinationString->Buffer[DestinationString->Length / sizeof(WCHAR)] = 0;
}
return STATUS_SUCCESS;
my_spin_lock(sl);
}

View File

@@ -1,4 +1,4 @@
<module name="sys_base" type="objectlibrary" allowwarnings="true">
<module name="sys_base" type="objectlibrary">
<define name="__USE_W32API" />
<define name="DEBUG_MODE" />
<include base="ntoskrnl">include</include>

View File

@@ -1,6 +1,4 @@
//#include <stdio.h>
//#include <stdlib.h>
//#include <string.h>
//#include <ntos/types.h>
//#include <extypes.h>
@@ -9,46 +7,11 @@
Lots of definitions should go to corresponding files
*/
//#include <ntifs.h>
#include "ntddk.h"
#include <ntifs.h>
#include <kbdmou.h>
#include <debug.h>
// a couple of defines
#define RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE 1
#define RTL_DUPLICATE_UNICODE_STRING_ALLOCATE_NULL_STRING 2
// Define bit scan intrinsics, so we can use them without the need to include wnet ddk
#if defined(_MSC_VER)
#define BitScanForward _BitScanForward
#define BitScanReverse _BitScanReverse
#define InterlockedBitTestAndSet _interlockedbittestandset
#define InterlockedBitTestAndReset _interlockedbittestandreset
BOOLEAN _BitScanForward (OUT ULONG *Index, IN ULONG Mask);
BOOLEAN _BitScanReverse (OUT ULONG *Index, IN ULONG Mask);
BOOLEAN _interlockedbittestandset (IN LONG *Base, IN LONG Offset);
BOOLEAN _interlockedbittestandreset (IN LONG *Base, IN LONG Offset);
#pragma intrinsic(_BitScanForward)
#pragma intrinsic(_BitScanReverse)
#pragma intrinsic(_interlockedbittestandset)
#pragma intrinsic(_interlockedbittestandreset)
#define inline __inline
#endif
#define TAG(A, B, C, D) (ULONG)(((A)<<0) + ((B)<<8) + ((C)<<16) + ((D)<<24))
/*
* FUNCTION: Assert a maximum value for the current irql
* ARGUMENTS:
* x = Maximum irql
*/
#define ASSERT_IRQL_LESS_OR_EQUAL(x) ASSERT(KeGetCurrentIrql()<=(x))
#define ASSERT_IRQL_EQUAL(x) ASSERT(KeGetCurrentIrql()==(x))
#define ASSERT_IRQL_LESS(x) ASSERT(KeGetCurrentIrql()<(x))
void wait_ms(int mils);
void my_udelay(int us);

View File

@@ -21,16 +21,16 @@ InitLinuxWrapper(PDEVICE_OBJECT DeviceObject)
/* Initialize generic linux structure */
dev->irq = DeviceExtension->InterruptVector;
dev->dev_ext = (PVOID)DeviceExtension;
dev->dev.dev_ext = DeviceObject;
dev->dev.dev_ext = (PVOID)DeviceObject;
dev->slot_name = ExAllocatePoolWithTag(NonPagedPool, 128, USB_OHCI_TAG); // 128 max len for slot name
/* Init wrapper */
// Init wrapper
init_wrapper(dev);
strcpy(dev->dev.name, "OpenHCI PCI-USB Controller");
strcpy(dev->slot_name, "OHCD PCI Slot");
/* Init the OHCI HCD. Probe will be called automatically, but will fail because id=NULL */
// Init the OHCI HCD. Probe will be called automatically, but will fail because id=NULL
Status = ohci_hcd_pci_init();
if (!NT_SUCCESS(Status))
{
@@ -40,10 +40,10 @@ InitLinuxWrapper(PDEVICE_OBJECT DeviceObject)
return Status;
}
/* Init core usb */
// Init core usb
usb_init();
/* Probe device with real id now */
// Probe device with real id now
ohci_pci_driver.probe(dev, ohci_pci_ids);
return STATUS_SUCCESS;

View File

@@ -1,5 +1,6 @@
<module name="usbohci" type="kernelmodedriver" installbase="system32/drivers" installname="usbohci.sys">
<define name="__USE_W32API" />
<define name="DEBUG_MODE" />
<include>../linux</include>
<include base="usbminiportcommon"></include>
<library>sys_base</library>

View File

@@ -144,7 +144,7 @@ static int uhci_show_qh(struct uhci_qh *qh, char *buf, int len, int space)
out += sprintf(out, "%*s Element != First TD\n", space, "");
while (tmp != head) {
/*struct uhci_td **/td = list_entry(tmp, struct uhci_td, list);
struct uhci_td *td = list_entry(tmp, struct uhci_td, list);
tmp = tmp->next;

File diff suppressed because it is too large Load Diff

View File

@@ -43,7 +43,6 @@
#define USBFRNUM 6
#define USBFLBASEADD 8
#define USBSOF 12
#define USBSOF_DEFAULT 64 /* Frame length is exactly 1 ms */
/* USB port status and control registers */
#define USBPORTSC1 16
@@ -52,25 +51,16 @@
#define USBPORTSC_CSC 0x0002 /* Connect Status Change */
#define USBPORTSC_PE 0x0004 /* Port Enable */
#define USBPORTSC_PEC 0x0008 /* Port Enable Change */
#define USBPORTSC_DPLUS 0x0010 /* D+ high (line status) */
#define USBPORTSC_DMINUS 0x0020 /* D- high (line status) */
#define USBPORTSC_LS 0x0030 /* Line Status */
#define USBPORTSC_RD 0x0040 /* Resume Detect */
#define USBPORTSC_RES1 0x0080 /* reserved, always 1 */
#define USBPORTSC_LSDA 0x0100 /* Low Speed Device Attached */
#define USBPORTSC_PR 0x0200 /* Port Reset */
/* OC and OCC from Intel 430TX and later (not UHCI 1.1d spec) */
#define USBPORTSC_OC 0x0400 /* Over Current condition */
#define USBPORTSC_OCC 0x0800 /* Over Current Change R/WC */
#define USBPORTSC_SUSP 0x1000 /* Suspend */
#define USBPORTSC_RES2 0x2000 /* reserved, write zeroes */
#define USBPORTSC_RES3 0x4000 /* reserved, write zeroes */
#define USBPORTSC_RES4 0x8000 /* reserved, write zeroes */
/* Legacy support register */
#define USBLEGSUP 0xc0
#define USBLEGSUP_DEFAULT 0x2000 /* only PIRQ enable set */
#define USBLEGSUP_RWC 0x8f00 /* the R/WC bits */
#define USBLEGSUP_RO 0x5040 /* R/O and reserved bits */
#define UHCI_NULL_DATA_SIZE 0x7FF /* for UHCI controller TD */
@@ -85,7 +75,7 @@
#define CAN_SCHEDULE_FRAMES 1000 /* how far future frames can be scheduled */
struct uhci_frame_list {
__le32 frame[UHCI_NUMFRAMES];
__u32 frame[UHCI_NUMFRAMES];
void *frame_cpu[UHCI_NUMFRAMES];
@@ -108,36 +98,25 @@ struct urb_priv;
* In the frame list, qh->link maintains a list of QHs seen by the HC:
* skel1 --> ep1-qh --> ep2-qh --> ... --> skel2 --> ...
*/
#include <pshpck16.h>
struct uhci_qh {
/* Hardware fields */
__le32 link; /* Next queue */
__le32 element; /* Queue element pointer */
__u32 link; /* Next queue */
__u32 element; /* Queue element pointer */
/* Software fields */
dma_addr_t dma_handle;
struct usb_device *dev;
struct urb_priv *urbp;
struct list_head list; /* P: uhci->frame_list_lock */
struct list_head remove_list; /* P: uhci->remove_list_lock */
};
#include <poppack.h>
/*
* We need a special accessor for the element pointer because it is
* subject to asynchronous updates by the controller
*/
static __le32 inline qh_element(struct uhci_qh *qh) {
__le32 element = qh->element;
barrier();
return element;
}
} __attribute__((aligned(16)));
/*
* for TD <status>:
*/
#define td_status(td) le32_to_cpu((td)->status)
#define TD_CTRL_SPD (1 << 29) /* Short Packet Detect */
#define TD_CTRL_C_ERR_MASK (3 << 27) /* Error Counter bits */
#define TD_CTRL_C_ERR_SHIFT 27
@@ -157,7 +136,7 @@ static __le32 inline qh_element(struct uhci_qh *qh) {
TD_CTRL_BABBLE | TD_CTRL_CRCTIME | TD_CTRL_BITSTUFF)
#define uhci_maxerr(err) ((err) << TD_CTRL_C_ERR_SHIFT)
#define uhci_status_bits(ctrl_sts) ((ctrl_sts) & 0xF60000)
#define uhci_status_bits(ctrl_sts) ((ctrl_sts) & 0xFE0000)
#define uhci_actual_length(ctrl_sts) (((ctrl_sts) + 1) & TD_CTRL_ACTLEN_MASK) /* 1-based */
/*
@@ -199,45 +178,31 @@ static __le32 inline qh_element(struct uhci_qh *qh) {
* td->link points to either another TD (not necessarily for the same urb or
* even the same endpoint), or nothing (PTR_TERM), or a QH (for queued urbs)
*/
#include <pshpck16.h>
struct uhci_td {
/* Hardware fields */
__le32 link;
__le32 status;
__le32 token;
__le32 buffer;
__u32 link;
__u32 status;
__u32 token;
__u32 buffer;
/* Software fields */
dma_addr_t dma_handle;
struct usb_device *dev;
struct urb *urb;
struct list_head list; /* P: urb->lock */
struct list_head remove_list; /* P: uhci->td_remove_list_lock */
int frame; /* for iso: what frame? */
struct list_head fl_list; /* P: uhci->frame_list_lock */
};
#include <poppack.h>
/*
* We need a special accessor for the control/status word because it is
* subject to asynchronous updates by the controller
*/
static u32 inline td_status(struct uhci_td *td) {
__le32 status = td->status;
barrier();
return le32_to_cpu(status);
}
} __attribute__((aligned(16)));
/*
* The UHCI driver places Interrupt, Control and Bulk into QH's both
* to group together TD's for one transfer, and also to faciliate queuing
* of URB's. To make it easy to insert entries into the schedule, we have
* a skeleton of QH's for each predefined Interrupt latency, low-speed
* control, full-speed control and terminating QH (see explanation for
* a skeleton of QH's for each predefined Interrupt latency, low speed
* control, high speed control and terminating QH (see explanation for
* the terminating QH below).
*
* When we want to add a new QH, we add it to the end of the list for the
@@ -252,9 +217,9 @@ static u32 inline td_status(struct uhci_td *td) {
* skel int32 QH
* ...
* skel int1 QH
* skel low-speed control QH
* skel low speed control QH
* dev 5 control QH
* skel full-speed control QH
* skel high speed control QH
* skel bulk QH
* dev 1 bulk QH
* dev 2 bulk QH
@@ -263,7 +228,7 @@ static u32 inline td_status(struct uhci_td *td) {
* The terminating QH is used for 2 reasons:
* - To place a terminating TD which is used to workaround a PIIX bug
* (see Intel errata for explanation)
* - To loop back to the full-speed control queue for full-speed bandwidth
* - To loop back to the high speed control queue for full speed bandwidth
* reclamation
*
* Isochronous transfers are stored before the start of the skeleton
@@ -283,7 +248,7 @@ static u32 inline td_status(struct uhci_td *td) {
#define skel_int2_qh skelqh[6]
#define skel_int1_qh skelqh[7]
#define skel_ls_control_qh skelqh[8]
#define skel_fs_control_qh skelqh[9]
#define skel_hs_control_qh skelqh[9]
#define skel_bulk_qh skelqh[10]
#define skel_term_qh skelqh[11]
@@ -321,155 +286,134 @@ static inline int __interval_to_skel(int interval)
}
/*
* States for the root hub.
* Device states for the host controller.
*
* To prevent "bouncing" in the presence of electrical noise,
* when there are no devices attached we delay for 1 second in the
* RUNNING_NODEVS state before switching to the AUTO_STOPPED state.
*
* (Note that the AUTO_STOPPED state won't be necessary once the hub
* driver learns to autosuspend.)
* we insist on a 1-second "grace" period, before switching to
* the RUNNING or SUSPENDED states, during which the state is
* not allowed to change.
*
* The resume process is divided into substates in order to avoid
* potentially length delays during the timer handler.
*
* States in which the host controller is halted must have values <= 0.
*/
enum uhci_rh_state {
/* In the following states the HC must be halted.
* These two must come first */
UHCI_RH_RESET,
UHCI_RH_SUSPENDED,
UHCI_RH_AUTO_STOPPED,
UHCI_RH_RESUMING,
/* In this state the HC changes from running to halted,
* so it can legally appear either way. */
UHCI_RH_SUSPENDING,
/* In the following states it's an error if the HC is halted.
* These two must come last */
UHCI_RH_RUNNING, /* The normal state */
UHCI_RH_RUNNING_NODEVS, /* Running with no devices attached */
enum uhci_state {
UHCI_RESET,
UHCI_RUNNING_GRACE, /* Before RUNNING */
UHCI_RUNNING, /* The normal state */
UHCI_SUSPENDING_GRACE, /* Before SUSPENDED */
UHCI_SUSPENDED = -10, /* When no devices are attached */
UHCI_RESUMING_1,
UHCI_RESUMING_2
};
#define hcd_to_uhci(hcd_ptr) container_of(hcd_ptr, struct uhci_hcd, hcd)
/*
* This describes the full uhci information.
*
* Note how the "proper" USB information is just
* a subset of what the full implementation needs.
*/
struct uhci_hcd {
void *dentry;
struct usb_hcd hcd;
#ifdef CONFIG_PROC_FS
/* procfs */
struct proc_dir_entry *proc_entry;
#endif
/* Grabbed from PCI */
unsigned long io_addr;
struct dma_pool *qh_pool;
struct dma_pool *td_pool;
struct pci_pool *qh_pool;
struct pci_pool *td_pool;
struct usb_bus *bus;
struct uhci_td *term_td; /* Terminating TD, see UHCI bug */
struct uhci_qh *skelqh[UHCI_NUM_SKELQH]; /* Skeleton QH's */
spinlock_t lock;
struct uhci_frame_list *fl; /* P: uhci->lock */
int fsbr; /* Full-speed bandwidth reclamation */
spinlock_t frame_list_lock;
struct uhci_frame_list *fl; /* P: uhci->frame_list_lock */
int fsbr; /* Full speed bandwidth reclamation */
unsigned long fsbrtimeout; /* FSBR delay */
enum uhci_rh_state rh_state;
unsigned long auto_stop_time; /* When to AUTO_STOP */
unsigned int frame_number; /* As of last check */
unsigned int is_stopped;
#define UHCI_IS_STOPPED 9999 /* Larger than a frame # */
unsigned int scan_in_progress:1; /* Schedule scan is running */
unsigned int need_rescan:1; /* Redo the schedule scan */
unsigned int hc_inaccessible:1; /* HC is suspended or dead */
unsigned int working_RD:1; /* Suspended root hub doesn't
need to be polled */
/* Support for port suspend/resume/reset */
unsigned long port_c_suspend; /* Bit-arrays of ports */
unsigned long suspended_ports;
unsigned long resuming_ports;
unsigned long ports_timeout; /* Time to stop signalling */
enum uhci_state state; /* FIXME: needs a spinlock */
unsigned long state_end; /* Time of next transition */
int resume_detect; /* Need a Global Resume */
/* Main list of URB's currently controlled by this HC */
struct list_head urb_list; /* P: uhci->lock */
spinlock_t urb_list_lock;
struct list_head urb_list; /* P: uhci->urb_list_lock */
/* List of QH's that are done, but waiting to be unlinked (race) */
struct list_head qh_remove_list; /* P: uhci->lock */
unsigned int qh_remove_age; /* Age in frames */
/* List of TD's that are done, but waiting to be freed (race) */
struct list_head td_remove_list; /* P: uhci->lock */
unsigned int td_remove_age; /* Age in frames */
spinlock_t qh_remove_list_lock;
struct list_head qh_remove_list; /* P: uhci->qh_remove_list_lock */
/* List of asynchronously unlinked URB's */
struct list_head urb_remove_list; /* P: uhci->lock */
unsigned int urb_remove_age; /* Age in frames */
spinlock_t urb_remove_list_lock;
struct list_head urb_remove_list; /* P: uhci->urb_remove_list_lock */
/* List of URB's awaiting completion callback */
struct list_head complete_list; /* P: uhci->lock */
spinlock_t complete_list_lock;
struct list_head complete_list; /* P: uhci->complete_list_lock */
int rh_numports; /* Number of root-hub ports */
int rh_numports;
wait_queue_head_t waitqh; /* endpoint_disable waiters */
struct timer_list stall_timer;
};
/* Convert between a usb_hcd pointer and the corresponding uhci_hcd */
static inline struct uhci_hcd *hcd_to_uhci(struct usb_hcd *hcd)
{
return (struct uhci_hcd *) (hcd->hcd_priv);
}
static inline struct usb_hcd *uhci_to_hcd(struct uhci_hcd *uhci)
{
return container_of((void *) uhci, struct usb_hcd, hcd_priv);
}
//#define uhci_dev(u) (uhci_to_hcd(u)->self.controller)
static struct device *uhci_dev(struct uhci_hcd *uhci)
{
//struct uhci_hcd *uhci = (struct uhci_hcd *) (hcd->hcd_priv);//hcd_to_uhci(hcd);
struct usb_hcd *new_hcd = container_of((void *) uhci, struct usb_hcd, hcd_priv); // uhci_to_hcd(uhci)
return new_hcd->self.controller; //uhci_dev(uhci);
}
struct urb_priv {
struct list_head urb_list;
struct urb *urb;
struct usb_device *dev;
struct uhci_qh *qh; /* QH for this URB */
struct list_head td_list; /* P: urb->lock */
unsigned fsbr : 1; /* URB turned on FSBR */
unsigned fsbr_timeout : 1; /* URB timed out on FSBR */
unsigned queued : 1; /* QH was queued (not linked in) */
unsigned short_control_packet : 1; /* If we get a short packet during */
/* a control transfer, retrigger */
/* the status phase */
int fsbr : 1; /* URB turned on FSBR */
int fsbr_timeout : 1; /* URB timed out on FSBR */
int queued : 1; /* QH was queued (not linked in) */
int short_control_packet : 1; /* If we get a short packet during */
/* a control transfer, retrigger */
/* the status phase */
int status; /* Final status */
unsigned long inserttime; /* In jiffies */
unsigned long fsbrtime; /* In jiffies */
struct list_head queue_list; /* P: uhci->frame_list_lock */
struct list_head complete_list; /* P: uhci->complete_list_lock */
};
/*
* Locking in uhci.c
*
* Almost everything relating to the hardware schedule and processing
* of URBs is protected by uhci->lock. urb->status is protected by
* urb->lock; that's the one exception.
* spinlocks are used extensively to protect the many lists and data
* structures we have. It's not that pretty, but it's necessary. We
* need to be done with all of the locks (except complete_list_lock) when
* we call urb->complete. I've tried to make it simple enough so I don't
* have to spend hours racking my brain trying to figure out if the
* locking is safe.
*
* To prevent deadlocks, never lock uhci->lock while holding urb->lock.
* The safe order of locking is:
* Here's the safe locking order to prevent deadlocks:
*
* #1 uhci->lock
* #1 uhci->urb_list_lock
* #2 urb->lock
* #3 uhci->urb_remove_list_lock, uhci->frame_list_lock,
* uhci->qh_remove_list_lock
* #4 uhci->complete_list_lock
*
* If you're going to grab 2 or more locks at once, ALWAYS grab the lock
* at the lowest level FIRST and NEVER grab locks at the same level at the
* same time.
*
* So, if you need uhci->urb_list_lock, grab it before you grab urb->lock
*/
/* Some special IDs */
#define PCI_VENDOR_ID_GENESYS 0x17a0
#define PCI_DEVICE_ID_GL880S_UHCI 0x8083
#define PCI_DEVICE_ID_GL880S_EHCI 0x8084
#endif

View File

@@ -1,7 +1,7 @@
/*
* Universal Host Controller Interface driver for USB.
*
* Maintainer: Alan Stern <stern@rowland.harvard.edu>
* Maintainer: Johannes Erdfelt <johannes@erdfelt.com>
*
* (C) Copyright 1999 Linus Torvalds
* (C) Copyright 1999-2002 Johannes Erdfelt, johannes@erdfelt.com
@@ -9,7 +9,6 @@
* (C) Copyright 1999 Georg Acher, acher@in.tum.de
* (C) Copyright 1999 Deti Fliegl, deti@fliegl.de
* (C) Copyright 1999 Thomas Sailer, sailer@ife.ee.ethz.ch
* (C) Copyright 2004 Alan Stern, stern@rowland.harvard.edu
*/
static __u8 root_hub_hub_des[] =
@@ -17,350 +16,160 @@ static __u8 root_hub_hub_des[] =
0x09, /* __u8 bLength; */
0x29, /* __u8 bDescriptorType; Hub-descriptor */
0x02, /* __u8 bNbrPorts; */
0x0a, /* __u16 wHubCharacteristics; */
0x00, /* (per-port OC, no power switching) */
0x00, /* __u16 wHubCharacteristics; */
0x00,
0x01, /* __u8 bPwrOn2pwrGood; 2ms */
0x00, /* __u8 bHubContrCurrent; 0 mA */
0x00, /* __u8 DeviceRemovable; *** 7 Ports max *** */
0xff /* __u8 PortPwrCtrlMask; *** 7 ports max *** */
};
#define UHCI_RH_MAXCHILD 7
/* must write as zeroes */
#define WZ_BITS (USBPORTSC_RES2 | USBPORTSC_RES3 | USBPORTSC_RES4)
/* status change bits: nonzero writes will clear */
#define RWC_BITS (USBPORTSC_OCC | USBPORTSC_PEC | USBPORTSC_CSC)
/* A port that either is connected or has a changed-bit set will prevent
* us from AUTO_STOPPING.
*/
static int any_ports_active(struct uhci_hcd *uhci)
static int uhci_hub_status_data(struct usb_hcd *hcd, char *buf)
{
int port;
for (port = 0; port < uhci->rh_numports; ++port) {
if ((inw(uhci->io_addr + USBPORTSC1 + port * 2) &
(USBPORTSC_CCS | RWC_BITS)) ||
test_bit(port, &uhci->port_c_suspend))
return 1;
}
return 0;
}
static inline int get_hub_status_data(struct uhci_hcd *uhci, char *buf)
{
int port;
struct uhci_hcd *uhci = hcd_to_uhci(hcd);
unsigned int io_addr = uhci->io_addr;
int i, len = 1;
*buf = 0;
for (port = 0; port < uhci->rh_numports; ++port) {
if ((inw(uhci->io_addr + USBPORTSC1 + port * 2) & RWC_BITS) ||
test_bit(port, &uhci->port_c_suspend))
*buf |= (1 << (port + 1));
for (i = 0; i < uhci->rh_numports; i++) {
*buf |= ((inw(io_addr + USBPORTSC1 + i * 2) & 0xa) > 0 ? (1 << (i + 1)) : 0);
len = (i + 1) / 8 + 1;
}
return !!*buf;
}
#define OK(x) len = (x); break
#define CLR_RH_PORTSTAT(x) \
status = inw(port_addr); \
status &= ~(RWC_BITS|WZ_BITS); \
status &= ~(x); \
status |= RWC_BITS & (x); \
outw(status, port_addr)
status = inw(io_addr + USBPORTSC1 + 2 * (wIndex-1)); \
status = (status & 0xfff5) & ~(x); \
outw(status, io_addr + USBPORTSC1 + 2 * (wIndex-1))
#define SET_RH_PORTSTAT(x) \
status = inw(port_addr); \
status |= (x); \
status &= ~(RWC_BITS|WZ_BITS); \
outw(status, port_addr)
status = inw(io_addr + USBPORTSC1 + 2 * (wIndex-1)); \
status = (status & 0xfff5) | (x); \
outw(status, io_addr + USBPORTSC1 + 2 * (wIndex-1))
/* UHCI controllers don't automatically stop resume signalling after 20 msec,
* so we have to poll and check timeouts in order to take care of it.
*/
static void uhci_finish_suspend(struct uhci_hcd *uhci, int port,
unsigned long port_addr)
{
int status;
if (test_bit(port, &uhci->suspended_ports)) {
CLR_RH_PORTSTAT(USBPORTSC_SUSP | USBPORTSC_RD);
clear_bit(port, &uhci->suspended_ports);
clear_bit(port, &uhci->resuming_ports);
set_bit(port, &uhci->port_c_suspend);
/* The controller won't actually turn off the RD bit until
* it has had a chance to send a low-speed EOP sequence,
* which takes 3 bit times (= 2 microseconds). We'll delay
* slightly longer for good luck. */
udelay(4);
}
}
static void uhci_check_ports(struct uhci_hcd *uhci)
{
unsigned int port;
unsigned long port_addr;
int status;
for (port = 0; port < uhci->rh_numports; ++port) {
port_addr = uhci->io_addr + USBPORTSC1 + 2 * port;
status = inw(port_addr);
if (unlikely(status & USBPORTSC_PR)) {
if (time_after_eq(jiffies, uhci->ports_timeout)) {
CLR_RH_PORTSTAT(USBPORTSC_PR);
udelay(10);
/* If the port was enabled before, turning
* reset on caused a port enable change.
* Turning reset off causes a port connect
* status change. Clear these changes. */
CLR_RH_PORTSTAT(USBPORTSC_CSC | USBPORTSC_PEC);
SET_RH_PORTSTAT(USBPORTSC_PE);
}
}
if (unlikely(status & USBPORTSC_RD)) {
if (!test_bit(port, &uhci->resuming_ports)) {
/* Port received a wakeup request */
set_bit(port, &uhci->resuming_ports);
uhci->ports_timeout = jiffies +
msecs_to_jiffies(20);
/* Make sure we see the port again
* after the resuming period is over. */
mod_timer(&uhci_to_hcd(uhci)->rh_timer,
uhci->ports_timeout);
} else if (time_after_eq(jiffies,
uhci->ports_timeout)) {
uhci_finish_suspend(uhci, port, port_addr);
}
}
}
}
static int uhci_hub_status_data(struct usb_hcd *hcd, char *buf)
{
struct uhci_hcd *uhci = hcd_to_uhci(hcd);
unsigned long flags;
int status = 0;
spin_lock_irqsave(&uhci->lock, flags);
uhci_scan_schedule(uhci, NULL);
if (uhci->hc_inaccessible)
goto done;
check_fsbr(uhci);
uhci_check_ports(uhci);
status = get_hub_status_data(uhci, buf);
switch (uhci->rh_state) {
case UHCI_RH_SUSPENDING:
case UHCI_RH_SUSPENDED:
/* if port change, ask to be resumed */
if (status)
usb_hcd_resume_root_hub(hcd);
break;
case UHCI_RH_AUTO_STOPPED:
/* if port change, auto start */
if (status)
wakeup_rh(uhci);
break;
case UHCI_RH_RUNNING:
/* are any devices attached? */
if (!any_ports_active(uhci)) {
uhci->rh_state = UHCI_RH_RUNNING_NODEVS;
uhci->auto_stop_time = jiffies + HZ;
}
break;
case UHCI_RH_RUNNING_NODEVS:
/* auto-stop if nothing connected for 1 second */
if (any_ports_active(uhci))
uhci->rh_state = UHCI_RH_RUNNING;
else if (time_after_eq(jiffies, uhci->auto_stop_time))
suspend_rh(uhci, UHCI_RH_AUTO_STOPPED);
break;
default:
break;
}
done:
spin_unlock_irqrestore(&uhci->lock, flags);
return status;
}
/* size of returned buffer is part of USB spec */
static int uhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
u16 wIndex, char *buf, u16 wLength)
u16 wIndex, u8 *buf, u16 wLength)
{
struct uhci_hcd *uhci = hcd_to_uhci(hcd);
int status, lstatus, retval = 0, len = 0;
unsigned int port = wIndex - 1;
unsigned long port_addr = uhci->io_addr + USBPORTSC1 + 2 * port;
u16 wPortChange, wPortStatus;
unsigned long flags;
int i, status, retval = 0, len = 0;
unsigned int io_addr = uhci->io_addr;
__u16 cstatus;
char c_p_r[8];
if (uhci->hc_inaccessible)
return -ETIMEDOUT;
for (i = 0; i < 8; i++)
c_p_r[i] = 0;
spin_lock_irqsave(&uhci->lock, flags);
switch (typeReq) {
/* Request Destination:
without flags: Device,
RH_INTERFACE: interface,
RH_ENDPOINT: endpoint,
RH_CLASS means HUB here,
RH_OTHER | RH_CLASS almost ever means HUB_PORT here
*/
case GetHubStatus:
*(__le32 *)buf = cpu_to_le32(0);
*(__u32 *)buf = cpu_to_le32(0);
OK(4); /* hub power */
case GetPortStatus:
if (port >= uhci->rh_numports)
goto err;
status = inw(io_addr + USBPORTSC1 + 2 * (wIndex - 1));
cstatus = ((status & USBPORTSC_CSC) >> (1 - 0)) |
((status & USBPORTSC_PEC) >> (3 - 1)) |
(c_p_r[wIndex - 1] << (0 + 4));
status = (status & USBPORTSC_CCS) |
((status & USBPORTSC_PE) >> (2 - 1)) |
((status & USBPORTSC_SUSP) >> (12 - 2)) |
((status & USBPORTSC_PR) >> (9 - 4)) |
(1 << 8) | /* power on */
((status & USBPORTSC_LSDA) << (-8 + 9));
uhci_check_ports(uhci);
status = inw(port_addr);
/* Intel controllers report the OverCurrent bit active on.
* VIA controllers report it active off, so we'll adjust the
* bit value. (It's not standardized in the UHCI spec.)
*/
if (to_pci_dev(hcd->self.controller)->vendor ==
PCI_VENDOR_ID_VIA)
status ^= USBPORTSC_OC;
/* UHCI doesn't support C_RESET (always false) */
wPortChange = lstatus = 0;
if (status & USBPORTSC_CSC)
wPortChange |= USB_PORT_STAT_C_CONNECTION;
if (status & USBPORTSC_PEC)
wPortChange |= USB_PORT_STAT_C_ENABLE;
if (status & USBPORTSC_OCC)
wPortChange |= USB_PORT_STAT_C_OVERCURRENT;
if (test_bit(port, &uhci->port_c_suspend)) {
wPortChange |= USB_PORT_STAT_C_SUSPEND;
lstatus |= 1;
}
if (test_bit(port, &uhci->suspended_ports))
lstatus |= 2;
if (test_bit(port, &uhci->resuming_ports))
lstatus |= 4;
/* UHCI has no power switching (always on) */
wPortStatus = USB_PORT_STAT_POWER;
if (status & USBPORTSC_CCS)
wPortStatus |= USB_PORT_STAT_CONNECTION;
if (status & USBPORTSC_PE) {
wPortStatus |= USB_PORT_STAT_ENABLE;
if (status & (USBPORTSC_SUSP | USBPORTSC_RD))
wPortStatus |= USB_PORT_STAT_SUSPEND;
}
if (status & USBPORTSC_OC)
wPortStatus |= USB_PORT_STAT_OVERCURRENT;
if (status & USBPORTSC_PR)
wPortStatus |= USB_PORT_STAT_RESET;
if (status & USBPORTSC_LSDA)
wPortStatus |= USB_PORT_STAT_LOW_SPEED;
if (wPortChange)
dev_dbg(uhci_dev(uhci), "port %d portsc %04x,%02x\n",
wIndex, status, lstatus);
*(__le16 *)buf = cpu_to_le16(wPortStatus);
*(__le16 *)(buf + 2) = cpu_to_le16(wPortChange);
*(__u16 *)buf = cpu_to_le16(status);
*(__u16 *)(buf + 2) = cpu_to_le16(cstatus);
OK(4);
case SetHubFeature: /* We don't implement these */
case ClearHubFeature:
case SetHubFeature:
switch (wValue) {
case C_HUB_OVER_CURRENT:
case C_HUB_LOCAL_POWER:
OK(0);
break;
default:
goto err;
}
break;
case ClearHubFeature:
switch (wValue) {
case C_HUB_OVER_CURRENT:
OK(0); /* hub power over current */
default:
goto err;
}
break;
case SetPortFeature:
if (port >= uhci->rh_numports)
if (!wIndex || wIndex > uhci->rh_numports)
goto err;
switch (wValue) {
case USB_PORT_FEAT_SUSPEND:
set_bit(port, &uhci->suspended_ports);
SET_RH_PORTSTAT(USBPORTSC_SUSP);
OK(0);
case USB_PORT_FEAT_RESET:
SET_RH_PORTSTAT(USBPORTSC_PR);
/* Reset terminates Resume signalling */
uhci_finish_suspend(uhci, port, port_addr);
/* USB v2.0 7.1.7.5 */
uhci->ports_timeout = jiffies + msecs_to_jiffies(50);
mdelay(50); /* USB v1.1 7.1.7.3 */
c_p_r[wIndex - 1] = 1;
CLR_RH_PORTSTAT(USBPORTSC_PR);
udelay(10);
SET_RH_PORTSTAT(USBPORTSC_PE);
mdelay(10);
SET_RH_PORTSTAT(0xa);
OK(0);
case USB_PORT_FEAT_POWER:
/* UHCI has no power switching */
OK(0); /* port power ** */
case USB_PORT_FEAT_ENABLE:
SET_RH_PORTSTAT(USBPORTSC_PE);
OK(0);
default:
goto err;
}
break;
case ClearPortFeature:
if (port >= uhci->rh_numports)
if (!wIndex || wIndex > uhci->rh_numports)
goto err;
switch (wValue) {
case USB_PORT_FEAT_ENABLE:
CLR_RH_PORTSTAT(USBPORTSC_PE);
/* Disable terminates Resume signalling */
uhci_finish_suspend(uhci, port, port_addr);
OK(0);
case USB_PORT_FEAT_C_ENABLE:
CLR_RH_PORTSTAT(USBPORTSC_PEC);
SET_RH_PORTSTAT(USBPORTSC_PEC);
OK(0);
case USB_PORT_FEAT_SUSPEND:
if (test_bit(port, &uhci->suspended_ports) &&
!test_and_set_bit(port,
&uhci->resuming_ports)) {
SET_RH_PORTSTAT(USBPORTSC_RD);
/* The controller won't allow RD to be set
* if the port is disabled. When this happens
* just skip the Resume signalling.
*/
if (!(inw(port_addr) & USBPORTSC_RD))
uhci_finish_suspend(uhci, port,
port_addr);
else
/* USB v2.0 7.1.7.7 */
uhci->ports_timeout = jiffies +
msecs_to_jiffies(20);
}
CLR_RH_PORTSTAT(USBPORTSC_SUSP);
OK(0);
case USB_PORT_FEAT_C_SUSPEND:
clear_bit(port, &uhci->port_c_suspend);
/*** WR_RH_PORTSTAT(RH_PS_PSSC); */
OK(0);
case USB_PORT_FEAT_POWER:
/* UHCI has no power switching */
goto err;
OK(0); /* port power */
case USB_PORT_FEAT_C_CONNECTION:
CLR_RH_PORTSTAT(USBPORTSC_CSC);
SET_RH_PORTSTAT(USBPORTSC_CSC);
OK(0);
case USB_PORT_FEAT_C_OVER_CURRENT:
CLR_RH_PORTSTAT(USBPORTSC_OCC);
OK(0);
OK(0); /* port power over current */
case USB_PORT_FEAT_C_RESET:
/* this driver won't report these */
c_p_r[wIndex - 1] = 0;
OK(0);
default:
goto err;
}
break;
case GetHubDescriptor:
len = min_t(unsigned int, sizeof(root_hub_hub_des), wLength);
len = min_t(unsigned int, wLength,
min_t(unsigned int, sizeof(root_hub_hub_des), wLength));
memcpy(buf, root_hub_hub_des, len);
if (len > 2)
buf[2] = uhci->rh_numports;
@@ -369,7 +178,7 @@ static int uhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
err:
retval = -EPIPE;
}
spin_unlock_irqrestore(&uhci->lock, flags);
return retval;
}

Some files were not shown because too many files have changed in this diff Show More