HwiP.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015-2022, 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  */
50 #ifndef ti_dpl_HwiP__include
51 #define ti_dpl_HwiP__include
52 
53 #include <stdint.h>
54 #include <stdbool.h>
55 #include <stddef.h>
56 
57 #ifdef __cplusplus
58 extern "C" {
59 #endif
60 
70 #define HwiP_STRUCT_SIZE (28)
71 
78 typedef union HwiP_Struct
79 {
80  uint32_t dummy;
82 } HwiP_Struct;
83 
89 typedef void *HwiP_Handle;
90 
94 typedef enum
95 {
96  HwiP_OK = 0,
98 } HwiP_Status;
99 
103 typedef void (*HwiP_Fxn)(uintptr_t arg);
104 
117 typedef struct
118 {
119  uintptr_t arg;
120  uint32_t priority;
121  bool enableInt;
122 } HwiP_Params;
123 
139 extern int HwiP_swiPIntNum;
140 
154 extern HwiP_Handle HwiP_construct(HwiP_Struct *hwiP, int interruptNum, HwiP_Fxn hwiFxn, HwiP_Params *params);
155 
164 extern void HwiP_destruct(HwiP_Struct *hwiP);
165 
171 extern void HwiP_clearInterrupt(int interruptNum);
172 
188 extern HwiP_Handle HwiP_create(int interruptNum, HwiP_Fxn hwiFxn, HwiP_Params *params);
189 
199 extern void HwiP_delete(HwiP_Handle handle);
200 
216 extern uintptr_t HwiP_disable(void);
217 
221 extern void HwiP_enable(void);
222 
228 extern void HwiP_disableInterrupt(int interruptNum);
229 
235 extern void HwiP_enableInterrupt(int interruptNum);
236 
244 extern bool HwiP_inISR(void);
245 
253 extern bool HwiP_interruptsEnabled(void);
254 
265 extern void HwiP_Params_init(HwiP_Params *params);
266 
273 extern void HwiP_plug(int interruptNum, void *fxn);
274 
280 extern void HwiP_post(int interruptNum);
281 
287 extern void HwiP_restore(uintptr_t key);
288 
296 extern void HwiP_setFunc(HwiP_Handle hwiP, HwiP_Fxn fxn, uintptr_t arg);
297 
304 extern void HwiP_setPriority(int interruptNum, uint32_t priority);
305 
313 void HwiP_dispatchInterrupt(int interruptNum);
314 
315 #ifdef __cplusplus
316 }
317 #endif
318 
319 #endif /* ti_dpl_HwiP__include */
void HwiP_enable(void)
Function to enable interrupts.
bool enableInt
Definition: HwiP.h:121
uint32_t priority
Definition: HwiP.h:120
ADC_Params params
Definition: Driver_Init.h:11
void HwiP_dispatchInterrupt(int interruptNum)
Function to call the HW ISR function registered by HwiP_construct.
uintptr_t HwiP_disable(void)
Function to disable interrupts to enter a critical region.
HwiP structure.
Definition: HwiP.h:78
void HwiP_destruct(HwiP_Struct *hwiP)
Function to destruct a hardware interrupt object.
void HwiP_enableInterrupt(int interruptNum)
Function to enable a single interrupt.
union HwiP_Struct HwiP_Struct
HwiP structure.
uint32_t dummy
Definition: HwiP.h:80
Definition: HwiP.h:96
bool HwiP_inISR(void)
Function to return a status based on whether it is in an interrupt context.
void HwiP_plug(int interruptNum, void *fxn)
Function to plug an interrupt vector.
bool HwiP_interruptsEnabled(void)
Function to determine whether interrupts are currently enabled.
HwiP_Handle HwiP_create(int interruptNum, HwiP_Fxn hwiFxn, HwiP_Params *params)
Function to create an interrupt on CortexM devices.
void HwiP_post(int interruptNum)
Function to generate an interrupt.
void HwiP_setPriority(int interruptNum, uint32_t priority)
Function to set the priority of a hardware interrupt.
#define HwiP_STRUCT_SIZE
Number of bytes greater than or equal to the size of any RTOS HwiP object.
Definition: HwiP.h:70
uintptr_t arg
Definition: HwiP.h:119
void HwiP_disableInterrupt(int interruptNum)
Function to disable a single interrupt.
void HwiP_setFunc(HwiP_Handle hwiP, HwiP_Fxn fxn, uintptr_t arg)
Function to overwrite HwiP function and arg.
void HwiP_restore(uintptr_t key)
Function to restore interrupts to exit a critical region.
Definition: HwiP.h:97
uint8_t data[(28)]
Definition: HwiP.h:81
void * HwiP_Handle
Opaque client reference to an instance of a HwiP.
Definition: HwiP.h:89
void HwiP_delete(HwiP_Handle handle)
Function to delete an interrupt on CortexM devices.
int HwiP_swiPIntNum
Interrupt number posted by SwiP.
void HwiP_Params_init(HwiP_Params *params)
Initialize params structure to default values.
Basic HwiP Parameters.
Definition: HwiP.h:117
void HwiP_clearInterrupt(int interruptNum)
Function to clear a single interrupt.
HwiP_Status
Status codes for HwiP APIs.
Definition: HwiP.h:94
void(* HwiP_Fxn)(uintptr_t arg)
Prototype for the entry function for a hardware interrupt.
Definition: HwiP.h:103
HwiP_Handle HwiP_construct(HwiP_Struct *hwiP, int interruptNum, HwiP_Fxn hwiFxn, HwiP_Params *params)
Function to construct a hardware interrupt object.
© Copyright 1995-2024, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale