ccNOos  v0.0.0
Build Portable Microcontroller Applications!
Macros | Functions
Application_Solution.c File Reference

Cross-Platform Portable ccNOos Tests Definitions. More...

#include "Application_Solution.h"
Include dependency graph for Application_Solution.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define uSNOW   MODdataPTR(Mn)->ui32_0
 
#define uSTHEN   MODdataPTR(Mn)->ui32_1
 
#define LOOPCYCLES   MODdataPTR(Mn)->ui16_0
 

Functions

MODdeclareCREATE() Mn (MODdeclareCREATEINS)
 
 MODdeclareSETUP (Mn)
 
 MODdeclareLOOP (Mn)
 
 MODdeclareSYSTICK (Mn)
 
UI_16 TimedExecutionTest (MODdeclarePTRIN(Mn))
 
UI_16 ExceptionsTest (MODdeclarePTRIN(Mn))
 

Detailed Description

Cross-Platform Portable ccNOos Tests Definitions.

Copyright 2021 InMechaSol, Inc

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Notes:

This source demonstrates the usage of the ccNOos library and its dependence on other files in the library. A platform specific main(.c,.cpp) file need only instantiate, configure, then execute the execution system.

Definition in file Application_Solution.c.

Macro Definition Documentation

◆ LOOPCYCLES

#define LOOPCYCLES   MODdataPTR(Mn)->ui16_0

◆ uSNOW

#define uSNOW   MODdataPTR(Mn)->ui32_0

◆ uSTHEN

#define uSTHEN   MODdataPTR(Mn)->ui32_1

Function Documentation

◆ ExceptionsTest()

UI_16 ExceptionsTest ( MODdeclarePTRIN(Mn )

Definition at line 403 of file Application_Solution.c.

404 {
405 
406  return RETURN_TEST_PASSED;
407 }

◆ Mn()

Definition at line 29 of file Application_Solution.c.

30 {
31  MODdeclareSTRUCT(Mn) outStruct;
32  outStruct.compMod = CreateComputeModuleStruct();
33 
34  outStruct.float_0 = 0.0;
35  outStruct.float_1 = outStruct.float_0;
36  outStruct.double_0 = 0.0;
37  outStruct.double_1 = outStruct.double_0;
38 
39  outStruct.ui64_0 = 0.0;
40  outStruct.ui64_1 = outStruct.ui64_0;
41  outStruct.i64_0 = 0.0;
42  outStruct.i64_1 = outStruct.i64_0;
43 
44  outStruct.ui32_0 = 0.0;
45  outStruct.ui32_1 = outStruct.ui32_0;
46  outStruct.i32_0 = 0.0;
47  outStruct.i32_1 = outStruct.i32_0;
48 
49  outStruct.ui16_0 = 0.0;
50  outStruct.ui16_1 = outStruct.ui16_0;
51  outStruct.i16_0 = 0.0;
52  outStruct.i16_1 = outStruct.i16_0;
53 
54  outStruct.ui8_0 = 0.0;
55  outStruct.ui8_1 = outStruct.ui8_0;
56  outStruct.i8_0 = 0.0;
57  outStruct.i8_1 = outStruct.i8_0;
58 
59  outStruct.charsRead = 1u;
60  outStruct.chars2Write = 0u;
61 
62 #ifdef __USINGCONSOLEMENU
63  UI_8 i = 0;
64  for (i = 0; i < charBuffMax; i++)
65  outStruct.charbuff_In[i] = 0x00;
66  for (i = 0; i < charBuffMax; i++)
67  outStruct.charbuff_Out[i] = 0x00;
68 
69 #endif
70 
71  outStruct.SerializationTestReturn = RETURN_TEST_PASSED;
72  outStruct.TestState = 0x0000;
73 
74  return outStruct;
75 }

◆ MODdeclareLOOP()

MODdeclareLOOP ( Mn  )

Definition at line 116 of file Application_Solution.c.

117 {
119 
120  UI_16 TestReturn = 0;
121  switch (MODdataPTR(Mn)->TestState)
122  {
123  case 0x0000:// Timed Execution Loop Test
124  TestReturn = TimedExecutionTest(MODdataPTR(Mn));
125  MODdataPTR(Mn)->TimedExecutionTestReturn = TestReturn;
126  if (TestReturn != RETURN_TEST_IN_PROGRESS)
127  MODdataPTR(Mn)->TestState++;
128  break;
129  case 0x0001:// Exception Loop Test
130  TestReturn = ExceptionsTest(MODdataPTR(Mn));
131  MODdataPTR(Mn)->ExceptionsTestReturn = TestReturn;
132  if (TestReturn != RETURN_TEST_IN_PROGRESS)
133  MODdataPTR(Mn)->TestState++;
134  break;
135  default:// Done!!!
136  if (MODdataPTR(Mn)->SerializationTestReturn == RETURN_TEST_PASSED
137  && MODdataPTR(Mn)->TimedExecutionTestReturn == RETURN_TEST_PASSED
138  && MODdataPTR(Mn)->ExceptionsTestReturn == RETURN_TEST_PASSED)
139  MODdataPTR(Mn)->TestState = 0xffff;
140  else
141  MODdataPTR(Mn)->TestState = 0xfffe;
142  break;
143  case 0xfffe:// Done - Failed
144  case 0xffff:// Done - Passed
145 #ifdef __USINGCONSOLEMENU
146  MODdataPTR(Mn)->ui16_0 = MODprintMENU(Mn)(compModPtrIn);
147  MODdataPTR(Mn)->ui16_0 = MODparseINPUT(Mn)(compModPtrIn);
148 #endif
149  break;
150  }
151 
152 
153 
154  return RETURN_SUCCESS;
155 }

◆ MODdeclareSETUP()

MODdeclareSETUP ( Mn  )

Definition at line 79 of file Application_Solution.c.

80 {
82 
83  // Setup is running in the loop area to handle exceptions...
85  {
86  CLEAR_MODULE_ERRORS(Mn); // do nothing, clear flags
87  }
88  // Setup is running in the setup area following power on
89  else
90  {
91  UI_16 TestReturn = 0;
92  TestReturn = ExceptionsTest(MODdataPTR(Mn));
93  MODdataPTR(Mn)->ExceptionsTestReturn = TestReturn;
94 
95  // Basic Platfrom Serialization / Deserialization if Included
96 #ifdef __USINGCONSOLEMENU
97  TestReturn = SerializationTest(MODdataPTR(Mn));
98  MODdataPTR(Mn)->SerializationTestReturn = TestReturn;
99  MODdataPTR(Mn)->charbuff_In[0] = ';';
100  MODdataPTR(Mn)->ui16_0 = MODprintMENU(Mn)(compModPtrIn);
101  //MODdataPTR(Mn)->ui16_0 = MODparseINPUT(Mn)(compModPtrIn);
102 #endif
103 
104 // initialize values for timedexecutiontest in loop
105  MODdataPTR(Mn)->ui32_0 = 0;
106  MODdataPTR(Mn)->ui32_1 = 0;
107  MODdataPTR(Mn)->ui16_0 = 0;
108  MODdataPTR(Mn)->ui16_1 = 0;
109 
110 
111  }
112  return RETURN_SUCCESS;
113 }

◆ MODdeclareSYSTICK()

MODdeclareSYSTICK ( Mn  )

Definition at line 157 of file Application_Solution.c.

157 { ; } // do nothing in the systick area

◆ TimedExecutionTest()

UI_16 TimedExecutionTest ( MODdeclarePTRIN(Mn )

Definition at line 376 of file Application_Solution.c.

377 {
378 #define uSNOW MODdataPTR(Mn)->ui32_0
379 #define uSTHEN MODdataPTR(Mn)->ui32_1
380 #define LOOPCYCLES MODdataPTR(Mn)->ui16_0
381 
382  uSNOW = getuSecTicks();
383 
384  if (++LOOPCYCLES == 0)
386  else if (LOOPCYCLES == 1)
387  uSTHEN = getuSecTicks();
388 
389  if ((uSNOW - uSTHEN) >= getuSecPerSysTick())
390  {
391  LOOPCYCLES = 0;
392  return RETURN_TEST_PASSED;
393  }
394  else
395  {
397  }
398 
399 #undef uSNOW
400 #undef uSTHEN
401 #undef LOOPCYCLES
402 }
TimedExecutionTest
UI_16 TimedExecutionTest(MODdeclarePTRIN(Mn))
Definition: Application_Solution.c:376
LOOPCYCLES
#define LOOPCYCLES
Mn
MODdeclareCREATE() Mn(MODdeclareCREATEINS)
Definition: Application_Solution.c:29
CLEAR_MODULE_ERRORS
#define CLEAR_MODULE_ERRORS(mNAME)
Definition: version_config.h:339
MODprintMENU
#define MODprintMENU(mNAME)
Definition: version_config.h:260
MODDATAPTR_ERROR_RETURN
#define MODDATAPTR_ERROR_RETURN(mNAME)
Definition: version_config.h:331
getuSecTicks
UI_32 getuSecTicks()
IF_MODULE_ERROR
#define IF_MODULE_ERROR(mNAME)
Definition: version_config.h:335
MODparseINPUT
#define MODparseINPUT(mNAME)
Definition: version_config.h:264
uSNOW
#define uSNOW
ExceptionsTest
UI_16 ExceptionsTest(MODdeclarePTRIN(Mn))
Definition: Application_Solution.c:403
uSTHEN
#define uSTHEN
getuSecPerSysTick
UI_32 getuSecPerSysTick()
charBuffMax
#define charBuffMax
Definition: version_config.h:78
MODdeclareSTRUCT
#define MODdeclareSTRUCT(mNAME)
Definition: version_config.h:277
MODdataPTR
#define MODdataPTR(mNAME)
Definition: version_config.h:244
RETURN_TEST_IN_PROGRESS
#define RETURN_TEST_IN_PROGRESS
Definition: Application_Solution.h:76
RETURN_TEST_PASSED
#define RETURN_TEST_PASSED
Definition: Application_Solution.h:75
RETURN_FAILED_TIMEDEXECUTION
#define RETURN_FAILED_TIMEDEXECUTION
Definition: Application_Solution.h:77
CreateComputeModuleStruct
struct computeModuleStruct CreateComputeModuleStruct()
Definition: compute_module.c:30
RETURN_SUCCESS
#define RETURN_SUCCESS
Function Return Value for Success.
Definition: version_config.h:87