MotorWare f2806x Module API Documentation

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

fem.c
Go to the documentation of this file.
1
7
8 // **************************************************************************
9 // the includes
10
11 #include "sw/modules/fem/src/32b/fem.h"
12
13
14 // **************************************************************************
15 // the globals
16
17
18 // **************************************************************************
19 // the functions
20
21 FEM_Handle FEM_init(void *pMemory,const size_t numBytes)
22 {
23 FEM_Handle handle;
24
25 if(numBytes < sizeof(FEM_Obj))
26 return((FEM_Handle)NULL);
27
28 // assign the handle
29 handle = (FEM_Handle)pMemory;
30
31 return(handle);
32 } // end of FEM_init() function
33
34
35 void FEM_setParams(FEM_Handle handle,
36 const float_t timerFreq_Hz,
37 const uint32_t timerPeriod_cnts,
38 const float_t spFreq_Hz,
39 const float_t maxFreqError_Hz)
40 {
41 uint32_t maxDeltaCnt = (uint32_t)(timerFreq_Hz/(spFreq_Hz - maxFreqError_Hz));
42 uint32_t minDeltaCnt = (uint32_t)(timerFreq_Hz/(spFreq_Hz + maxFreqError_Hz));
43
44 FEM_setTimerPeriod(handle,timerPeriod_cnts);
45
46 FEM_setCnt_z0(handle,0);
47 FEM_setCnt_z1(handle,0);
48 FEM_setDeltaCnt(handle,0);
49
50 FEM_setMaxDeltaCnt(handle,maxDeltaCnt);
51 FEM_setMaxDeltaCntObserved(handle,0);
52 FEM_setMinDeltaCnt(handle,minDeltaCnt);
53
54 FEM_setErrorCnt(handle,0);
55 FEM_setFlag_freqError(handle,false);
56
57 return;
58 } // end of FEM_setParams() function
59
60 // end of file
FEM_setFlag_freqError
static void FEM_setFlag_freqError(FEM_Handle handle, const bool state)
Sets the state of the frequency error flag.
Definition: fem.h:243
FEM_setDeltaCnt
static void FEM_setDeltaCnt(FEM_Handle handle, const uint32_t deltaCnt)
Sets the delta count value.
Definition: fem.h:217
FEM_setMinDeltaCnt
static void FEM_setMinDeltaCnt(FEM_Handle handle, const uint32_t minDeltaCnt)
Sets the minimum delta count, cnts.
Definition: fem.h:282
FEM_setParams
void FEM_setParams(FEM_Handle handle, const float_t timerFreq_Hz, const uint32_t timerPeriod_cnts, const float_t spFreq_Hz, const float_t maxFreqError_Hz)
Sets the frequency of execution monitoring parameters, cnts.
Definition: fem.c:35
FEM_setErrorCnt
static void FEM_setErrorCnt(FEM_Handle handle, const uint32_t numErrors)
Sets the error count.
Definition: fem.h:230
fem.h
Contains the public interface to the frequency of execution monitoring(FEM) module routines...
FEM_setMaxDeltaCntObserved
static void FEM_setMaxDeltaCntObserved(FEM_Handle handle, const uint32_t maxDeltaCnt)
Sets the maximum delta count observed, cnts.
Definition: fem.h:269
_FEM_Obj_
Defines the frequency of execution monitoring (FEM) object.
Definition: fem.h:40
FEM_setCnt_z0
static void FEM_setCnt_z0(FEM_Handle handle, const uint32_t cnt)
Sets the current count value.
Definition: fem.h:191
FEM_setMaxDeltaCnt
static void FEM_setMaxDeltaCnt(FEM_Handle handle, const uint32_t maxDeltaCnt)
Sets the maximum delta count, cnts.
Definition: fem.h:256
FEM_setCnt_z1
static void FEM_setCnt_z1(FEM_Handle handle, const uint32_t cnt)
Sets the previous count value.
Definition: fem.h:204
FEM_Handle
struct _FEM_Obj_ * FEM_Handle
Defines the FEM handle.
Definition: fem.h:60
FEM_init
FEM_Handle FEM_init(void *pMemory, const size_t numBytes)
Initializes the frequency of execution monitoring (FEM) object.
Definition: fem.c:21
FEM_setTimerPeriod
static void FEM_setTimerPeriod(FEM_Handle handle, const uint32_t timerPeriod_cnts)
Sets the timer period, cnts.
Definition: fem.h:308
float_t
float float_t
Defines the portable data type for 32 bit, signed floating-point data.
Definition: types.h:121