MTOG
The Interconnect Isolation Gasket is a TI proprietary IP that is used to prevent a hang caused by target, which can hold up the interconnect and terminate such a transaction safely. It tracks transactions, and times out if outstanding too long, and reports the error via interrupt that can be monitored. The TOGs help to achieve Freedom From Interference by monitoring the various VBUS transactions and providing a way to detect any errors, and helping to avoid the bus to be locked up due to a transaction error.
Features Supported
These TOGs have the following functions, to avoid these concerns:
Monitors various VBUS transaction and provide a way to detect errors
Helps avoid the bus to be locked up due to a transaction in error.
Tracks outstanding transactions and allows for timeout/recovery.
Each of the Timeout gaskets can be programmed to a specific timeout and any transaction exceeding the timeout will result in abort of the transaction. This will also result in an error event triggered through ESM, which will in turn can be programmed to interrupt the CPU.
In addition the timeout gasket can be stopped, started and reset at anytime.
Safety diagnostics are provided for TOG module through API’s
Configure the TOG
Read the static registers
Verify the written configuration
SysConfig Features
None
Features NOT Supported
None
Important Usage Guidelines
None
Example Usage
The following shows an example of SDL TOG API usage by the application to set up the TOG for monitoring for events. Events can be monitored by enabling the events in the associated ESM instance.
Include the below file to access the APIs
#include <sdl/sdlr_mtog.h>
Initialization structure for WKUP ESM instance
static SDL_ESM_config MTOG_Example_esmInitConfig_WKUP =
{
.esmErrorConfig = {0u, 3u}, /* Self test error config */
.enableBitmap = {0x04000000u, 0x00000000u, 0x00000000u, 0x00000000u,
},
/**< All events enable: except timer and self test events, */
/* and Main ESM output.Configured based off esmErrorConfig to test high or low priorty events.*/
.priorityBitmap = {0x04000000u, 0x00000000u, 0x00000000u, 0x00000000u,
},
/**< Configured based off esmErrorConfig to test high or low priorty events. */
.errorpinBitmap = {0x04000000u, 0x00000000u, 0x00000000u, 0x00000000u,
},
};
Event handler API
void MTOG_eventHandler( uint32_t instanceIndex )
{
int32_t status = SDL_PASS;
/* Reset the Timeout gasket */
status = SDL_MTOG_reset( instanceIndex );
if (status == SDL_PASS)
{
DebugP_log("\n MTOG Reset done\n");
}
else{
DebugP_log("\n MTOG Reset failed");
}
doneFlag = true;
return;
}
ESM callback function
int32_t SDL_ESM_applicationCallbackFunction(SDL_ESM_Inst esmInst, SDL_ESM_IntType esmIntrType,
uint32_t grpChannel, uint32_t index, uint32_t intSrc, void *arg)
{
int32_t retVal = SDL_PASS;
MTOG_eventHandler(instanceIndex);
DebugP_log("\nInterrupt is generated to ESM\n");
DebugP_log(" ESM Call back function called : instType 0x%x, intType 0x%x, " \
"grpChannel 0x%x, index 0x%x, intSrc 0x%x \n",
esmInst, esmIntrType, grpChannel, index, intSrc);
DebugP_log(" Take action \n");
/* For clearing the interrupt */
IntrDisable(intSrc);
return retVal;
}
Initialize ESM
SDL_ESM_init(SDL_ESM_INST_WKUP_ESM0, &MTOG_Example_esmInitConfig_WKUP, SDL_ESM_applicationCallbackFunction, &apparg);
Configure a TOG instance with a timeout value
uint32_t instance;
SDL_MTOG_config config;
int32_t status=0;
uint32_t ESMEventNumber;
ESMEventNumber = SDLR_WKUP_R5FSS0_CORE0_INTR_GLUELOGIC_MGASKET_INTR_GLUE_OUT_0;
config.timeOut = SDL_MTOG_VAL_1K;
result = SDL_MTOG_init(instanceIndex, &config);
if (status != SDL_PASS)
{
DebugP_log(" SDL_MTOG_init Failed \n");
result = -1;
}
Call SDL API to enable Timeout Gasket
status = SDL_MTOG_start(instanceIndex);
if (status != SDL_PASS)
{
DebugP_log(" SDL_MTOG_start Failed \n");
result = -1;
}
Inject master timeout error
status = SDL_MTOG_forceTimeout(instanceIndex);
if (status != SDL_PASS)
{
DebugP_log("\n SDL_MTOG_forceTimeout Failed \n");
result = -1;
}
Wait for MTOG Interrupt
/* Timeout if exceeds time */
while ((!doneFlag)
&& (timeoutCount++ < MTOG_MAX_TIMEOUT_VALUE))
{
/* Use Polling */
MTOG_eventHandler(instanceIndex);
}
if(timeoutCount >= MTOG_MAX_TIMEOUT_VALUE)
{
DebugP_log("\n MTOG Timed out \n");
result = -1;
}
Disable ESM Interrupts
status=SDL_ESM_disableIntr(SDL_ESM_INST_WKUP_ESM0, ESMEventNumber);
if (status != SDL_PASS)
{
DebugP_log(" sdlAppEsmDisable Failed \n");
result = -1;
}
API Reference
Defines
-
SDL_MTOG_FORCE_KEY
Functions
-
int32_t SDL_MTOG_init(SDL_MTOG_Inst instance, const SDL_MTOG_config *pConfig)
Initialize Master TOG module with respect of instance.
This function allows software to initialize MTOG module
The pConfig contains the timeout value
- Parameters:
instance – [IN] MTOG instance
pConfig – [IN] Pointer to store the configuration
- Returns:
SDL_PASS The function completed successfully SDL_EBADARGS instance is invalid or pConfig is NULL
-
int32_t SDL_MTOG_verifyConfig(SDL_MTOG_Inst instance, const SDL_MTOG_config *pConfig)
Verifying written configuration with Master TOG module.
This function allows software to verifying MTOG module
The pConfig contains the timeout value
- Parameters:
instance – [IN] MTOG instance
pConfig – [IN] Pointer to store the configuration
- Returns:
SDL_PASS The function completed successfully SDL_EBADARGS instance is invalid or pConfig is NULL
-
int32_t SDL_MTOG_start(SDL_MTOG_Inst instance)
Start the timeout function.
This function starts the timeout counter functionality.
- Parameters:
instance – [IN] MTOG instance
- Returns:
SDL_PASS Function completed successfully SDL_EBADARGS pRegs is NULL
-
int32_t SDL_MTOG_stop(SDL_MTOG_Inst instance)
Stop the timeout function.
This function stops the timeout counter functionality.
- Parameters:
instance – [IN] MTOG instance
- Returns:
SDL_PASS Function completed successfully SDL_EBADARGS pRegs is NULL
-
int32_t SDL_MTOG_forceTimeout(SDL_MTOG_Inst instance)
Force a timeout.
This function enables software to force a timeout and flush of the interface transactions.
- Parameters:
instance – [IN] MTOG instance
- Returns:
SDL_PASS Function completed successfully SDL_EFAIL Timeout function is disabled. Call SDL_MTOG_start first. SDL_EBADARGS pRegs is NULL
-
int32_t SDL_MTOG_reset(SDL_MTOG_Inst instance)
Reset the timeout functionality.
This function resets the timeout functionality by clearing the timeout interrupt and timeout counter. It should be called after servicing a timeout interrupt and before re-enabling the timeout counter via the SDL_MTOG_start function.
Note that the timeout value set via the SDL_MTOG_setTimeoutVal function is unaffected.
- Parameters:
instance – [IN] MTOG instance
- Returns:
SDL_PASS Function completed successfully SDL_EBADARGS pRegs is NULL
-
int32_t SDL_MTOG_getStaticRegisters(SDL_MTOG_Inst instance, SDL_MTOG_staticRegs *pStaticRegs)
Readback Static configuration register.
This function reads back configuration registers that are static. Note that this is just one register master TOG
- Parameters:
instance – [IN] MTOG instance
pStaticRegs – [OUT] Pointer to store the read static registers
- Returns:
SDL_PASS Function completed successfully SDL_EBADARGS pRegs is NULL