Пример #1
0
Файл: radio.c Проект: x893/WDS
/*!
 *  Set Radio to TX mode, fixed packet length.
 *
 *  @param channel Freq. Channel, Packet to be sent
 *
 *  @note
 *
 */
void  vRadio_StartTx(U8 channel, U8 *pioFixRadioPacket)
{
  // Read ITs, clear pending ones
  si446x_get_int_status(0u, 0u, 0u);

  /* Fill the TX fifo with datas */
  si446x_write_tx_fifo(RadioConfiguration.Radio_PacketLength, pioFixRadioPacket);

  /* Start sending packet, channel 0, START immediately, Packet n bytes long, go READY when done */
  si446x_start_tx(channel, 0x30,  RadioConfiguration.Radio_PacketLength);
}
Пример #2
0
void vRadio_StartTxVarLen(U8 channel, U8 *pData, U8 len)
{
	// Read ITs, clear pending ones
	si446x_get_int_status(0u, 0u, 0u);
	/* Fill the TX fifo with datas */
	si446x_write_tx_fifo(len, pData);

	/* Start sending packet on channel, START immediately, Packet according to PH */
	/* Start sending packet, channel 0, START immediately, Packet n bytes long, go READY when done */
	si446x_start_tx(channel, 0x30,  0);
}
Пример #3
0
void SendTestStream(unsigned char ChannelIndex ,unsigned char Stream_M,unsigned char Send_S)
{
  UINT8 ChannelGroup , ChannelNum,SendCode;
  UINT32 Send_MS;
  unsigned int counter_tmp;
  
  ChannelGroup=ChannelIndex/2;
  ChannelNum= ChannelIndex%2;

  if(!Si4438_Tx__Config())
  {
    Si4438_Tx__Config();
  }

  Send_MS=Send_S*1000;
  ChannelSelect(ChannelGroup, ChannelNum);
  PA_Txen();
  RXD_LED(0);
  si446x_start_tx(si4438_phy.SI4438CurrentChannel,0u,0u);  
    
  si4438_phy.RF_status=RF_IDLE_FLAG;

  TXD_LED(1);
  SendByte(0x00);
  SendByte(SFDL);
  SendByte(SFDH);
  counter_tmp=GET_SYS_TICK;
  if(Stream_M==0x04)
  {
    SendCode=0x55;
  }
  else if(Stream_M==0x00)
  {
    SendCode=0x00;
  }
  else if(Stream_M==0x01)
  {
    SendCode=0xff;
  }
  else
  { 
    ;
  }
  
  do{
    Iwdg_Init();  
    SendByte(SendCode); 
  }while((GET_SYS_TICK-counter_tmp)<Send_MS);
  wireless_phy_init();
  TXD_LED(0);
}
Пример #4
0
uint8 New_SI4463_Transmit(U8 * pSrc,U8 len)
{
   
  
  SI4463_Enable_NIRQ_TX();
  
 
  
  
  /* Check if the radio is already in TX state */
  si446x_request_device_state();
  if (SI446X_CMD_REQUEST_DEVICE_STATE_REP_MAIN_STATE_ENUM_TX == \
      (Si446xCmd.REQUEST_DEVICE_STATE.CURR_STATE & 0x0F)) {
    /* Still transmitting */
    return FALSE;
  }

  /* Reset TX FIFO */
  si446x_fifo_info(SI446X_CMD_FIFO_INFO_ARG_TX_BIT);

  /* Fill the TX FIFO with data */
  si446x_write_tx_fifo(len, pSrc);


  /* Start sending packet, channel 0, START immediately,
   * Packet length according to 'len', go READY when done */
  si446x_start_tx(0u, 0x30,  len);
  
 uint32 counter = 0;
 StatTime = tmpGlobalTime;
 while(TRUE != gRadio_CheckTransmitted())
 {
   
  asm("nop");
  counter++;
  if(counter >= 0xFFFFFFFF)
  {
     
    SI4463_Enable_NIRQ_RX();
    EXTILineNIRQ_Config();
    return FALSE;
  }
    
 }  
  StopTime = tmpGlobalTime-StatTime;
 

 SI4463_Enable_NIRQ_RX();
  EXTILineNIRQ_Config();
  return TRUE;
}
Пример #5
0
/*!
 *  Set Radio to TX mode, fixed packet length.
 *
 *  @param channel Freq. Channel, Packet to be sent
 *
 *  @note
 *
 */
void  vRadio_StartTx(uint8_t channel, uint8_t *pioFixRadioPacket)
{
  /* Reset TX FIFO */
  si446x_fifo_info(SI446X_CMD_FIFO_INFO_ARG_TX_BIT);

  // Read ITs, clear pending ones
  si446x_get_int_status(0u, 0u, 0u);

  /* Fill the TX fifo with datas */
  si446x_write_tx_fifo(RadioConfiguration.Radio_PacketLength, pioFixRadioPacket);

  /* Start sending packet, channel 0, START immediately, Packet length according to PH, go READY when done */
  si446x_start_tx(channel, 0x30,  0x00);
}
Пример #6
0
void vRadio_StartTx_Variable_Packet(U8 channel, U8 *pioRadioPacket, U8 length)
{
//  DBUG("send channel=%d pioRadioPacket=%d length=%d\r\n",channel,pioRadioPacket,length);
  /* Read ITs, clear pending ones */
  Clear_int_status();
  /* Reset the Tx Fifo */
  si446x_fifo_info(SI446X_CMD_FIFO_INFO_ARG_TX_BIT);

  /* Fill the TX fifo with datas */
  si446x_write_tx_fifo(length, pioRadioPacket);

  /* Start sending packet, channel 0, START immediately */
   si446x_start_tx(channel, 0x80, length);  
  
  si4438_phy.tx_flag=TX_ON;
  si4438_phy.RF_status=RF_TX_FLAG;
}
Пример #7
0
/*!
 *  Set Radio to TX mode, variable packet length.
 *
 *  @param channel Freq. Channel, Packet to be sent length of of the packet sent to TXFIFO
 *
 *  @note
 *
 */
void vRadio_StartTx_Variable_Packet(U8 channel, U8 *pioRadioPacket, U8 length)
{
  /* Leave RX state */
  si446x_change_state(SI446X_CMD_CHANGE_STATE_ARG_NEXT_STATE1_NEW_STATE_ENUM_READY);

  /* Read ITs, clear pending ones */
  si446x_get_int_status(0u, 0u, 0u);

  /* Reset the Tx Fifo */
  si446x_fifo_info(SI446X_CMD_FIFO_INFO_ARG_FIFO_TX_BIT);

  /* Fill the TX fifo with datas */
  si446x_write_tx_fifo(length, pioRadioPacket);

  /* Start sending packet, channel 0, START immediately */
   si446x_start_tx(channel, 0x80, length);
 
}
Пример #8
0
/*!
 *  Set Radio to TX mode, fixed packet length.
 *
 *  @param channel Freq. Channel, Packet to be sent
 *
 *  @note
 *
 */
uint8  vRadio_StartTx(U8 channel, U8 *pioFixRadioPacket,U8 len)
{
  // Read ITs, clear pending ones
  si446x_get_int_status(0u, 0u, 0u);

  
  /* Check if the radio is already in TX state */
  si446x_request_device_state();
  if (SI446X_CMD_REQUEST_DEVICE_STATE_REP_MAIN_STATE_ENUM_TX == \
      (Si446xCmd.REQUEST_DEVICE_STATE.CURR_STATE & 0x0F)) {
    /* Still transmitting */
    return FALSE;
  }

  
  /* Fill the TX fifo with datas */
  si446x_write_tx_fifo(RadioConfiguration.Radio_PacketLength, pioFixRadioPacket);

  /* Start sending packet, channel 0, START immediately, Packet n bytes long, go READY when done */
  si446x_start_tx(channel, 0x30,  RadioConfiguration.Radio_PacketLength);
  
  return TRUE;
}
Пример #9
0
uint8 SI4463_Config_Transmit_singlerate(U8 * pSrc1,U8 len1)
{
  
  //发送第一个包
   trx_state = 0;//f发送模式
  
  /* Check if the radio is already in TX state */
  si446x_request_device_state();
  if (SI446X_CMD_REQUEST_DEVICE_STATE_REP_MAIN_STATE_ENUM_TX == \
      (Si446xCmd.REQUEST_DEVICE_STATE.CURR_STATE & 0x0F)) {
    /* Still transmitting */
    return FALSE;
  }

  /* Reset TX FIFO */
  si446x_fifo_info(SI446X_CMD_FIFO_INFO_ARG_TX_BIT);

  /* Fill the TX FIFO with data */
  si446x_write_tx_fifo(len1, pSrc1);


  /* Start sending packet, channel 0, START immediately,
   * Packet length according to 'len', go READY when done */
  si446x_start_tx(0u, 0x30,  len1);
  
  uint32 counter = 0;
  while (PKT_Sent_Flag!=1)//发送等待
  {
  //等待保护
  asm("nop");
  counter++;
  if(counter >= 0xFFFFFFFF)
    {
     //第一个包未发送成功
    counter=0;
    return FALSE;
    }  
  }
  
   PKT_Sent_Flag =0;
  
  
#if 0
  //DelayMs(1);
//发送第二个包
  
  vRadio_config_2nd();
  
  trx_state = 0;//f发送模式
  
  /* Check if the radio is already in TX state */
  si446x_request_device_state();
  if (SI446X_CMD_REQUEST_DEVICE_STATE_REP_MAIN_STATE_ENUM_TX == \
      (Si446xCmd.REQUEST_DEVICE_STATE.CURR_STATE & 0x0F)) {
    /* Still transmitting */
    return FALSE;
  }

  /* Reset TX FIFO */
  si446x_fifo_info(SI446X_CMD_FIFO_INFO_ARG_TX_BIT);

  /* Fill the TX FIFO with data */
  si446x_write_tx_fifo(len2, pSrc2);


  /* Start sending packet, channel 0, START immediately,
   * Packet length according to 'len', go READY when done */
  si446x_start_tx(0u, 0x30,  len2);
  
  
  while (PKT_Sent_Flag!=1)//发送等待
  {
  //等待保护
  asm("nop");
  counter++;
  if(counter >= 0xFFFFFFFF)
  {
     //第一个包未发送成功
    counter=0;
    return FALSE;
  }
    
  }
  
  PKT_Sent_Flag =0;
  vRadio_config_1st();
  
  vRadio_StartRX_1st(pRadioConfiguration_1st->Radio_ChannelNumber);//回复第一个包的接收模式
  trx_state = 1;//第二个包发完之后默认为接收状态
   
#endif 
  
    vRadio_StartRX(pRadioConfiguration->Radio_ChannelNumber);//回复第一个包的接收模式
  trx_state = 1;//第二个包发完之后默认为接收状态
  
  return TRUE;
}