]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - keystone-rtos/netapi.git/blobdiff - ti/runtime/netapi/src/netapi_sched.c
Set qmQueMgmtProxyDataReg to NULL for k1, k2h
[keystone-rtos/netapi.git] / ti / runtime / netapi / src / netapi_sched.c
index 12fc2a97a1dfd2897d5cc6a87d23f7065a16e858..41988cb77571a224f3839cd1831949f88f558d76 100755 (executable)
@@ -8,7 +8,7 @@
  * DESCRIPTION:  netapi sample scheduler source file for user space transport
  *               library
  * 
- * REVISION HISTORY:  rev 0.0.1 
+ * REVISION HISTORY:
  *
  *  Copyright (c) Texas Instruments Incorporated 2013
  * 
 
 
 /********************************************************************
- * FUNCTION PURPOSE:  API to get  scheduling context statistics
+ * FUNCTION PURPOSE:  API to get scheduling context statistics
  ********************************************************************
- * DESCRIPTION:  API to get  scheduling context statistics
+ * DESCRIPTION:  API to get scheduling context statistics
  ********************************************************************/
 void netapi_schedGetStats(NETAPI_SCHED_HANDLE_T *s, 
-    unsigned long long * p_pkts, 
-    unsigned long long * p_cycles,
-    unsigned long long * p_cache_cycles)
+                          unsigned long long * p_pkts, 
+                          unsigned long long * p_cycles,
+                          unsigned long long * p_cache_cycles)
 {
    *p_pkts= s->stats.num_pkts;
    *p_cycles= s->stats.busy_cycles;
@@ -77,23 +77,34 @@ NETAPI_SCHED_HANDLE_T * netapi_schedOpen(NETAPI_T n,
 {
     *p_err=0;
      NETAPI_SCHED_HANDLE_T * ph = (NETAPI_SCHED_HANDLE_T *) netapi_get_scheduler(n);
-    if(!ph) {*p_err= NETAPI_ERR_NOMEM; return NULL;}
-    if(!p_config) {*p_err=  NETAPI_ERR_BAD_INPUT; return NULL;}
+    if(!ph)
+    {
+        *p_err= NETAPI_ERR_NOMEM;
+        return NULL;
+    }
+    if(!p_config)
+    {
+        *p_err=  NETAPI_ERR_BAD_INPUT; 
+        return NULL;
+    }
     memcpy(&ph->config,p_config,sizeof(NETAPI_SCHED_CONFIG_T));
     ph->start =   hplib_mUtilGetTimestamp();
     ph->back = (void *) n;
     if (ph->config.valid_flags & NETAPI_SCHED_DURATION)
     {
-      if (ph->config.duration == NETAPI_SCHED_FOREVER) 
-      {
-          ph->shutdown_time=(uint64_t) -1; 
-      }
-      else
-      {
-          ph->shutdown_time = ph->start + ph->config.duration;
-      }
+        if (ph->config.duration == NETAPI_SCHED_FOREVER) 
+        {
+            ph->shutdown_time=(uint64_t) -1; 
+        }
+        else
+        {
+            ph->shutdown_time = ph->start + ph->config.duration;
+        }
+    }
+    else
+    {
+        ph->shutdown_time = (uint64_t) -1;
     }
-    else ph->shutdown_time = (uint64_t) -1;
     ph->state =NETAPI_SCHED_STATE_OPEN; 
     return(ph);
 }
@@ -120,7 +131,8 @@ int netapi_schedControl(NETAPI_SCHED_HANDLE_T *s,
  * DESCRIPTION:  API to get NETAPI scheduling context statistics
  ********************************************************************/
 /* main entry point.  caller gives up control to scheduler */
-int netapi_schedRun(NETAPI_SCHED_HANDLE_T *s, int *p_err)
+int netapi_schedRun(NETAPI_SCHED_HANDLE_T *s,
+                    int *p_err)
 {
     int err;
     *p_err=0;
@@ -143,8 +155,8 @@ int netapi_schedRun(NETAPI_SCHED_HANDLE_T *s, int *p_err)
 
          cache_op_b2= Osal_cache_op_measure(&n_c_ops);
          t1=hplib_mUtilGetPmuCCNT();
-         //poll all  pktio channels we have open in RX mode 
-         pkts=pktio_pollAll((NETAPI_T) s->back, NULL, &err);
+         /* poll all  pktio channels we have open in RX mode */
+         pkts=netapi_pktioPollAll((NETAPI_T) s->back, NULL, &err);
          if (!pkts  && (s->config.yield == TRUE))
          {
             sched_yield();
@@ -158,27 +170,27 @@ int netapi_schedRun(NETAPI_SCHED_HANDLE_T *s, int *p_err)
             s->stats.cache_cycles += (unsigned long long) cache_op_b2;
          }
 
-        //poll pktlib garbage collections for registered heaps
+        /* poll pktlib garbage collections for registered heaps */
         if (TRUE == s->config.pollGarbageQ)
         {
             netapi_pollHeapGarbage((NETAPI_T) s->back);
         }
 
 
-        //poll NETCP/PA control channels 
+        /*poll NETCP/PA control channels */
         if (TRUE == s->config.pollCtrlQ)
         {
             netapi_netcpPoll((NETAPI_T) s->back);
         }
 
-        //see if time to do a house keeping callback
+        /* see if time to do a house keeping callback */
         if ((s->config.valid_flags & NETAPI_SCHED_CBV) && s->config.house_cb)
         if (next_house<=0)
         {
             s->config.house_cb(s);
             next_house = s->config.interval;
         }
-        //see if we were closed and/or its time to close
+        /* see if we were closed and/or its time to close */
         if (s->state!= NETAPI_SCHED_STATE_OPEN) 
         {
             s->state=NETAPI_SCHED_STATE_CLOSE;
@@ -194,12 +206,14 @@ int netapi_schedRun(NETAPI_SCHED_HANDLE_T *s, int *p_err)
  * DESCRIPTION:  API to close a scheduling context
  ********************************************************************/
 /* shutdown scheduler context */
-int netapi_schedClose(NETAPI_SCHED_HANDLE_T * s, NETAPI_SCHED_SHUTDOWN_T * p_close, int * p_err)
+int netapi_schedClose(NETAPI_SCHED_HANDLE_T * s, 
+                      NETAPI_SCHED_SHUTDOWN_T * p_close,
+                      int * p_err)
 {
     *p_err=0;
     if (p_close->shutdown_type == NETAPI_SCHED_SHUTDOWN_NOW)
     {
-        s->state=NETAPI_SCHED_STATE_CLOSE_IN_PROGRESS;  //say we are closing
+        s->state=NETAPI_SCHED_STATE_CLOSE_IN_PROGRESS;
     }
   return 1;
 }