Fork for workshops

Committer:
JimCarver
Date:
Fri Oct 12 21:22:49 2018 +0000
Revision:
0:6b753f761943
Initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
JimCarver 0:6b753f761943 1 /*******************************************************************************
JimCarver 0:6b753f761943 2 * Copyright 2016, 2017 ARM Ltd.
JimCarver 0:6b753f761943 3 *
JimCarver 0:6b753f761943 4 * Licensed under the Apache License, Version 2.0 (the "License");
JimCarver 0:6b753f761943 5 * you may not use this file except in compliance with the License.
JimCarver 0:6b753f761943 6 * You may obtain a copy of the License at
JimCarver 0:6b753f761943 7 *
JimCarver 0:6b753f761943 8 * http://www.apache.org/licenses/LICENSE-2.0
JimCarver 0:6b753f761943 9 *
JimCarver 0:6b753f761943 10 * Unless required by applicable law or agreed to in writing, software
JimCarver 0:6b753f761943 11 * distributed under the License is distributed on an "AS IS" BASIS,
JimCarver 0:6b753f761943 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
JimCarver 0:6b753f761943 13 * See the License for the specific language governing permissions and
JimCarver 0:6b753f761943 14 * limitations under the License.
JimCarver 0:6b753f761943 15 *******************************************************************************/
JimCarver 0:6b753f761943 16
JimCarver 0:6b753f761943 17 #ifndef _PAL_RTOS_TEST_UTILS_H
JimCarver 0:6b753f761943 18 #define _PAL_RTOS_TEST_UTILS_H
JimCarver 0:6b753f761943 19
JimCarver 0:6b753f761943 20 #include "pal.h"
JimCarver 0:6b753f761943 21 #include "pal_BSP.h"
JimCarver 0:6b753f761943 22 #if 0 //MUST MOVE TO PLATFORM SPECIFIC HEADER
JimCarver 0:6b753f761943 23 #include "fsl_device_registers.h"
JimCarver 0:6b753f761943 24 #include "fsl_debug_console.h"
JimCarver 0:6b753f761943 25 #include "board.h"
JimCarver 0:6b753f761943 26
JimCarver 0:6b753f761943 27 #include "pin_mux.h"
JimCarver 0:6b753f761943 28 #include "clock_config.h"
JimCarver 0:6b753f761943 29
JimCarver 0:6b753f761943 30
JimCarver 0:6b753f761943 31 #define MUTEX_UNITY_TEST 1
JimCarver 0:6b753f761943 32 #define SEMAPHORE_UNITY_TEST 1
JimCarver 0:6b753f761943 33 #endif // MUST MOVE TO PLATFORM SPECIFIC HEADER
JimCarver 0:6b753f761943 34 #define PAL_RANDOM_TEST_LOOP 100000
JimCarver 0:6b753f761943 35 #define PAL_RANDOM_ARRAY_TEST_SIZE 100
JimCarver 0:6b753f761943 36 #define PAL_RANDOM_BUFFER_ARRAY_TEST_SIZE 60
JimCarver 0:6b753f761943 37 #define PAL_TIME_TO_WAIT_MS 5000 //in [ms]
JimCarver 0:6b753f761943 38 #define PAL_TIME_TO_WAIT_SHORT_MS 300 //in [ms]
JimCarver 0:6b753f761943 39 #define PAL_TIMER_TEST_TIME_TO_WAIT_MS_SHORT 40 //in [ms]
JimCarver 0:6b753f761943 40 #define PAL_TIMER_TEST_TIME_TO_WAIT_MS_LONG 130 //in [ms]
JimCarver 0:6b753f761943 41
JimCarver 0:6b753f761943 42 typedef struct threadsArgument{
JimCarver 0:6b753f761943 43 uint32_t arg1;
JimCarver 0:6b753f761943 44 uint32_t arg2;
JimCarver 0:6b753f761943 45 uint32_t arg3;
JimCarver 0:6b753f761943 46 uint32_t arg4;
JimCarver 0:6b753f761943 47 uint32_t arg5;
JimCarver 0:6b753f761943 48 uint32_t arg6;
JimCarver 0:6b753f761943 49 uint32_t arg7;
JimCarver 0:6b753f761943 50 uint8_t threadCounter;
JimCarver 0:6b753f761943 51 }threadsArgument_t;
JimCarver 0:6b753f761943 52
JimCarver 0:6b753f761943 53
JimCarver 0:6b753f761943 54 extern threadsArgument_t g_threadsArg;
JimCarver 0:6b753f761943 55
JimCarver 0:6b753f761943 56 void palThreadFunc1(void const *argument);
JimCarver 0:6b753f761943 57 void palThreadFunc2(void const *argument);
JimCarver 0:6b753f761943 58 void palThreadFunc3(void const *argument);
JimCarver 0:6b753f761943 59 void palThreadFunc4(void const *argument);
JimCarver 0:6b753f761943 60 void palThreadFunc5(void const *argument);
JimCarver 0:6b753f761943 61 void palThreadFunc6(void const *argument);
JimCarver 0:6b753f761943 62
JimCarver 0:6b753f761943 63
JimCarver 0:6b753f761943 64 typedef struct timerArgument{
JimCarver 0:6b753f761943 65 uint32_t ticksBeforeTimer;
JimCarver 0:6b753f761943 66 uint32_t ticksInFunc1;
JimCarver 0:6b753f761943 67 uint32_t ticksInFunc2;
JimCarver 0:6b753f761943 68 }timerArgument_t;
JimCarver 0:6b753f761943 69
JimCarver 0:6b753f761943 70 extern timerArgument_t g_timerArgs;
JimCarver 0:6b753f761943 71
JimCarver 0:6b753f761943 72 void palTimerFunc1(void const *argument);
JimCarver 0:6b753f761943 73 void palTimerFunc2(void const *argument);
JimCarver 0:6b753f761943 74 void palTimerFunc3(void const *argument);
JimCarver 0:6b753f761943 75 void palTimerFunc4(void const *argument);
JimCarver 0:6b753f761943 76 void palTimerFunc5(void const *argument);
JimCarver 0:6b753f761943 77
JimCarver 0:6b753f761943 78
JimCarver 0:6b753f761943 79 void palThreadFuncWaitForEverTest(void const *argument);
JimCarver 0:6b753f761943 80
JimCarver 0:6b753f761943 81 void RecursiveLockThread(void const *param);
JimCarver 0:6b753f761943 82 typedef struct palRecursiveMutexParam{
JimCarver 0:6b753f761943 83 palMutexID_t mtx;
JimCarver 0:6b753f761943 84 palSemaphoreID_t sem;
JimCarver 0:6b753f761943 85 size_t count;
JimCarver 0:6b753f761943 86 palThreadID_t higherPriorityThread;
JimCarver 0:6b753f761943 87 palThreadID_t lowerPriorityThread;
JimCarver 0:6b753f761943 88 palThreadID_t activeThread;
JimCarver 0:6b753f761943 89 } palRecursiveMutexParam_t;
JimCarver 0:6b753f761943 90
JimCarver 0:6b753f761943 91 #define MEMORY_POOL1_BLOCK_SIZE 32
JimCarver 0:6b753f761943 92 #define MEMORY_POOL1_BLOCK_COUNT 5
JimCarver 0:6b753f761943 93 #define MEMORY_POOL2_BLOCK_SIZE 12
JimCarver 0:6b753f761943 94 #define MEMORY_POOL2_BLOCK_COUNT 4
JimCarver 0:6b753f761943 95
JimCarver 0:6b753f761943 96 extern palMutexID_t mutex1;
JimCarver 0:6b753f761943 97 extern palMutexID_t mutex2;
JimCarver 0:6b753f761943 98
JimCarver 0:6b753f761943 99 extern palSemaphoreID_t semaphore1;
JimCarver 0:6b753f761943 100
JimCarver 0:6b753f761943 101 #endif //_PAL_RTOS_TEST_UTILS_H