Esempio n. 1
0
/**************************************************************************//**
 * @brief Get a packet from the board controller.
 *
 * @param[in] pkt Pointer to a @ref BCP_Packet instance.
 *
 * @return True if packet received without errors, false otherwise.
 *****************************************************************************/
bool BSP_BccPacketReceive( BCP_Packet *pkt )
{
  int i;
  int length;
  uint8_t *bptr;

  /* Setup a byte pointer to start of packet buffer */
  bptr   = (uint8_t *) pkt;

  /* Receive packet magic */
  *bptr++ = RxByte();
  if (pkt->magic != BSP_BCP_MAGIC)
  {
     return false;
  }

  /* Receive packet type */
  *bptr++ = RxByte();
  if ( (pkt->type < BSP_BCP_FIRST) || (pkt->type > BSP_BCP_LAST) )
  {
     return false;
  }

  /* Receive packet length */
  *bptr++ = RxByte();
  if (pkt->payloadLength > BSP_BCP_PACKET_SIZE)
  {
     return false;
  }

#if ( BSP_BCP_VERSION == 2 )
   /* Receive reserved byte */
   *bptr++ = RxByte();
#endif

  /* Receive packet data length field and sanity check it */
  length  = pkt->payloadLength;
  if (length > BSP_BCP_PACKET_SIZE)
  {
     length = BSP_BCP_PACKET_SIZE;
  }

  /* Receive packet payload */
  for( i=0; i<length; i++ )
  {
     *bptr++ = RxByte();
  }

  return true;
}
Esempio n. 2
0
//##ModelId=48114D4A0362
U8 TiLib_RS232::GetKey()
{
	U8 key = RS232_NOKEY;
	
	if (RxByte(&key) == SUCCESS) {
		return key;
	}
	else {
		return RS232_NOKEY;
	}
}
Esempio n. 3
0
//------------------------------------------------------------------------
//------------------------------------------------------------------------
void MapOverflow(U8 channelId,  U32 condition)
{
    int OrgMedStrmIdx;

    DebSystemMessage(DEBL0_NSTR, (CSTR*)"1##BufOvl:", channelId, (CSTR*)"1 -> ", OrgMedStrmIdx);
    RxByte();
    GH_BM2_set_BufferWritePointer(channelId, 0);
    GH_BM2_set_BufferReadPointer(channelId, 0);

    if (MediaFunctions[OrgMedStrmIdx].MedOvfNotify) {
        MediaFunctions[OrgMedStrmIdx].MedOvfNotify(0,0);
    }
}