MotorWare f2806x Module API Documentation

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

cpu_usage.c
Go to the documentation of this file.
1
7
8 // **************************************************************************
9 // the includes
10
11 #include "sw/modules/cpu_usage/src/32b/cpu_usage.h"
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
34 void CPU_USAGE_setParams(CPU_USAGE_Handle handle,
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);
45 CPU_USAGE_setDeltaCntAccNum(handle,0);
46 CPU_USAGE_setDeltaCntAccNumMax(handle,numDeltaCntsAvg);
47
48 CPU_USAGE_setMinDeltaCntObserved(handle,timerPeriod_cnts);
49 CPU_USAGE_setAvgDeltaCntObserved(handle,0);
50 CPU_USAGE_setMaxDeltaCntObserved(handle,0);
51
52 CPU_USAGE_setFlag_resetStats(handle,false);
53
54 return;
55 } // end of CPU_USAGE_setParams() function
56
57 // end of file
CPU_USAGE_Handle
struct _CPU_USAGE_Obj_ * CPU_USAGE_Handle
Defines the CPU_USAGE handle.
Definition: cpu_usage.h:61
CPU_USAGE_setCnt_z0
static void CPU_USAGE_setCnt_z0(CPU_USAGE_Handle handle, const uint32_t cnt)
Sets the current count value.
Definition: cpu_usage.h:216
CPU_USAGE_setDeltaCntAcc
static void CPU_USAGE_setDeltaCntAcc(CPU_USAGE_Handle handle, const uint32_t deltaCntAcc)
Sets the accumulated delta counts value.
Definition: cpu_usage.h:255
cpu_usage.h
Contains the public interface to the CPU usage (CPU_USAGE) module routines.
CPU_USAGE_setFlag_resetStats
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
CPU_USAGE_setDeltaCnt
static void CPU_USAGE_setDeltaCnt(CPU_USAGE_Handle handle, const uint32_t deltaCnt)
Sets the delta count value.
Definition: cpu_usage.h:242
CPU_USAGE_setMinDeltaCntObserved
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
CPU_USAGE_setDeltaCntAccNumMax
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
CPU_USAGE_setMaxDeltaCntObserved
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
CPU_USAGE_setTimerPeriod
static void CPU_USAGE_setTimerPeriod(CPU_USAGE_Handle handle, const uint32_t timerPeriod_cnts)
Sets the timer period, cnts.
Definition: cpu_usage.h:203
CPU_USAGE_setParams
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_init
CPU_USAGE_Handle CPU_USAGE_init(void *pMemory, const size_t numBytes)
Initializes the CPU usage (CPU_USAGE) object.
Definition: cpu_usage.c:21
CPU_USAGE_setDeltaCntAccNum
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
CPU_USAGE_setAvgDeltaCntObserved
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
_CPU_USAGE_Obj_
Defines the CPU usage (CPU_USAGE) object.
Definition: cpu_usage.h:40
CPU_USAGE_setCnt_z1
static void CPU_USAGE_setCnt_z1(CPU_USAGE_Handle handle, const uint32_t cnt)
Sets the previous count value.
Definition: cpu_usage.h:229