leo hendrickson / Mbed OS example-Ethernet-mbed-Cloud-connect
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 
00022 // XXX: remove this block completely once all the tests pass again
00023 #if 0    //MUST MOVE TO PLATFORM SPECIFIC HEADER
00024 #include "fsl_device_registers.h"
00025 #include "fsl_debug_console.h"
00026 #include "board.h"
00027 
00028 #include "pin_mux.h"
00029 #include "clock_config.h"
00030 
00031 
00032 #define MUTEX_UNITY_TEST 1
00033 #define SEMAPHORE_UNITY_TEST 1
00034 #endif   // MUST MOVE TO PLATFORM SPECIFIC HEADER
00035 #define PAL_TIME_TO_WAIT_MS 5000 //in [ms]
00036 #define PAL_TIME_TO_WAIT_SHORT_MS   300 //in [ms]
00037 #define PAL_TIMER_TEST_TIME_TO_WAIT_MS_SHORT 40 //in [ms]
00038 #define PAL_TIMER_TEST_TIME_TO_WAIT_MS_LONG 130 //in [ms]
00039 
00040 typedef struct threadsArgument{
00041     uint32_t arg1;
00042     uint32_t arg2;
00043     uint32_t arg3;
00044     uint32_t arg4;
00045     uint32_t arg5;
00046     uint32_t arg6;
00047     uint32_t arg7;
00048     uint8_t threadCounter;
00049 }threadsArgument_t;
00050 
00051 
00052 extern threadsArgument_t g_threadsArg;
00053 
00054 void palThreadFunc1(void const *argument);
00055 void palThreadFunc2(void const *argument);
00056 void palThreadFunc3(void const *argument);
00057 void palThreadFunc4(void const *argument);
00058 void palThreadFunc5(void const *argument);
00059 void palThreadFunc6(void const *argument);
00060 
00061 
00062 typedef struct timerArgument{
00063     uint32_t ticksBeforeTimer;
00064     uint32_t ticksInFunc1;
00065     uint32_t ticksInFunc2;
00066 }timerArgument_t;
00067 
00068 extern volatile timerArgument_t g_timerArgs;
00069 
00070 void palTimerFunc1(void const *argument);
00071 void palTimerFunc2(void const *argument);
00072 void palTimerFunc3(void const *argument);
00073 void palTimerFunc4(void const *argument);
00074 void palTimerFunc5(void const *argument);
00075 void palTimerFunc6(void const *argument);
00076 void palTimerFunc7(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