Maxim Integrated / MaximBLE

Dependents:   BLE_Thermometer MAXWSNENV_demo

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers wsf_os.h Source File

wsf_os.h

Go to the documentation of this file.
00001 /*************************************************************************************************/
00002 /*!
00003  *  \file   wsf_os.h
00004  *        
00005  *  \brief  Software foundation OS API.
00006  *
00007  *          $Date: 2012-10-22 14:09:36 -0700 (Mon, 22 Oct 2012) $
00008  *          $Revision: 359 $
00009  *  
00010  *  Copyright (c) 2009-2016 ARM Limited. All rights reserved.
00011  *
00012  *  SPDX-License-Identifier: LicenseRef-PBL
00013  *
00014  *  Licensed under the Permissive Binary License, Version 1.0 (the "License"); you may not use
00015  *  this file except in compliance with the License.  You may obtain a copy of the License at
00016  *
00017  *  https://www.mbed.com/licenses/PBL-1.0
00018  *
00019  *  See the License for the specific language governing permissions and limitations under the License.
00020  */
00021 /*************************************************************************************************/
00022 #ifndef WSF_OS_H
00023 #define WSF_OS_H
00024 
00025 #include "wsf_os_int.h"
00026 #include "wsf_queue.h"
00027 
00028 #ifdef __cplusplus
00029 extern "C" {
00030 #endif
00031 
00032 /**************************************************************************************************
00033   Data Types
00034 **************************************************************************************************/
00035 
00036 /*! Common message structure passed to event handler */
00037 typedef struct
00038 {
00039   uint16_t        param;          /*! General purpose parameter passed to event handler */
00040   uint8_t         event ;          /*! General purpose event value passed to event handler */
00041   uint8_t         status ;         /*! General purpose status value passed to event handler */
00042 } wsfMsgHdr_t ;
00043 
00044 /**************************************************************************************************
00045   Callback Function Types
00046 **************************************************************************************************/
00047 
00048 /*************************************************************************************************/
00049 /*!
00050  *  \fn     wsfEventHandler_t
00051  *        
00052  *  \brief  Event handler callback function.
00053  *
00054  *  \param  event    Mask of events set for the event handler.
00055  *  \param  pMsg     Pointer to message for the event handler.
00056  *
00057  *  \return None.
00058  */
00059 /*************************************************************************************************/
00060 typedef void (*wsfEventHandler_t)(wsfEventMask_t event, wsfMsgHdr_t  *pMsg);
00061 
00062 /**************************************************************************************************
00063   Function Declarations
00064 **************************************************************************************************/
00065 
00066 /*************************************************************************************************/
00067 /*!
00068  *  \fn     WsfSetEvent
00069  *        
00070  *  \brief  Set an event for an event handler.
00071  *
00072  *  \param  handlerId   Handler ID.
00073  *  \param  event       Event or events to set.
00074  *
00075  *  \return None.
00076  */
00077 /*************************************************************************************************/
00078 void WsfSetEvent(wsfHandlerId_t handlerId, wsfEventMask_t event);
00079 
00080 /*************************************************************************************************/
00081 /*!
00082  *  \fn     WsfTaskLock
00083  *        
00084  *  \brief  Lock task scheduling.
00085  *
00086  *  \return None.
00087  */
00088 /*************************************************************************************************/
00089 void WsfTaskLock(void);
00090 
00091 /*************************************************************************************************/
00092 /*!
00093  *  \fn     WsfTaskUnlock
00094  *        
00095  *  \brief  Unlock task scheduling.
00096  *
00097  *  \return None.
00098  */
00099 /*************************************************************************************************/
00100 void WsfTaskUnlock(void);
00101 
00102 /*************************************************************************************************/
00103 /*!
00104  *  \fn     WsfTaskSetReady
00105  *        
00106  *  \brief  Set the task used by the given handler as ready to run.
00107  *
00108  *  \param  handlerId   Event handler ID.
00109  *  \param  event       Task event mask.
00110  *
00111  *  \return None.
00112  */
00113 /*************************************************************************************************/
00114 void WsfTaskSetReady(wsfHandlerId_t handlerId, wsfTaskEvent_t event);
00115 
00116 /*************************************************************************************************/
00117 /*!
00118  *  \fn     WsfTaskMsgQueue
00119  *        
00120  *  \brief  Return the task message queue used by the given handler.
00121  *
00122  *  \param  handlerId   Event handler ID.
00123  *
00124  *  \return Task message queue.
00125  */
00126 /*************************************************************************************************/
00127 wsfQueue_t  *WsfTaskMsgQueue(wsfHandlerId_t handlerId);
00128 
00129 /*************************************************************************************************/
00130 /*!
00131  *  \fn     WsfOsSetNextHandler
00132  *        
00133  *  \brief  Set the next WSF handler function in the WSF OS handler array.  This function
00134  *          should only be called as part of the OS initialization procedure.
00135  *
00136  *  \param  handler    WSF handler function.
00137  *
00138  *  \return WSF handler ID for this handler.
00139  */
00140 /*************************************************************************************************/
00141 wsfHandlerId_t WsfOsSetNextHandler(wsfEventHandler_t handler);
00142 
00143 #ifdef __cplusplus
00144 };
00145 #endif
00146 
00147 #endif /* WSF_OS_H */