]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - processor-sdk/pdk.git/blob - packages/ti/osal/EventCombinerP.h
[DSS M2M Driver]Addressed review comments
[processor-sdk/pdk.git] / packages / ti / osal / EventCombinerP.h
1 /*
2  * Copyright (c) 2017-present, Texas Instruments Incorporated
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * *  Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  *
12  * *  Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  *
16  * *  Neither the name of Texas Instruments Incorporated nor the names of
17  *    its contributors may be used to endorse or promote products derived
18  *    from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
34 /**
35  *  \ingroup DRV_OSAL_MODULE
36  *  \defgroup DRV_OSAL_EventCombinerP EventCombinerP
37  *            EventCombinerP interface
38  *
39  *  @{
40  */ 
41   
42  
43 /** ============================================================================
44  *  @file       EventCombinerP.h
45  *
46  *  @brief      Event Combiner routines for the RTOS Porting Interface
47  *
48  *
49  *  ============================================================================
50  */
52 #ifndef ti_osal_EventCombinerP__include
53 #define ti_osal_EventCombinerP__include
55 #ifdef __cplusplus
56 extern "C" {
57 #endif
59 #include <stdint.h>
60 #include <stdbool.h>
61 #include <stddef.h>
62 #include <ti/osal/HwiP.h>
63 typedef void (*EventCombinerP_FuncPtr)(uint32_t arg);
65 /*!
66  *  @brief  Function to disable an event inside event combiner
67  *
68  *  @param  eventId  event ID to be disabled in the event combiner
69  *
70  */
71 int32_t EventCombinerP_disableEvent(uint32_t eventId);
73 /*!
74  *  @brief  Function to enable an event inside event combiner
75  *
76  *  @param  eventId  event ID to be disabled in the event combiner
77  *
78  */
79 int32_t EventCombinerP_enableEvent(uint32_t eventId);
81 /*!\r
82  *  @brief  Function to clear an event inside event combiner\r
83  *\r
84  *  @param  eventId  event ID to be cleared in the event combiner\r
85  *\r
86  */\r
87 int32_t EventCombinerP_clearEvent(uint32_t eventId);\r
88 \r
89 /*!
90  *  @brief  Function to plug an ISR handler to an event inside event combiner
91  *
92  *  @param  eventId  The event id (4-127)
93  *
94  *  @param  eventIsrRoutine  The ISR routine for servicing the event
95  *
96  *  @param  arg  The argument to the ISR routine
97  *
98  *  @param  unmask Unmask the event
99  */
100 int32_t EventCombinerP_dispatchPlug(uint32_t eventId, EventCombinerP_FuncPtr eventIsrRoutine,uintptr_t arg,bool unmask );
102 /*!
103  *  @brief  Function to return the Hwi Handle corresponding to an event combiner group number
104  *
105  *  @param  groupNum  The event combiner group id (0-3)
106  *
107  */
108 HwiP_Handle EventCombinerP_getHwi(uint32_t groupNum);
111 /*!
112  *  @brief  Function to return the interrupt vector number corresponding to
113  *  a group number (0-3)
114  *
115  *  @param  groupNum  The event combiner group id (0-3)
116  *
117  */
118 int32_t EventCombinerP_getIntNum(int32_t groupNum);
120 /*!
121  *  @brief  Function to register single event combiner group to a vector number
122  *
123  *  @param  groupNum  The event combiner group id (0-3)
124  *
125  *  @param  intNum    The interrupt vector id (4-15)
126  *
127  */
128 int32_t EventCombinerP_SingleRegisterInt(int32_t groupNum, int32_t intNum);
130 /*!
131  *  @brief  Function to register single event combiner group to a vector number
132  *
133  *  @param  intNum []   List of interrupt vector ids (4-15) per ECM group(0-3)
134  *
135  */
136 int32_t EventCombinerP_GroupRegisterInt(int32_t intNum[]);
138 /**
139  *  \name Osal Event Combiner return Codes
140  *  @brief  Return codes for Osal  Event Combiner functions
141  *  @{
142  */
143 /*! Successful call */
144 #define OSAL_EVTCOMBINE_GROUPREG_SUCCESS (0)
145 /*! Registration Error */
146 #define OSAL_EVTCOMBINE_ERR_GROUPREG_REGISTER_ERR (-1)
147 /*! Invalid interrupt number */
148 #define OSAL_EVTCOMBINE_ERR_GROUPREG_INVALID_INTNUM (-2)
149 /* @} */
151 /**
152  *  \name Osal Event Combiner Defualt Group Interrupts
153  *  @brief  Deafult group interrupt numbers for the Event Combiner
154  *
155  * These are the system default interrupt numbers if the Event Combiner has already not been registered
156  * If applications register Event Combiners during startup, these values may not be used (in SYSBIOS case)
157  * If not, these are the interrupts reserved for Event Combiner group events (0-3).
158  * These defaults are stored in Osal_HwAttrs.ECM_intNum[] and can be obtained by the 
159  * application at run time through the OSAL API Osal_getHwAttrs(). These values also can be modified 
160  * using Osal_setHwAttrs(Osal_HwAttrs,OSAL_HWATTR_SET_ECM_INT)
161  *  @{
162  */
163 /*! ECM group 0 default interrupt: 4 */
164 #define OSAL_ECM_GROUP0_INT 4
165 /*! ECM group 1 default interrupt: 5 */
166 #define OSAL_ECM_GROUP1_INT 5
167 /*! ECM group 2 default interrupt: 6 */
168 #define OSAL_ECM_GROUP2_INT 6
169 /*! ECM group 3 default interrupt: 7 */
170 #define OSAL_ECM_GROUP3_INT 7
171 /* @} */
173 #ifdef __cplusplus
175 #endif
177 #endif /* ti_osalEventCombinerP__include */
178 /* @} */