USB_PipeOpen (SWI&5538B) — Opens a pipe for data transfer for a given endpoint.
R0 | Pointer to endpoint structure. | ||||||||||||
R1 |
| ||||||||||||
R2 | Reserved. Must be set to zero. |
R0 | Pointer to pipe structure or zero if an error occurred. |
R1 | Error code Table A.1, “Error codes used by the USB system” |
R2 | Preserved |
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.
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.