AM261x MCU+ SDK: sdl_dpl.h Source File

| AM261x MCU+ SDK 26.00.00 |

sdl_dpl.h
Go to the documentation of this file.
1 /* Copyright (C) 2022 Texas Instruments Incorporated.
2 *
3 * Redistribution and use in source and binary forms, with or without
4 * modification, are permitted provided that the following conditions
5 * are met:
6 *
7 * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 *
10 * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the
13 * distribution.
14 *
15 * Neither the name of Texas Instruments Incorporated nor the names of
16 * its contributors may be used to endorse or promote products derived
17 * from this software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 *
31 */
32
52 #ifndef SDL_DPL_H_
53 #define SDL_DPL_H_
54
55 #include <stdint.h>
56 #include <sdl/include/sdl_types.h>
57
58 /* Data Structures and Types */
59
63 typedef void (*pSDL_DPL_InterruptCallbackFunction)(void *arg);
64
69 typedef struct SDL_DPL_HwipParams_s
70 {
71 int32_t intNum;
73 pSDL_DPL_InterruptCallbackFunction callback;
75 uintptr_t callbackArg;
77 } SDL_DPL_HwipParams;
78
79 typedef void* pSDL_DPL_HwipHandle;
80
84 typedef int32_t (*pSDL_DPL_InterruptFunction)(int32_t intNum);
85
89 typedef pSDL_DPL_HwipHandle (*pSDL_DPL_RegisterFunction)(SDL_DPL_HwipParams *pParams);
90
94 typedef int32_t (*pSDL_DPL_DeregisterFunction)(pSDL_DPL_HwipHandle handle);
95
99 typedef int32_t (*pSDL_DPL_DelayFunction)(int32_t ndelay);
100
104 typedef void* (*pSDL_DPL_AddrTranslateFunction)(uint64_t addr, uint32_t size);
105
109 typedef int32_t (*pSDL_DPL_globalDisableInterruptsFunction)(uintptr_t *key);
110
114 typedef int32_t (*pSDL_DPL_globalRestoreInterruptsFunction)(uintptr_t key);
115
120 typedef struct SDL_DPL_Interface_s
121 {
123 pSDL_DPL_InterruptFunction enableInterrupt;
125 pSDL_DPL_InterruptFunction disableInterrupt;
127 pSDL_DPL_RegisterFunction registerInterrupt;
129 pSDL_DPL_DeregisterFunction deregisterInterrupt;
131 pSDL_DPL_DelayFunction delay;
133 pSDL_DPL_globalDisableInterruptsFunction globalDisableInterrupts;
135 pSDL_DPL_globalRestoreInterruptsFunction globalRestoreInterrupts;
137 pSDL_DPL_AddrTranslateFunction addrTranslate;
138 } SDL_DPL_Interface;
139
140 /* Functions */
141
156 int32_t SDL_DPL_init(SDL_DPL_Interface *dplInterface);
157
170 int32_t SDL_DPL_enableInterrupt(int32_t intNum);
171
184 int32_t SDL_DPL_disableInterrupt(int32_t intNum);
185
199 int32_t SDL_DPL_registerInterrupt(SDL_DPL_HwipParams *pParams, pSDL_DPL_HwipHandle *handle);
200
213 int32_t SDL_DPL_deregisterInterrupt(pSDL_DPL_HwipHandle handle);
214
228 int32_t SDL_DPL_delay(int32_t ndelay);
229
242 void *SDL_DPL_addrTranslate(uint64_t addr, uint32_t size);
243
262 int32_t SDL_DPL_globalDisableInterrupts(uintptr_t *key);
263
279 int32_t SDL_DPL_globalRestoreInterrupts(uintptr_t key);
280
283 #endif /* SDL_DPL_H_ */
pSDL_DPL_globalRestoreInterruptsFunction
int32_t(* pSDL_DPL_globalRestoreInterruptsFunction)(uintptr_t key)
Prototype for the interrupt global restore function.
Definition: sdl_dpl.h:114
SDL_DPL_Interface::addrTranslate
pSDL_DPL_AddrTranslateFunction addrTranslate
Definition: sdl_dpl.h:137
pSDL_DPL_InterruptCallbackFunction
void(* pSDL_DPL_InterruptCallbackFunction)(void *arg)
Prototype for the interrupt callback function.
Definition: sdl_dpl.h:63
SDL_DPL_Interface::enableInterrupt
pSDL_DPL_InterruptFunction enableInterrupt
Definition: sdl_dpl.h:123
SDL_DPL_disableInterrupt
int32_t SDL_DPL_disableInterrupt(int32_t intNum)
DPL disable interrupt.
SDL_DPL_Interface::disableInterrupt
pSDL_DPL_InterruptFunction disableInterrupt
Definition: sdl_dpl.h:125
SDL_DPL_init
int32_t SDL_DPL_init(SDL_DPL_Interface *dplInterface)
DPL init.
pSDL_DPL_InterruptFunction
int32_t(* pSDL_DPL_InterruptFunction)(int32_t intNum)
Prototype for the interrupt enable/disable functions.
Definition: sdl_dpl.h:84
pSDL_DPL_RegisterFunction
pSDL_DPL_HwipHandle(* pSDL_DPL_RegisterFunction)(SDL_DPL_HwipParams *pParams)
Prototype for the interrupt registration function.
Definition: sdl_dpl.h:89
pSDL_DPL_AddrTranslateFunction
void *(* pSDL_DPL_AddrTranslateFunction)(uint64_t addr, uint32_t size)
Prototype for address translation function.
Definition: sdl_dpl.h:104
SDL_DPL_Interface::globalRestoreInterrupts
pSDL_DPL_globalRestoreInterruptsFunction globalRestoreInterrupts
Definition: sdl_dpl.h:135
SDL_DPL_HwipParams
This structure contains the parameters for interrupt registration through the SDL DPL interface.
Definition: sdl_dpl.h:70
SDL_DPL_Interface::delay
pSDL_DPL_DelayFunction delay
Definition: sdl_dpl.h:131
SDL_DPL_globalRestoreInterrupts
int32_t SDL_DPL_globalRestoreInterrupts(uintptr_t key)
DPL globally enable interrupts.
SDL_DPL_Interface
This structure contains the pointers for the DPL interfaces provided by the application to SDL_DPL_in...
Definition: sdl_dpl.h:121
pSDL_DPL_globalDisableInterruptsFunction
int32_t(* pSDL_DPL_globalDisableInterruptsFunction)(uintptr_t *key)
Prototype for the interrupt global disable function.
Definition: sdl_dpl.h:109
SDL_DPL_Interface::globalDisableInterrupts
pSDL_DPL_globalDisableInterruptsFunction globalDisableInterrupts
Definition: sdl_dpl.h:133
SDL_DPL_HwipParams::intNum
int32_t intNum
Definition: sdl_dpl.h:71
SDL_DPL_enableInterrupt
int32_t SDL_DPL_enableInterrupt(int32_t intNum)
DPL enable interrupt.
SDL_DPL_Interface::registerInterrupt
pSDL_DPL_RegisterFunction registerInterrupt
Definition: sdl_dpl.h:127
SDL_DPL_HwipParams::callbackArg
uintptr_t callbackArg
Definition: sdl_dpl.h:75
SDL_DPL_HwipParams::callback
pSDL_DPL_InterruptCallbackFunction callback
Definition: sdl_dpl.h:73
SDL_DPL_deregisterInterrupt
int32_t SDL_DPL_deregisterInterrupt(pSDL_DPL_HwipHandle handle)
DPL deregister interrupt.
SDL_DPL_delay
int32_t SDL_DPL_delay(int32_t ndelay)
DPL delay.
SDL_DPL_Interface::deregisterInterrupt
pSDL_DPL_DeregisterFunction deregisterInterrupt
Definition: sdl_dpl.h:129
SDL_DPL_registerInterrupt
int32_t SDL_DPL_registerInterrupt(SDL_DPL_HwipParams *pParams, pSDL_DPL_HwipHandle *handle)
DPL register interrupt.
SDL_DPL_addrTranslate
void * SDL_DPL_addrTranslate(uint64_t addr, uint32_t size)
DPL Address translation function.
pSDL_DPL_DeregisterFunction
int32_t(* pSDL_DPL_DeregisterFunction)(pSDL_DPL_HwipHandle handle)
Prototype for the interrupt de-register function.
Definition: sdl_dpl.h:94
SDL_DPL_globalDisableInterrupts
int32_t SDL_DPL_globalDisableInterrupts(uintptr_t *key)
DPL globally disable interrupts.
pSDL_DPL_HwipHandle
void * pSDL_DPL_HwipHandle
Definition: sdl_dpl.h:79
pSDL_DPL_DelayFunction
int32_t(* pSDL_DPL_DelayFunction)(int32_t ndelay)
Prototype for the delay function.
Definition: sdl_dpl.h:99