Re: [Ql-Users] Ser-USB Driver Update: External Command Interface (and Progress Update)
On Sun, Feb 13, 2011 at 1:09 AM, Adrian Ives adr...@acanthis.co.uk wrote: [SNIP] Here is a tidier version of the example S*BASIC program that I posted in my last mail. It shows how to use the interface in its current form. Requires SMSQ Turbo Toolkit (and the Ser-USB Driver). [SNIP] Is the SMSQ requirement permanent, or just for development purposes? Dave ___ QL-Users Mailing List http://www.q-v-d.demon.co.uk/smsqe.htm
Re: [Ql-Users] Ser-USB Driver Update: External Command Interface (and Progress Update)
Well, in that version it was because of the NUL device (although there are ways around that - any channel could be used as the target of a Turbo Toolkit SET_CHANNEL). However, I have now implemented three new commands which remove the need for all that mucking about ... USB_PUTCMD Byte [,Byte]: Put a command in the driver's command pipe. USB_GETCMD(): Get a long word command response from the driver's command pipe. USB_GETCMD$(): Get a long word command response from the driver's command pipe and return it as a string to S*BASIC. ... which makes the S*BASIC example look like this (also much faster): 100 PRINT The Response to Command $01 (Get Driver Version) was: GetResponse$(1) 110 PRINT The Response to Command $02 (Get Hardware Version) was: GetResponse$(2) 120 PRINT The Response to Command $03 (Get Hardware Type) was: GetResponse$(3) 130 PRINT The Response to Command $04 (Get I/O Queue Status) was: GetDWordResponse$(4) 140 PRINT The Response to Command $05 (Get I/O State) was: GetDWordResponse$(5) 150 PRINT The Response to Command $06 (Get Flags) was: Get32BitResponse$(6) 160 PRINT The Response to Command $11 (Get Mapped Physical Drive 1) was: GetDWordResponse$(HEX(11)) 170 REMark : 180 REMark === 190 REMark : 200 DEFine FuNction GetResponse$(Cmd%) 210 USB_PUTCMD Cmd% 220 RETurn USB_GETCMD$ 230 END DEFine GetResponse$ 240 REMark : 250 REMark === 260 REMark : 270 DEFine FuNction GetDWordResponse$(Cmd%) 280 LOCal Response, High%, Low% 290 USB_PUTCMD Cmd% 300 Response= USB_GETCMD 310 High%= Response DIV 65536 320 Low%= Response MOD 65536 330 RETurn High% '/' Low% 340 END DEFine GetDWordResponse$ 350 REMark : 360 REMark === 370 REMark : 380 DEFine FuNction Get32BitResponse$(Cmd%) 390 LOCal Response, High%, Low% 400 USB_PUTCMD Cmd% 410 Response= USB_GETCMD 420 High%= Response DIV 65536 430 Low%= Response MOD 65536 440 RETurn BIN$(High%,16) / BIN$(Low%,16) 450 END DEFine Get32BitResponse$ -Original Message- From: ql-users-boun...@lists.q-v-d.com [mailto:ql-users-boun...@lists.q-v-d.com] On Behalf Of Plastic Sent: 13 February 2011 11:16 To: ql-us...@q-v-d.com Subject: Re: [Ql-Users] Ser-USB Driver Update: External Command Interface (and Progress Update) On Sun, Feb 13, 2011 at 1:09 AM, Adrian Ives adr...@acanthis.co.uk wrote: [SNIP] Here is a tidier version of the example S*BASIC program that I posted in my last mail. It shows how to use the interface in its current form. Requires SMSQ Turbo Toolkit (and the Ser-USB Driver). [SNIP] Is the SMSQ requirement permanent, or just for development purposes? Dave ___ QL-Users Mailing List http://www.q-v-d.demon.co.uk/smsqe.htm ___ QL-Users Mailing List http://www.q-v-d.demon.co.uk/smsqe.htm
Re: [Ql-Users] Ser-USB Driver Update: External Command Interface (and Progress Update)
Op Sun, 13 Feb 2011 13:10:41 +0100 schreef Adrian Ives adr...@acanthis.co.uk: 250 REMark === 260 REMark : 270 DEFine FuNction GetDWordResponse$(Cmd%) 280 LOCal Response, High%, Low% 290 USB_PUTCMD Cmd% 300 Response= USB_GETCMD 310 High%= Response DIV 65536 320 Low%= Response MOD 65536 330 RETurn High% '/' Low% 340 END DEFine GetDWordResponse$ 350 REMark : 360 REMark === 370 REMark : 380 DEFine FuNction Get32BitResponse$(Cmd%) 390 LOCal Response, High%, Low% 400 USB_PUTCMD Cmd% 410 Response= USB_GETCMD 420 High%= Response DIV 65536 430 Low%= Response MOD 65536 440 RETurn BIN$(High%,16) / BIN$(Low%,16) 450 END DEFine Get32BitResponse$ I think these functions need a little adjustment. The DIV MOD functions in S'Basic work on signed Integers and not on Longs. Value DIV 65536 will always produce zero. Value MOD 65536 will always produce value. There probably are Long DIV/MOD functions in some toolkit out there, I just happened to find one in an old Machine Code book. Otherwise just use '/' and INT to extract the high% and low% parts. high%=INT(response / 65536): low%=response -(high% * 65536) Bob -- The BSJR QL software site at: http://members.chello.nl/b.spelten/ql/ ___ QL-Users Mailing List http://www.q-v-d.demon.co.uk/smsqe.htm
Re: [Ql-Users] Ser-USB Driver Update: External Command Interface (and Progress Update)
Bob, Hn. Well, I'm using SMSQ and I get this ... 65537 DIV 65536 = 1 65537 MOD 65536 = 1 128000 DIV 65536 = 1 128000 MOD 65536 = 62464 It's academic, anyway. This is just an example to show how you _could_ use these facilities. Thanks for pointing it out, though. Adrian -Original Message- From: ql-users-boun...@lists.q-v-d.com [mailto:ql-users-boun...@lists.q-v-d.com] On Behalf Of Bob Spelten Sent: 13 February 2011 13:44 To: ql-us...@q-v-d.com Subject: Re: [Ql-Users] Ser-USB Driver Update: External Command Interface (and Progress Update) Op Sun, 13 Feb 2011 13:10:41 +0100 schreef Adrian Ives adr...@acanthis.co.uk: 250 REMark === 260 REMark : 270 DEFine FuNction GetDWordResponse$(Cmd%) 280 LOCal Response, High%, Low% 290 USB_PUTCMD Cmd% 300 Response= USB_GETCMD 310 High%= Response DIV 65536 320 Low%= Response MOD 65536 330 RETurn High% '/' Low% 340 END DEFine GetDWordResponse$ 350 REMark : 360 REMark === 370 REMark : 380 DEFine FuNction Get32BitResponse$(Cmd%) 390 LOCal Response, High%, Low% 400 USB_PUTCMD Cmd% 410 Response= USB_GETCMD 420 High%= Response DIV 65536 430 Low%= Response MOD 65536 440 RETurn BIN$(High%,16) / BIN$(Low%,16) 450 END DEFine Get32BitResponse$ I think these functions need a little adjustment. The DIV MOD functions in S'Basic work on signed Integers and not on Longs. Value DIV 65536 will always produce zero. Value MOD 65536 will always produce value. There probably are Long DIV/MOD functions in some toolkit out there, I just happened to find one in an old Machine Code book. Otherwise just use '/' and INT to extract the high% and low% parts. high%=INT(response / 65536): low%=response -(high% * 65536) Bob -- The BSJR QL software site at: http://members.chello.nl/b.spelten/ql/ ___ QL-Users Mailing List http://www.q-v-d.demon.co.uk/smsqe.htm ___ QL-Users Mailing List http://www.q-v-d.demon.co.uk/smsqe.htm
Re: [Ql-Users] Ser-USB Driver Update: External Command Interface (and Progress Update)
On 13 Feb 2011, at 14:02, Adrian Ives wrote: Hn. Well, I'm using SMSQ and I get this ... 65537 DIV 65536 = 1 65537 MOD 65536 = 1 128000 DIV 65536 = 1 128000 MOD 65536 = 62464 Yes. SMSQ/E allows larger numbers than integers for DIV and MOD. However, Turbo does not allow this. George ___ QL-Users Mailing List http://www.q-v-d.demon.co.uk/smsqe.htm
[Ql-Users] Ser-USB Driver Update: External Command Interface (and Progress Update)
Here is a list of the commands that the current version of the Ser-USB Driver can execute through its command pipe interface. This interface supports run-time interrogation and configuration of the driver and is intended to enable the development of utility software that does not require detailed knowledge of the underlying hardware. When the necessary code support is completed there will also be commands for mounting/unmounting partitions. This interface has primarily come about as a result of including run-time debugging so I would be very interested to hear any views on its usefulness, or what other features might be desirable. usbcmd_get_dr_ver $01 Get Driver Version Command Size: Byte Response Size: Long Returns the Ser-USB Driver version as four characters. usbcmd_get_hw_ver $02 Get Hardware Version Command Size: Byte Response Size: Long Returns the hardware (USBWiz) version as four characters. usbcmd_get_hw_type $03 Get Hardware Type Command Size: Byte Response Size: Long Returns the hardware type as four characters. USBWiz returns USBW. Other hardware types are supported as per the original QUBIDE defines (though these are unlikely to be encountered). usbcmd_get_q_stats $04 Get I/O Queue Stats Command Size: Byte Response Size: Long Returns statistics about the I/O Queue as a long word. High word contains the maximum I/O Queue size in requests. Low word contains the current number of entries in the queue. usbcmd_get_io_state $05 Get I/O State Command Size: Byte Response Size: Long Returns information about the currently executing I/O operation. High word contains the op code of the current operation (ip_op_read=1 or io_op_write=2). Low word contains the stage number in the operation. usbcmd_get_flags $06 Get Flags Command Size: Byte Response Size: Long Returns all flag bytes as one long word. High word contains the debug flags in the top 8 bits, the USBWiz flags in the bottom 8. Low word contains 0 in the top 8 bits, the Ser-USB Driver flags in the bottom 8. usbcmd_get_mphys_drv $10 Get Mapped Physical Drive Command Size: Byte with operand in low nibble ($11..$18) Response Size: Long Returns the physical drive/partition that is currently mapped to a USB drive number. High word contains the Logical Unit Number (LUN). Low word contains the partition number. The low nibble of command $10 is a logical drive number in the range 1..8; other values always return 0. usbcmd_clr_flag $e0 Clear Flag Command Size: Byte with operand in low nibble ($e0..$ef) Response Size: Long Clear a Ser-USB Driver or USBWiz flag. Returns the previous state of the flag as 0 or 1. The low nibble of command $e0 is broken down as follows: Bits 0..2 = Flag number (0..7). Bit 3 = 0 for Ser-USB Flags, or 1 for USBWiz Flags. usbcmd_set_flag $f0 Set Flag Command Size: Byte with operand in low nibble ($f0..$ff) Response Size: Long Set a Ser-USB Driver or USBWiz flag. Returns the previous state of the flag as 0 or 1. The low nibble of command $f0 is broken down as follows: Bits 0..2 = Flag number (0..7). Bit 3 = 0 for Ser-USB Flags, or 1 for USBWiz Flags. Here is a tidier version of the example S*BASIC program that I posted in my last mail. It shows how to use the interface in its current form. Requires SMSQ Turbo Toolkit (and the Ser-USB Driver). 100 OPEN #4,NUL 110 OPEN #5,NUL 120 SET_CHANNEL #4,USB_PIPE_W 130 SET_CHANNEL #5,USB_PIPE_R 140 PRINT The Response to Command $01 (Get Driver Version) was: GetResponse$(1) 150 PRINT The Response to Command $02 (Get Hardware Version) was: GetResponse$(2) 160 PRINT The Response to Command $03 (Get Hardware Type) was: GetResponse$(3) 170 PRINT The Response to Command $04 (Get I/O Queue Status) was: GetDWordResponse$(4) 180 PRINT The Response to Command $05 (Get I/O State) was: GetDWordResponse$(5) 190 PRINT The Response to Command $06 (Get Flags) was: Get32BitResponse$(6) 200 PRINT The Response to Command $11 (Get Mapped Physical Drive 1) was: GetDWordResponse$(HEX(11)) 210 REMark === 220 DEFine FuNction GetResponse$(Cmd%) 230 LOCal Response$, This$, Bytes% 240 PRINT #4;CHR$(Cmd%); 250 Response$= 260 Bytes%= 0 270 REPeat GetResponse 280 This$= INKEY$(#5) 290 IF This$ = THEN NEXT GetResponse 300 Response$= Response$ This$ 310 Bytes%= Bytes% + 1 320 IF Bytes% = 4 THEN EXIT GetResponse 330 END REPeat GetResponse 340 RETurn Response$ 350 END DEFine GetResponse$ 360 REMark === 370 DEFine FuNction GetDWordResponse$(Cmd%) 380 LOCal Response$, High%, Low% 390 Response$= GetResponse$(Cmd%) 400 High%= CODE(Response$(1))*256 + CODE(Response$(2)) 410 Low%= CODE(Response$(3))*256 + CODE(Response$(4)) 420 RETurn High% '/' Low% 430 END DEFine GetDWordResponse$ 440 REMark === 450 DEFine FuNction Get32BitResponse$(Cmd%) 460 LOCal Response$, High%, Low% 470 Response$= GetResponse$(Cmd%) 480 High%=