Simple interface for Mbed Cloud Client

Dependents:  

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 extern palThreadLocalStore_t g_threadStorage;
00057 
00058 void palThreadFunc1(void const *argument);
00059 void palThreadFunc2(void const *argument);
00060 void palThreadFunc3(void const *argument);
00061 void palThreadFunc4(void const *argument);
00062 void palThreadFunc5(void const *argument);
00063 void palThreadFunc6(void const *argument);
00064 
00065 
00066 typedef struct timerArgument{
00067     uint32_t ticksBeforeTimer;
00068     uint32_t ticksInFunc1;
00069     uint32_t ticksInFunc2;
00070 }timerArgument_t;
00071 
00072 extern timerArgument_t g_timerArgs;
00073 
00074 void palTimerFunc1(void const *argument);
00075 void palTimerFunc2(void const *argument);
00076 void palTimerFunc3(void const *argument);
00077 void palTimerFunc4(void const *argument);
00078 void palTimerFunc5(void const *argument);
00079 
00080 
00081 void palThreadFuncCustom1(void const *argument);
00082 void palThreadFuncCustom2(void const *argument);
00083 void palThreadFuncCustom3(void const *argument);
00084 void palThreadFuncCustom4(void const *argument);
00085 void palThreadFuncWaitForEverTest(void const *argument);
00086 
00087 void RecursiveLockThread(void const *param);
00088 typedef struct palRecursiveMutexParam{
00089     palMutexID_t mtx;
00090     palSemaphoreID_t sem;
00091     size_t count;
00092     palThreadID_t higherPriorityThread;
00093     palThreadID_t lowerPriorityThread;
00094     palThreadID_t activeThread;
00095 } palRecursiveMutexParam_t;
00096 
00097 #define MEMORY_POOL1_BLOCK_SIZE 32
00098 #define MEMORY_POOL1_BLOCK_COUNT 5
00099 #define MEMORY_POOL2_BLOCK_SIZE 12
00100 #define MEMORY_POOL2_BLOCK_COUNT 4
00101 
00102 extern palMutexID_t mutex1;
00103 extern palMutexID_t mutex2;
00104 
00105 extern palSemaphoreID_t semaphore1;
00106 
00107 #endif //_PAL_RTOS_TEST_UTILS_H