|
Nexus Embedded Platform 0.1.0
Statically assembled reusable embedded mechanisms
|
Single-executor polling SPI endpoints and complete CS transactions. More...
Go to the source code of this file.
Data Structures | |
| struct | nx_spi_request_t |
| Caller-owned finite SPI request with one whole-CS interval. More... | |
| struct | nx_spi_ops_t |
| Shared read-only methods using one provider state. More... | |
| struct | nx_spi_port |
| Immutable interface pointing to caller-owned state. More... | |
| struct | nx_spi_endpoint_ops_t |
| Shared read-only methods using one provider state. More... | |
| struct | nx_spi_endpoint |
| Immutable interface pointing to caller-owned state. More... | |
Macros | |
| #define | NX_SPI_MEMORY_TX_FIXED 1U |
| Explicit single-cell DMA addresses, both borrowed until SETTLED. | |
| #define | NX_SPI_MEMORY_RX_FIXED 2U |
Typedefs | |
| typedef struct nx_spi_port | nx_spi_port_t |
| typedef struct nx_spi_endpoint | nx_spi_endpoint_t |
Functions | |
| nx_result_t | nx_spi_endpoint_transfer (const nx_spi_endpoint_t *endpoint, const uint8_t *tx, uint8_t *rx, size_t length, nx_time_us_t deadline, size_t *transferred) |
| Execute one bounded full-duplex 8-bit polling transaction. | |
| nx_result_t | nx_spi_port_recover (const nx_spi_port_t *port) |
| Recover an idle SPI controller after its retained fault. | |
| nx_result_t | nx_spi_request_prepare (nx_spi_request_t *request, const uint8_t *tx, uint8_t *rx, size_t length, nx_time_us_t deadline) |
| Prepare an unborrowed finite request without copying buffers. | |
| nx_result_t | nx_spi_endpoint_submit (const nx_spi_endpoint_t *endpoint, nx_spi_request_t *request) |
| Submit one finite asynchronous whole-CS transaction. | |
| nx_result_t | nx_spi_endpoint_submit_memory (const nx_spi_endpoint_t *endpoint, nx_spi_request_t *request, uint8_t memory_flags) |
| Submit explicit incrementing or single-cell DMA memory. | |
| nx_result_t | nx_spi_endpoint_start_admitted (const nx_spi_endpoint_t *endpoint, nx_spi_request_t *request) |
| Start an adapter-admitted QUEUED request without readmission. | |
| bool | nx_spi_endpoint_on_port (const nx_spi_endpoint_t *endpoint, const nx_spi_port_t *port) |
| Verify an endpoint belongs to the serviced bus. | |
| nx_result_t | nx_spi_port_cancel (const nx_spi_port_t *port, nx_spi_request_t *request) |
| Request cancellation without revoking DMA/CS buffer loans. | |
| void | nx_spi_port_service (const nx_spi_port_t *port) |
| Advance one asynchronous bus under its single task executor. | |
| nx_result_t | nx_spi_port_stop (const nx_spi_port_t *port) |
| Close admission and retain active sources until full drain. | |
| nx_result_t | nx_spi_port_attach_wake (const nx_spi_port_t *port, const nx_irq_wake_t *wake, uint8_t syscall_ceiling) |
| Attach an optional hint sink to asynchronous bus IRQ publishers. | |
Single-executor polling SPI endpoints and complete CS transactions.
Definition in file spi.h.
| #define NX_SPI_MEMORY_TX_FIXED 1U |
| typedef struct nx_spi_endpoint nx_spi_endpoint_t |
| typedef struct nx_spi_port nx_spi_port_t |
| bool nx_spi_endpoint_on_port | ( | const nx_spi_endpoint_t * | endpoint, |
| const nx_spi_port_t * | port ) |
Verify an endpoint belongs to the serviced bus.
| [in] | endpoint | Immutable endpoint identity kept alive by its caller. |
| [in] | port | Exact execution bus bound to an adapter. |
| nx_result_t nx_spi_endpoint_start_admitted | ( | const nx_spi_endpoint_t * | endpoint, |
| nx_spi_request_t * | request ) |
Start an adapter-admitted QUEUED request without readmission.
| [in] | endpoint | Initialized exact CS binding and bus executor. |
| [in,out] | request | Live QUEUED storage already borrowed by its adapter. |
| nx_result_t nx_spi_endpoint_submit | ( | const nx_spi_endpoint_t * | endpoint, |
| nx_spi_request_t * | request ) |
Submit one finite asynchronous whole-CS transaction.
| [in] | endpoint | Initialized endpoint on a single-executor bus. |
| [in,out] | request | READY storage; retained only after NX_SUCCESS. |
| nx_result_t nx_spi_endpoint_submit_memory | ( | const nx_spi_endpoint_t * | endpoint, |
| nx_spi_request_t * | request, | ||
| uint8_t | memory_flags ) |
Submit explicit incrementing or single-cell DMA memory.
| [in] | endpoint | Initialized single-executor DMA endpoint |
| [in,out] | request | READY request with two non-NULL caller addresses |
| [in] | memory_flags | TX_FIXED repeats one immutable dummy byte; RX_FIXED repeatedly writes one caller-owned discard byte; zero uses complete incrementing TX/RX buffers |
| nx_result_t nx_spi_endpoint_transfer | ( | const nx_spi_endpoint_t * | endpoint, |
| const uint8_t * | tx, | ||
| uint8_t * | rx, | ||
| size_t | length, | ||
| nx_time_us_t | deadline, | ||
| size_t * | transferred ) |
Execute one bounded full-duplex 8-bit polling transaction.
| [in] | endpoint | Fixed CS/mode/rate binding on one controller. |
| [in] | tx | Transmit bytes, or NULL to send 0xff. |
| [out] | rx | Receive bytes, or NULL to discard. |
| [in] | length | Positive transfer length; at least one buffer exists. |
| [in] | deadline | Absolute deadline; includes adapter queue residence. |
| [out] | transferred | Complete bytes; reset to zero before execution. |
| nx_result_t nx_spi_port_attach_wake | ( | const nx_spi_port_t * | port, |
| const nx_irq_wake_t * | wake, | ||
| uint8_t | syscall_ceiling ) |
Attach an optional hint sink to asynchronous bus IRQ publishers.
| [in] | port | One initialized bus controlled by a task executor. |
| [in] | wake | Immutable borrowed target or NULL to detach. |
| [in] | syscall_ceiling | Optional additional unshifted kernel-safe priority floor; cannot weaken generated policy. PRIMASK kernel targets require zero. Ignored without kernel calls. |
| nx_result_t nx_spi_port_cancel | ( | const nx_spi_port_t * | port, |
| nx_spi_request_t * | request ) |
Request cancellation without revoking DMA/CS buffer loans.
| [in] | port | Same single execution owner as submit and service. |
| [in,out] | request | Exact live active request, never a stale raw pointer. |
| nx_result_t nx_spi_port_recover | ( | const nx_spi_port_t * | port | ) |
Recover an idle SPI controller after its retained fault.
| [in] | port | Single executor with no live transaction or CS borrow. |
| void nx_spi_port_service | ( | const nx_spi_port_t * | port | ) |
Advance one asynchronous bus under its single task executor.
| [in] | port | Live provider; call while stopping and throughout drain. |
| nx_result_t nx_spi_port_stop | ( | const nx_spi_port_t * | port | ) |
Close admission and retain active sources until full drain.
| [in] | port | Live bus; all external producers already quiesced. |
| nx_result_t nx_spi_request_prepare | ( | nx_spi_request_t * | request, |
| const uint8_t * | tx, | ||
| uint8_t * | rx, | ||
| size_t | length, | ||
| nx_time_us_t | deadline ) |
Prepare an unborrowed finite request without copying buffers.
| [in,out] | request | Fresh initialized or consumed SETTLED descriptor. |
| [in] | tx | Nonempty TX bytes or NULL when the selected mode supports dummy transmission; immutable through final settlement. |
| [out] | rx | RX buffer or NULL when the selected mode supports discard. |
| [in] | length | Positive byte count with at least one supplied buffer. |
| [in] | deadline | Absolute monotonic deadline including queue time. |