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_BSP.h Source File

pal_BSP.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 #ifndef MBED_CLIENT_PAL_TEST_MAINTEST_H_
00017 #define MBED_CLIENT_PAL_TEST_MAINTEST_H_
00018 
00019 
00020 
00021 #ifdef PAL_LINUX
00022 #define PAL_TEST_THREAD_STACK_SIZE 16*1024*sizeof(uint32_t)
00023 #else
00024 #define PAL_TEST_THREAD_STACK_SIZE 512*sizeof(uint32_t)
00025 #endif
00026 #include <stdbool.h>
00027 
00028 typedef struct {
00029     int argc;
00030     char **argv;
00031 } pal_args_t;
00032 
00033 
00034 #ifdef __cplusplus
00035 extern "C" {
00036 #endif
00037 
00038 
00039 typedef void (*testMain_t)(pal_args_t *);
00040 
00041 typedef enum {
00042     //Success Codes are positive
00043     BSP_SUCCESS = 0,
00044 
00045     //All errors are Negative
00046     // generic errors
00047     BSP_GENERIC_FAILURE =  -1,
00048     BSP_PARAMETER_FAILURE =  -2,
00049     BSP_THREAD_CREATION_FAILURE =  -3,
00050     BSP_NETWORK_TIMEOUT =  -4,
00051     BSP_FILE_SYSTEM_TIMEOUT =  -5
00052 } bspStatus_t; /*! errors returned by the pal BSP code */
00053 
00054 
00055 /*! \brief This function initialized the platform (BSP , file system ....)
00056 *
00057 * @param[out] outputContext: used to return the network context to be used by the tests. The funciton expects the address of a writable void* in order to return this value (use NULL if not applicable).
00058 *
00059 * \return status of platform intialization
00060 *
00061 */
00062 bspStatus_t initPlatform(void** outputContext);
00063 
00064 
00065 /*! \brief This function is called from the main function
00066 *           and calls the startup sequence for the board tests
00067 *
00068 * @param[in] mainTestFunc - callback function for the main test runner
00069 * @param[in] args - structure the contains argv and argc received from the main function
00070 *
00071 * \return void
00072 *
00073 */
00074 bool runProgram(testMain_t mainTestFunc, pal_args_t * args);
00075 
00076 
00077 
00078 #ifdef __cplusplus
00079 }
00080 #endif
00081 
00082 #endif /* MBED_CLIENT_PAL_TEST_MAINTEST_H_ */