Simulated product dispenser

Dependencies:   HTS221

Fork of mbed-cloud-workshop-connect-HTS221 by Jim Carver

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers pal_rtos_test_utils.h Source File

pal_rtos_test_utils.h

00001 /*******************************************************************************
00002  * Copyright 2016, 2017 ARM Ltd.
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  *******************************************************************************/
00016 
00017 #ifndef _PAL_RTOS_TEST_UTILS_H
00018 #define _PAL_RTOS_TEST_UTILS_H
00019 
00020 #include "pal.h"
00021 #include "pal_BSP.h"
00022 #if 0    //MUST MOVE TO PLATFORM SPECIFIC HEADER
00023 #include "fsl_device_registers.h"
00024 #include "fsl_debug_console.h"
00025 #include "board.h"
00026 
00027 #include "pin_mux.h"
00028 #include "clock_config.h"
00029 
00030 
00031 #define MUTEX_UNITY_TEST 1
00032 #define SEMAPHORE_UNITY_TEST 1
00033 #endif   // MUST MOVE TO PLATFORM SPECIFIC HEADER
00034 #define PAL_RANDOM_TEST_LOOP 100000
00035 #define PAL_RANDOM_ARRAY_TEST_SIZE 100
00036 #define PAL_RANDOM_BUFFER_ARRAY_TEST_SIZE 60
00037 #define PAL_TIME_TO_WAIT_MS 5000 //in [ms]
00038 #define PAL_TIME_TO_WAIT_SHORT_MS   300 //in [ms]
00039 #define PAL_TIMER_TEST_TIME_TO_WAIT_MS_SHORT 40 //in [ms]
00040 #define PAL_TIMER_TEST_TIME_TO_WAIT_MS_LONG 130 //in [ms]
00041 
00042 typedef struct threadsArgument{
00043     uint32_t arg1;
00044     uint32_t arg2;
00045     uint32_t arg3;
00046     uint32_t arg4;
00047     uint32_t arg5;
00048     uint32_t arg6;
00049     uint32_t arg7;
00050     uint8_t threadCounter;
00051 }threadsArgument_t;
00052 
00053 
00054 extern threadsArgument_t g_threadsArg;
00055 
00056 void palThreadFunc1(void const *argument);
00057 void palThreadFunc2(void const *argument);
00058 void palThreadFunc3(void const *argument);
00059 void palThreadFunc4(void const *argument);
00060 void palThreadFunc5(void const *argument);
00061 void palThreadFunc6(void const *argument);
00062 
00063 
00064 typedef struct timerArgument{
00065     uint32_t ticksBeforeTimer;
00066     uint32_t ticksInFunc1;
00067     uint32_t ticksInFunc2;
00068 }timerArgument_t;
00069 
00070 extern timerArgument_t g_timerArgs;
00071 
00072 void palTimerFunc1(void const *argument);
00073 void palTimerFunc2(void const *argument);
00074 void palTimerFunc3(void const *argument);
00075 void palTimerFunc4(void const *argument);
00076 void palTimerFunc5(void const *argument);
00077 
00078 
00079 void palThreadFuncWaitForEverTest(void const *argument);
00080 
00081 void RecursiveLockThread(void const *param);
00082 typedef struct palRecursiveMutexParam{
00083     palMutexID_t mtx;
00084     palSemaphoreID_t sem;
00085     size_t count;
00086     palThreadID_t higherPriorityThread;
00087     palThreadID_t lowerPriorityThread;
00088     palThreadID_t activeThread;
00089 } palRecursiveMutexParam_t;
00090 
00091 #define MEMORY_POOL1_BLOCK_SIZE 32
00092 #define MEMORY_POOL1_BLOCK_COUNT 5
00093 #define MEMORY_POOL2_BLOCK_SIZE 12
00094 #define MEMORY_POOL2_BLOCK_COUNT 4
00095 
00096 extern palMutexID_t mutex1;
00097 extern palMutexID_t mutex2;
00098 
00099 extern palSemaphoreID_t semaphore1;
00100 
00101 #endif //_PAL_RTOS_TEST_UTILS_H