Ejemplo n.º 1
0
void si4455_get_property(U8 GROUP, U8 NUM_PROPS, U8 START_PROP)
{
    radioCmd[0] = SI4455_CMD_ID_GET_PROPERTY;
    radioCmd[1] = GROUP;
    radioCmd[2] = NUM_PROPS;
    radioCmd[3] = START_PROP;

    radio_comm_SendCmdGetResp( SI4455_CMD_ARG_COUNT_GET_PROPERTY,
                              radioCmd,
                              SI4455_CMD_REPLY_COUNT_GET_PROPERTY,
                              radioCmd );

    Si4455Cmd.GET_PROPERTY.DATA0    = radioCmd[0];
    Si4455Cmd.GET_PROPERTY.DATA1    = radioCmd[1];
    Si4455Cmd.GET_PROPERTY.DATA2    = radioCmd[2];
    Si4455Cmd.GET_PROPERTY.DATA3    = radioCmd[3];
    Si4455Cmd.GET_PROPERTY.DATA4    = radioCmd[4];
    Si4455Cmd.GET_PROPERTY.DATA5    = radioCmd[5];
    Si4455Cmd.GET_PROPERTY.DATA6    = radioCmd[6];
    Si4455Cmd.GET_PROPERTY.DATA7    = radioCmd[7];
    Si4455Cmd.GET_PROPERTY.DATA8    = radioCmd[8];
    Si4455Cmd.GET_PROPERTY.DATA9    = radioCmd[9];
    Si4455Cmd.GET_PROPERTY.DATA10   = radioCmd[10];
    Si4455Cmd.GET_PROPERTY.DATA11   = radioCmd[11];
    Si4455Cmd.GET_PROPERTY.DATA12   = radioCmd[12];
    Si4455Cmd.GET_PROPERTY.DATA13   = radioCmd[13];
    Si4455Cmd.GET_PROPERTY.DATA14   = radioCmd[14];
    Si4455Cmd.GET_PROPERTY.DATA15   = radioCmd[15];
}
Ejemplo n.º 2
0
U8 set_property(const U8* pSetPropCmd,U8 length)
{
//  U8 chip_pend;
  if (radio_comm_SendCmdGetResp(length, Pro2Cmd, 0, 0) != 0xFF)
    {
      /* Timeout occured */
    DBUG("CTS_TIMEOUT");
      return SI446X_CTS_TIMEOUT;
    }

    if (radio_hal_NirqLevel() == 0)
    {
      /* Get and clear all interrupts.  An error has occured... */
      si446x_get_int_status(0, 0, 0);
    
  //  bApi_GetFastResponseRegister(SI446X_CMD_ID_FRR_B_READ,SI446X_CMD_ARG_COUNT_FRR_B_READ,&chip_pend);
  //  if (chip_pend & SI446X_CMD_GET_CHIP_STATUS_REP_CMD_ERROR_PEND_MASK)
    if (Si446xCmd.GET_INT_STATUS.CHIP_PEND & SI446X_CMD_GET_CHIP_STATUS_REP_CMD_ERROR_PEND_MASK)
    {
        DBUG("COMMAND_ERROR");
        return SI446X_COMMAND_ERROR;
    }
    }
  return SI446X_SUCCESS;
}
Ejemplo n.º 3
0
/*!
 * Get property values from the radio. Reads them into Si446xCmd union.
 *
 * @param GROUP       Property group number.
 * @param NUM_PROPS   Number of properties to be read.
 * @param START_PROP  Starting sub-property number.
 */
void si446x_get_property(U8 GROUP, U8 NUM_PROPS, U8 START_PROP)
{
    Pro2Cmd[0] = SI446X_CMD_ID_GET_PROPERTY;
    Pro2Cmd[1] = GROUP;
    Pro2Cmd[2] = NUM_PROPS;
    Pro2Cmd[3] = START_PROP;

    radio_comm_SendCmdGetResp( SI446X_CMD_ARG_COUNT_GET_PROPERTY,
                              Pro2Cmd,
                              SI446X_CMD_REPLY_COUNT_GET_PROPERTY,
                              Pro2Cmd );

    Si446xCmd.GET_PROPERTY.DATA0    = Pro2Cmd[0];
    Si446xCmd.GET_PROPERTY.DATA1    = Pro2Cmd[1];
    Si446xCmd.GET_PROPERTY.DATA2    = Pro2Cmd[2];
    Si446xCmd.GET_PROPERTY.DATA3    = Pro2Cmd[3];
    Si446xCmd.GET_PROPERTY.DATA4    = Pro2Cmd[4];
    Si446xCmd.GET_PROPERTY.DATA5    = Pro2Cmd[5];
    Si446xCmd.GET_PROPERTY.DATA6    = Pro2Cmd[6];
    Si446xCmd.GET_PROPERTY.DATA7    = Pro2Cmd[7];
    Si446xCmd.GET_PROPERTY.DATA8    = Pro2Cmd[8];
    Si446xCmd.GET_PROPERTY.DATA9    = Pro2Cmd[9];
    Si446xCmd.GET_PROPERTY.DATA10   = Pro2Cmd[10];
    Si446xCmd.GET_PROPERTY.DATA11   = Pro2Cmd[11];
    Si446xCmd.GET_PROPERTY.DATA12   = Pro2Cmd[12];
    Si446xCmd.GET_PROPERTY.DATA13   = Pro2Cmd[13];
    Si446xCmd.GET_PROPERTY.DATA14   = Pro2Cmd[14];
    Si446xCmd.GET_PROPERTY.DATA15   = Pro2Cmd[15];
}
Ejemplo n.º 4
0
void si4455_request_device_state(void)
{
    radioCmd[0] = SI4455_CMD_ID_REQUEST_DEVICE_STATE;

    radio_comm_SendCmdGetResp( SI4455_CMD_ARG_COUNT_REQUEST_DEVICE_STATE,
                              radioCmd,
                              SI4455_CMD_REPLY_COUNT_REQUEST_DEVICE_STATE,
                              radioCmd );

    Si4455Cmd.REQUEST_DEVICE_STATE.CURR_STATE       = radioCmd[0];
    Si4455Cmd.REQUEST_DEVICE_STATE.CURRENT_CHANNEL  = radioCmd[1];
}
Ejemplo n.º 5
0
/*!
 * Gets the Packet Handler status flags. Optionally clears them.
 *
 * @param PH_CLR_PEND Flags to clear.
 */
void si446x_get_ph_status(U8 PH_CLR_PEND)
{
    Pro2Cmd[0] = SI446X_CMD_ID_GET_PH_STATUS;
    Pro2Cmd[1] = PH_CLR_PEND;

    radio_comm_SendCmdGetResp( SI446X_CMD_ARG_COUNT_GET_PH_STATUS,
                              Pro2Cmd,
                              SI446X_CMD_REPLY_COUNT_GET_PH_STATUS,
                              Pro2Cmd );

    Si446xCmd.GET_PH_STATUS.PH_PEND        = Pro2Cmd[0];
    Si446xCmd.GET_PH_STATUS.PH_STATUS      = Pro2Cmd[1];
}
Ejemplo n.º 6
0
void si4455_fifo_info(U8 FIFO)
{
    radioCmd[0] = SI4455_CMD_ID_FIFO_INFO;
    radioCmd[1] = FIFO;

    radio_comm_SendCmdGetResp( SI4455_CMD_ARG_COUNT_FIFO_INFO,
                              radioCmd,
                              SI4455_CMD_REPLY_COUNT_FIFO_INFO,
                              radioCmd );

    Si4455Cmd.FIFO_INFO.RX_FIFO_COUNT   = radioCmd[0];
    Si4455Cmd.FIFO_INFO.TX_FIFO_SPACE   = radioCmd[1];
}
Ejemplo n.º 7
0
/*!
 * Send the FIFO_INFO command to the radio. Optionally resets the TX/RX FIFO. Reads the radio response back
 * into @Si446xCmd.
 *
 * @param FIFO  RX/TX FIFO reset flags.
 */
void si446x_fifo_info(U8 FIFO)
{
    Pro2Cmd[0] = SI446X_CMD_ID_FIFO_INFO;
    Pro2Cmd[1] = FIFO;

    radio_comm_SendCmdGetResp( SI446X_CMD_ARG_COUNT_FIFO_INFO,
                              Pro2Cmd,
                              SI446X_CMD_REPLY_COUNT_FIFO_INFO,
                              Pro2Cmd );

    Si446xCmd.FIFO_INFO.RX_FIFO_COUNT   = Pro2Cmd[0];
    Si446xCmd.FIFO_INFO.TX_FIFO_SPACE   = Pro2Cmd[1];
}
Ejemplo n.º 8
0
/*!
 * Gets the Chip status flags. Optionally clears them.
 *
 * @param CHIP_CLR_PEND Flags to clear.
 */
void si446x_get_chip_status( U8 CHIP_CLR_PEND )
{
    Pro2Cmd[0] = SI446X_CMD_ID_GET_CHIP_STATUS;
    Pro2Cmd[1] = CHIP_CLR_PEND;

    radio_comm_SendCmdGetResp( SI446X_CMD_ARG_COUNT_GET_CHIP_STATUS,
                              Pro2Cmd,
                              SI446X_CMD_REPLY_COUNT_GET_CHIP_STATUS,
                              Pro2Cmd );

    Si446xCmd.GET_CHIP_STATUS.CHIP_PEND         = Pro2Cmd[0];
    Si446xCmd.GET_CHIP_STATUS.CHIP_STATUS       = Pro2Cmd[1];
    Si446xCmd.GET_CHIP_STATUS.CMD_ERR_STATUS    = Pro2Cmd[2];
}
Ejemplo n.º 9
0
unsigned char Rf_set(void)
{ 
  U8 SetPA[]={ RF_PA_MODE_5};
  si4438_phy.RF_status=RF_IDLE_FLAG;
  si446x_change_state(SI446X_CMD_CHANGE_STATE_ARG_NEW_STATE_ENUM_READY);
  
  
  if (radio_comm_SendCmdGetResp(0x09, SetPA, 0, 0) != 0xFF)
  {
    DBUG("rf_power_up SI446X_CTS_TIMEOUT\r\n");
    return FALSE;
  }

  return TRUE;
}
Ejemplo n.º 10
0
/*!
 * Sends the FUNC_INFO command to the radio, then reads the resonse into @Si446xCmd union.
 */
void si446x_func_info(void)
{
    Pro2Cmd[0] = SI446X_CMD_ID_FUNC_INFO;

    radio_comm_SendCmdGetResp( SI446X_CMD_ARG_COUNT_FUNC_INFO,
                              Pro2Cmd,
                              SI446X_CMD_REPLY_COUNT_FUNC_INFO,
                              Pro2Cmd );

    Si446xCmd.FUNC_INFO.REVEXT          = Pro2Cmd[0];
    Si446xCmd.FUNC_INFO.REVBRANCH       = Pro2Cmd[1];
    Si446xCmd.FUNC_INFO.REVINT          = Pro2Cmd[2];
    Si446xCmd.FUNC_INFO.PATCH.U8[MSB]   = Pro2Cmd[3];
    Si446xCmd.FUNC_INFO.PATCH.U8[LSB]   = Pro2Cmd[4];
    Si446xCmd.FUNC_INFO.FUNC            = Pro2Cmd[5];
}
Ejemplo n.º 11
0
/*!
 * Performs image rejection calibration. Completion can be monitored by polling CTS or waiting for CHIP_READY interrupt source.
 *
 * @param SEARCHING_STEP_SIZE
 * @param SEARCHING_RSSI_AVG
 * @param RX_CHAIN_SETTING1
 * @param RX_CHAIN_SETTING2
 */
void si446x_ircal(U8 SEARCHING_STEP_SIZE, U8 SEARCHING_RSSI_AVG, U8 RX_CHAIN_SETTING1, U8 RX_CHAIN_SETTING2)
{
    Pro2Cmd[0] = SI446X_CMD_ID_IRCAL;
    Pro2Cmd[1] = SEARCHING_STEP_SIZE;
    Pro2Cmd[2] = SEARCHING_RSSI_AVG;
    Pro2Cmd[3] = RX_CHAIN_SETTING1;
    Pro2Cmd[4] = RX_CHAIN_SETTING2;

    radio_comm_SendCmdGetResp( SI446X_CMD_ARG_COUNT_IRCAL,
                              Pro2Cmd,
                              SI446X_CMD_REPLY_COUNT_IRCAL,
                              Pro2Cmd );

    Si446xCmd.IRCAL.CAL_STATE   = Pro2Cmd[0];
    Si446xCmd.IRCAL.RSSI        = Pro2Cmd[1];
    Si446xCmd.IRCAL.DIR_CH      = Pro2Cmd[2];
}
Ejemplo n.º 12
0
/*!
 * This function is used to load all properties and commands with a list of NULL terminated commands.
 * Before this function @si446x_reset should be called.
 */
U8 si446x_configuration_init(const U8* pSetPropCmd)
{
  SEGMENT_VARIABLE(col, U8, SEG_DATA);
  SEGMENT_VARIABLE(numOfBytes, U8, SEG_DATA);

  /* While cycle as far as the pointer points to a command */
  while (*pSetPropCmd != 0x00)
  {
    /* Commands structure in the array:
     * --------------------------------
     * LEN | <LEN length of data>
     */

    numOfBytes = *pSetPropCmd++;

    if (numOfBytes > 16u)
    {
      /* Number of command bytes exceeds maximal allowable length */
      return SI446X_COMMAND_ERROR;
    }

    for (col = 0u; col < numOfBytes; col++)
    {
      Pro2Cmd[col] = *pSetPropCmd;
      pSetPropCmd++;
    }

    if (radio_comm_SendCmdGetResp(numOfBytes, Pro2Cmd, 0, 0) != 0xFF)
    {
      /* Timeout occured */
      return SI446X_CTS_TIMEOUT;
    }

    if (radio_hal_NirqLevel() == 0)
    {
      /* Get and clear all interrupts.  An error has occured... */
      si446x_get_int_status(0, 0, 0);
      if (Si446xCmd.GET_INT_STATUS.CHIP_PEND & SI446X_CMD_GET_CHIP_STATUS_REP_CMD_ERROR_PEND_MASK)
      {
        return SI446X_COMMAND_ERROR;
      }
    }
  }

  return SI446X_SUCCESS;
}
Ejemplo n.º 13
0
/*! This function sends the PART_INFO command to the radio and receives the answer
 *  into @Si446xCmd union.
 */
void si446x_part_info(void)
{
    Pro2Cmd[0] = SI446X_CMD_ID_PART_INFO;

    radio_comm_SendCmdGetResp( SI446X_CMD_ARG_COUNT_PART_INFO,
                              Pro2Cmd,
                              SI446X_CMD_REPLY_COUNT_PART_INFO,
                              Pro2Cmd );

    Si446xCmd.PART_INFO.CHIPREV         = Pro2Cmd[0];
    Si446xCmd.PART_INFO.PART.U8[MSB]    = Pro2Cmd[1];
    Si446xCmd.PART_INFO.PART.U8[LSB]    = Pro2Cmd[2];
    Si446xCmd.PART_INFO.PBUILD          = Pro2Cmd[3];
    Si446xCmd.PART_INFO.ID.U8[MSB]      = Pro2Cmd[4];
    Si446xCmd.PART_INFO.ID.U8[LSB]      = Pro2Cmd[5];
    Si446xCmd.PART_INFO.CUSTOMER        = Pro2Cmd[6];
    Si446xCmd.PART_INFO.ROMID           = Pro2Cmd[7];
}
Ejemplo n.º 14
0
/*!
 * Gets the Modem status flags. Optionally clears them.
 *
 * @param MODEM_CLR_PEND Flags to clear.
 */
void si446x_get_modem_status( U8 MODEM_CLR_PEND )
{
    Pro2Cmd[0] = SI446X_CMD_ID_GET_MODEM_STATUS;
    Pro2Cmd[1] = MODEM_CLR_PEND;

    radio_comm_SendCmdGetResp( SI446X_CMD_ARG_COUNT_GET_MODEM_STATUS,
                              Pro2Cmd,
                              SI446X_CMD_REPLY_COUNT_GET_MODEM_STATUS,
                              Pro2Cmd );

    Si446xCmd.GET_MODEM_STATUS.MODEM_PEND   = Pro2Cmd[0];
    Si446xCmd.GET_MODEM_STATUS.MODEM_STATUS = Pro2Cmd[1];
    Si446xCmd.GET_MODEM_STATUS.CURR_RSSI    = Pro2Cmd[2];
    Si446xCmd.GET_MODEM_STATUS.LATCH_RSSI   = Pro2Cmd[3];
    Si446xCmd.GET_MODEM_STATUS.ANT1_RSSI    = Pro2Cmd[4];
    Si446xCmd.GET_MODEM_STATUS.ANT2_RSSI    = Pro2Cmd[5];
    Si446xCmd.GET_MODEM_STATUS.AFC_FREQ_OFFSET.U8[MSB]  = Pro2Cmd[6];
    Si446xCmd.GET_MODEM_STATUS.AFC_FREQ_OFFSET.U8[LSB]  = Pro2Cmd[7];
}
Ejemplo n.º 15
0
/*!
 * Receives information from the radio of the current packet. Optionally can be used to modify
 * the Packet Handler properties during packet reception.
 *
 * @param FIELD_NUMBER_MASK Packet Field number mask value.
 * @param LEN               Length value.
 * @param DIFF_LEN          Difference length.
 */
void si446x_get_packet_info(U8 FIELD_NUMBER_MASK, U16 LEN, S16 DIFF_LEN )
{
    Pro2Cmd[0] = SI446X_CMD_ID_PACKET_INFO;
    Pro2Cmd[1] = FIELD_NUMBER_MASK;
    Pro2Cmd[2] = (U8)(LEN >> 8);
    Pro2Cmd[3] = (U8)(LEN);
    // the different of the byte, althrough it is signed, but to command hander
    // it can treat it as unsigned
    Pro2Cmd[4] = (U8)((U16)DIFF_LEN >> 8);
    Pro2Cmd[5] = (U8)(DIFF_LEN);

    radio_comm_SendCmdGetResp( SI446X_CMD_ARG_COUNT_PACKET_INFO,
                              Pro2Cmd,
                              SI446X_CMD_REPLY_COUNT_PACKET_INFO,
                              Pro2Cmd );

    Si446xCmd.PACKET_INFO.LENGTH_15_8   = Pro2Cmd[0];
    Si446xCmd.PACKET_INFO.LENGTH_7_0    = Pro2Cmd[1];
}
Ejemplo n.º 16
0
/*!
 * Reads the ADC values from the radio into @Si446xCmd union.
 *
 * @param ADC_EN  ADC enable parameter.
 */
void si446x_get_adc_reading(U8 ADC_EN)
{
    Pro2Cmd[0] = SI446X_CMD_ID_GET_ADC_READING;
    Pro2Cmd[1] = ADC_EN;

    radio_comm_SendCmdGetResp( SI446X_CMD_ARG_COUNT_GET_ADC_READING,
                              Pro2Cmd,
                              SI446X_CMD_REPLY_COUNT_GET_ADC_READING,
                              Pro2Cmd );

    Si446xCmd.GET_ADC_READING.GPIO_ADC.U8[MSB]      = Pro2Cmd[0];
    Si446xCmd.GET_ADC_READING.GPIO_ADC.U8[LSB]      = Pro2Cmd[1];
    Si446xCmd.GET_ADC_READING.BATTERY_ADC.U8[MSB]   = Pro2Cmd[2];
    Si446xCmd.GET_ADC_READING.BATTERY_ADC.U8[LSB]   = Pro2Cmd[3];
    Si446xCmd.GET_ADC_READING.TEMP_ADC.U8[MSB]      = Pro2Cmd[4];
    Si446xCmd.GET_ADC_READING.TEMP_ADC.U8[LSB]      = Pro2Cmd[5];
    Si446xCmd.GET_ADC_READING.TEMP_SLOPE            = Pro2Cmd[6];
    Si446xCmd.GET_ADC_READING.TEMP_INTERCEPT        = Pro2Cmd[7];
}
Ejemplo n.º 17
0
void si4455_part_info(void)
{
    radioCmd[0] = SI4455_CMD_ID_PART_INFO;

    radio_comm_SendCmdGetResp( SI4455_CMD_ARG_COUNT_PART_INFO,
                              radioCmd,
                              SI4455_CMD_REPLY_COUNT_PART_INFO,
                              radioCmd );

    Si4455Cmd.PART_INFO.CHIPREV         = radioCmd[0];
    Si4455Cmd.PART_INFO.PART.U8[MSB]    = radioCmd[1];
    Si4455Cmd.PART_INFO.PART.U8[LSB]    = radioCmd[2];
    Si4455Cmd.PART_INFO.PBUILD          = radioCmd[3];
    Si4455Cmd.PART_INFO.ID.U8[MSB]      = radioCmd[4];
    Si4455Cmd.PART_INFO.ID.U8[LSB]      = radioCmd[5];
    Si4455Cmd.PART_INFO.CUSTOMER        = radioCmd[6];
    Si4455Cmd.PART_INFO.ROMID           = radioCmd[7];
    Si4455Cmd.PART_INFO.BOND            = radioCmd[8];
}
Ejemplo n.º 18
0
void si4455_get_int_status(U8 PH_CLR_PEND, U8 MODEM_CLR_PEND, U8 CHIP_CLR_PEND)
{
    radioCmd[0] = SI4455_CMD_ID_GET_INT_STATUS;
    radioCmd[1] = PH_CLR_PEND;
    radioCmd[2] = MODEM_CLR_PEND;
    radioCmd[3] = CHIP_CLR_PEND;

    radio_comm_SendCmdGetResp( SI4455_CMD_ARG_COUNT_GET_INT_STATUS,
                              radioCmd,
                              SI4455_CMD_REPLY_COUNT_GET_INT_STATUS,
                              radioCmd );

    Si4455Cmd.GET_INT_STATUS.INT_PEND       = radioCmd[0];
    Si4455Cmd.GET_INT_STATUS.INT_STATUS     = radioCmd[1];
    Si4455Cmd.GET_INT_STATUS.PH_PEND        = radioCmd[2];
    Si4455Cmd.GET_INT_STATUS.PH_STATUS      = radioCmd[3];
    Si4455Cmd.GET_INT_STATUS.MODEM_PEND     = radioCmd[4];
    Si4455Cmd.GET_INT_STATUS.MODEM_STATUS   = radioCmd[5];
    Si4455Cmd.GET_INT_STATUS.CHIP_PEND      = radioCmd[6];
    Si4455Cmd.GET_INT_STATUS.CHIP_STATUS    = radioCmd[7];
}
Ejemplo n.º 19
0
void si4455_func_info(void)
{
    radioCmd[0] = SI4455_CMD_ID_FUNC_INFO;

    radio_comm_SendCmdGetResp( SI4455_CMD_ARG_COUNT_FUNC_INFO,
                              radioCmd,
                              SI4455_CMD_REPLY_COUNT_FUNC_INFO,
                              radioCmd );

    Si4455Cmd.FUNC_INFO.REVEXT          = radioCmd[0];
    Si4455Cmd.FUNC_INFO.REVBRANCH       = radioCmd[1];
    Si4455Cmd.FUNC_INFO.REVINT          = radioCmd[2];
    Si4455Cmd.FUNC_INFO.PATCH.U8[MSB]   = radioCmd[3];
    Si4455Cmd.FUNC_INFO.PATCH.U8[LSB]   = radioCmd[4];
    Si4455Cmd.FUNC_INFO.FUNC            = radioCmd[5];
    Si4455Cmd.FUNC_INFO.SVNFLAGS        = radioCmd[6];
    Si4455Cmd.FUNC_INFO.SVNREV.U8[b3]   = radioCmd[7];
    Si4455Cmd.FUNC_INFO.SVNREV.U8[b2]   = radioCmd[8];
    Si4455Cmd.FUNC_INFO.SVNREV.U8[b1]   = radioCmd[9];
    Si4455Cmd.FUNC_INFO.SVNREV.U8[b0]   = radioCmd[10];
}
Ejemplo n.º 20
0
/*!
 * This function is used to apply a firmware patch to the si446x radio.  This
 * patch is stored in code using the si446x_patch.h file.
 *
 * @return  SI446X_CTS_TIMEOUT If a CTS error occurs.
 *          SI446X_PATCH_FAIL If the patch fails.
 *          SI446X_SUCCESS If the patch is successful.
 *          SI446X_NO_PATCH If there is no patch in the Flash to load.
 */
U8 si446x_apply_patch(void)
{
#ifdef SI446X_PATCH_CMDS
    SEGMENT_VARIABLE(line, U16, SEG_DATA);
    SEGMENT_VARIABLE(row,  U8, SEG_DATA);

    /* Check if patch is needed. */
    si446x_part_info();

    if ((Si446xCmd.PART_INFO.ROMID == SI446X_PATCH_ROMID) && (Si446xCmd.PART_INFO.ID.U8[MSB] < SI446X_PATCH_ID))
    {
      for (line = 0; line < (sizeof(Si446xPatchCommands) / 8u); line++)
      {
        for (row=0; row<8; row++)
        {
          Pro2Cmd[row] = Si446xPatchCommands[line][row];
        }
        if (radio_comm_SendCmdGetResp(8, Pro2Cmd, 0, 0) != 0xFF)
        {
          // Timeout occured
          return SI446X_CTS_TIMEOUT;
        }
        if (radio_hal_NirqLevel() == 0)
        {
          /* Get and clear all interrupts.  An error has occured... */
          si446x_get_int_status(0, 0, 0);
          return SI446X_PATCH_FAIL;
        }
      }
    }

    return SI446X_SUCCESS;
#else
    return SI446X_NO_PATCH;
#endif
}
Ejemplo n.º 21
0
/*!
 * Send GPIO pin config command to the radio and reads the answer into
 * @Si446xCmd union.
 *
 * @param GPIO0       GPIO0 configuration.
 * @param GPIO1       GPIO1 configuration.
 * @param GPIO2       GPIO2 configuration.
 * @param GPIO3       GPIO3 configuration.
 * @param NIRQ        NIRQ configuration.
 * @param SDO         SDO configuration.
 * @param GEN_CONFIG  General pin configuration.
 */
void si446x_gpio_pin_cfg(U8 GPIO0, U8 GPIO1, U8 GPIO2, U8 GPIO3, U8 NIRQ, U8 SDO, U8 GEN_CONFIG)
{
    Pro2Cmd[0] = SI446X_CMD_ID_GPIO_PIN_CFG;
    Pro2Cmd[1] = GPIO0;
    Pro2Cmd[2] = GPIO1;
    Pro2Cmd[3] = GPIO2;
    Pro2Cmd[4] = GPIO3;
    Pro2Cmd[5] = NIRQ;
    Pro2Cmd[6] = SDO;
    Pro2Cmd[7] = GEN_CONFIG;

    radio_comm_SendCmdGetResp( SI446X_CMD_ARG_COUNT_GPIO_PIN_CFG,
                              Pro2Cmd,
                              SI446X_CMD_REPLY_COUNT_GPIO_PIN_CFG,
                              Pro2Cmd );

    Si446xCmd.GPIO_PIN_CFG.GPIO0        = Pro2Cmd[0];
    Si446xCmd.GPIO_PIN_CFG.GPIO1        = Pro2Cmd[1];
    Si446xCmd.GPIO_PIN_CFG.GPIO2        = Pro2Cmd[2];
    Si446xCmd.GPIO_PIN_CFG.GPIO3        = Pro2Cmd[3];
    Si446xCmd.GPIO_PIN_CFG.NIRQ         = Pro2Cmd[4];
    Si446xCmd.GPIO_PIN_CFG.SDO          = Pro2Cmd[5];
    Si446xCmd.GPIO_PIN_CFG.GEN_CONFIG   = Pro2Cmd[6];
}
Ejemplo n.º 22
0
void si4455_gpio_pin_cfg(U8 GPIO0, U8 GPIO1, U8 GPIO2, U8 GPIO3, U8 NIRQ, U8 SDO, U8 GEN_CONFIG)
{
    radioCmd[0] = SI4455_CMD_ID_GPIO_PIN_CFG;
    radioCmd[1] = GPIO0;
    radioCmd[2] = GPIO1;
    radioCmd[3] = GPIO2;
    radioCmd[4] = GPIO3;
    radioCmd[5] = NIRQ;
    radioCmd[6] = SDO;
    radioCmd[7] = GEN_CONFIG;

    radio_comm_SendCmdGetResp( SI4455_CMD_ARG_COUNT_GPIO_PIN_CFG,
                              radioCmd,
                              SI4455_CMD_REPLY_COUNT_GPIO_PIN_CFG,
                              radioCmd );

    Si4455Cmd.GPIO_PIN_CFG.GPIO0        = radioCmd[0];
    Si4455Cmd.GPIO_PIN_CFG.GPIO1        = radioCmd[1];
    Si4455Cmd.GPIO_PIN_CFG.GPIO2        = radioCmd[2];
    Si4455Cmd.GPIO_PIN_CFG.GPIO3        = radioCmd[3];
    Si4455Cmd.GPIO_PIN_CFG.NIRQ         = radioCmd[4];
    Si4455Cmd.GPIO_PIN_CFG.SDO          = radioCmd[5];
    Si4455Cmd.GPIO_PIN_CFG.GEN_CONFIG   = radioCmd[6];
}
Ejemplo n.º 23
0
unsigned char get_property(void)
{
  U8 cmd_length,i,device_state;

    i=0;
    device_state=0;
  
    Pro2Cmd[i++]=0x12;
    Pro2Cmd[i++]=0x50;
    Pro2Cmd[i++]=0x0C;
    Pro2Cmd[i++]=0x00;
    cmd_length=0x0C;
    if(radio_comm_SendCmdGetResp(4, Pro2Cmd, cmd_length, Pro2Cmd)!= 0xFF)  //获取跳频表参数
    {
      DBUG("get_hop cmd err\r\n");
      return FALSE;
    }
    for(i=0;i<(cmd_length);i++)
    {
    //  DBUG("%02x %02x\r\n",Pro2Cmd[i],Si4438HopRegister[i]);
      if(Pro2Cmd[i]!=Si4438HopRegister[i])  //判断跳频表参数
      {
          DBUG("get_hop err\r\n");
          return FALSE;
      }
    }
    if(si4438_phy.RF_status==RF_RX_FLAG)
    {
      si446x_request_device_state();
      device_state=Si446xCmd.REQUEST_DEVICE_STATE.CURR_STATE;  //获取设备当前状态是否为读状态
      if(device_state!=SI446X_CMD_REQUEST_DEVICE_STATE_REP_MAIN_STATE_ENUM_RX)
      {
          DBUG("CURR_STATE err\r\n");
          return FALSE;
      }

    }
/*        
    tick_tmp=0;
    device_state=0x00;

    if(radio_hal_Gpio0Level())  //判断晶振是否启振;
    {
      for(tick_tmp=0;tick_tmp<5;tick_tmp++)
      {
        if(!radio_hal_Gpio0Level())
          break;
      }
    }
    else
    {
      for(tick_tmp=0;tick_tmp<5;tick_tmp++)
      {
        if(radio_hal_Gpio0Level())
          break;
      }
    }
    
    if(tick_tmp>=20)
    {
      DBUG("READY state err");
      return TRUE;
    }
*/
    return TRUE;
}
Ejemplo n.º 24
0
unsigned char get_all_property(void)
{
  U8 i,j,col;
  const U8 *pSetPropCmd=pRadioConfiguration->Radio_ConfigurationArray;
  U8 numOfBytes;
  U8 buf[20],length;
  U16 Pregister=0;
  U8 not_check_register[2]={NOT_CHECK_REGISTER};
  
  numOfBytes = *pSetPropCmd++;
  pSetPropCmd+=numOfBytes;
  numOfBytes = *pSetPropCmd++;
  pSetPropCmd+=numOfBytes;
  while (*pSetPropCmd != 0x00)
  {
    numOfBytes = *pSetPropCmd++;

    for (col = 0u; col < numOfBytes; col++)
    {
      Pro2Cmd[col] = *pSetPropCmd;
      pSetPropCmd++;
    }
    Pro2Cmd[0]=0x12;

    length=Pro2Cmd[2];
    
    if (radio_comm_SendCmdGetResp(4, Pro2Cmd, length, buf) != 0xFF)
    {
      DBUG("SI446X_CTS_TIMEOUT\r\n");
      return FALSE;
    }
    //DBUG("\r\n");
    for(i=0;i<length;i++)
    {
      
      Pregister++;
      //DBUG("%02x ",buf[i]);
      if(Pro2Cmd[i+4]!=buf[i])
      {
        for(j=0;j<2;j++)
        {
          
          if(Pregister==not_check_register[j])
          {
            j=0xee;
            break;
          }
        }
        if(j!=0xee)
        {
          DBUG("Pregister=%d ",Pregister);
          return FALSE;
        }

      }
      
    }
  }

  return TRUE;
}