| 59 | } |
| 60 | |
| 61 | int bounce_buffer_stop(struct bounce_buffer *state) |
| 62 | { |
| 63 | if (state->flags & GEN_BB_WRITE) { |
| 64 | // Invalidate cache so that CPU can see any newly DMA'd data |
| 65 | dcache_invalidate_by_mva(state->bounce_buffer, |
| 66 | state->len_aligned); |
| 67 | } |
| 68 | |
| 69 | if (state->bounce_buffer == state->user_buffer) |
| 70 | return 0; |
| 71 | |
| 72 | if (state->flags & GEN_BB_WRITE) |
| 73 | memcpy(state->user_buffer, state->bounce_buffer, state->len); |
| 74 | |
| 75 | free(state->bounce_buffer); |
| 76 | |
| 77 | return 0; |
| 78 | } |
no test coverage detected