AM263Px MCU+ SDK: HwiP.h Source File

| AM263Px MCU+ SDK 26.00.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
52 #if defined(__ARM_ARCH_7R__) || defined(__ARM7R__)
53
54 /* compile flag to enable or disable save/restore of FPU context in FIQ */
55 // #define HWIP_FPU_CONTEXT_SAVE_RESTORE_ENABLE
56
57 /* compile flag to enable or disable interrupt nesting */
58 #define HWIP_NESTED_INTERRUPTS_IRQ_ENABLE
59
60 #if defined (OS_NORTOS)
61
62 /* compile flag to enable or disable interrupt priority mask based critical sections */
63 // #define HWIP_USE_INTERRUPT_PRIORITY_BASED_CRITICAL_SECTIONS
64
71 #if defined (HWIP_USE_INTERRUPT_PRIORITY_BASED_CRITICAL_SECTIONS)
72
85 #define HWIP_CRITICAL_SECTION_INTERRUPT_PRIORITY_THRESHOLD (4U)
86
95 #define HWIP_ENTER_CRITICAL_SECTION() HwiP_setVimIrqPriMaskAtomic(HWIP_CRITICAL_SECTION_INTERRUPT_PRIORITY_THRESHOLD)
96
99 #define HWIP_EXIT_CRITICAL_SECTION(key) HwiP_restoreVimIrqPriMask(key)
100
101 #endif /* HWIP_USE_INTERRUPT_PRIORITY_BASED_CRITICAL_SECTIONS */
102
103 #endif /* OS_NORTOS */
104
105 #endif /* __ARM_ARCH_7R__ */
106
112 typedef void (*HwiP_FxnCallback)(void *args);
113
114
118 typedef struct HwiP_Config_
119 {
120 uint32_t intcBaseAddr;
122 } HwiP_Config;
123
127 typedef struct HwiP_Params_ {
128
129 uint32_t intNum;
130 HwiP_FxnCallback callback;
131 void *args;
132 uint16_t eventId;
133 uint8_t priority;
134 uint8_t isFIQ;
135 uint8_t isPulse;
137 } HwiP_Params;
138
142 typedef struct HwiP_Object_ {
143
144 uint32_t intNum;
145
146 } HwiP_Object;
147
155 void HwiP_Params_init(HwiP_Params *params);
156
165 int32_t HwiP_construct(HwiP_Object *obj, HwiP_Params *params);
166
167
176 int32_t HwiP_setArgs(HwiP_Object *obj, void *args);
177
183 void HwiP_destruct(HwiP_Object *obj);
184
190 void HwiP_enableInt(uint32_t intNum);
191
202 uint32_t HwiP_disableInt(uint32_t intNum);
203
213 void HwiP_restoreInt(uint32_t intNum, uint32_t oldIntState);
214
220 void HwiP_clearInt(uint32_t intNum);
221
222
223
229 void HwiP_post(uint32_t intNum);
230
240 uintptr_t HwiP_disable(void);
241
248 void HwiP_enable(void);
249
258 void HwiP_restore(uintptr_t oldIntState);
259
260
277 uint32_t HwiP_inISR(void);
278
289 void HwiP_init(void);
290
299 int32_t HwiP_registerNmiHandler(HwiP_FxnCallback nmiHandler, void *args);
300
306 int32_t HwiP_unregisterNmiHandler(void);
307
308 typedef struct {
309 volatile uint32_t index;
310 /* index bit*/
311 volatile uint32_t side_ext;
312 /* side extension*/
313 volatile uint32_t recoverable_error;
314 /* recoverable error*/
315 volatile uint32_t cacheway;
316 /* cacheway*/
317 }AIFSR;
318
319 typedef struct {
320 volatile uint32_t status;
321 /* status */
322 volatile uint32_t sd;
323 /* SD bit */
324 }IFSR;
325
326 typedef struct {
327 volatile uint32_t index;
328 /* index bit*/
329 volatile uint32_t side_ext;
330 /* side extension*/
331 volatile uint32_t recoverable_error;
332 /* recoverable error*/
333 volatile uint32_t cacheway;
334 /* cacheway*/
335 }ADFSR;
336 typedef struct {
337 volatile uint32_t status;
338 /* status */
339 volatile uint32_t sd;
340 /* SD bit */
341 volatile uint32_t rw;
342 /* read or write error */
343 }DFSR;
344
345
346
347
354 #ifdef __cplusplus
355 }
356 #endif
357
358 #endif /* HWIP_H */
HwiP_Params::eventId
uint16_t eventId
Definition: HwiP.h:132
args
void * args
Definition: hsmclient_msg.h:4
ADFSR
Definition: HwiP.h:326
DFSR
Definition: HwiP.h:336
IFSR::sd
volatile uint32_t sd
Definition: HwiP.h:322
HwiP_Object::intNum
uint32_t intNum
Definition: HwiP.h:144
HwiP_inISR
uint32_t HwiP_inISR(void)
Check if the caller of this function is inside a ISR or not.
AIFSR
Definition: HwiP.h:308
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.
DFSR::status
volatile uint32_t status
Definition: HwiP.h:337
IFSR
Definition: HwiP.h:319
HwiP_Params
Parameters passed during HwiP_construct.
Definition: HwiP.h:127
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:120
IFSR::status
volatile uint32_t status
Definition: HwiP.h:320
AIFSR::recoverable_error
volatile uint32_t recoverable_error
Definition: HwiP.h:313
ADFSR::recoverable_error
volatile uint32_t recoverable_error
Definition: HwiP.h:331
AIFSR::index
volatile uint32_t index
Definition: HwiP.h:309
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:133
HwiP_Params::isPulse
uint8_t isPulse
Definition: HwiP.h:135
DFSR::sd
volatile uint32_t sd
Definition: HwiP.h:339
HwiP_Params::callback
HwiP_FxnCallback callback
Definition: HwiP.h:130
ADFSR::cacheway
volatile uint32_t cacheway
Definition: HwiP.h:333
HwiP_init
void HwiP_init(void)
Initialize Hwi module.
HwiP_Object
Opaque Hwi object used with the Hwi APIs.
Definition: HwiP.h:142
AIFSR::side_ext
volatile uint32_t side_ext
Definition: HwiP.h:311
HwiP_Params::isFIQ
uint8_t isFIQ
Definition: HwiP.h:134
HwiP_Params::args
void * args
Definition: HwiP.h:131
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.
ADFSR::index
volatile uint32_t index
Definition: HwiP.h:327
HwiP_clearInt
void HwiP_clearInt(uint32_t intNum)
Clear a pending specific interrupt.
AIFSR::cacheway
volatile uint32_t cacheway
Definition: HwiP.h:315
ADFSR::side_ext
volatile uint32_t side_ext
Definition: HwiP.h:329
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:129
DFSR::rw
volatile uint32_t rw
Definition: HwiP.h:341
HwiP_FxnCallback
void(* HwiP_FxnCallback)(void *args)
Callback that is called when a HW interrupt is received.
Definition: HwiP.h:112
HwiP_Config
HwiP config parameters, setup as part of SysConfig, not to be set by end-users directly.
Definition: HwiP.h:119