static int cable_vpi_inout ( const uint8_t value, uint8_t * const inval )
{
  // Ask the remote VPI/DPI server to send us the out-bit.
  send_one_byte( 0x80 );

  // Wait and read the data.
  const uint8_t data_in = receive_one_byte();

  if ( data_in > 1 )
    fprintf(stderr, "Unexpected value: %i\n", data_in );

  cable_vpi_out( value );

  *inval = data_in;

  // Finish the transaction.
  cable_vpi_wait();

  return APP_ERR_NONE;
}
Exemplo n.º 2
0
int cable_vpi_inout(uint8_t value, uint8_t *inval)
{
  uint8_t dat;

  /* ask vpi to send us the out-bit */
  dat = 0x80;
  send(vpi_comm, &dat, 1, 0);

  /* Wait and read the data */
  recv(vpi_comm, &dat, 1, 0);

  if(dat > 1)
    fprintf(stderr, "Unexpected value: %i\n", dat);

  cable_vpi_out(value);

  *inval = dat;

  cable_vpi_wait();  // finish the transaction

  return APP_ERR_NONE;
}