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

From WikiTI
Jump to: navigation, search
m
m (call->U_CALL)
 
Line 23: Line 23:
 
== Example ==
 
== Example ==
 
  <nowiki>
 
  <nowiki>
ld   hl,DescriptorBuf    ;Temporary buffer to hold config descriptor
+
ld     hl,DescriptorBuf    ;Temporary buffer to hold config descriptor
ld   b,descConfig
+
ld     b,descConfig
push hl
+
push   hl
call ReadDescriptor      ;Read config descriptor from device
+
U_CALL ReadDescriptor      ;Read config descriptor from device
pop hl
+
pop   hl
jp   c,Error
+
jp     c,Error
ld   b,descEndpoint
+
ld     b,descEndpoint
call FindDescriptor      ;Search for endpoint descriptor within config descriptor</nowiki>
+
U_CALL FindDescriptor      ;Search for endpoint descriptor within config descriptor</nowiki>
  
 
== See Also ==
 
== See Also ==
 
* [[../ReadDescriptor|ReadDescriptor]] - Reads a descriptor from device
 
* [[../ReadDescriptor|ReadDescriptor]] - Reads a descriptor from device

Latest revision as of 23:53, 15 July 2006

Synopsis

Name: FindDescriptor

Minimum usb8x version: 0.05

Find the first instance of a descriptor entry in the config descriptor listing

Inputs

  • B: Descriptor type
  • HL: Address of descriptor list

Outputs

  • DE: Points byte after entire descriptor listing
  • HL: Points to requested descriptor
  • NC: Success

Destroys

  • AF, BC

Notes

This routine only finds the first instance of a descriptor. There is an internal routine to find additional instances, but it does not currently have an entry point. This will be fixed in future versions.

Example

ld     hl,DescriptorBuf    ;Temporary buffer to hold config descriptor
ld     b,descConfig
push   hl
U_CALL ReadDescriptor      ;Read config descriptor from device
pop    hl
jp     c,Error
ld     b,descEndpoint
U_CALL FindDescriptor      ;Search for endpoint descriptor within config descriptor

See Also

  • [[../ReadDescriptor|ReadDescriptor]] - Reads a descriptor from device