static void simdisk_transfer(struct simdisk *dev, unsigned long sector, unsigned long nsect, char *buffer, int write) { unsigned long offset = sector << SECTOR_SHIFT; unsigned long nbytes = nsect << SECTOR_SHIFT; if (offset > dev->size || dev->size - offset < nbytes) { pr_notice("Beyond-end %s (%ld %ld)\n", write ? "write" : "read", offset, nbytes); return; } spin_lock(&dev->lock); while (nbytes > 0) { unsigned long io; __simc(SYS_lseek, dev->fd, offset, SEEK_SET, 0, 0); if (write) io = simc_write(dev->fd, buffer, nbytes); else io = simc_read(dev->fd, buffer, nbytes); if (io == -1) { pr_err("SIMDISK: IO error %d\n", errno); break; } buffer += io; offset += io; nbytes -= io; } spin_unlock(&dev->lock); }
void iss_serial_puts( char *s ) { if( s != 0 && *s != 0 ) __simc( SYS_write, 1, s, strlen(s) ); }
void iss_serial_putc( char c ) { __simc( SYS_write, 1, &c, 1 ); }
char iss_serial_getc() { char c; __simc( SYS_read, 0, &c, 1 ); return c; }