PDK API Guide for AM64x
HwiP.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015-2018, 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  */
58 #ifndef ti_osal_HwiP__include
59 #define ti_osal_HwiP__include
60 
61 #ifdef __cplusplus
62 extern "C" {
63 #endif
64 
65 #include <stdint.h>
66 #include <stdbool.h>
67 #include <stddef.h>
68 
69 /*********************************************************************
70  * @def HWIP_USE_DEFAULT_PRIORITY
71  * Use the default priority for the interrupts
72  *
73  *********************************************************************/
74 #define HWIP_USE_DEFAULT_PRIORITY (~((uint32_t)0))
75 
81 typedef void *HwiP_Handle;
82 
86 typedef enum HwiP_Status_e {
87  HwiP_OK = 0,
88  HwiP_FAILURE = (-(int32_t)1)
89 } HwiP_Status;
90 
97 typedef enum
98 {
117 
121 typedef void (*HwiP_Fxn)(uintptr_t arg);
122 
127 typedef void (*HwiP_DirectFxn)(void);
128 
138 typedef struct HwiP_Params_s {
139  char *name;
143  uintptr_t arg;
144  uint32_t priority;
150  uint32_t enableIntr;
152  uint32_t evtId;
153 #if defined (__ARM_ARCH_7A__) || defined(__aarch64__) || defined (__TI_ARM_V7R4__)
154  uint32_t triggerSensitivity;
158 #endif
159 } HwiP_Params;
160 
166 extern void HwiP_clearInterrupt(int32_t interruptNum);
167 
181 extern HwiP_Handle HwiP_create(int32_t interruptNum, HwiP_Fxn hwiFxn,
182  const HwiP_Params *hwipParams);
183 
195 extern HwiP_Handle HwiP_createDirect(int32_t interruptNum, HwiP_DirectFxn hwiFxn,
196  const HwiP_Params *hwipParams);
197 
205 extern HwiP_Status HwiP_delete(HwiP_Handle hwiPhandle);
206 
222 extern uintptr_t HwiP_disable(void);
223 
229 extern void HwiP_disableInterrupt(int32_t interruptNum);
230 
236 extern void HwiP_enableInterrupt(int32_t interruptNum);
237 
248 extern void HwiP_Params_init(HwiP_Params *hwipParams);
249 
255 extern void HwiP_restore(uintptr_t key);
261 HwiP_Handle HwiP_getHandle(int32_t interruptNum);
267 int32_t HwiP_getEventId(int32_t interruptNum);
275 extern int32_t HwiP_post(uint32_t interruptNum);
276 
277 #ifdef __cplusplus
278 }
279 #endif
280 
281 #endif /* ti_osal_HwiP__include */
282 /* @} */
uint32_t enableIntr
Definition: HwiP.h:150
Basic HwiP Parameters.
Definition: HwiP.h:138
char * name
Definition: HwiP.h:139
void HwiP_disableInterrupt(int32_t interruptNum)
Function to disable a single interrupt.
void HwiP_clearInterrupt(int32_t interruptNum)
Function to clear a single interrupt.
Definition: HwiP.h:99
HwiP_Handle HwiP_createDirect(int32_t interruptNum, HwiP_DirectFxn hwiFxn, const HwiP_Params *hwipParams)
Function to create an interrupt using VIM direct registration.
Definition: HwiP.h:87
Definition: HwiP.h:105
void * HwiP_Handle
Opaque client reference to an instance of a HwiP.
Definition: HwiP.h:81
uint32_t evtId
Definition: HwiP.h:152
void HwiP_enableInterrupt(int32_t interruptNum)
Function to enable a single interrupt.
void HwiP_Params_init(HwiP_Params *hwipParams)
Initialize params structure to default values.
void HwiP_restore(uintptr_t key)
Function to restore interrupts to exit a critical region.
uint32_t priority
Definition: HwiP.h:144
HwiP_Status HwiP_delete(HwiP_Handle hwiPhandle)
Function to delete an interrupt on CortexM devices.
void(* HwiP_DirectFxn)(void)
Prototype for the entry function for a hardware interrupt registered using HwiP_createDirect.
Definition: HwiP.h:127
void(* HwiP_Fxn)(uintptr_t arg)
Prototype for the entry function for a hardware interrupt.
Definition: HwiP.h:121
int32_t HwiP_post(uint32_t interruptNum)
Function to post the Hwi interrupt by software.
uintptr_t arg
Definition: HwiP.h:143
Definition: HwiP.h:102
HwiP_Handle HwiP_getHandle(int32_t interruptNum)
Function to get HwiP Handle from an interrupt number.
Definition: HwiP.h:108
HwiP_Handle HwiP_create(int32_t interruptNum, HwiP_Fxn hwiFxn, const HwiP_Params *hwipParams)
Function to create an interrupt on CortexM devices.
HwiP_Status
Status codes for HwiP APIs.
Definition: HwiP.h:86
Definition: HwiP.h:88
uintptr_t HwiP_disable(void)
Function to disable interrupts to enter a critical region.
OSAL_armGicTrigType_t
Enumerates the types different trigger types. Please refer to Section 4.3.13 Interrupt Configuration ...
Definition: HwiP.h:97
int32_t HwiP_getEventId(int32_t interruptNum)
Function to get the eventId associated with an interrupt number.