MotorWare f2806x Module API Documentation
cpu_usage.c
Go to the documentation of this file.
1 
7 
8 // **************************************************************************
9 // the includes
10 
12 
13 
14 // **************************************************************************
15 // the globals
16 
17 
18 // **************************************************************************
19 // the functions
20 
21 CPU_USAGE_Handle CPU_USAGE_init(void *pMemory,const size_t numBytes)
22 {
23  CPU_USAGE_Handle handle;
24 
25  if(numBytes < sizeof(CPU_USAGE_Obj))
26  return((CPU_USAGE_Handle)NULL);
27 
28  // assign the handle
29  handle = (CPU_USAGE_Handle)pMemory;
30 
31  return(handle);
32 } // end of CPU_USAGE_init() function
33 
35  const uint32_t timerPeriod_cnts,
36  const uint32_t numDeltaCntsAvg)
37 {
38  CPU_USAGE_setTimerPeriod(handle,timerPeriod_cnts);
39 
40  CPU_USAGE_setCnt_z0(handle,0);
41  CPU_USAGE_setCnt_z1(handle,0);
42  CPU_USAGE_setDeltaCnt(handle,0);
43 
44  CPU_USAGE_setDeltaCntAcc(handle,0);
46  CPU_USAGE_setDeltaCntAccNumMax(handle,numDeltaCntsAvg);
47 
48  CPU_USAGE_setMinDeltaCntObserved(handle,timerPeriod_cnts);
51 
52  CPU_USAGE_setFlag_resetStats(handle,false);
53 
54  return;
55 } // end of CPU_USAGE_setParams() function
56 
57 // end of file
struct _CPU_USAGE_Obj_ * CPU_USAGE_Handle
Defines the CPU_USAGE handle.
Definition: cpu_usage.h:61
static void CPU_USAGE_setCnt_z0(CPU_USAGE_Handle handle, const uint32_t cnt)
Sets the current count value.
Definition: cpu_usage.h:216
static void CPU_USAGE_setDeltaCntAcc(CPU_USAGE_Handle handle, const uint32_t deltaCntAcc)
Sets the accumulated delta counts value.
Definition: cpu_usage.h:255
Contains the public interface to the CPU usage (CPU_USAGE) module routines.
static void CPU_USAGE_setFlag_resetStats(CPU_USAGE_Handle handle, const bool state)
Sets the state of the reset stats flag.
Definition: cpu_usage.h:333
static void CPU_USAGE_setDeltaCnt(CPU_USAGE_Handle handle, const uint32_t deltaCnt)
Sets the delta count value.
Definition: cpu_usage.h:242
static void CPU_USAGE_setMinDeltaCntObserved(CPU_USAGE_Handle handle, const uint32_t minDeltaCnt)
Sets the minimum delta count observed, cnts.
Definition: cpu_usage.h:294
static void CPU_USAGE_setDeltaCntAccNumMax(CPU_USAGE_Handle handle, const uint32_t deltaCntAccNumMax)
Sets the maximum number of accumulated delta counts.
Definition: cpu_usage.h:281
static void CPU_USAGE_setMaxDeltaCntObserved(CPU_USAGE_Handle handle, const uint32_t maxDeltaCnt)
Sets the maximum delta count observed, cnts.
Definition: cpu_usage.h:320
static void CPU_USAGE_setTimerPeriod(CPU_USAGE_Handle handle, const uint32_t timerPeriod_cnts)
Sets the timer period, cnts.
Definition: cpu_usage.h:203
void CPU_USAGE_setParams(CPU_USAGE_Handle handle, const uint32_t timerPeriod_cnts, const uint32_t numDeltaCntsAvg)
Sets the CPU usage module parameters.
Definition: cpu_usage.c:34
CPU_USAGE_Handle CPU_USAGE_init(void *pMemory, const size_t numBytes)
Initializes the CPU usage (CPU_USAGE) object.
Definition: cpu_usage.c:21
static void CPU_USAGE_setDeltaCntAccNum(CPU_USAGE_Handle handle, const uint32_t deltaCntAccNum)
Sets the number of accumulated delta counts.
Definition: cpu_usage.h:268
static void CPU_USAGE_setAvgDeltaCntObserved(CPU_USAGE_Handle handle, const uint32_t avgDeltaCnt)
Sets the average delta count observed, cnts.
Definition: cpu_usage.h:307
Defines the CPU usage (CPU_USAGE) object.
Definition: cpu_usage.h:40
static void CPU_USAGE_setCnt_z1(CPU_USAGE_Handle handle, const uint32_t cnt)
Sets the previous count value.
Definition: cpu_usage.h:229