Platform/ECM3532/M3/framework/serial_proto/src/serial_proto.c
int sendCmdResp(uint8_t cmd, uint32_t val)
{
  tRespPkt *respPkt;
  tPktHdr *pktHdr;
  uint8_t *buf;
  uint8_t bufLen;

  bufLen = sizeof(tPktHdr) +  sizeof(tRespPkt);
  buf = pvPortMalloc(bufLen);
  if (buf)
  {
    xSemaphoreTake(spDev.xSPLock, portMAX_DELAY);
    spDev.st = RESP_ST;
    pktHdr = (tPktHdr *)buf;
    pktHdr->sof = SOF;
    pktHdr->ptype = CMD_RESP;
    pktHdr->plen = sizeof(tRespPkt);

    respPkt = (tRespPkt *)(buf + sizeof(tPktHdr));
    respPkt->cmd = cmd;
    respPkt->resp = val;
    xportSend(buf, bufLen);
    spDev.st = DONE;
    xSemaphoreGive(spDev.xSPLock);
    vPortFree(buf);
  }
  return 0;
}
/**
 * form and send Response of command
 *
 * @param event value
 * @param val event data
 * @return 0 on success, non-zero error code on failure
 *
 */
form and send Response of command
@param event value
@param val event data
@return 0 on success, non-zero error code on failure
form and send Response of command @param event value @param val event data @return 0 on success non - zero error code on failure
int sendCmdResp(uint8_t cmd, uint32_t val)
{
  tRespPkt *respPkt;
  tPktHdr *pktHdr;
  uint8_t *buf;
  uint8_t bufLen;
  bufLen = sizeof(tPktHdr) +  sizeof(tRespPkt);
  buf = pvPortMalloc(bufLen);
  if (buf)
  {
    xSemaphoreTake(spDev.xSPLock, portMAX_DELAY);
    spDev.st = RESP_ST;
    pktHdr = (tPktHdr *)buf;
    pktHdr->sof = SOF;
    pktHdr->ptype = CMD_RESP;
    pktHdr->plen = sizeof(tRespPkt);
    respPkt = (tRespPkt *)(buf + sizeof(tPktHdr));
    respPkt->cmd = cmd;
    respPkt->resp = val;
    xportSend(buf, bufLen);
    spDev.st = DONE;
    xSemaphoreGive(spDev.xSPLock);
    vPortFree(buf);
  }
  return 0;
}
int sendCmdResp ( uint8_t cmd , uint32_t val ) { tRespPkt * respPkt ; tPktHdr * pktHdr ; uint8_t * buf ; uint8_t bufLen ; bufLen = sizeof ( tPktHdr ) + sizeof ( tRespPkt ) ; buf = pvPortMalloc ( bufLen ) ; if ( buf ) { xSemaphoreTake ( spDev . xSPLock , portMAX_DELAY ) ; spDev . st = RESP_ST ; pktHdr = ( tPktHdr * ) buf ; pktHdr -> sof = SOF ; pktHdr -> ptype = CMD_RESP ; pktHdr -> plen = sizeof ( tRespPkt ) ; respPkt = ( tRespPkt * ) ( buf + sizeof ( tPktHdr ) ) ; respPkt -> cmd = cmd ; respPkt -> resp = val ; xportSend ( buf , bufLen ) ; spDev . st = DONE ; xSemaphoreGive ( spDev . xSPLock ) ; vPortFree ( buf ) ; } return 0 ; }
form and send Response of command
 @param event value
 @param val event data
 @return 0 on success, non-zero error code on failure
form and send Response of command @param event value @param val event data @return 0 on success non - zero error code on failure