en:pfw:usb_cdc_driver_for_rp2040
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| en:pfw:usb_cdc_driver_for_rp2040 [2025-12-27 15:37] – [Pseudo code] willem | en:pfw:usb_cdc_driver_for_rp2040 [2026-01-13 18:16] (current) – [The idea] willem | ||
|---|---|---|---|
| Line 131: | Line 131: | ||
| Reset setup request interrupt, read bmrequest type and do HANDLE-REQ) | Reset setup request interrupt, read bmrequest type and do HANDLE-REQ) | ||
| - | Now define the ring buffer | + | Function: #L ( -- +n ) |
| + | Ring buffer | ||
| + | Function: #R ( -- +n ) | ||
| + | this is equal to #L - 1 | ||
| - | ... | + | Function: #RX ( -- +n ) |
| + | Leave number of characters in receive buffer | ||
| + | Function: #TX ( -- +n ) | ||
| + | Leave number of characters in transmit buffer | ||
| + | |||
| + | Function: > | ||
| + | Store character ' | ||
| + | Function: > | ||
| + | Store character ' | ||
| + | |||
| + | Function: RX> | ||
| + | Read character ' | ||
| + | Function: TX> | ||
| + | Read character ' | ||
| + | |||
| + | Function: IFLAG | ||
| + | Reserve one cell space for receive interrupt flag | ||
| + | |||
| + | Function: ENDPOINTS | ||
| + | Handle EP1 & EP3 endpoints, save received data interrupt flag in IFLAG | ||
| + | Release all interrupt flags | ||
| + | |||
| + | Function: REQUESTS | ||
| + | Handle all USB interrupts, that are the USB bus reset, setup requests & endpoints | ||
| + | |||
| + | Function: USB-HANDLER | ||
| + | Handle the receiving of the RX data using iFLAG and use the low level USB | ||
| + | ACK/NAK handshake to move data from an endpoint to the RX ring buffer in a controlled way. | ||
| + | Handle the transmitting of TX data, but only when a connection is made. Before filling | ||
| + | the TX endpoint check if the previous data packet was sent too. | ||
| + | |||
| + | Function: USB-KEY? | ||
| + | Leave true flag when there is data in the RX ring buffer, otherwise false | ||
| + | Call the USB-HANDLER once too | ||
| + | |||
| + | Function: USB-KEY | ||
| + | Leave character ' | ||
| + | Call the USB-HANDLER waiting for space in the RX ring buffer | ||
| + | |||
| + | Function: USB-EMIT | ||
| + | Store character ' | ||
| + | Call the USB-HANDLER waiting for space in the TX ring buffer | ||
| + | |||
| + | Function: USB-ON | ||
| + | Initialise the USB DPRAM, call START-USB, clear USB-STATE & IFLAG | ||
| + | finally initialse the KEY?, KEY and EMIT vectors of the used system. | ||
| </ | </ | ||
| - | ===== Implementation | + | ===== Generic Forth implementation |
| <code forth> | <code forth> | ||
| Line 374: | Line 422: | ||
| </ | </ | ||
| + | ===== Implementations ===== | ||
| + | |||
| + | [[https:// | ||
en/pfw/usb_cdc_driver_for_rp2040.1766846222.txt.gz · Last modified: 2025-12-27 15:37 by willem