/***************************************************************************************************
 * @fn      MT_UtilProcessing
 *
 * @brief   Process all the DEBUG commands that are issued by test tool
 *
 * @param   pBuf  - pointer to received SPI data message
 *
 * @return  status
 ***************************************************************************************************/
uint8 MT_UtilCommandProcessing(uint8 *pBuf)
{
  uint8 status = MT_RPC_SUCCESS;

  switch (pBuf[MT_RPC_POS_CMD1])
  {
// CC253X MAC Network Processor does not have NV support
#if !defined(CC253X_MACNP)
    case MT_UTIL_GET_DEVICE_INFO:
      MT_UtilGetDeviceInfo();
      break;

    case MT_UTIL_GET_NV_INFO:
      MT_UtilGetNvInfo();
      break;

    case MT_UTIL_SET_PANID:
      MT_UtilSetPanID(pBuf);
      break;

    case MT_UTIL_SET_CHANNELS:
      MT_UtilSetChannels(pBuf);
      break;

    case MT_UTIL_SET_SECLEVEL:
      MT_UtilSetSecLevel(pBuf);
      break;

    case MT_UTIL_SET_PRECFGKEY:
      MT_UtilSetPreCfgKey(pBuf);
      break;
#endif
    case MT_UTIL_CALLBACK_SUB_CMD:
      MT_UtilCallbackSub(pBuf);
      break;

    case MT_UTIL_KEY_EVENT:
#if (defined HAL_KEY) && (HAL_KEY == TRUE)
      MT_UtilKeyEvent(pBuf);
#endif
      break;

    case MT_UTIL_TIME_ALIVE:
      MT_UtilTimeAlive();
      break;

    case MT_UTIL_LED_CONTROL:
#if (defined HAL_LED) && (HAL_LED == TRUE)
      MT_UtilLedControl(pBuf);
#endif
      break;

    case MT_UTIL_SRC_MATCH_ENABLE:
      MT_UtilSrcMatchEnable(pBuf);
      break;

    case MT_UTIL_SRC_MATCH_ADD_ENTRY:
      MT_UtilSrcMatchAddEntry(pBuf);
      break;

    case MT_UTIL_SRC_MATCH_DEL_ENTRY:
      MT_UtilSrcMatchDeleteEntry(pBuf);
      break;

    case MT_UTIL_SRC_MATCH_CHECK_SRC_ADDR:
      MT_UtilSrcMatchCheckSrcAddr(pBuf);
      break;

    case MT_UTIL_SRC_MATCH_ACK_ALL_PENDING:
      MT_UtilSrcMatchAckAllPending(pBuf);
      break;

    case MT_UTIL_SRC_MATCH_CHECK_ALL_PENDING:
      MT_UtilSrcMatchCheckAllPending(pBuf);
      break;

    case MT_UTIL_TEST_LOOPBACK:
      MT_BuildAndSendZToolResponse((MT_RPC_CMD_SRSP|(uint8)MT_RPC_SYS_UTIL), MT_UTIL_TEST_LOOPBACK,
                                    pBuf[MT_RPC_POS_LEN], (pBuf+MT_RPC_FRAME_HDR_SZ));
      break;

#if !defined NONWK
    case MT_UTIL_DATA_REQ:
      MT_UtilDataReq(pBuf);
      break;

    case MT_UTIL_ADDRMGR_EXT_ADDR_LOOKUP:
      MT_UtilAddrMgrEntryLookupExt(pBuf);
      break;

    case MT_UTIL_ADDRMGR_NWK_ADDR_LOOKUP:
      MT_UtilAddrMgrEntryLookupNwk(pBuf);
      break;

#if defined MT_SYS_KEY_MANAGEMENT
    case MT_UTIL_APSME_LINK_KEY_DATA_GET:
      MT_UtilAPSME_LinkKeyDataGet(pBuf);
      break;

    case MT_UTIL_APSME_LINK_KEY_NV_ID_GET:
      MT_UtilAPSME_LinkKeyNvIdGet(pBuf);
      break;
#endif // MT_SYS_KEY_MANAGEMENT

    case MT_UTIL_APSME_REQUEST_KEY_CMD:
      MT_UtilAPSME_RequestKeyCmd(pBuf);
      break;

    case MT_UTIL_ASSOC_COUNT:
      MT_UtilAssocCount(pBuf);
      break;

    case MT_UTIL_ASSOC_FIND_DEVICE:
      MT_UtilAssocFindDevice(pBuf);
      break;

    case MT_UTIL_ASSOC_GET_WITH_ADDRESS:
      MT_UtilAssocGetWithAddress(pBuf);
      break;

#if defined ZCL_KEY_ESTABLISH
    case MT_UTIL_ZCL_KEY_EST_INIT_EST:
      MT_UtilzclGeneral_KeyEstablish_InitiateKeyEstablishment(pBuf);
      break;

    case MT_UTIL_ZCL_KEY_EST_SIGN:
      MT_UtilzclGeneral_KeyEstablishment_ECDSASign(pBuf);
      break;
#endif

    case MT_UTIL_SYNC_REQ:
      MT_UtilSync();
      break;
#endif /* !defined NONWK */

    default:
      status = MT_RPC_ERR_COMMAND_ID;
      break;
  }

  return status;
}
Ejemplo n.º 2
0
/***************************************************************************************************
 * @fn      MT_UtilProcessing
 *
 * @brief   Process all the DEBUG commands that are issued by test tool
 *
 * @param   pBuf  - pointer to received SPI data message
 *
 * @return  status
 ***************************************************************************************************/
uint8 MT_UtilCommandProcessing(uint8 *pBuf)
{
  uint8 status = MT_RPC_SUCCESS;

  switch (pBuf[MT_RPC_POS_CMD1])
  {
    case MT_UTIL_GET_DEVICE_INFO:
      MT_UtilGetDeviceInfo();
      break;

    case MT_UTIL_GET_NV_INFO:
      MT_UtilGetNvInfo();
      break;

    case MT_UTIL_SET_PANID:
      MT_UtilSetPanID(pBuf);
      break;

    case MT_UTIL_SET_CHANNELS:
      MT_UtilSetChannels(pBuf);
      break;

    case MT_UTIL_SET_SECLEVEL:
      MT_UtilSetSecLevel(pBuf);
      break;

    case MT_UTIL_SET_PRECFGKEY:
      MT_UtilSetPreCfgKey(pBuf);
      break;

    case MT_UTIL_CALLBACK_SUB_CMD:
      MT_UtilCallbackSub(pBuf);
      break;

    case MT_UTIL_KEY_EVENT:
#if (defined HAL_KEY) && (HAL_KEY == TRUE)
      MT_UtilKeyEvent(pBuf);
#endif
      break;

    case MT_UTIL_LED_CONTROL:
#if (defined HAL_LED) && (HAL_LED == TRUE)
      MT_UtilLedControl(pBuf);
#endif
      break;

    case MT_UTIL_TIME_ALIVE:
      MT_UtilTimeAlive();
      break;

    case MT_UTIL_ADDRMGR_EXT_ADDR_LOOKUP:
      MT_UtilAddrMgrExtAddrLookup(pBuf);
      break;

    case MT_UTIL_ADDRMGR_NWK_ADDR_LOOKUP:
      MT_UtilAddrMgrEntryLookupNwk(pBuf);
      break;

    case MT_UTIL_APSME_LINK_KEY_DATA_GET:
      MT_UtilAPSME_LinkKeyDataGet(pBuf);
      break;

    case MT_UTIL_ASSOC_COUNT:
      MT_UtilAssocCount(pBuf);
      break;

    case MT_UTIL_ASSOC_FIND_DEVICE:
      MT_UtilAssocFindDevice(pBuf);
      break;

    case MT_UTIL_ASSOC_GET_WITH_ADDRESS:
      MT_UtilAssocGetWithAddress(pBuf);
      break;

#if defined ZCL_KEY_ESTABLISH
    case MT_UTIL_ZCL_KEY_EST_INIT_EST:
      MT_UtilzclGeneral_KeyEstablish_InitiateKeyEstablishment(pBuf);
      break;

    case MT_UTIL_ZCL_KEY_EST_SIGN:
      MT_UtilzclGeneral_KeyEstablishment_ECDSASign(pBuf);
      break;
#endif

    case MT_UTIL_SYNC_REQ:
      MT_UtilSync();
      break;

    default:
      status = MT_RPC_ERR_COMMAND_ID;
      break;
  }

  return status;
}