Ejemplo n.º 1
0
/*********************************************************************
 * @fn          macSrcMatchSetEnableBit
 *
 * @brief       Set or clear the enable bit in the SRCMATCH EN register
 *
 * @param       index - index of the entry in the source address table
 * @param       option - true (set the enable bit), or false (clear the 
 *              enable bit)
 * @param       macSrcMatchAddrMode - Address Mode for the entry. Valid values
 *              are SADDR_MODE_SHORT or SADDR_MODE_EXT
 *
 * @return      none
 */
static void macSrcMatchSetEnableBit(uint8 index, 
                                    bool option, 
                                    uint8 macSrcMatchAddrMode)
{
  uint24 enable;  
  uint8 buf[MAC_SRCMATCH_ENABLE_BITMAP_LEN];
  
  if( option == TRUE )
  {
    if( macSrcMatchAddrMode == SADDR_MODE_SHORT )
    {
      enable = MAC_RADIO_SRC_MATCH_GET_SHORTADDR_EN(); 
      enable |= ( (uint24)0x01 << index );
      osal_buffer_uint24( buf, enable );
      MAC_RADIO_SRC_MATCH_SET_SHORTEN( buf );
    }
    else
    {
      enable = MAC_RADIO_SRC_MATCH_GET_EXTADDR_EN(); 
      enable |= ( (uint24)0x01 << ( index *  EXT_ADDR_INDEX_SIZE) );
      osal_buffer_uint24( buf, enable );
      MAC_RADIO_SRC_MATCH_SET_EXTEN( buf );
    }
  }
  else
  {
    if( macSrcMatchAddrMode == SADDR_MODE_SHORT )
    {
      enable = MAC_RADIO_SRC_MATCH_GET_SHORTADDR_EN();
      enable &= ~( (uint24)0x01 << index );
      osal_buffer_uint24( buf, enable );
      MAC_RADIO_SRC_MATCH_SET_SHORTEN( buf );
    }
    else
    {
      enable = MAC_RADIO_SRC_MATCH_GET_EXTADDR_EN(); 
      enable &= ~( (uint24)0x01 << ( index * EXT_ADDR_INDEX_SIZE ) );
      osal_buffer_uint24( buf, enable );
      MAC_RADIO_SRC_MATCH_SET_EXTEN( buf );
    }
  }
}
Ejemplo n.º 2
0
/*********************************************************************
 * @fn          macSrcMatchSetPendEnBit
 *
 * @brief       Set the enable bit in the source address table
 *
 * @param       index - index of the entry in the source address table
 *
 * @return      none
 */
static void macSrcMatchSetPendEnBit( uint8 index )
{
  uint24 enable;
  uint8 buf[MAC_SRCMATCH_ENABLE_BITMAP_LEN];
       
  enable = MAC_RADIO_SRC_MATCH_GET_PENDEN(); 
      
  if( macSrcMatchAddrMode == SADDR_MODE_SHORT )
  {
    enable |= ( (uint24)0x01 << index );
    osal_buffer_uint24( buf, enable );
    MAC_RADIO_SRC_MATCH_SET_SHORTPENDEN( buf );
  }
  else
  {
    enable |= ( (uint24)0x01 << ( index * 2 ) );
    osal_buffer_uint24( buf, enable );
    MAC_RADIO_SRC_MATCH_SET_EXTPENDEN( buf );
  }
}