static BOOL sig_do_data(VISORCHANNEL *channel, U32 queue, SIGNAL_QUEUE_HEADER *sig_hdr, U32 slot, void *data, BOOL is_write) { BOOL rc = FALSE; int signal_data_offset = SIG_DATA_OFFSET(&channel->chan_hdr, queue, sig_hdr, slot); if (is_write) { if (visor_memregion_write(channel->memregion, signal_data_offset, data, sig_hdr->SignalSize) < 0) { ERRDRV("visor_memregion_write of signal data failed: (status=%d)\n", rc); goto Away; } } else { if (visor_memregion_read(channel->memregion, signal_data_offset, data, sig_hdr->SignalSize) < 0) { ERRDRV("visor_memregion_read of signal data failed: (status=%d)\n", rc); goto Away; } } rc = TRUE; Away: return rc; }
static BOOL sig_do_data(VISORCHANNEL *channel, u32 queue, struct signal_queue_header *sig_hdr, u32 slot, void *data, BOOL is_write) { BOOL rc = FALSE; int signal_data_offset = SIG_DATA_OFFSET(&channel->chan_hdr, queue, sig_hdr, slot); if (is_write) { if (visor_memregion_write(channel->memregion, signal_data_offset, data, sig_hdr->signal_size) < 0) { ERRDRV("visor_memregion_write of signal data failed: (status=%d)\n", rc); goto cleanup; } } else { if (visor_memregion_read(channel->memregion, signal_data_offset, data, sig_hdr->signal_size) < 0) { ERRDRV("visor_memregion_read of signal data failed: (status=%d)\n", rc); goto cleanup; } } rc = TRUE; cleanup: return rc; }
int visorchannel_write(VISORCHANNEL *channel, ulong offset, void *local, ulong nbytes) { if (offset == 0 && nbytes >= sizeof(CHANNEL_HEADER)) memcpy(&channel->chan_hdr, local, sizeof(CHANNEL_HEADER)); return visor_memregion_write(channel->memregion, offset, local, nbytes); }
int visorchannel_write(struct visorchannel *channel, ulong offset, void *local, ulong nbytes) { if (offset == 0 && nbytes >= sizeof(struct channel_header)) memcpy(&channel->chan_hdr, local, sizeof(struct channel_header)); return visor_memregion_write(channel->memregion, offset, local, nbytes); }
int visorchannel_clear(struct visorchannel *channel, ulong offset, u8 ch, ulong nbytes) { int rc = -1; int bufsize = 65536; int written = 0; u8 *buf = vmalloc(bufsize); if (buf == NULL) { ERRDRV("%s failed memory allocation", __func__); goto cleanup; } memset(buf, ch, bufsize); while (nbytes > 0) { ulong thisbytes = bufsize; int x = -1; if (nbytes < thisbytes) thisbytes = nbytes; x = visor_memregion_write(channel->memregion, offset + written, buf, thisbytes); if (x < 0) { rc = x; goto cleanup; } written += thisbytes; nbytes -= thisbytes; } rc = 0; cleanup: if (buf != NULL) { vfree(buf); buf = NULL; } return rc; }