|
Nexus Embedded Platform 1.0.0
Statically assembled reusable embedded mechanisms
|
Full-speed device packets and caller-owned endpoint loans. More...
Go to the source code of this file.
Data Structures | |
| struct | nx_usb_request_t |
| struct | nx_usb_setup_t |
| struct | nx_usb_event_t |
| struct | nx_usb_device_state_t |
| struct | nx_usb_endpoint_ops_t |
| Shared readonly packet methods; context is a selected endpoint. More... | |
| struct | nx_usb_endpoint_port_t |
| struct | nx_usb_device_ops_t |
| Controller identity remains separate from endpoint identities. More... | |
| struct | nx_usb_device_port_t |
Enumerations | |
| enum | nx_usb_stage_t { NX_USB_DATA , NX_USB_STATUS } |
| enum | nx_usb_event_kind_t { NX_USB_EVENT_SETUP , NX_USB_EVENT_RESET , NX_USB_EVENT_SUSPEND , NX_USB_EVENT_RESUME , NX_USB_EVENT_LOSS } |
Functions | |
| nx_result_t | nx_usb_in_prepare (nx_usb_request_t *request, const uint8_t *bytes, size_t length, nx_usb_stage_t stage, uint64_t epoch, nx_time_us_t deadline) |
| Prepare one IN packet without reading or borrowing its bytes. | |
| nx_result_t | nx_usb_out_prepare (nx_usb_request_t *request, uint8_t *bytes, size_t capacity, nx_usb_stage_t stage, uint64_t epoch, nx_time_us_t deadline) |
| Prepare an OUT packet capacity without modifying its storage. | |
| nx_result_t | nx_usb_endpoint_submit (const nx_usb_endpoint_port_t *port, nx_usb_request_t *request) |
| Admit one packet, never a hidden queue or complete USB transaction. | |
| nx_result_t | nx_usb_endpoint_cancel (const nx_usb_endpoint_port_t *port, nx_usb_request_t *request) |
| Request endpoint disable/drain without revoking a buffer loan. | |
| nx_result_t | nx_usb_endpoint_stall (const nx_usb_endpoint_port_t *port, bool stalled) |
| Set/clear STALL only after the endpoint has no live transfer. | |
| nx_result_t | nx_usb_device_service (const nx_usb_device_port_t *port) |
| Task-only bounded progress; deadline never depends on USB SOF. | |
| nx_result_t | nx_usb_device_read_events (const nx_usb_device_port_t *port, nx_usb_event_t *events, size_t capacity, size_t *count) |
| Consume bounded value events; output is never retained. | |
| nx_result_t | nx_usb_device_state (const nx_usb_device_port_t *port, nx_usb_device_state_t *state) |
| Task-only authoritative snapshot, independent of event-ring space. | |
| nx_result_t | nx_usb_device_address (const nx_usb_device_port_t *port, uint64_t epoch, uint8_t address) |
| Stage SET_ADDRESS for the matching zero-data standard SETUP. | |
| nx_result_t | nx_usb_device_attach_wake (const nx_usb_device_port_t *port, const nx_irq_wake_t *wake, uint8_t syscall_ceiling) |
| Attach/detach a borrowed task/IRQ-compatible wake hint. | |
| nx_result_t | nx_usb_device_stop (const nx_usb_device_port_t *port) |
| Disconnect, disable, drain, detach IRQs, then release clock consumer. | |
Full-speed device packets and caller-owned endpoint loans.
Definition in file usb_device.h.
| enum nx_usb_event_kind_t |
| Enumerator | |
|---|---|
| NX_USB_EVENT_SETUP | |
| NX_USB_EVENT_RESET | |
| NX_USB_EVENT_SUSPEND | |
| NX_USB_EVENT_RESUME | |
| NX_USB_EVENT_LOSS | |
Definition at line 30 of file usb_device.h.
| enum nx_usb_stage_t |
| Enumerator | |
|---|---|
| NX_USB_DATA | |
| NX_USB_STATUS | |
Definition at line 13 of file usb_device.h.
| nx_result_t nx_usb_device_address | ( | const nx_usb_device_port_t * | port, |
| uint64_t | epoch, | ||
| uint8_t | address ) |
Stage SET_ADDRESS for the matching zero-data standard SETUP.
| [in] | port | Serialized privileged controller owner. |
| [in] | epoch | Current SETUP identity. |
| [in] | address | 0..127, matching SETUP wValue. |
| nx_result_t nx_usb_device_attach_wake | ( | const nx_usb_device_port_t * | port, |
| const nx_irq_wake_t * | wake, | ||
| uint8_t | syscall_ceiling ) |
Attach/detach a borrowed task/IRQ-compatible wake hint.
| [in] | port | Started serialized owner with IRQ masks clear. |
| [in] | wake | Immutable target, or NULL to detach. |
| [in] | syscall_ceiling | Additional numerical IRQ priority floor. |
| nx_result_t nx_usb_device_read_events | ( | const nx_usb_device_port_t * | port, |
| nx_usb_event_t * | events, | ||
| size_t | capacity, | ||
| size_t * | count ) |
Consume bounded value events; output is never retained.
| [in] | port | Single task consumer and stable controller. |
| [out] | events | Caller records disjoint from provider and live loans. |
| [in] | capacity | Positive output count. |
| [out] | count | Disjoint count output; EMPTY means zero. |
| nx_result_t nx_usb_device_service | ( | const nx_usb_device_port_t * | port | ) |
Task-only bounded progress; deadline never depends on USB SOF.
| [in] | port | Serialized privileged owner with incoming IRQ masks clear. |
| nx_result_t nx_usb_device_state | ( | const nx_usb_device_port_t * | port, |
| nx_usb_device_state_t * | state ) |
Task-only authoritative snapshot, independent of event-ring space.
| [in] | port | Serialized privileged owner with IRQ masks clear. |
| [out] | state | Disjoint caller snapshot, never retained. |
| nx_result_t nx_usb_device_stop | ( | const nx_usb_device_port_t * | port | ) |
Disconnect, disable, drain, detach IRQs, then release clock consumer.
| [in] | port | Serialized owner; external observers must also join. |
| nx_result_t nx_usb_endpoint_cancel | ( | const nx_usb_endpoint_port_t * | port, |
| nx_usb_request_t * | request ) |
Request endpoint disable/drain without revoking a buffer loan.
| [in] | port | Same serialized privileged task owner. |
| [in,out] | request | Live request accepted by this exact endpoint. |
| nx_result_t nx_usb_endpoint_stall | ( | const nx_usb_endpoint_port_t * | port, |
| bool | stalled ) |
Set/clear STALL only after the endpoint has no live transfer.
| [in] | port | Serialized owner, started and IRQ masks clear. |
| [in] | stalled | Desired STALL; clearing bulk also resets DATA0. |
| nx_result_t nx_usb_endpoint_submit | ( | const nx_usb_endpoint_port_t * | port, |
| nx_usb_request_t * | request ) |
Admit one packet, never a hidden queue or complete USB transaction.
| [in] | port | Stable endpoint face and private state. |
| [in,out] | request | READY packet, buffers alive until acquire SETTLED. |
| nx_result_t nx_usb_in_prepare | ( | nx_usb_request_t * | request, |
| const uint8_t * | bytes, | ||
| size_t | length, | ||
| nx_usb_stage_t | stage, | ||
| uint64_t | epoch, | ||
| nx_time_us_t | deadline ) |
Prepare one IN packet without reading or borrowing its bytes.
| [in,out] | request | Initialized unborrowed request. |
| [in] | bytes | Immutable packet bytes, NULL only for zero length. |
| [in] | length | Packet length, no automatic terminating ZLP. |
| [in] | stage | DATA or control STATUS; STATUS must be zero length. |
| [in] | epoch | Current SETUP epoch for EP0, zero for bulk endpoints. |
| [in] | deadline | Absolute independent monotonic clock deadline. |
| nx_result_t nx_usb_out_prepare | ( | nx_usb_request_t * | request, |
| uint8_t * | bytes, | ||
| size_t | capacity, | ||
| nx_usb_stage_t | stage, | ||
| uint64_t | epoch, | ||
| nx_time_us_t | deadline ) |
Prepare an OUT packet capacity without modifying its storage.
| [in,out] | request | Initialized unborrowed request. |
| [out] | bytes | Borrowed until SETTLED only after accepted submission. |
| [in] | capacity | At most endpoint MPS; short packets complete normally. |
| [in] | stage | DATA or zero-capacity control STATUS. |
| [in] | epoch | Current SETUP epoch for EP0, zero for bulk endpoints. |
| [in] | deadline | Absolute independent monotonic clock deadline. |