;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; Copyright (c) 2000 - 2002 TIMEX Corporation.
; 
; This document is the property of, and contains information proprietary to
; TIMEX Corporation.  It is to be returned upon request.  Reproduction by any
; means, disclosure, or use of its contents for other than the expressed
; purpose for which it is loaned, without the written consent of TIMEX
; Corporation, is strictly prohibited.
;
; File Name : intvars.h
;
; Purpose   : Interval Timer Application Variable Offsets
;
; File Change History:
;
;             12/20/2001 FSU - Created for M851.
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;==============================================================================
;
; INTERVAL TIMER APPLICATION SYSTEM DATA
;
;==============================================================================


INTSYSTEMDATASTARTOFFSET        equ     0

; First resource index allocated for interval timer.
INTRESOURCEINDEX0OFFSET         equ     0

; Second resource index allocated for interval timer.
INTRESOURCEINDEX1OFFSET         equ     1

; Timer resource currently active.  If timer is reset, this contains the index 
;   of the first resource allocated for interval timer.
INTACTIVERESOURCEINDEXOFFSET    equ     2           
                                        
; Last viewed or currently running entry.  
INTLASTVIEWEDENTRYOFFSET        equ     3           

; Status of the last viewed or currently running entry.
INTLASTVIEWEDENTRYFLAGOFFSET    equ     4
                                        
    bINTHalfwayEnable           equ     bCTMRHalfwayEnable  ; b2     : 0 - Disable halfway reminder
                                                            ;        : 1 - Enable halfway reminder

    bINTDataIsZero              equ     bCTMRDataIsZero     ; b3     : 0 - Data is not zero.
                                                            ;        : 1 - Data is zero.

    bINTLess15Sec               equ     bCTMRLess15Sec      ; b4     : 0 - Data is not less than 15 seconds.
                                                            ;        : 1 - Data is less than 15 seconds.

    bINTLess1Min                equ     bCTMRLess1Min       ; b5     : 0 - Data is not less than 1 minute.
                                                            ;        : 1 - Data is less than 1 minute.


; Holds the action at end.
INTACTIONATENDOFFSET            equ     5       

    bINTActionAtEnd0            equ     bCTMRActionAtEnd0   ; b0 & b1: 00 - Stop At End.    
    bINTActionAtEnd1            equ     bCTMRActionAtEnd1   ;          01 - Repeat At End.
                                                            ;          10 - Chrono At End.

; Next timer entry that will be started after completion of the current timer entry.
INTNEXTENTRYOFFSET              equ     6

; Status of the next timer entry.  Refer to above bit definitions.
INTNEXTENTRYFLAGOFFSET          equ     7

; Timers repeat count.
INTREPEATNUMBEROFFSET           equ     8

INTPOPUPTYPEOFFSET              equ     9

INTFLAGSOFFSET					equ		10

    bINTUpdRepeatNumDisplay     equ     00000001B           ; b0     : 0 - Do not update repeat number display.
                                                            ;        : 1 - Update repeat number display.

	bINTNewTimerData			equ		00000010B			; b1	 : 0 - No new interval timer has started.
															;		 : 1 - New interval timer has started.

	bINTCameFromPopup			equ		00000100B			; b2	 : 0 - Default state entry came from a mode change.
															;        : 1 - Default state entry came from an interval popup.


INTSYSTEMDATASIZE               equ     11


;==============================================================================
;
; TIMER APPLICATION DATABASE
;
;==============================================================================

INTDATABASESTARTOFFSET          equ     INTSYSTEMDATASIZE



INTRAMDATABASEDATASIZE          equ     0

;------------------------------------------------------------------------------
; Total RAM allocation
;------------------------------------------------------------------------------
INTHEAPSIZEREQUIREMENTS         equ     INTSYSTEMDATASIZE + INTRAMDATABASEDATASIZE

;------------------------------------------------------------------------------
; Total EEPROM allocation
;------------------------------------------------------------------------------

; Size of the generic database header.  2 bytes for allocation size, 2 bytes
;   for database size and 1 byte for app specific header size.
INTADDGENERICHEADERSIZE         equ     5

; Size of the application specific header.  2 bytes for the number of records
;   , 1 byte for the record size and 1 byte for action at end.
INTAPPSPECIFICHEADERSIZE        equ     4

; Initial number of timer records.
INTNUMBEROFRECORDS              equ     10

; Size of each timer record.  This consist of Status flag, HMS data and 9 character name.
INTRECORDSIZE                   equ     CTMRRECORDSIZE

; Size of the entire database allocated for 10 timer entries.
INTEEPROMDATABASEDATASIZE       equ     (INTADDGENERICHEADERSIZE + INTAPPSPECIFICHEADERSIZE + (INTNUMBEROFRECORDS * INTRECORDSIZE))

; Size allocated for the entire database with 64-byte per page in EEPROM.
INTEEPROMDBALLOCATIONSIZE       equ     (((INTEEPROMDATABASEDATASIZE/64) + 1) * 64)


; Offset to action at end data from the beginning of the app specific header.
INTACTIONATENDOFFSETFROMAPPSPECIFICHDR  equ     3

;==============================================================================
;
; VARIABLE REDEFINITIONS 
;
;==============================================================================

;------------------------------------------------------------------------------
; INTERVAL TMR COMMON SYSTEM DATA (Used only during foreground execution)
;------------------------------------------------------------------------------

; Timer resource index used by interval timer application.
INTResourceIndex0               equ     (COREForegroundCommonBuffer + 0)
INTResourceIndex1               equ     (COREForegroundCommonBuffer + 1)

; Interval timer action at end.
INTActionAtEnd                  equ     (COREForegroundCommonBuffer + 2)

                                                                         

;------------------------------------------------------------------------------
; INTERVAL TMR COMMON SYSTEM DATA (Used only during background execution)
;------------------------------------------------------------------------------

;==============================================================================
; Used as storage for next non-zero interval.
;==============================================================================

INTNextFlags                    equ     (COREBackgroundCommonBuffer + 0)
INTNextUserSetSecond            equ     (COREBackgroundCommonBuffer + 1)
INTNextUserSetMinute            equ     (COREBackgroundCommonBuffer + 2)
INTNextUserSetHour              equ     (COREBackgroundCommonBuffer + 3)

INTNextResourceIndex            equ     (COREBackgroundCommonBuffer + 4)


