aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Huth <thuth@linux.vnet.ibm.com>2011-08-12 16:38:17 +0200
committerThomas Huth <thuth@linux.vnet.ibm.com>2011-10-12 16:24:55 +0200
commitf2bf58f8ec5e1e9411e3d088afde60d823fe2ce3 (patch)
treea8552feb074bb7f75122c2e4357831ef2971351e
parent7c3b65d835c41e89902772bb1e81d3bacebb75c9 (diff)
downloadSLOF-f2bf58f8ec5e1e9411e3d088afde60d823fe2ce3.zip
SLOF-f2bf58f8ec5e1e9411e3d088afde60d823fe2ce3.tar.gz
SLOF-f2bf58f8ec5e1e9411e3d088afde60d823fe2ce3.tar.bz2
USB source code beautification
Fixed some white space damages and corrected some bad comments. Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
-rw-r--r--slof/fs/usb/usb-ohci.fs94
-rw-r--r--slof/fs/usb/usb-support.fs98
2 files changed, 95 insertions, 97 deletions
diff --git a/slof/fs/usb/usb-ohci.fs b/slof/fs/usb/usb-ohci.fs
index 6f9df10..a4e80d1 100644
--- a/slof/fs/usb/usb-ohci.fs
+++ b/slof/fs/usb/usb-ohci.fs
@@ -61,7 +61,7 @@ STRUCT
CONSTANT /edlen
-\ HCCA Done queue location packaged as a structure for ease OF use.
+\ HCCA Done queue location packaged as a structure for ease of use.
STRUCT
@@ -231,10 +231,10 @@ INSTANCE VARIABLE cd-buffer
\ before usage in functions and their values assume significance only during
\ the function's execution time. Should be used like local variables.
\ CAUTION:
-\ If you are calling functions that destroy contents OF these variables, be
+\ If you are calling functions that destroy contents of these variables, be
\ smart enuf to save the values before calling them.
\ It is recommended that these temporary variables are used only amidst normal
-\ FORTH words -- not among the vicinity OF any OF the functions OF this node.
+\ FORTH words -- not among the vicinity of any of the functions of this node.
0 VALUE temp1
@@ -314,7 +314,7 @@ INSTANCE VARIABLE cd-buffer
\ The following are WORDS internal to this node. They are supposed to
\ be used by other WORDS inside this device node.
\ The first three WORDS below form the interface. The fourth and fifth
-\ word is a helper function and is not exposed to other portions OF this
+\ word is a helper function and is not exposed to other portions of this
\ device node.
\ a) initialize-td-free-list
\ b) allocate-td-list
@@ -326,18 +326,16 @@ INSTANCE VARIABLE cd-buffer
: zero-out-a-td-except-link ( td -- )
-
- \ There r definitely smarter ways to DO it especially
+ \ There are definitely smarter ways to do it especially
\ on a 64-bit machine.
\ Optimization, Portability:
\ --------------------------
- \ Replace the following code by two "!" OF zeroes. Since
+ \ Replace the following code by two "!" of zeroes. Since
\ we know that an "td" is actually 16 bytes and that we
- \ will be executing on a 64-bit machine, we can finish OFf
+ \ will be executing on a 64-bit machine, we can finish off
\ with 2 stores. But that WONT be portable.
-
dup 0 swap td>tattr l!-le ( td )
dup 0 swap td>cbptr l!-le ( td )
dup 0 swap td>bfrend l!-le ( td )
@@ -347,7 +345,7 @@ INSTANCE VARIABLE cd-buffer
\ COLON DEFINITION: initialize-td-free-list - Internal Function
-\ Initialize the TD Free List Region and create a linked list OF successive
+\ Initialize the TD Free List Region and create a linked list of successive
\ TDs. Note that the NEXT pointers are all in little-endian and they
\ can be directly used for HC purposes.
@@ -372,17 +370,17 @@ INSTANCE VARIABLE cd-buffer
\ Argument:
\ The function accepts a non-negative number and allocates
\ a TD-LIST containing that many TDs. A TD-LIST is a list
-\ OF TDs that are linked by the next-td field. The next-td
+\ of TDs that are linked by the next-td field. The next-td
\ field is in little-endian mode so that the TD list can
\ be directly re-used by the HC.
\ Return value:
-\ The function returns "head" and "tail" OF the allocated
+\ The function returns "head" and "tail" of the allocated
\ TD-LIST. If for any reason, the function cannot allocate
\ the TD-LIST, the function returns 2 NULL pointers in the
\ stack indicating that the allocation failed.
\ Note that the TD list returned is NULL terminated. i.e
-\ the nextTd field OF the tail is NULL.
+\ the nextTd field of the tail is NULL.
@@ -397,9 +395,9 @@ INSTANCE VARIABLE cd-buffer
EXIT
THEN
- \ If we are here THEN we know that the requested number OF TDs is less
- \ than what we actually have. We need TO traverse the list and find the
- \ new Head pointer position and THEN update the head pointer accordingly.
+ \ If we are here then we know that the requested number of TDs is less
+ \ than what we actually have. We need to traverse the list and find the
+ \ new Head pointer position and then update the head pointer accordingly.
\ Update num-free-tds
dup num-free-tds swap - TO num-free-tds ( n )
@@ -422,9 +420,9 @@ INSTANCE VARIABLE cd-buffer
\ COLON DEFINITION: find-td-list-tail-and-size
-\ This function counts the number OF TD elements
+\ This function counts the number of TD elements
\ in the given list. It also returns the last tail
-\ TD OF the TD list.
+\ TD of the TD list.
\ ASSUMPTION:
\ A NULL terminated TD list is assumed. A not-well formed
@@ -432,9 +430,9 @@ INSTANCE VARIABLE cd-buffer
\ ROOM FOR ENHANCEMENT:
\ We could arrive at a generic function for counting
-\ list elements to which the next-ptr OFfset can also
+\ list elements to which the next-ptr offset can also
\ be passed as an argument (in this case it is >ntd)
-\ This function can THEN be changed to call the
+\ This function can then be changed to call the
\ function with "0 >ntd" as an additional argument
\ (apart from head and tail)
@@ -466,25 +464,25 @@ INSTANCE VARIABLE cd-buffer
\ COLON DEFINITION: (free-td-list)
\ Arguments: (head --)
-\ The "head" pointer OF the TD-LIST to be freed is passed as
+\ The "head" pointer of the TD-LIST to be freed is passed as
\ an argument to this function. The function merely adds the list to the
\ already existing TD-LIST
\ Assumptions:
\ The function assumes that the TD-LIST passed as argument is a well-formed
-\ list. The function does not DO any check on it.
+\ list. The function does not do any check on it.
\ But since, the "TD-LIST" is generally freed from the DONE-QUEUE which is
\ a well-formed list, the interface makes much sense.
\ Return values:
-\ Nothing is returned. The arguments passed are popped OFf.
+\ Nothing is returned. The arguments passed are popped off.
: (free-td-list) ( head -- )
\ Enhancement:
\ We could zero-out-a-td-except-link for the TD list that is being freed.
- \ This way, we could prevent some nasty repercussions OF bugs (that r yet
+ \ This way, we could prevent some nasty repercussions of bugs (that are yet
\ to be discovered). but we can include this enhancement during the testing
\ phase.
@@ -511,7 +509,7 @@ INSTANCE VARIABLE cd-buffer
\ --------------------------
\ Replace by a "!" and "l!". we know that an "ed" is
\ actually 16 bytes and that we will be executing on
- \ a 64-bit machine, we can finish OFf with 2 stores.
+ \ a 64-bit machine, we can finish off with 2 stores.
\ But that WONT be portable.
dup 0 swap ed>eattr l!-le ( ed )
@@ -567,7 +565,7 @@ INSTANCE VARIABLE cd-buffer
\ ------------------
\ Note:
\ -----
-\ 1. What should we DO IF alloc-mem fails ?
+\ 1. What should we do if alloc-mem fails ?
\ 2. alloc-mem must return aligned memory addresses.
\ 3. alloc-mem must return DMAable memory!
@@ -669,11 +667,11 @@ THEN
;
-\ Clearing WDH to allow HC to write into DOne queue again
+\ Clearing WDH to allow HC to write into done queue again
: (HC-ACK-WDH) ( -- ) WDH hcintstat rl!-le ;
-\ Checking whether anything has been written into DOne queue
+\ Checking whether anything has been written into done queue
: (HC-CHECK-WDH) ( -- ) hcintstat rl@-le WDH and 0<> ;
@@ -704,14 +702,14 @@ THEN
\ Arguments:
\ ----------
-\ (from bottom OF stack)
-\ 1. addr -- Address OF the data buffer
-\ 2. dlen -- Length OF the data buffer above.
+\ (from bottom of stack)
+\ 1. addr -- Address of the data buffer
+\ 2. dlen -- Length of the data buffer above.
\ 3. dir -- Tells whether the TDs r for an IN or
\ OUT transaction.
\ 4. MPS -- Maximum Packet Size associated with the endpoint
\ that will use this TD list.
-\ 5. TD-List-Head - Head pointer OF the List OF TDs.
+\ 5. TD-List-Head - Head pointer of the List of TDs.
\ This list is NOT expected to be NULL terminated.
\ Assumptions:
@@ -721,14 +719,14 @@ THEN
\ 2. The TDs toggle field is assumed to be taken from the endpoint
\ descriptor's "toggle carry" field.
\ 3. Assumes that the caller specifies the correct start-toggle.
-\ If the caller specifies a wrong data toggle OF 1 for a SETUP
+\ If the caller specifies a wrong data toggle of 1 for a SETUP
\ PACKET, this method will not find it out.
\ COLON DEFINTION: (toggle-current-toggle)
\ Scope: Internal to fill-TD-list
\ Functionality:
\ Toggles the "T" field that is passed as argument.
-\ "T" as in the "T" field OF the TD.
+\ "T" as in the "T" field of the TD.
0 VALUE current-toggle
: fill-TD-list ( start-toggle addr dlen dp MPS TD-List-Head -- )
@@ -807,8 +805,8 @@ THEN
\ ==================================================================
\ COLON DEFINITION: (wait-for-done-q)
\ FUNCTIONALITY:
-\ To DO a timed polling OF the DOne queue and acknowledge and return
-\ the address OF the last retired Td list
+\ To do a timed polling of the done queue and acknowledge and return
+\ the address of the last retired Td list
\ SCOPE:
\ Internal method
\ ==================================================================
@@ -847,7 +845,7 @@ THEN
\ : debug-frame-counter ( -- )
\ 40 1 DO
-\ ." Frame ct at HCCA at end OF enumeration = "
+\ ." Frame ct at HCCA at end of enumeration = "
\ hchcca 80 + rl@-le .
\ LOOP
\ ;
@@ -858,7 +856,7 @@ THEN
\ This routine will reset the HC and will bring it to Operational
\ state.
\ PENDING:
-\ Arrive at the right value OF FrameInterval. Currently we are hardcoding
+\ Arrive at the right value of FrameInterval. Currently we are hardcoding
\ it.
\ ==========================================================================
: HC-reset ( -- )
@@ -901,7 +899,7 @@ THEN
\ Its OHCI controller (AM8111) behaves different to NEC's one
23f02edf hcintrval rl!-le \ frame-interval register
hchcca hchccareg rl!-le \ HC communication area
-
+
d# 50 ms
\ now power on all ports of this root-hub
@@ -985,7 +983,7 @@ s" usb-support.fs" INCLUDED
\ ==================================================================
-\ To retrieve the configuration descriptor OF a device
+\ To retrieve the configuration descriptor of a device
\ with a valid USB address
@@ -1084,11 +1082,11 @@ s" usb-enumerate.fs" INCLUDED
dd-buffer @ DEVICE-DESCRIPTOR-TYPE-OFFSET + c@ ( Descriptor-type )
DEVICE-DESCRIPTOR-TYPE <> IF
s" USB: Error Reading Device Descriptor" usb-debug-print
- s" Read descriptor is not OF the right type" usb-debug-print
+ s" Read descriptor is not of the right type" usb-debug-print
s" Aborting enumeration" usb-debug-print
EXIT
- \ NOTE: Tomorrow, IF u have a LOOP here THEN we may need to
- \ UNLOOP before EXITing. Depends on what type OF LOOPing construct
+ \ NOTE: Tomorrow, if you have a LOOP here then we may need to
+ \ UNLOOP before EXITing. Depends on what type of looping construct
\ is used. Beware.
THEN
@@ -1100,7 +1098,7 @@ s" usb-enumerate.fs" INCLUDED
\ NOTE: Probably, we could check MPS for only 8/16/32/64
\ hmm.. not now...
- \ Read the device class to see what type OF device it is and create an
+ \ Read the device class to see what type of device it is and create an
\ appropriate child node here.
create-usb-device-tree
ELSE
@@ -1108,8 +1106,8 @@ s" usb-enumerate.fs" INCLUDED
s" Aborting Enumeration." usb-debug-print
EXIT
- \ NOTE: Tomorrow , IF u have a LOOP here THEN we may need to
- \ UNLOOP before EXITing. Depends on what type OF LOOPing construct
+ \ NOTE: Tomorrow , if you have a LOOP here then we may need to
+ \ UNLOOP before EXITing. Depends on what type of looping construct
\ is used. Beware.
THEN
@@ -1119,9 +1117,9 @@ s" usb-enumerate.fs" INCLUDED
\ =========================================================================
\ PROTOTYPE FUNCTION: "rhport-initialize"
\ Detect Device, reset and enable the respective port.
-\ COLON Definition rhport-initialize accepts the total number OF root hub
+\ COLON Definition rhport-initialize accepts the total number of root hub
\ ports as an argument and probes every available root hub port and initiates
-\ the build OF the USB devie sub-tree so is effectively the mother OF all
+\ the build of the USB devie sub-tree so is effectively the mother of all
\ USB device nodes that are to be detected and instantiated.
\ ==========================================================================
: rhport-initialize ( -- )
diff --git a/slof/fs/usb/usb-support.fs b/slof/fs/usb/usb-support.fs
index 08ff9bd..a9dd919 100644
--- a/slof/fs/usb/usb-support.fs
+++ b/slof/fs/usb/usb-support.fs
@@ -190,7 +190,7 @@ VARIABLE controlxfer-cmd
THEN ( ed-ptr done-td )
(free-td-list) ( ed-ptr )
0 hchccadneq l!-le ( ed-ptr )
- (HC-ACK-WDH) \ TDs were written to DOne queue. ACK the HC.
+ (HC-ACK-WDH) \ TDs were written to done queue. ACK the HC.
THEN
poll-timer 1+ TO poll-timer
4 ms \ longer 1 ms
@@ -199,7 +199,7 @@ VARIABLE controlxfer-cmd
td-retire-count num-tds <> ( ed-ptr )
IF
dup display-descriptors ( ed-ptr )
- s" maximum of retire " usb-debug-print
+ s" maximum of retire " usb-debug-print
THEN
free-ed
td-retire-count num-tds <>
@@ -215,22 +215,22 @@ VARIABLE controlxfer-cmd
\ INTERFACE FUNCTION
\ ARGUMENTS:
-\ (from the bottom OF stack)
-\ 1. dir -- This is the direction OF data transfer associated with
-\ the DATA STAGE OF the control xfer.
+\ (from the bottom of stack)
+\ 1. dir -- This is the direction of data transfer associated with
+\ the DATA STAGE of the control xfer.
\ If there is no data transfer (argument dlen is zero)
-\ THEN this argument DOes not matter, nonethless it has
+\ then this argument does not matter, nonethless it has
\ to be passed.
\ A "0" represents an IN and "1" represents an "OUT".
-\ 2. addr -- If therez a data stage associated with the transfer,
-\ THEN, this argument holds the address OF the data buffer
-\ 3. dlen -- This arg holds the length OF the data buffer discussed
+\ 2. addr -- If there is a data stage associated with the transfer,
+\ then this argument holds the address of the data buffer
+\ 3. dlen -- This arg holds the length of the data buffer discussed
\ in previous step (addr)
\ 4. setup-packet -- This holds the pointer to the setup packet that
-\ will be transmitted during the SETUP stage OF
+\ will be transmitted during the SETUP stage of
\ the control xfer. The function assumes the length
-\ OF the status packet to be 8 bytes.
-\ 5. MPS -- This is the MAX PACKET SIZE OF the endpoint.
+\ of the status packet to be 8 bytes.
+\ 5. MPS -- This is the MAX PACKET SIZE of the endpoint.
\ 6. ep-fun -- This is the 11-bit value that holds the Endpoint and
\ the function address. bit 7 to bit 10 holds the Endpoint
\ address. Bits 0 to Bit 6 holds the Function Address.
@@ -239,16 +239,16 @@ VARIABLE controlxfer-cmd
\ Bit 13 must be set for low-speed devices.
\ RETURN VALUE:
-\ Returns TRUE | FALSE depending on the success OF the transaction.
+\ Returns TRUE | FALSE depending on the success of the transaction.
\ ASSUMPTIONS:
\ 1. Function assumes that the setup packet is 8-bytes in length.
\ If in future, IF we need to add a new argument, we need to change
-\ the function in lot OF places.
+\ the function in lot of places.
\ RISKS:
-\ 1. If for some reason, the USB controller DOes not retire all the TDs
-\ THEN, the status checking part OF this "word" can spin forever.
+\ 1. If for some reason, the USB controller does not retire all the TDs
+\ then the status checking part of this "word" can spin forever.
: controlxfer ( dir addr dlen setup-packet MPS ep-fun -- TRUE | FALSE )
@@ -264,7 +264,7 @@ VARIABLE controlxfer-cmd
\ FIXME:
- \ Clear the TAIL pointer in ED. This has got sthg to DO with how
+ \ Clear the TAIL pointer in ED. This has got sthg to do with how
\ the HC finds an EMPTY queue condition. Refer spec.
@@ -283,7 +283,7 @@ VARIABLE controlxfer-cmd
endpt-num setup-packet 4 + c! \ endpoint number
0 0 0 setup-packet DEFAULT-CONTROL-MPS usb-addr-contr-req controlxfer
( TRUE|FALSE )
-;
+;
\ It resets the usb bulk-device
21FF000000000000 CONSTANT BULK-RESET
@@ -298,20 +298,20 @@ VARIABLE controlxfer-cmd
>r ( bulk-out-endp bulk-in-endp R: usb-addr )
\ perform a bulk reset
r@ control-std-bulk-reset
- IF s" bulk reset OK"
- ELSE s" bulk reset failed"
+ IF s" bulk reset OK"
+ ELSE s" bulk reset failed"
THEN usb-debug-print
-
+
\ clear bulk-in endpoint ( bulk-out-endp bulk-in-endp R: usb-addr )
80 or r@ control-std-clear-feature
- IF s" control-std-clear IN endpoint OK"
- ELSE s" control-std-clear-IN endpoint failed"
+ IF s" control-std-clear IN endpoint OK"
+ ELSE s" control-std-clear-IN endpoint failed"
THEN usb-debug-print
\ clear bulk-out endpoint ( bulk-out-endp R: usb-addr )
r@ control-std-clear-feature
- IF s" control-std-clear OUT endpoint OK"
- ELSE s" control-std-clear-OUT endpoint failed"
+ IF s" control-std-clear OUT endpoint OK"
+ ELSE s" control-std-clear-OUT endpoint failed"
THEN usb-debug-print
r> drop
;
@@ -448,24 +448,24 @@ VARIABLE controlxfer-cmd
saved-list-type
CASE
0 OF
- 0 0 control-std-clear-feature
- s" clear feature " usb-debug-print
+ 0 0 control-std-clear-feature
+ s" clear feature " usb-debug-print
ENDOF
1 OF \ clean bulk stalled
s" clear bulk when stalled " usb-debug-print
- disable-bulk-list-processing \ disable procesing
+ disable-bulk-list-processing \ disable procesing
saved-rw-ed ed>eattr l@-le dup \ extract
780 and 7 rshift 80 or \ endpoint and
swap 7f and \ usb addr
control-std-clear-feature
- ENDOF
+ ENDOF
2 OF
- 0 saved-rw-ed ed>eattr l@-le
+ 0 saved-rw-ed ed>eattr l@-le
control-std-clear-feature
- ENDOF
- dup OF
- s" unknown status " usb-debug-print
- ENDOF
+ ENDOF
+ dup OF
+ s" unknown status " usb-debug-print
+ ENDOF
ENDCASE
ELSE ( td-list failed-TD CC )
." TD failed " 5b emit .s 5d emit cr
@@ -477,15 +477,15 @@ VARIABLE controlxfer-cmd
NEXT-TD 0<> \ clean the TD if we
IF
NEXT-TD (free-td-list) \ had a stalled
- THEN
+ THEN
THEN
(free-td-list)
ELSE
drop \ drop td-list pointer
scan-time? IF 2e emit THEN \ show proceeding dots
TRUE TO while-failed
- s" time out wait for done" usb-debug-print
- 20 ms \ wait for bad device
+ s" time out wait for done" usb-debug-print
+ 20 ms \ wait for bad device
THEN
REPEAT
;
@@ -500,11 +500,11 @@ VARIABLE controlxfer-cmd
1 OF disable-bulk-list-processing ENDOF
2 OF disable-interrupt-list-processing ENDOF
ENDCASE
- saved-rw-ed ed>tdqhp l@-le 2 and 0<> IF
- 1
+ saved-rw-ed ed>tdqhp l@-le 2 and 0<> IF
+ 1
s" retired 1" usb-debug-print
ELSE
- 0
+ 0
s" retired 0" usb-debug-print
THEN
\ s" retired " usb-debug-print-val
@@ -517,9 +517,9 @@ VARIABLE controlxfer-cmd
;
-\ (DO-rw-endpoint): T1 12 80 0 0chis method is an privately visible function
+\ (do-rw-endpoint): T1 12 80 0 0chis method is an privately visible function
\ to be used by the "rw-endpoint" the required
-\ number OF times based on the actual length
+\ number of times based on the actual length
\ to be transferred
\ Arguments:
@@ -533,9 +533,9 @@ VARIABLE controlxfer-cmd
\ toggle: Starting toggle for this transfer
\ buffer length: Data buffer associated with the transfer limited
\ accordingly by the "rw-endpoint" method to the
-\ value OF max packet size
+\ value of max packet size
\ mps: Max Packet Size.
-\ address: Address OF endpoint. 11-bit address. The lower 7-bits represent
+\ address: Address of endpoint. 11-bit address. The lower 7-bits represent
\ the USB addres and the upper 4-bits represent the Endpoint
\ number.
@@ -562,9 +562,9 @@ VARIABLE controlxfer-cmd
\ rw-endpoint: The method is an externally visible method to be exported
\ to the child nodes. It uses the internal method
-\ "(DO-rw-endpoint)", the required number OF times based on the
-\ actual length OF transfer, so that the limitataion OF MAX-TDS
-\ DO not hinder the transfer.
+\ "(do-rw-endpoint)", the required number of times based on the
+\ actual length of transfer, so that the limitation of MAX-TDS
+\ do not hinder the transfer.
\ Arguments:
\ pt: Packet type
@@ -577,7 +577,7 @@ VARIABLE controlxfer-cmd
\ toggle: Starting toggle for this transfer
\ buffer length: Data buffer associated with the transfer
\ mps: Max Packet Size.
-\ address: Address OF endpoint. 11-bit address. The lower 7-bits represent
+\ address: Address of endpoint. 11-bit address. The lower 7-bits represent
\ the USB addres and the upper 4-bits represent the Endpoint
\ number.
@@ -598,7 +598,7 @@ VARIABLE controlxfer-cmd
( pt ed-type toggle buffer length mps address -- )
( toggle TRUE |toggle FALSE )
- \ a single transfer descriptor can point to a buffer OF
+ \ a single transfer descriptor can point to a buffer of
\ 8192 bytes a block on the CDROM has 2048 bytes
\ but a single transfer is constrained by the MPS