| 1952 | |
| 1953 | template <bool UseScBuffer> |
| 1954 | void vuart_av_thread::write_resp(u32 cid, u32 status, const void *data, |
| 1955 | u16 data_size) { |
| 1956 | const ps3av_pkt_reply_hdr pkt_hdr = {PS3AV_VERSION, data_size + 8U, |
| 1957 | cid | PS3AV_REPLY_BIT, status}; |
| 1958 | |
| 1959 | if (status != PS3AV_STATUS_SUCCESS) { |
| 1960 | sys_uart.error("Packet failed cid=0x%08x status=0x%02x", cid, status); |
| 1961 | } |
| 1962 | |
| 1963 | temp_buf &buf = UseScBuffer ? temp_rx_sc_buf : temp_rx_buf; |
| 1964 | const u32 total_size = sizeof(pkt_hdr) + data_size; |
| 1965 | |
| 1966 | if (buf.crnt_size + total_size <= sizeof(buf.buf)) { |
| 1967 | memcpy(&buf.buf[buf.crnt_size], &pkt_hdr, sizeof(pkt_hdr)); |
| 1968 | memcpy(&buf.buf[buf.crnt_size + sizeof(pkt_hdr)], data, data_size); |
| 1969 | buf.crnt_size += total_size; |
| 1970 | } |
| 1971 | } |
| 1972 | |
| 1973 | std::shared_ptr<ps3av_cmd> vuart_av_thread::get_cmd(u32 cid) { |
| 1974 | switch (cid) { |
no test coverage detected