Ejemplo n.º 1
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.º 2
0
/*!
 *  Check if Packet sent IT flag is pending.
 *
 *  @return   TRUE / FALSE
 *
 *  @note
 *
 */
uint8_t gRadio_CheckTransmitted(void)
{
  if (radio_hal_NirqLevel() == FALSE)
  {
    /* Read ITs, clear pending ones */
    si446x_get_int_status(0u, 0u, 0u);

    /* check the reason for the IT */
    if (Si446xCmd.GET_INT_STATUS.PH_PEND & SI446X_CMD_GET_INT_STATUS_REP_PACKET_SENT_PEND_BIT)
    {
      return TRUE;
    }
  }

  return FALSE;
}
Ejemplo n.º 3
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.º 4
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
}