AM261x MCU+ SDK: SDL DPL

| AM261x MCU+ SDK 26.00.00 |

SDL DPL

The SDL requires the application to provide an DPL implementation for various functionalities in order to keep SDL as OS-agnostic. Primarily, the SDL requires DPL implementations for interrupt registration and enable/disable, and also for a delay mechanism needed for POK programming.

# Features Supported

The SDL DPL layer provides support for the application to define the following functionalities to be used by SDL:

- Interrupt Enable/Disable
- Interrupt Register/De-register
- Address Translation
- Delay

These features are provided by the application by calling SDL_DPL_init() with the appropriate function pointers.

# SysConfig Features

- None

# Features NOT Supported

- None

# Important Usage Guidelines

- SDL_DPL_init() must be called before using any SDL module that utilizes the SDL DPL APIs.

# Example Usage

The SDL provides a sample implementation of these APIs as part of the SDL examples. The sample implementation re-uses PDK DPL APIs from the SDK in order to provide the services. This is verified with the following Operating Systems:

- Non-OS (Baremetal)

The existing baremetal sample DPL interface can be used, or the application may implement it's own. To use the existing sample interface:

1. Add the source file dpl_interface.c (located in example/dpl/src/) to the application's build
2. Include the header dpl_interface.h (located in example/dpl/) to the application's source file
3. Call the example's DPL initializtion function SDL_TEST_dplInit() to initialize the DPL. Do this before calling any SDL APIs.

Alternatively, the application may implement it's own DPL. An example of how to do this is shown below

Include the below file to access the APIs

#include <sdl/sdl_dpl.h>

Define the DPL APIs

HwiP_Object gHwiObject;

pSDL_DPL_HwipHandle SDL_TEST_registerInterrupt(SDL_DPL_HwipParams *pParams)
{
HwiP_Params hwipParams;
HwiP_Params_init(&hwipParams);
hwipParams.args = (void *)pParams->callbackArg;
hwipParams.intNum = pParams->intNum;
hwipParams.callback = pParams->callback;
HwiP_construct(&gHwiObject, &hwipParams);
return &gHwiObject;
}
int32_t SDL_TEST_enableInterrupt(uint32_t intNum)
{
HwiP_enableInt(intNum);
return SDL_PASS;
}
int32_t SDL_TEST_disableInterrupt(uint32_t intNum)
{
HwiP_disableInt(intNum);
return SDL_PASS;
}
void* SDL_TEST_addrTranslate(uint64_t addr, uint32_t size)
{
uint32_t transAddr = (uint32_t)(-1);
transAddr = (uint32_t)AddrTranslateP_getLocalAddr(addr);
return (void *)transAddr;
}
int32_t SDL_TEST_deregisterInterrupt(pSDL_DPL_HwipHandle handle)
{
HwiP_destruct(handle);
return SDL_PASS;
}

Initalize the DPL Interface

SDL_DPL_Interface dpl_interface =
{
.enableInterrupt = (pSDL_DPL_InterruptFunction) SDL_TEST_enableInterrupt,
.disableInterrupt = (pSDL_DPL_InterruptFunction) SDL_TEST_disableInterrupt,
.registerInterrupt = (pSDL_DPL_RegisterFunction) SDL_TEST_registerInterrupt,
.deregisterInterrupt = (pSDL_DPL_DeregisterFunction) SDL_TEST_deregisterInterrupt,
.delay = (pSDL_DPL_DelayFunction) ClockP_sleep,
.addrTranslate = (pSDL_DPL_AddrTranslateFunction) SDL_TEST_addrTranslate
};
int32_t main(void)
{
SDL_ErrType_t ret = SDL_PASS;
ret = SDL_DPL_init(&dpl_interface);
return ret;
}

# API

APIs for SDL DPL

HwiP_destruct
void HwiP_destruct(HwiP_Object *obj)
Cleanup, delete, destruct a Hwi object.
HwiP_disableInt
uint32_t HwiP_disableInt(uint32_t intNum)
Disable a specific interrupt.
HwiP_Params
Parameters passed during HwiP_construct.
Definition: HwiP.h:127
SDL_DPL_Interface::enableInterrupt
pSDL_DPL_InterruptFunction enableInterrupt
Definition: sdl_dpl.h:123
ClockP_sleep
void ClockP_sleep(uint32_t sec)
Sleep for user specified seconds.
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
HwiP_construct
int32_t HwiP_construct(HwiP_Object *obj, HwiP_Params *params)
Create a Hwi object.
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_HwipParams
This structure contains the parameters for interrupt registration through the SDL DPL interface.
Definition: sdl_dpl.h:70
HwiP_Params_init
void HwiP_Params_init(HwiP_Params *params)
Set default values to HwiP_Params.
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
HwiP_enableInt
void HwiP_enableInt(uint32_t intNum)
Enable a specific interrupt.
SDL_DPL_HwipParams::intNum
int32_t intNum
Definition: sdl_dpl.h:71
AddrTranslateP_getLocalAddr
void * AddrTranslateP_getLocalAddr(uint64_t systemAddr)
Translate from system address to a CPU address as seen via the RAT module.
HwiP_Params::callback
HwiP_FxnCallback callback
Definition: HwiP.h:130
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
HwiP_Params::args
void * args
Definition: HwiP.h:131
pSDL_DPL_DeregisterFunction
int32_t(* pSDL_DPL_DeregisterFunction)(pSDL_DPL_HwipHandle handle)
Prototype for the interrupt de-register function.
Definition: sdl_dpl.h:94
pSDL_DPL_HwipHandle
void * pSDL_DPL_HwipHandle
Definition: sdl_dpl.h:79
HwiP_Params::intNum
uint32_t intNum
Definition: HwiP.h:129
pSDL_DPL_DelayFunction
int32_t(* pSDL_DPL_DelayFunction)(int32_t ndelay)
Prototype for the delay function.
Definition: sdl_dpl.h:99