Platform/ECM3532/M3/framework/serial_proto/src/serial_proto.c
/**
 * form and send Event
 *
 * @param event value
 * @param val event data
 * @return 0 on success, non-zero error code on failure
 *
 */
form and send Event
@param event value
@param val event data
@return 0 on success, non-zero error code on failure
form and send Event @param event value @param val event data @return 0 on success non - zero error code on failure
int sendEvent(uint8_t event, uint32_t val)
{
  tEventPkt *eventPkt;
  tPktHdr *pktHdr;
  uint8_t *buf;
  uint8_t bufLen;
  bufLen = sizeof(tPktHdr) +  sizeof(tEventPkt);
  buf = pvPortMalloc(bufLen);
  if (buf)
  {
    xSemaphoreTake(spDev.xSPLock, portMAX_DELAY);
    spDev.st = EVENT_ST;
    pktHdr = (tPktHdr *)buf;
    pktHdr->sof = SOF;
    pktHdr->ptype = EVENT;
    pktHdr->plen = sizeof(tEventPkt);
    eventPkt = (tEventPkt *)(buf + sizeof(tPktHdr));
    eventPkt->event = event;
    eventPkt->val = val;
    xportSend(buf, bufLen);
    spDev.st = DONE;
    xSemaphoreGive(spDev.xSPLock);
    vPortFree(buf);
  }
  return 0;
}
int sendEvent ( uint8_t event , uint32_t val ) { tEventPkt * eventPkt ; tPktHdr * pktHdr ; uint8_t * buf ; uint8_t bufLen ; bufLen = sizeof ( tPktHdr ) + sizeof ( tEventPkt ) ; buf = pvPortMalloc ( bufLen ) ; if ( buf ) { xSemaphoreTake ( spDev . xSPLock , portMAX_DELAY ) ; spDev . st = EVENT_ST ; pktHdr = ( tPktHdr * ) buf ; pktHdr -> sof = SOF ; pktHdr -> ptype = EVENT ; pktHdr -> plen = sizeof ( tEventPkt ) ; eventPkt = ( tEventPkt * ) ( buf + sizeof ( tPktHdr ) ) ; eventPkt -> event = event ; eventPkt -> val = val ; xportSend ( buf , bufLen ) ; spDev . st = DONE ; xSemaphoreGive ( spDev . xSPLock ) ; vPortFree ( buf ) ; } return 0 ; }
form and send Event
 @param event value
 @param val event data
 @return 0 on success, non-zero error code on failure
form and send Event @param event value @param val event data @return 0 on success non - zero error code on failure