qemu/hw/riscv/riscv_htif.c
/*
 * Called by the char dev to supply input to HTIF console.
 * We assume that we will receive one character at a time.
 */
Called by the char dev to supply input to HTIF console.
We assume that we will receive one character at a time.
Called by the char dev to supply input to HTIF console . We assume that we will receive one character at a time .
static void htif_recv(void *opaque, const uint8_t *buf, int size)
{
    HTIFState *htifstate = opaque;
    if (size != 1) {
        return;
    }
    uint64_t val_written = htifstate->pending_read;
    uint64_t resp = 0x100 | *buf;
    htifstate->env->mfromhost = (val_written >> 48 << 48) | (resp << 16 >> 16);
}
static void htif_recv ( void * opaque , const uint8_t * buf , int size ) { HTIFState * htifstate = opaque ; if ( size != 1 ) { return ; } uint64_t val_written = htifstate -> pending_read ; uint64_t resp = 0x100 | * buf ; htifstate -> env -> mfromhost = ( val_written >> 48 << 48 ) | ( resp << 16 >> 16 ) ; }
Called by the char dev to supply input to HTIF console.
Called by the char dev to supply input to HTIF console .
/* TODO - we need to check whether mfromhost is zero which indicates
              the device is ready to receive. The current implementation
              will drop characters */