USB_PipeOpen (SWI&5538B)

USB_PipeOpen (SWI&5538B) — Opens a pipe for data transfer for a given endpoint.

On Entry

R0Pointer to endpoint structure.
R1

ValueDefinitionDescription
0x00000000USB_PIPE_OPEN_EXCLUSIVEOpens a pipe with exclusive access.
0x00000001USB_PIPE_OPEN_SHAREDOpens a pipe in a non exclusive manner.
0x10000000USB_PIPE_CLEAR_TOGGLEClears the data toggle when opening the pipe.

R2Reserved. Must be set to zero.

On Exit

R0Pointer to pipe structure or zero if an error occurred.
R1Error code Table A.1, “Error codes used by the USB system”
R2Preserved

Use

A reference to the pipe structure is registered automatically if call is successful.

One application only is responsible for handling a pipe to an endpoint of a device. If the pipe to this endpoint has been already opened by another program this function will fail. You can share a pipe between several applications if USB_PIPE_OPEN_SHARED is set. In this case the opening of the pipe will be successful if it has not been opened before or it has been opened before in shared mode. Trying to open a pipe exclusively which has been opened before in shared mode will fail. Also trying to open a pipe in shared mode which has opened before in exclusive mode will fail. Normally only the default pipe of a device shall be opened in shared mode. Note that activities of several programs on the same pipe may damage each other read the chapter about pipes for details.

Bus capacity is checked and claimed if the pipe is opened by the first program.

This function will reset internally some values like data toggle.

Note

The actual version of the USB module is handling pipes internally using the endpoint structures. You will therefore get back the pointer to the endpoint structure as passed to the function as a parameter. However this may change in the future.

Related SWI's

USB_PipeClose (SWI&5538C)