joey shelton / LED_Demo

Dependencies:   MAX44000 PWM_Tone_Library nexpaq_mdk

Fork of LED_Demo by Maxim nexpaq

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers eventOS_event.h Source File

eventOS_event.h

00001 /*
00002  * Copyright (c) 2014-2015 ARM Limited. All rights reserved.
00003  * SPDX-License-Identifier: Apache-2.0
00004  * Licensed under the Apache License, Version 2.0 (the License); you may
00005  * 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, WITHOUT
00012  * 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 EVENTOS_EVENT_H_
00017 #define EVENTOS_EVENT_H_
00018 #ifdef __cplusplus
00019 extern "C" {
00020 #endif
00021 
00022 #include "ns_types.h"
00023 /**
00024  * \enum arm_library_event_priority_e
00025  * \brief Event Priority level.
00026  */
00027 typedef enum arm_library_event_priority_e {
00028     ARM_LIB_HIGH_PRIORITY_EVENT = 0, /**< High Priority Event (Function CB) */
00029     ARM_LIB_MED_PRIORITY_EVENT = 1, /**< Medium Priority (Timer) */
00030     ARM_LIB_LOW_PRIORITY_EVENT = 2, /*!*< Normal Event and ECC / Security */
00031 } arm_library_event_priority_e;
00032 
00033 /**
00034  * \enum arm_event_s
00035  * \brief Event structure.
00036  */
00037 typedef struct arm_event_s {
00038     int8_t receiver; /**< Event handler Tasklet ID */
00039     int8_t sender; /**< Event sender Tasklet ID */
00040     uint8_t event_type; /**< This will be typecast arm_library_event_type_e, arm_internal_event_type_e or application specific define */
00041     uint8_t event_id; /**< Timer ID, NWK interface ID or application specific ID */
00042     void *data_ptr; /**< Application could share data pointer tasklet to tasklet */
00043     arm_library_event_priority_e priority;
00044     uint32_t event_data;
00045 } arm_event_s;
00046 
00047 /**
00048  * \brief Send event to  event scheduler.
00049  *
00050  * \param event pointer to pushed event.
00051  *
00052  * \return 0 Event push OK
00053  * \return -1 Memory allocation Fail
00054  *
00055  */
00056 extern int8_t eventOS_event_send(arm_event_s *event);
00057 
00058 /**
00059  * \brief Event handler callback register
00060  *
00061  * Function will register and allocate unique event id handler
00062  *
00063  * \param handler_func_ptr function pointer for event handler
00064  * \param init_event_type generated evevnt type for init purpose
00065  *
00066  * \return >= 0 Unique event ID for this handler
00067  * \return < 0 Register fail
00068  *
00069  * */
00070 extern int8_t eventOS_event_handler_create(void (*handler_func_ptr)(arm_event_s *), uint8_t init_event_type);
00071 #ifdef __cplusplus
00072 }
00073 #endif
00074 #endif /* EVENTOS_EVENT_H_ */