PDK API Guide for J721E
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 
103 typedef uint32_t OSAL_armGicTrigType_t;
105 #define OSAL_ARM_GIC_TRIG_TYPE_LEVEL ((uint32_t) 1U)
106 
107 #define OSAL_ARM_GIC_TRIG_TYPE_EDGE ((uint32_t) 2U)
108 
109 #define OSAL_ARM_GIC_TRIG_TYPE_HIGH_LEVEL ((uint32_t) 3U)
110 
111 #define OSAL_ARM_GIC_TRIG_TYPE_LOW_LEVEL ((uint32_t) 4U)
112 
113 #define OSAL_ARM_GIC_TRIG_TYPE_RISING_EDGE ((uint32_t) 5U)
114 
115 #define OSAL_ARM_GIC_TRIG_TYPE_FALLING_EDGE ((uint32_t) 6U)
116 /* @} */
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__) || ((__ARM_ARCH == 7) && (__ARM_ARCH_PROFILE == 'R'))
154  uint32_t triggerSensitivity;
158 #endif
159 #ifdef QNX_OS
160  uint32_t autoEnable;
161 #endif
162 } HwiP_Params;
163 
169 extern void HwiP_clearInterrupt(uint32_t interruptNum);
170 
184 extern HwiP_Handle HwiP_create(uint32_t interruptNum, HwiP_Fxn hwiFxn,
185  const HwiP_Params *hwipParams);
186 
198 extern HwiP_Handle HwiP_createDirect(uint32_t interruptNum, HwiP_DirectFxn hwiFxn,
199  const HwiP_Params *hwipParams);
200 
208 extern HwiP_Status HwiP_delete(HwiP_Handle hwiPhandle);
209 
231 extern uintptr_t HwiP_disable(void);
232 
238 extern void HwiP_disableInterrupt(uint32_t interruptNum);
239 
245 extern void HwiP_enableInterrupt(uint32_t interruptNum);
246 
257 extern void HwiP_Params_init(HwiP_Params *hwipParams);
258 
264 extern void HwiP_restore(uintptr_t key);
270 HwiP_Handle HwiP_getHandle(uint32_t interruptNum);
276 uint32_t HwiP_getEventId(uint32_t interruptNum);
284 extern int32_t HwiP_post(uint32_t interruptNum);
285 
286 #ifdef __cplusplus
287 }
288 #endif
289 
290 #endif /* ti_osal_HwiP__include */
291 /* @} */
uint32_t enableIntr
Definition: HwiP.h:150
Basic HwiP Parameters.
Definition: HwiP.h:138
HwiP_Handle HwiP_getHandle(uint32_t interruptNum)
Function to get HwiP Handle from an interrupt number.
char * name
Definition: HwiP.h:139
void HwiP_enableInterrupt(uint32_t interruptNum)
Function to enable a single interrupt.
uint32_t HwiP_getEventId(uint32_t interruptNum)
Function to get the eventId associated with an interrupt number.
void HwiP_clearInterrupt(uint32_t interruptNum)
Function to clear a single interrupt.
Definition: HwiP.h:87
void * HwiP_Handle
Opaque client reference to an instance of a HwiP.
Definition: HwiP.h:81
uint32_t OSAL_armGicTrigType_t
Enumerates the types different trigger types. Please refer to Section 4.3.13 Interrupt Configuration ...
Definition: HwiP.h:103
HwiP_Handle HwiP_create(uint32_t interruptNum, HwiP_Fxn hwiFxn, const HwiP_Params *hwipParams)
Function to create an interrupt on CortexM devices.
uint32_t evtId
Definition: HwiP.h:152
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.
HwiP_Handle HwiP_createDirect(uint32_t interruptNum, HwiP_DirectFxn hwiFxn, const HwiP_Params *hwipParams)
Function to create an interrupt using VIM direct registration.
uintptr_t arg
Definition: HwiP.h:143
HwiP_Status
Status codes for HwiP APIs.
Definition: HwiP.h:86
void HwiP_disableInterrupt(uint32_t interruptNum)
Function to disable a single interrupt.
Definition: HwiP.h:88
uintptr_t HwiP_disable(void)
Function to disable interrupts to enter a critical region.