Пример #1
0
/*
 * UART0发送一个字符串,以'\0'结束
 */
void send_string (unsigned char *s)
{
	while (*s != '\0') {
		send_one_byte (*s);
		s++ ;
	}
}
Пример #2
0
//kiküldi a data-ban tárolt összes bitet
static void send(void){

	int i;

	for(i=DRIVER_COUNT ; i-- > 0 ; )
		send_one_byte(data[i]);

}
static void cable_vpi_wait ( void )
{
  // Get the sim to reply when the timeout has been reached.
  send_one_byte( 0x81 );

  // Block, waiting for the data.
  const uint8_t data_in = receive_one_byte();

  if(data_in != 0xFF)
    fprintf(stderr, "Warning: got wrong byte waiting for timeout: 0x%X\n", data_in);
}
static int cable_vpi_out ( const uint8_t value )
{
  send_one_byte( value );

  uint8_t ack;
  do
  {
    ack = receive_one_byte();

  } while(ack != (value | 0x10));

  cable_vpi_wait();  // finish the transaction

  return APP_ERR_NONE;
}
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;
}