TMR_main.c File Reference


Detailed Description

This module provides timer support.

REVISION

Definition in file TMR_main.c.

#include "../feature.h"
#include "timer.h"

Include dependency graph for TMR_main.c:

Include dependency graph

Go to the source code of this file.

Functions

BOOL TMR_create (TMR_ID eID, UINT32 iTimer, UINT16 msgD1, UINT16 msgD2, UINT16 flag)
 Function creates a timer.
void TMR_delete (TMR_ID eID)
 Function deletes the specified timer.
void TMR_reset (TMR_ID eID)
 Function resets the specified timer.
void TMR_init (void)
 Function clears timer controls.
void TMR_main (void)
 Function serves as the system tick handle.
BOOL TMR_isActive (TMR_ID eID)
 Function checks to see if specified timer is active.


Function Documentation

BOOL TMR_create TMR_ID  eID,
UINT32  iTimer,
UINT16  msgD1,
UINT16  msgD2,
UINT16  flag
 

Function creates a timer.

Parameters:
eID Timer ID.
iTimer Timer period in 25ms.
msgD1 Timer message data1.
msgD2 Timer message data2.
flag Timer control flag.
Returns:
TRUE if timer successfully created, otherwise FALSE.

Definition at line 46 of file TMR_main.c.

References st_TMR::Control, st_TMRCTL::Counter, st_TMRCTL::Flag, st_TMRCTL::MsgD1, st_TMRCTL::MsgD2, st_TMR::Regist, st_TMRCTL::TimerCnst, and TMR_ID.

Referenced by MENU__createListMenu(), MENU__createPlayMenu(), SYS_autoffEnable(), SYS_clearBusy(), SYS_main(), SYS_setBusy(), SYS_SF_idle(), UI_CSF_myfiChannel(), UI_CSF_null(), UI_CSF_volume(), UI_MSF_backlight(), UI_PSF_autosync(), UI_PSF_hisi(), UI_PSF_hisidone(), UI_PSF_record(), UI_PSF_recorddone(), and UI_SF_autoscan().

00052 {   
00053     BOOL        TimerRegistered;
00054     BOOL        TimerAvailable;
00055     UINT16      ii;
00056     st_TMRCTL * pCtl;
00057     TMR_REGIST *pReg;
00058     BOOL        ret;
00059     
00060     TSK_disable();
00061     TimerRegistered = FALSE;
00062     TimerAvailable = FALSE;
00063     pCtl = &Timer.Control[0];
00064     pReg = &Timer.Regist[0];
00065     
00066     for( ii = 0; ii < TMR_MAXNUM; ii++ ) 
00067     {
00068         if(*pReg == eID )
00069         {
00070             TimerRegistered = TRUE;
00071             break;
00072         }       
00073         pReg++;
00074     }
00075 
00076 
00077     if(TimerRegistered == FALSE)
00078     {
00079         pReg = &Timer.Regist[0];
00080         for( ii = 0; ii < TMR_MAXNUM; ii++ ) 
00081         {
00082             if( *pReg == TMR_NULL ) 
00083             {
00084                 TimerAvailable = TRUE;             
00085                 *pReg = eID;
00086                 break;
00087             }
00088             pReg++;
00089         }
00090     }   
00091 
00092     if( (TimerAvailable == TRUE)||(TimerRegistered == TRUE) )
00093     {
00094         pCtl = &Timer.Control[0] + ii;
00095 
00096         pCtl->MsgD1 = msgD1;
00097         pCtl->MsgD2 = msgD2;
00098         pCtl->TimerCnst = pCtl->Counter = iTimer;
00099         pCtl->Flag = flag;
00100         ret = TRUE;
00101     }       
00102     else ret = FALSE;   
00103     
00104     TSK_enable();
00105     return ret;
00106 }       

void TMR_delete TMR_ID  eID  ) 
 

Function deletes the specified timer.

Parameters:
eID Timer ID.

Definition at line 116 of file TMR_main.c.

References st_TMR::Regist.

Referenced by AUDIO_start(), MENU__createListMenu(), MENU__createPlayMenu(), MENU_action(), SYS_autoffDisable(), SYS_clearBusy(), SYS_setBusy(), SYS_SF_idle(), UI_CSF_msgbox(), UI_CSF_volume(), UI_MSF_backlight(), UI_PSF_autosync(), UI_PSF_hisidone(), UI_PSF_radio(), UI_PSF_recorddone(), and UI_SF_autoscan().

00117 {  
00118     UINT16 ii;
00119     TMR_REGIST *pReg;
00120     
00121     TSK_disable();
00122     
00123     pReg = &Timer.Regist[0];
00124     
00125     for( ii = 0; ii < TMR_MAXNUM; ii++ )
00126     {   
00127         if(*pReg == eID ) 
00128         {   
00129             *pReg = TMR_NULL;           
00130             break;
00131         }
00132         pReg++;
00133     }     
00134     
00135     TSK_enable();
00136     
00137     return;  
00138 }              

BOOL TMR_isActive TMR_ID  eID  ) 
 

Function checks to see if specified timer is active.

Parameters:
eID Timer ID.

Definition at line 239 of file TMR_main.c.

References st_TMR::Regist.

Referenced by SYS_clearBusy().

00240 {  
00241     UINT16      ii;
00242     TMR_REGIST *pReg = &Timer.Regist[0];
00243     BOOL        ret;
00244     
00245     TSK_disable();
00246     ret = FALSE;
00247     pReg = &Timer.Regist[0];
00248     
00249     for( ii = 0; ii < TMR_MAXNUM; ii++ ) 
00250     {
00251         if(*pReg++ == eID )
00252         {
00253             ret = TRUE;
00254             break;
00255         }
00256     }
00257             
00258     TSK_enable();
00259     return ret;
00260 }

void TMR_reset TMR_ID  eID  ) 
 

Function resets the specified timer.

Parameters:
eID Timer ID.

Definition at line 149 of file TMR_main.c.

References st_TMR::Control, st_TMRCTL::Counter, st_TMR::Regist, and st_TMRCTL::TimerCnst.

Referenced by SYS_autoffReset(), UI_CSF_myfiChannel(), and UI_CSF_volume().

00150 {  
00151     UINT16 ii;
00152     TMR_REGIST *pReg;
00153     st_TMRCTL * pCtl;
00154     
00155     TSK_disable();
00156     
00157     pReg = &Timer.Regist[0];
00158     pCtl = &Timer.Control[0];
00159 
00160     for( ii = 0; ii < TMR_MAXNUM; ii++ ) 
00161     {
00162         if(*pReg == eID )
00163         { 
00164             pCtl->Counter = pCtl->TimerCnst;
00165             break;
00166         }
00167         pReg++;
00168         pCtl++;
00169     }       
00170     
00171     TSK_enable();
00172     
00173     return;
00174 }


Generated on Wed Jan 19 01:13:20 2005 for neuros-firmware by  doxygen 1.3.9.1