Functions
WDT Functions
WDT

Functions

CSL_WdtHandle WDTIM_open (WDT_Instance wdtNum, CSL_WdtObj *wdtObj, CSL_Status *status)
CSL_Status WDTIM_start (CSL_WdtHandle hWdt)
CSL_Status WDTIM_stop (CSL_WdtHandle hWdt)
CSL_Status WDTIM_getCnt (CSL_WdtHandle hWdt, Uint32 *timeCnt)
CSL_Status WDTIM_close (CSL_WdtHandle hWdt)
CSL_Status WDTIM_service (CSL_WdtHandle hWdt)
CSL_Status WDTIM_config (CSL_WdtHandle hWdt, WDTIM_Config *hwConfig)
CSL_Status WDTIM_getConfig (CSL_WdtHandle hWdt, WDTIM_Config *getConfig)

Function Documentation

CSL_Status WDTIM_close ( CSL_WdtHandle  hWdt)

===========================================================================
WDTIM_close

Description
This function close WDT operation.

Arguments

            hWdt            Handle to the WDT
     

Return Value CSL_Status

  • CSL_SOK - Close successful
  • CSL_ESYS_BADHANDLE - Invalid handle

Pre Condition
WDTIM_open() must be called before this function call.

Post Condition
After calling this function no other function can call.

Modifies
None

Example

            CSL_status           status;
            CSL_WdtHandle		 hWdt;
            ...

           hWdt = WDTIM_open(WDT_INST_0, &wdtObj, &status);
           status = WDTIM_close(hWdt);
     

===========================================================================

References CSL_WdtObj::hwRegs, WDT_INST_0, and CSL_WdtObj::wdtInstance.

CSL_Status WDTIM_config ( CSL_WdtHandle  hWdt,
WDTIM_Config hwConfig 
)

===========================================================================
WDTIM_config

Description
This function is to Configure the WDT hardware related registers

Arguments

            hWdt            Handle to the WDT
			hwConfig        configuration structure.
     

Return Value CSL_Status

  • CSL_SOK - Close successful
  • CSL_ESYS_BADHANDLE - Invalid handle

Pre Condition
WDTIM_open() must be called before this function call.

Post Condition
After calling this function WDTIM_start() API should call to start wdt operation.

Modifies
This function modifies the WDT object structure.

Example

            CSL_status           status;
            CSL_WdtHandle 		 hWdt;
            WDTIM_Config         hwConfig;
            ...
			hwConfig.counter  = 0xFFFF;
	        hwConfig.prescale = 0x00FF;

           hWdt = WDTIM_open(WDT_INST_0, &wdtObj, &status);
		   status = WDTIM_config(hWdt, &hwConfig);
     

===========================================================================

References WDTIM_Config::counter, CSl_WDT_WDPSLR_FIRST_SEQ, CSl_WDT_WDPSLR_SECOND_SEQ, CSl_WDT_WDSVLR_FIRST_SEQ, CSl_WDT_WDSVLR_SECOND_SEQ, CSL_WdtObj::hwRegs, and WDTIM_Config::prescale.

CSL_Status WDTIM_getCnt ( CSL_WdtHandle  hWdt,
Uint32 *  timeCnt 
)

===========================================================================
WDTIM_getCnt

Description
This function is to get countdown value from Kick register

Arguments

            hWdt            Handle to the WDT
			timeCnt         Pointer to the countdown value
     

Return Value CSL_Status

  • CSL_SOK - Close successful
  • CSL_ESYS_BADHANDLE - Invalid handle

Pre Condition
WDTIM_start() must be called before this function call.

Post Condition
After calling this function WDTIM_close() API should call to close wdt operation.

Modifies
None

Example

            CSL_status           status;
            CSL_WdtHandle 		 hWdt;
            Uint32               timeCnt;
            ...

           status = WDTIM_start(hWdt);
		   status = WDTIM_getCnt(hWdt, &timeCnt);
     

===========================================================================

===========================================================================
WDTIM_getCnt

Description
This function is to get condown value from Kick register

Arguments

            hWdt            Handle to the WDT
			timeCnt         Pointer to the countdown value
     

Return Value CSL_Status

  • CSL_SOK - Close successful
  • CSL_ESYS_BADHANDLE - Invalid handle

Pre Condition
WDTIM_start() must be called before this function call.

Post Condition
After calling this function WDTIM_close() API should call to close wdt operation.

Modifies
None

Example

            CSL_status           status;
            CSL_WdtHandle 		 hWdt;
            Uint32               timeCnt;
            ...

           status = WDTIM_start(hWdt);
		   status = WDTIM_getCnt(hWdt, &timeCnt);
     

===========================================================================

References CSL_WdtObj::hwRegs.

CSL_Status WDTIM_getConfig ( CSL_WdtHandle  hWdt,
WDTIM_Config getConfig 
)

===========================================================================
WDTIM_getConfig

Description
This function is to Get Configure of the previous set configuration

Arguments

            hWdt            Handle to the WDT
			getConfig        configuration structure.
     

Return Value CSL_Status

  • CSL_SOK - Close successful
  • CSL_ESYS_BADHANDLE - Invalid handle

Pre Condition
WDTIM_config() must be called before this function call.

Post Condition
After calling this function WDTIM_Close() API can be call to close wdt operation.

Modifies
This function modifies the WDT object structure.

Example

            CSL_status           status;
            CSL_WdtHandle 		 hWdt;
            WDTIM_Config         getConfig;
            ...
			hwConfig.counter  = 0xFFFF;
	        hwConfig.prescale = 0x00FF;

           status = WDTIM_config(hWdt, &hwConfig);
		   status = WDTIM_getConfig(hWdt, &getConfig);
     

===========================================================================

References WDTIM_Config::counter, CSL_WdtObj::hwRegs, and WDTIM_Config::prescale.

CSL_WdtHandle WDTIM_open ( WDT_Instance  wdtNum,
CSL_WdtObj wdtObj,
CSL_Status *  status 
)

===========================================================================
WDTIM_open

Description
This is the initialization function for the GPT CSL. The function must be called before calling any other API from this CSL. This function is idem-potent. Currently, the function just returns handler to application.

Arguments

     

Return Value CSL_Status

  • CSL_SOK - Always returns

CSL_Handle Pointer to the object structure. Pre Condition
This should be call first before calling any other WDT Function.

Post Condition
The status is updated in the status variable. If status returned is

  • CSL_SOK - Valid GPT handle is returned
  • CSL_ESYS_INVPARAMS - Invalid parameter

Modifies
1. The status variable
2. The object structure handler.

Example

            CSL_WdtHandle	hWdt;
            WDT_Instance	wdtNum;
			CSL_WdtObj		wdtObj;
		  	CSL_Status 		status;
			....
			....
			instance = WDT_INST_0.

            hWdt = WDTIM_open(WDT_INST_0, &wdtObj, &status);
     

===========================================================================

References CSL_WdtObj::hwRegs, WDT_INST_0, WDT_INST_INVALID, and CSL_WdtObj::wdtInstance.

CSL_Status WDTIM_service ( CSL_WdtHandle  hWdt)

===========================================================================
WDTIM_service

Description
This function Service watch dog timer. Without service function WDT reset the target device.

Arguments

            hWdt            Handle to the WDT
     

Return Value CSL_Status

  • CSL_SOK - Close successful
  • CSL_ESYS_BADHANDLE - Invalid handle

Pre Condition
WDTIM_start() must be called before this function call.

Post Condition
None

Modifies
None

Example

            CSL_status           status;
            CSL_WdtHandle		 hWdt;
            ...

           status = WDTIM_start(hWdt);
           status = WDTIM_service(hWdt);
     

===========================================================================

References CSl_WDT_WDKCKLK_FIRST_SEQ, CSl_WDT_WDKCKLK_SECOND_SEQ, CSl_WDT_WDKICK_RESET, and CSL_WdtObj::hwRegs.

CSL_Status WDTIM_start ( CSL_WdtHandle  hWdt)

===========================================================================
WDTIM_start

Description
This function start to load value from counter register to kick register.

Arguments

            hWdt            Handle to the WDT
     

Return Value CSL_Status

  • CSL_SOK - Close successful
  • CSL_ESYS_BADHANDLE - Invalid handle

Pre Condition
WDTIM_config() must be called before this function call.

Post Condition
After calling this function WDTIM_stop() function can call to stop loading from counter register to kick register.

Modifies
None

Example

            CSL_status           status;
            CSL_WdtHandle 		 hWdt;
            ...

           status = WDTIM_config(hWdt, &hwConfig);
           status = WDTIM_start(hWdt);
     

===========================================================================

References CSl_WDT_WDENLOK_FIRST_SEQ, CSl_WDT_WDENLOK_SECOND_SEQ, CSl_WDT_WDENLOK_THIRD_SEQ, and CSL_WdtObj::hwRegs.

CSL_Status WDTIM_stop ( CSL_WdtHandle  hWdt)

===========================================================================
GPT_stop

Description
This function stop to load value from counter register to kick register.

Arguments

            hWdt            Handle to the WDT
     

Return Value CSL_Status

  • CSL_SOK - Close successful
  • CSL_ESYS_BADHANDLE - Invalid handle

Pre Condition
GPT_start() must be called before this function call.

Post Condition
After calling this function WDTIM_close() API should call to close WDT operation.

Modifies
None

Example

            CSL_status           status;
            CSL_WdtHandle 		 hWdt;
            ...

           status = WDTIM_start(hWdt);
		   status = WDTIM_stop(hWdt);
     

===========================================================================

References CSl_WDT_WDENLOK_FIRST_SEQ, CSl_WDT_WDENLOK_SECOND_SEQ, CSl_WDT_WDENLOK_THIRD_SEQ, and CSL_WdtObj::hwRegs.