Difference between revisions of "83Plus:Software:usb8x/Asm Interface/AutoSetup"

From WikiTI
Jump to: navigation, search
(callback info)
m (call->U_CALL)
Line 27: Line 27:
 
== Example ==
 
== Example ==
 
  <nowiki>      ld    hl,DriverBuf
 
  <nowiki>      ld    hl,DriverBuf
       call  DriverInit
+
       U_CALL DriverInit
      ld    de,CallBackRoutine
+
 
       ld    hl,DescriptorBuf
 
       ld    hl,DescriptorBuf
       call  AutoSetup
+
       U_CALL AutoSetup
 
       jp    c,Error
 
       jp    c,Error
 
;Device is now ready to use
 
;Device is now ready to use
 
;Use GetClass or GetIDs to make sure you have the right device</nowiki>
 
;Use GetClass or GetIDs to make sure you have the right device</nowiki>

Revision as of 23:53, 15 July 2006

Synopsis

Name: AutoSetup

Minimum usb8x version: 0.05

Sets up the attached USB device.

Inputs

  • DE: Address of callback routine
  • HL: Address of temporary buffer for descriptors

Outputs

  • NC: Success

Destroys

  • AF, BC, DE, HL

Notes

AutoSetup completes the following tasks:

  • Checks for an attached device
  • Calls HostInit
  • Sets configuration
  • Sets up pipes

AutoSetup may fail some circumstances, including devices with multiple configurations and/or interfaces. If you are using the U_CALL system, you don't need to set the callback address when calling AutoSetup. The address you set via U_CALL_INIT will be used instead.

Example

       ld     hl,DriverBuf
       U_CALL DriverInit
       ld     hl,DescriptorBuf
       U_CALL AutoSetup
       jp     c,Error
;Device is now ready to use
;Use GetClass or GetIDs to make sure you have the right device