Exemplo n.º 1
0
ec_timet osal_current_time(void)
{
   struct timeval current_time;
   ec_timet return_value;

   osal_gettimeofday(&current_time, 0);
   return_value.sec = current_time.tv_sec;
   return_value.usec = current_time.tv_usec;
   return return_value;
}
Exemplo n.º 2
0
boolean osal_timer_is_expired (osal_timert * self)
{
   struct timeval current_time;
   struct timeval stop_time;
   int is_not_yet_expired;

   osal_gettimeofday(&current_time, 0);
   stop_time.tv_sec = self->stop_time.sec;
   stop_time.tv_usec = self->stop_time.usec;
   is_not_yet_expired = timercmp(&current_time, &stop_time, <);

   return is_not_yet_expired == FALSE;
}
Exemplo n.º 3
0
void osal_timer_start(osal_timert * self, uint32 timeout_usec)
{
   struct timeval start_time;
   struct timeval timeout;
   struct timeval stop_time;

   osal_gettimeofday(&start_time, 0);
   timeout.tv_sec = timeout_usec / USECS_PER_SEC;
   timeout.tv_usec = timeout_usec % USECS_PER_SEC;
   timeradd(&start_time, &timeout, &stop_time);

   self->stop_time.sec = stop_time.tv_sec;
   self->stop_time.usec = stop_time.tv_usec;
}
Exemplo n.º 4
0
static INT32 stp_dbg_fill_hdr (struct stp_dbg_pkt_hdr *hdr, INT32 type, INT32 ack, INT32 seq, INT32 crc, INT32 dir, INT32 len, INT32 dbg_type)
{
    INT32 sec = 0;
    INT32 usec = 0;

    if (!hdr){
        STP_DBG_ERR_FUNC("function invalid\n");
        return -22;
    } else {
        osal_gettimeofday(&sec,&usec);
        hdr->dbg_type = dbg_type;
        hdr->ack = ack;
        hdr->seq = seq;
        hdr->sec = sec;
        hdr->usec = usec;
        hdr->crc  = crc;
        hdr->dir  = dir;//rx
        hdr->dmy  = 0xffffffff;
        hdr->len  =  len;
        hdr->type = type;

        return 0;
    }
}