12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013 |
- /**
- * @file csl_tmrAux.h
- *
- * @brief
- * This is the TIMER Auxilary Header File which exposes the various
- * CSL Functional Layer API's to configure the TIMER Module.
- *
- * \par
- * ============================================================================
- * @n (C) Copyright 2002-2011, Texas Instruments, Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of Texas Instruments Incorporated nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
- #ifndef CSL_TMRAUX_H
- #define CSL_TMRAUX_H
- #include <ti/csl/csl_tmr.h>
- #ifdef __cplusplus
- extern "C" {
- #endif
- /** @addtogroup CSL_TIMER_FUNCTION
- @{ */
-
- /** ============================================================================
- * @n@b CSL_tmrGetTimHiCount
- *
- * @b Description
- * @n This function gets the value of the CNTHI counter
- *
- * @b Arguments
- * @verbatim
- hTmr Pointer to the object that holds reference to the
- instance of TIMER requested after the call
- countHi Output parameter to get the CNTHI value
- @endverbatim
- *
- * <b> Return Value </b>
- * @n The argument countHi is populated with the contents of the CNTHI register
- *
- * <b> Pre Condition </b>
- * @n Both @a CSL_tmrInit() and @a CSL_tmrOpen() must be called.
- *
- * <b> Post Condition </b>
- * @n None
- *
- * @b Reads
- * @n TMR_CNTHI_CNT
- *
- * @b Example
- * @verbatim
- CSL_TmrHandle hTmr;
- Unit32* countHi;
- ...
- CSL_tmrGetTimHiCount(hTmr, &countHi);
- ...
- @endverbatim
- * ============================================================================
- */
- /* for misra warnings*/
- static inline void CSL_tmrGetTimHiCount (CSL_TmrHandle hTmr,Uint32 *countHi);
- static inline void CSL_tmrGetTimHiCount (CSL_TmrHandle hTmr,Uint32 *countHi)
- {
- *countHi = CSL_FEXT (hTmr->regs->CNTHI, TMR_CNTHI_CNT);
- }
- /** ===========================================================================
- * @n@b CSL_tmrGetTimLoCount
- *
- * @b Description
- * @n This function gets the value of the CNTLO counter
- *
- * @b Arguments
- * @verbatim
- hTmr Pointer to the object that holds reference to the
- instance of TIMER requested after the call
- countLo Output parameter to get the CNTLO value
- @endverbatim
- *
- * <b> Return Value </b>
- * None
- *
- * <b> Pre Condition </b>
- * @n Both @a CSL_tmrInit() and @a CSL_tmrOpen() must be called.
- *
- * <b> Post Condition </b>
- * @n The argument countLo is populated with the contents of the CNTLO register
- *
- * @b Reads
- * @n TMR_CNTLO_CNT
- *
- * @b Example
- * @verbatim
- CSL_TmrHandle hTmr;
- Unit32 *countLo;
- ...
- CSL_tmrGetTimLoCount(hTmr, &countLo);
- ...
- @endverbatim
- * ============================================================================
- */
- /* for misra warnings*/
- static inline void CSL_tmrGetTimLoCount (CSL_TmrHandle hTmr,Uint32* countLo);
- static inline void CSL_tmrGetTimLoCount (CSL_TmrHandle hTmr,Uint32* countLo)
- {
- *countLo = CSL_FEXT (hTmr->regs->CNTLO, TMR_CNTLO_CNT);
- }
- /** ===========================================================================
- * @n@b CSL_tmrGetTstatLoStatus
- *
- * @b Description
- * @n This function gets the status of the TINTLO
- *
- * @b Arguments
- * @verbatim
- hTmr Pointer to the object that holds reference to the
- instance of TIMER requested after the call
- @endverbatim
- *
- * <b> Return Value </b>
- * @n CSL_TmrTstatLo - TINTLO status value
- * @li CSL_TMR_TSTAT_LO_LOW - Data low
- * @li CSL_TMR_TSTAT_LO_HIGH - Data High
- *
- * <b> Pre Condition </b>
- * @n Both @a CSL_tmrInit() and @a CSL_tmrOpen() must be called.
- *
- * <b> Post Condition </b>
- * @n None
- *
- * @b Reads
- * @n TMR_TCR_TSTAT_LO
- *
- * @b Example
- * @verbatim
- CSL_TmrHandle hTmr;
- CSL_TmrTstatLo statusLo;
- ...
- statusLo = CSL_tmrGetTstatLoStatus(hTmr);
- ...
- @endverbatim
- * ===========================================================================
- */
- /* for misra warnings*/
- static inline CSL_TmrTstat CSL_tmrGetTstatLoStatus (CSL_TmrHandle hTmr);
- static inline CSL_TmrTstat CSL_tmrGetTstatLoStatus (CSL_TmrHandle hTmr)
- {
- return (CSL_TmrTstat)CSL_FEXT(hTmr->regs->TCR, TMR_TCR_TSTAT_LO);
- }
- /** ===========================================================================
- * @n@b CSL_tmrGetTstatHiStatus
- *
- * @b Description
- * @n This function gets the status of the TINTHI
- *
- * @b Arguments
- * @verbatim
- hTmr Pointer to the object that holds reference to the
- instance of TIMER requested after the call
- @endverbatim
- *
- * <b> Return Value </b>
- * @n CSL_TmrTstatHi - TINTHI status value
- * @li CSL_TMR_TSTATHI_LOW - Data low
- * @li CSL_TMR_TSTATHI_HIGH - Data High
- *
- * <b> Pre Condition </b>
- * @n Both @a CSL_tmrInit() and @a CSL_tmrOpen() must be called.
- *
- * <b> Post Condition </b>
- * @n None
- *
- * @b Reads
- * @n TMR_TCR_TSTAT_HI
- *
- * @b Example
- * @verbatim
- CSL_TmrHandle hTmr;
- CSL_TmrTstatHi statusHi;
- ...
- statusHi = CSL_tmrGetTstatHiStatus(hTmr);
- ...
- @endverbatim
- * ============================================================================
- */
- /* for misra warnings*/
- static inline CSL_TmrTstat CSL_tmrGetTstatHiStatus (CSL_TmrHandle hTmr);
- static inline CSL_TmrTstat CSL_tmrGetTstatHiStatus (CSL_TmrHandle hTmr)
- {
- return (CSL_TmrTstat)CSL_FEXT(hTmr->regs->TCR, TMR_TCR_TSTAT_HI);
- }
- /** ===========================================================================
- * @n@b CSL_tmrGetWdflagStatus
- *
- * @b Description
- * @n This function gets the status of the WDFLAG
- *
- * @b Arguments
- * @verbatim
- hTmr Pointer to the object that holds reference to the
- instance of TIMER requested after the call
- @endverbatim
- *
- * <b> Return Value </b>
- * @n CSL_TmrFlagBitStatus - WDFLAG status value
- * @li CSL_TMR_WDFLAG_NOTIMEOUT - no watchdog timeout occurred
- * @li CSL_TMR_WDFLAG_TIMEOUT - watchdog timeout occurred
- *
- * <b> Pre Condition </b>
- * @n Both @a CSL_tmrInit() and @a CSL_tmrOpen() must be called and the
- * Timer should be set in WATCHDOG mode
- *
- * <b> Post Condition </b>
- * @n None
- *
- * @b Reads
- * @n TMR_WDTCR_WDFLAG
- *
- * @b Example
- * @verbatim
- CSL_TmrHandle hTmr;
- CSL_TmrWdflagBitStatus status;
- ...
- status = CSL_tmrGetWdflagStatus(hTmr);
- ...
- @endverbatim
- * ===========================================================================
- */
- /* for misra warnings*/
- static inline CSL_TmrWdflagBitStatus CSL_tmrGetWdflagStatus (CSL_TmrHandle hTmr);
- static inline CSL_TmrWdflagBitStatus CSL_tmrGetWdflagStatus (CSL_TmrHandle hTmr)
- {
- return (CSL_TmrWdflagBitStatus)CSL_FEXT(hTmr->regs->WDTCR, TMR_WDTCR_WDFLAG);
- }
- /** ============================================================================
- * @n@b CSL_TmrLoadPrdLo
- *
- * @b Description
- * Loads the General purpose timer LOW period register.
- *
- * @b Arguments
- * @verbatim
- hTmr Handle to the Gptimer instance
- loadVal Value to be loaded to the Gptimer period register Low
- @endverbatim
- *
- * <b> Return Value </b>
- * @n None
- *
- * <b> Pre Condition </b>
- * @n Both @a CSL_tmrInit() and @a CSL_tmrOpen() must be called.
- *
- * <b> Post Condition </b>
- * @n Period register is loaded with the given value.
- *
- * @b Writes
- * @n TMR_PRDLO_PRDLO
- *
- * @b Example
- * @verbatim
- CSL_TmrHandle hTmr;
- Uint32 loadVal;
- loadVal = 10;
- CSL_TmrLoadPrdLo(hWdt, &loadVal);
- ...
- @endverbatim
- * ===========================================================================
- */
- /* for misra warnings*/
- static inline void CSL_TmrLoadPrdLo (CSL_TmrHandle hTmr,const Uint32* loadVal);
- static inline void CSL_TmrLoadPrdLo (CSL_TmrHandle hTmr,const Uint32* loadVal)
- {
- CSL_FINS (hTmr->regs->PRDLO, TMR_PRDLO_PRDLO, *loadVal);
- }
- /** ============================================================================
- * @n@b CSL_TmrLoadPrdHi
- *
- * @b Description
- * Loads the General purpose timer HIGH period register
- *
- * @b Arguments
- * @verbatim
- hTmr Handle to the GPtimer instance
- loadVal Value to be loaded to the Gptimer period register High
- @endverbatim
- *
- * <b> Return Value </b>
- * None
- *
- * <b> Pre Condition </b>
- * @n Both @a CSL_tmrInit() and @a CSL_tmrOpen() must be called.
- *
- * <b> Post Condition </b>
- * @n Period register is loaded with the given value.
- *
- * @b Writes
- * @n TMR_PRDHI_PRDHI
- *
- * @b Example
- * @verbatim
- CSL_TmrHandle hTmr;
- Uint32 loadVal;
- ...
- loadVal = 10;
- CSL_TmrLoadPrdHi(hWdt, &loadVal);
- ...
- @endverbatim
- * ===========================================================================
- */
- /* for misra warnings*/
- static inline void CSL_TmrLoadPrdHi (CSL_TmrHandle hTmr,const Uint32* loadVal);
- static inline void CSL_TmrLoadPrdHi (CSL_TmrHandle hTmr,const Uint32* loadVal)
- {
- CSL_FINS (hTmr->regs->PRDHI, TMR_PRDHI_PRDHI, *loadVal);
- }
- /** ============================================================================
- * @n@b CSL_TmrLoadRelLo
- *
- * @b Description
- * Loads the General purpose timer LOW reload register.
- *
- * @b Arguments
- * @verbatim
- hTmr Handle to the Gptimer instance
- loadVal Value to be loaded to the Gptimer reload register Low
- @endverbatim
- *
- * <b> Return Value </b>
- * @n None
- *
- * <b> Pre Condition </b>
- * @n Both @a CSL_tmrInit() and @a CSL_tmrOpen() must be called.
- *
- * <b> Post Condition </b>
- * @n Reload register is loaded with the given value.
- *
- * @b Writes
- * @n TMR_RELLO_RELLO
- *
- * @b Example
- * @verbatim
- CSL_TmrHandle hTmr;
- Uint32 loadVal;
- loadVal = 10;
- CSL_TmrLoadRelLo(hWdt, &loadVal);
- ...
- @endverbatim
- * ===========================================================================
- */
- /* for misra warnings*/
- static inline void CSL_TmrLoadRelLo (CSL_TmrHandle hTmr,const Uint32* loadVal);
- static inline void CSL_TmrLoadRelLo (CSL_TmrHandle hTmr,const Uint32* loadVal)
- {
- CSL_FINS (hTmr->regs->RELLO, TMR_RELLO_RELLO, *loadVal);
- }
- /** ============================================================================
- * @n@b CSL_TmrLoadRelHi
- *
- * @b Description
- * Loads the General purpose timer HIGH reload register
- *
- * @b Arguments
- * @verbatim
- hTmr Handle to the GPtimer instance
- loadVal Value to be loaded to the Gptimer reload register High
- @endverbatim
- *
- * <b> Return Value </b>
- * None
- *
- * <b> Pre Condition </b>
- * @n Both @a CSL_tmrInit() and @a CSL_tmrOpen() must be called.
- *
- * <b> Post Condition </b>
- * @n Reload register is loaded with the given value.
- *
- * @b Writes
- * @n TMR_RELHI_RELHI
- *
- * @b Example
- * @verbatim
- CSL_TmrHandle hTmr;
- Uint32 loadVal;
- ...
- loadVal = 10;
- CSL_TmrLoadRelHi(hWdt, &loadVal);
- ...
- @endverbatim
- * ===========================================================================
- */
- /* for misra warnings*/
- static inline void CSL_TmrLoadRelHi (CSL_TmrHandle hTmr,const Uint32* loadVal);
- static inline void CSL_TmrLoadRelHi (CSL_TmrHandle hTmr,const Uint32* loadVal)
- {
- CSL_FINS (hTmr->regs->RELHI, TMR_RELHI_RELHI, *loadVal);
- }
- /** ============================================================================
- * @n@b CSL_TmrLoadPrescalarHi
- *
- * @b Description
- * Configures the prescalar values for the HIGH Timer.
- *
- * @b Arguments
- * @verbatim
- hTmr Handle to the Timer Instance
- loadVal Value to be loaded to the PRESCALAR bits in the TGCR register
- @endverbatim
- *
- * <b> Return Value </b>
- * @n None
- *
- * <b> Pre Condition </b>
- * @n Both @a CSL_tmrInit() and @a CSL_tmrOpen() must be called.
- *
- * <b> Post Condition </b>
- * @n Gptimer pre scalar register is loaded with the given value.
- *
- * @b Writes
- * @n TMR_TGCR_PSCHI
- *
- * @b Example
- * @verbatim
- CSL_TmrHandle hTmr;
- Uint8 *loadVal;
- ...
- CSL_TmrLoadPrescalarHi(hWdt, &loadVal);
- ...
- @endverbatim
- * ===========================================================================
- */
- /* for misra warnings*/
- static inline void CSL_TmrLoadPrescalarHi (CSL_TmrHandle hTmr, const Uint8* loadVal);
- static inline void CSL_TmrLoadPrescalarHi (CSL_TmrHandle hTmr, const Uint8* loadVal)
- {
- CSL_FINS(hTmr->regs->TGCR, TMR_TGCR_PSCHI, ((Uint32)(*loadVal)));
- }
- /** ============================================================================
- * @n@b CSL_TmrStartHi
- *
- * @b Description
- * The functions starts the HIGH timer.
- *
- * @b Arguments
- * @verbatim
- hTmr Handle to the Timer instance
- countMode Specifies the timer counting mode (OFF/CONTINIOUS/SINGLE Shot)
- @endverbatim
- *
- * <b> Return Value </b>
- * None
- *
- * <b> Pre Condition </b>
- * @n Both @a CSL_tmrInit() and @a CSL_tmrOpen() must be called.
- *
- * <b> Post Condition </b>
- * @n The HIGH timer is brought out of reset and is activated in the
- * provided counting mode.
- *
- * @b Writes
- * @n TMR_TGCR_TIMHIRS=1,TMR_TCR_ENAMODE_HI
- *
- * @b Example
- * @verbatim
- CSL_TmrHandle hTmr;
- ...
- CSL_TmrStartHi(hTmr, CSL_TMR_ENAMODE_ENABLE);
- ...
- @endverbatim
- * ===========================================================================
- */
- /* for misra warnings*/
- static inline void CSL_TmrStartHi (CSL_TmrHandle hTmr, CSL_TmrEnamode countMode);
- static inline void CSL_TmrStartHi (CSL_TmrHandle hTmr, CSL_TmrEnamode countMode)
- {
- /* Bring the HIGH Timer out of reset. */
- CSL_FINST(hTmr->regs->TGCR, TMR_TGCR_TIMHIRS, RESET_OFF);
- /* Configure the HIGH TIMER with the appropriate counting mode. */
- CSL_FINS(hTmr->regs->TCR, TMR_TCR_ENAMODE_HI, countMode);
- return;
- }
- /** ============================================================================
- * @n@b CSL_TmrStartLo
- *
- * @b Description
- * The function starts the LOW Timer.
- *
- * @b Arguments
- * @verbatim
- hTmr Handle to the Gptimer instance
- countMode Specifies the timer counting mode (OFF/CONTINIOUS/SINGLE Shot)
- @endverbatim
- *
- * <b> Return Value </b>
- * None
- *
- * <b> Pre Condition </b>
- * @n Both @a CSL_tmrInit() and @a CSL_tmrOpen() must be called.
- *
- * <b> Post Condition </b>
- * @n The LOW timer is brought out of reset and is activated in the
- * provided counting mode.
- *
- * @b Writes
- * @n TMR_TGCR_TIMLORS=1,TMR_TCR_ENAMODE_LO
- *
- * @b Example
- * @verbatim
- CSL_TmrHandle hTmr;
- ...
- CSL_TmrStartLo(hTmr, CSL_TMR_ENAMODE_ENABLE);
- ...
- @endverbatim
- * ===========================================================================
- */
- /* for misra warnings*/
- static inline void CSL_TmrStartLo (CSL_TmrHandle hTmr, CSL_TmrEnamode countMode);
- static inline void CSL_TmrStartLo (CSL_TmrHandle hTmr, CSL_TmrEnamode countMode)
- {
- /* Bring the LOW Timer out of reset. */
- CSL_FINST(hTmr->regs->TGCR, TMR_TGCR_TIMLORS, RESET_OFF);
- /* Configure the LOW TIMER with the appropriate counting mode. */
- CSL_FINS(hTmr->regs->TCR, TMR_TCR_ENAMODE_LO, countMode);
- }
- /** ===========================================================================
- * @n@b CSL_TmrStart64
- *
- * @b Description
- * The function starts the 64bit Timer by bringing both the LOW and HIGH
- * timer out of reset.
- *
- * @b Arguments
- * @verbatim
- hTmr Handle to the Gptimer instance
- countMode Specifies the timer counting mode (OFF/CONTINIOUS/SINGLE Shot)
- @endverbatim
- *
- * <b> Return Value </b>
- * None
- *
- * <b> Pre Condition </b>
- * @n Both @a CSL_tmrInit() and @a CSL_tmrOpen() must be called.
- *
- * <b> Post Condition </b>
- * @n Set the GP OR chained timer counting mode and
- * timer Low and High reset register.
- *
- * @b Writes
- * @n TMR_TGCR_TIMLORS=1,TMR_TGCR_TIMHIRS=1,
- * @n TMR_TCR_ENAMODE_LO,TMR_TCR_ENAMODE_HI
- *
- * @b Example
- * @verbatim
- CSL_TmrHandle hTmr;
- ...
- CSL_TmrStart64(hTmr, CSL_TMR_ENAMODE_ENABLE);
- ...
- @endverbatim
- * ===========================================================================
- */
- /* for misra warnings*/
- static inline void CSL_TmrStart64 (CSL_TmrHandle hTmr, CSL_TmrEnamode countMode);
- static inline void CSL_TmrStart64 (CSL_TmrHandle hTmr, CSL_TmrEnamode countMode)
- {
- Uint32 tmpReg;
- /* Bring the LOW and HIGH Timer outs of reset. */
- tmpReg = hTmr->regs->TGCR;
- CSL_FINST(tmpReg, TMR_TGCR_TIMLORS, RESET_OFF);
- CSL_FINST(tmpReg, TMR_TGCR_TIMHIRS, RESET_OFF);
- hTmr->regs->TGCR = tmpReg;
- /* Configure the counting mode for both the LOW and HIGH Timers. */
- tmpReg = hTmr->regs->TCR;
- CSL_FINS(tmpReg, TMR_TCR_ENAMODE_LO, countMode);
- CSL_FINS(tmpReg, TMR_TCR_ENAMODE_HI, countMode);
- hTmr->regs->TCR = tmpReg;
- }
- /** ===========================================================================
- * @n@b CSL_TmrStopLo
- *
- * @b Description
- * The function stops the LOW Timer
- *
- * @b Arguments
- * @verbatim
- hTmr Handle to the Timer instance
- @endverbatim
- *
- * <b> Return Value </b>
- * @n None
- *
- * <b> Pre Condition </b>
- * @n Both @a CSL_tmrInit() and @a CSL_tmrOpen() must be called.
- *
- * <b> Post Condition </b>
- * @n Low Timer is disabled.
- *
- * @b Writes
- * @n TMR_TCR_ENAMODE_LO=0
- *
- * @b Example
- * @verbatim
- CSL_TmrHandle hTmr;
- ...
- CSL_TmrStopLo(hTmr);
- ...
- @endverbatim
- * ===========================================================================
- */
- /* for misra warnings*/
- static inline void CSL_TmrStopLo (CSL_TmrHandle hTmr);
- static inline void CSL_TmrStopLo (CSL_TmrHandle hTmr)
- {
- CSL_FINST(hTmr->regs->TCR, TMR_TCR_ENAMODE_LO, DISABLE);
- }
- /** ===========================================================================
- * @n@b CSL_TmrStopHi
- *
- * @b Description
- * The function stops the HIGH Timer
- *
- * @b Arguments
- * @verbatim
- hTmr Handle to the Timer instance
- @endverbatim
- *
- * <b> Return Value </b>
- * @n None
- *
- * <b> Pre Condition </b>
- * @n Both @a CSL_tmrInit() and @a CSL_tmrOpen() must be called.
- *
- * <b> Post Condition </b>
- * @n High Timer is disabled.
- *
- * @b Writes
- * @n TMR_TCR_ENAMODE_HI=0
- *
- * @b Example
- * @verbatim
- CSL_TmrHandle hTmr;
- ...
- CSL_TmrStopHi(hTmr);
- ...
- @endverbatim
- * ===========================================================================
- */
- /* for misra warnings*/
- static inline void CSL_TmrStopHi (CSL_TmrHandle hTmr);
- static inline void CSL_TmrStopHi (CSL_TmrHandle hTmr)
- {
- CSL_FINST(hTmr->regs->TCR, TMR_TCR_ENAMODE_HI, DISABLE);
- }
- /** ===========================================================================
- * @n@b CSL_TmrStop64
- *
- * @b Description
- * The function stops the 64bit timer.
- *
- * @b Arguments
- * @verbatim
- hTmr Handle to the Timer instance
- @endverbatim
- *
- * <b> Return Value </b>
- * @n None
- *
- * <b> Pre Condition </b>
- * @n Both @a CSL_tmrInit() and @a CSL_tmrOpen() must be called.
- *
- * <b> Post Condition </b>
- * @n The 64bit timer is stopped
- *
- * @b Writes
- * @n TMR_TCR_ENAMODE_LO=0,TMR_TCR_ENAMODE_HI=0
- *
- * @b Example
- * @verbatim
- CSL_TmrHandle hTmr;
- ...
- CSL_TmrStop64(hWdt);
- ...
- @endverbatim
- * ===========================================================================
- */
- /* for misra warnings*/
- static inline void CSL_TmrStop64 (CSL_TmrHandle hTmr);
- static inline void CSL_TmrStop64 (CSL_TmrHandle hTmr)
- {
- Uint32 tmpReg;
- /* Disable the LOW and HIGH Timers. */
- tmpReg = hTmr->regs->TCR;
- CSL_FINST(tmpReg, TMR_TCR_ENAMODE_LO, DISABLE);
- CSL_FINST(tmpReg, TMR_TCR_ENAMODE_HI, DISABLE);
- hTmr->regs->TCR = tmpReg;
- }
- /** ===========================================================================
- * @n@b CSL_TmrResetHi
- *
- * @b Description
- * The HIGH timer is moved to RESET state.
- *
- * @b Arguments
- * @verbatim
- hTmr Handle to the HIGH timer instance
- @endverbatim
- *
- * <b> Return Value </b>
- * @n None
- *
- * <b> Pre Condition </b>
- * @n Both @a CSL_tmrInit() and @a CSL_tmrOpen() must be called.
- *
- * <b> Post Condition </b>
- * @n High timer is reset.
- *
- * @b Writes
- * @n TMR_TGCR_TIMHIRS=0
- *
- * @b Example
- * @verbatim
- CSL_TmrHandle hTmr;
- ...
- CSL_TmrResetHi(hTmr);
- ...
- @endverbatim
- * ===========================================================================
- */
- /* for misra warnings*/
- static inline void CSL_TmrResetHi (CSL_TmrHandle hTmr);
- static inline void CSL_TmrResetHi (CSL_TmrHandle hTmr)
- {
- CSL_FINST(hTmr->regs->TGCR, TMR_TGCR_TIMHIRS, RESET_ON);
- }
- /** ===========================================================================
- * @n@b CSL_TmrResetLo
- *
- * @b Description
- * The LOW timer is moved to RESET state.
- *
- * @b Arguments
- * @verbatim
- hTmr Handle to the Gptimer instance
- @endverbatim
- *
- * <b> Return Value </b>
- * @n None
- *
- * <b> Pre Condition </b>
- * @n Both @a CSL_tmrInit() and @a CSL_tmrOpen() must be called.
- *
- * <b> Post Condition </b>
- * @n Low Timer is Reset
- *
- * @b Writes
- * @n TMR_TGCR_TIMLORS=0
- *
- * @b Example
- * @verbatim
- CSL_TmrHandle hTmr;
- ...
- CSL_TmrResetLo(hWdt);
- ...
- @endverbatim
- * ===========================================================================
- */
- /* for misra warnings*/
- static inline void CSL_TmrResetLo (CSL_TmrHandle hTmr);
- static inline void CSL_TmrResetLo (CSL_TmrHandle hTmr)
- {
- CSL_FINST(hTmr->regs->TGCR, TMR_TGCR_TIMLORS, RESET_ON);
- }
- /** ===========================================================================
- * @n@b CSL_TmrReset64
- *
- * @b Description
- * The function resets the 64bit timer.
- *
- * @b Arguments
- * @verbatim
- hTmr Handle to the Timer instance
- @endverbatim
- *
- * <b> Return Value </b>
- * @n None
- *
- * <b> Pre Condition </b>
- * @n Both @a CSL_tmrInit() and @a CSL_tmrOpen() must be called.
- *
- * <b> Post Condition </b>
- * @n 64bit Timer is reset.
- *
- * @b Writes
- * @n TMR_TGCR_TIMLORS=0,TMR_TGCR_TIMHIRS=0
- *
- * @b Example
- * @verbatim
- CSL_TmrHandle hTmr;
- ...
- CSL_TmrReset64(hTmr);
- ...
- @endverbatim
- * ===========================================================================
- */
- /* for misra warnings*/
- static inline void CSL_TmrReset64 (CSL_TmrHandle hTmr);
- static inline void CSL_TmrReset64 (CSL_TmrHandle hTmr)
- {
- Uint32 tmpReg = hTmr->regs->TGCR;
- /* Move both the Low and High Timers into reset. */
- CSL_FINST(tmpReg, TMR_TGCR_TIMLORS, RESET_ON);
- CSL_FINST(tmpReg, TMR_TGCR_TIMHIRS, RESET_ON);
- hTmr->regs->TGCR = tmpReg;
- }
- /** ===========================================================================
- * @n@b CSL_TmrStartWdt
- *
- * @b Description
- * The function starts the timer in Watch Dog Mode.
- *
- * @b Arguments
- * @verbatim
- hTmr Handle to the Timer instance
- countMode Specifies the timer counting mode (OFF/CONTINIOUS/SINGLE Shot)
- @endverbatim
- *
- * <b> Return Value </b>
- * None
- *
- * <b> Pre Condition </b>
- * @n Both @a CSL_tmrInit() and @a CSL_tmrOpen() must be called.
- *
- * <b> Post Condition </b>
- * @n Timer has been started in WATCH Dog Mode.
- *
- * @b Writes
- * @n TMR_TGCR_TIMLORS=1,TMR_TGCR_TIMHIRS=1,TMR_WDTCR_WDEN=1,TMR_TCR_ENAMODE_LO,TMR_TCR_ENAMODE_HI;
- *
- * @b Example
- * @verbatim
- CSL_TmrHandle hWdt;
- ...
- CSL_TmrStartWdt(hWdt, CSL_TMR_ENAMODE_CONT);
- ...
- @endverbatim
- * ===========================================================================
- */
- /* for misra warnings*/
- static inline void CSL_TmrStartWdt (CSL_TmrHandle hTmr,CSL_TmrEnamode countMode);
- static inline void CSL_TmrStartWdt (CSL_TmrHandle hTmr,CSL_TmrEnamode countMode)
- {
- Uint32 tmpReg = hTmr->regs->TGCR;
- /* Bring the LOW and HIGH Timers out of reset. */
- CSL_FINST(tmpReg, TMR_TGCR_TIMLORS, RESET_OFF);
- CSL_FINST(tmpReg, TMR_TGCR_TIMHIRS, RESET_OFF);
- hTmr->regs->TGCR = tmpReg;
- /* Enable the Watch Dog Timer */
- CSL_FINST(hTmr->regs->WDTCR, TMR_WDTCR_WDEN, ENABLE);
- /* Enable the LOW and HIGH Timers to operate */
- tmpReg = hTmr->regs->TCR;
- CSL_FINS(tmpReg, TMR_TCR_ENAMODE_LO, countMode);
- CSL_FINS(tmpReg, TMR_TCR_ENAMODE_HI, countMode);
- hTmr->regs->TCR = tmpReg;
- }
- /** ===========================================================================
- * @n@b CSL_TmrLoadtWdkey
- *
- * @b Description
- * The function loads the watch dog timer with the appropriate key.
- *
- * @b Arguments
- * @verbatim
- hTmr Handle to the Gptimer instance
- cmd Specifies the WATCHDOG Key. This can only be either of
- the following:-
- - CSL_TMR_WDTCR_WDKEY_CMD1
- - CSL_TMR_WDTCR_WDKEY_CMD2
- @endverbatim
- *
- * <b> Return Value </b>
- * None
- *
- * <b> Pre Condition </b>
- * @n Both @a CSL_tmrInit() and @a CSL_tmrOpen() must be called.
- *
- * <b> Post Condition </b>
- * @n Loads the WDKEY in WDTCR register.
- *
- * @b Writes
- * @n TMR_WDTCR_WDKEY
- *
- * @b Example
- * @verbatim
- CSL_TmrHandle hWdt;
- ...
- CSL_TmrLoadWdkey(hWdt, CSL_TMR_WDTCR_WDKEY_CMD1);
- ...
- @endverbatim
- * ===========================================================================
- */
- /* for misra warnings*/
- static inline void CSL_TmrLoadWdkey (CSL_TmrHandle hTmr, Uint16 cmd);
- static inline void CSL_TmrLoadWdkey (CSL_TmrHandle hTmr, Uint16 cmd)
- {
- CSL_FINS(hTmr->regs->WDTCR, TMR_WDTCR_WDKEY, (Uint32)cmd);
- }
- /** ===========================================================================
- * @n@b CSL_TmrDisableWdt
- *
- * @b Description
- * The function disables the Watch Dog Timer.
- *
- * @b Arguments
- * @verbatim
- hTmr Handle to the Timer instance
- @endverbatim
- *
- * <b> Return Value </b>
- * None
- *
- * <b> Pre Condition </b>
- * @n Both @a CSL_tmrInit() and @a CSL_tmrOpen() must be called.
- *
- * <b> Post Condition </b>
- * @n The Watch Dog timer is disabled.
- *
- * @b Writes
- * @n TMR_WDTCR_WDEN=0
- *
- * @b Example
- * @verbatim
- CSL_TmrHandle hWdt;
- ...
- CSL_TmrDisableWdt(hWdt);
- ...
- @endverbatim
- * ===========================================================================
- */
- /* for misra warnings*/
- static inline void CSL_TmrDisableWdt (CSL_TmrHandle hTmr);
- static inline void CSL_TmrDisableWdt (CSL_TmrHandle hTmr)
- {
- CSL_FINST(hTmr->regs->WDTCR, TMR_WDTCR_WDEN, DISABLE);
- }
- /**
- @}
- */
- #ifdef __cplusplus
- }
- #endif
- #endif /* CSL_TMRAUX_H_ */
|