setup to use DMA-safe bouncebuffers for device transfers */
| 175 | setup to use DMA-safe bouncebuffers for device transfers |
| 176 | */ |
| 177 | bool DeviceBus::bouncebuffer_setup(const uint8_t *&buf_tx, uint16_t tx_len, |
| 178 | uint8_t *&buf_rx, uint16_t rx_len) |
| 179 | { |
| 180 | if (buf_rx) { |
| 181 | if (!bouncebuffer_setup_read(bounce_buffer_rx, &buf_rx, rx_len)) { |
| 182 | return false; |
| 183 | } |
| 184 | } |
| 185 | if (buf_tx) { |
| 186 | if (!bouncebuffer_setup_write(bounce_buffer_tx, &buf_tx, tx_len)) { |
| 187 | if (buf_rx) { |
| 188 | bouncebuffer_abort(bounce_buffer_rx); |
| 189 | } |
| 190 | return false; |
| 191 | } |
| 192 | } |
| 193 | return true; |
| 194 | } |
| 195 | |
| 196 | /* |
| 197 | complete a transfer using DMA bounce buffer |
no test coverage detected