USB_ManageDeviceAddresses (SWI&55388)

USB_ManageDeviceAddresses (SWI&55388) — Manages device addresses.

On Entry

R0Pointer to host controller structure.
R1Pointer to device structure or zero
R2Device number Table 1.1, “Constants used for Device Numbering”
R3

ValueDefinitionDescription
0USB_DEVICE_ADDRESS_OP_CHANGEAllows to change the actual address of a device to another unused but reserved address.
1USB_DEVICE_ADDRESS_OP_CLAIMReserves a device address for a device.
2USB_DEVICE_ADDRESS_OP_RELEASEReleases a device address

R4Reserved. Must be set to zero.
R5Reserved. Must be set to zero.

On Exit

R0preserved
R1Error code Table A.1, “Error codes used by the USB system”
R2Depends on the behaviour control. At USB_DEVICE_ADDRESS_OP_CHANGE the old device address is returned, at USB_DEVICE_ADDRESS_OP_CLAIM the reserved device address is returned and at USB_DEVICE_ADDRESS_OP_RELEASE the released device address is returned. USB_DEVICE_AUTO_NUMBER will be returned if an error occurs.
R3, R4, R5Preserved

Use

References will be kept in every case.

In fact the SWI contains 3 different function which allows you to manage to device addresses for a given controller. The functions are also used internally by the USB module at USB_DeviceRegister/USB_DeviceDeregister.

At USB_DEVICE_ADDRESS_OP_CLAIM you must pass a reference to the device for which the new address is reserved. Normally this is done by USB_DeviceRegister and you will not use this function. The only usage for a normal program is to reserve an address for changing the device address. In this case you must pass a device reference zero. You can either reserve a given address or let the USB module determine an unused number for you if passing USB_DEVICE_AUTO_NUMBER.

With USB_DEVICE_ADDRESS_OP_CHANGE you can change the number of a device. Please note that all transactions belonging to this device (that means on all endpoints!) will be aborted during this process. You must reserve a new device number by using USB_DEVICE_ADDRESS_OP_CLAIM before. At USB_DEVICE_ADDRESS_OP_CHANGE you must pass the reference to the device together with the new number.

USB_DEVICE_ADDRESS_OP_RELEASE will normally be used automatically if USB_DeviceDeregister is called. It puts the address back into a list of unused devices. It can be used by normal programs together with a device reference of zero if an USB Standard address change request for which an address has been allocated by using USB_DEVICE_ADDRESS_OP_CLAIM before fails.

Normally changing of the device address from the default device address to a usual address will be done by the USB Hub module driver (using the calls described above) so you will never have to use this call by your own programs.

Related SWI's

USB_DeviceRegister (SWI&55382)

USB_DeviceDeregister (SWI&55383)