AM65x MCU+ SDK  09.01.00
HwiP.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018-2023 Texas Instruments Incorporated
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *
8  * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  *
11  * Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in the
13  * documentation and/or other materials provided with the
14  * 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
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 #ifndef HWIP_H
34 #define HWIP_H
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
40 #include <stdint.h>
41 #include <kernel/dpl/SystemP.h>
42 
57 typedef void (*HwiP_FxnCallback)(void *args);
58 
59 
63 typedef struct HwiP_Config_
64 {
65  uint32_t intcBaseAddr;
67 } HwiP_Config;
68 
72 typedef struct HwiP_Params_ {
73 
74  uint32_t intNum;
76  void *args;
77  uint16_t eventId;
78  uint8_t priority;
79  uint8_t isFIQ;
80  uint8_t isPulse;
82 } HwiP_Params;
83 
87 #define HwiP_OBJECT_SIZE_MAX (32u)
88 
91 typedef struct HwiP_Object_ {
92 
93  uint32_t rsv[HwiP_OBJECT_SIZE_MAX/sizeof(uint32_t)];
95 } HwiP_Object;
96 
105 
114 int32_t HwiP_construct(HwiP_Object *obj, HwiP_Params *params);
115 
116 
125 int32_t HwiP_setArgs(HwiP_Object *obj, void *args);
126 
133 
139 void HwiP_enableInt(uint32_t intNum);
140 
151 uint32_t HwiP_disableInt(uint32_t intNum);
152 
162 void HwiP_restoreInt(uint32_t intNum, uint32_t oldIntState);
163 
169 void HwiP_clearInt(uint32_t intNum);
170 
171 
172 
178 void HwiP_post(uint32_t intNum);
179 
188 uintptr_t HwiP_disable(void);
189 
196 void HwiP_enable(void);
197 
206 void HwiP_restore(uintptr_t oldIntState);
207 
208 
225 uint32_t HwiP_inISR(void);
226 
237 void HwiP_init(void);
238 
247 int32_t HwiP_registerNmiHandler(HwiP_FxnCallback nmiHandler, void *args);
248 
255 
258 #ifdef __cplusplus
259 }
260 #endif
261 
262 #endif /* HWIP_H */
HwiP_Params::eventId
uint16_t eventId
Definition: HwiP.h:77
HwiP_inISR
uint32_t HwiP_inISR(void)
Check if the caller of this function is inside a ISR or not.
HwiP_destruct
void HwiP_destruct(HwiP_Object *obj)
Cleanup, delete, destruct a Hwi object.
SystemP.h
HwiP_disableInt
uint32_t HwiP_disableInt(uint32_t intNum)
Disable a specific interrupt.
HwiP_Params
Parameters passed during HwiP_construct.
Definition: HwiP.h:72
HwiP_post
void HwiP_post(uint32_t intNum)
Force trigger a specific interrupt.
HwiP_restoreInt
void HwiP_restoreInt(uint32_t intNum, uint32_t oldIntState)
Restore a specific interrupt.
HwiP_unregisterNmiHandler
int32_t HwiP_unregisterNmiHandler(void)
This API unregisters the current NMI handler.
HwiP_enable
void HwiP_enable(void)
Enable all interrupts.
HwiP_construct
int32_t HwiP_construct(HwiP_Object *obj, HwiP_Params *params)
Create a Hwi object.
HwiP_Params_init
void HwiP_Params_init(HwiP_Params *params)
Set default values to HwiP_Params.
HwiP_Config::intcBaseAddr
uint32_t intcBaseAddr
Definition: HwiP.h:65
HwiP_enableInt
void HwiP_enableInt(uint32_t intNum)
Enable a specific interrupt.
HwiP_registerNmiHandler
int32_t HwiP_registerNmiHandler(HwiP_FxnCallback nmiHandler, void *args)
This API registers the NMI handler.
HwiP_Params::priority
uint8_t priority
Definition: HwiP.h:78
HwiP_OBJECT_SIZE_MAX
#define HwiP_OBJECT_SIZE_MAX
Max size of Hwi object across no-RTOS and all OS's.
Definition: HwiP.h:87
HwiP_Params::isPulse
uint8_t isPulse
Definition: HwiP.h:80
HwiP_Params::callback
HwiP_FxnCallback callback
Definition: HwiP.h:75
HwiP_init
void HwiP_init(void)
Initialize Hwi module.
HwiP_Object
Opaque Hwi object used with the Hwi APIs.
Definition: HwiP.h:91
HwiP_Params::isFIQ
uint8_t isFIQ
Definition: HwiP.h:79
HwiP_Params::args
void * args
Definition: HwiP.h:76
HwiP_disable
uintptr_t HwiP_disable(void)
Disable all interrupts.
HwiP_restore
void HwiP_restore(uintptr_t oldIntState)
Restores all interrupts to a given state.
HwiP_clearInt
void HwiP_clearInt(uint32_t intNum)
Clear a pending specific interrupt.
HwiP_setArgs
int32_t HwiP_setArgs(HwiP_Object *obj, void *args)
Set argument to pass to the ISR.
HwiP_Params::intNum
uint32_t intNum
Definition: HwiP.h:74
HwiP_FxnCallback
void(* HwiP_FxnCallback)(void *args)
Callback that is called when a HW interrupt is received.
Definition: HwiP.h:57
HwiP_Config
HwiP config parameters, setup as part of SysConfig, not to be set by end-users directly.
Definition: HwiP.h:64