;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; 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      : ktod.h
;
; Purpose        : Kernel Tod Resource Header File
;
; Change History : 05/15/2000 ACN - Created file
;
;   M851 Development
;
;                  02/06/2002 FSU - Reuse for M851 Development.
;                  06/28/2002 NLS - ECR# 851-20020628-393
;                                   ROM REDUCTION
;                                   - Set KTOD_ENABLE_UNUSED_ROUTINE to 0
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;==============================================================================
;
; MONTH EQUATES
;
;==============================================================================

JANUARY                     equ     01H
FEBRUARY                    equ     02H
MARCH                       equ     03H
APRIL                       equ     04H
MAY                         equ     05H
JUNE                        equ     06H
JULY                        equ     07H
AUGUST                      equ     08H
SEPTEMBER                   equ     09H
OCTOBER                     equ     10H
NOVEMBER                    equ     11H
DECEMBER                    equ     12H


;==============================================================================
;
; MAXIMUM NUMBER OF DAYS IN A MONTH EQUATES
;
;==============================================================================

KTODMAXDAYSOFJANUARY        equ     31H
KTODMAXDAYSOFFEBRUARY       equ     29H
KTODMAXDAYSOFMARCH          equ     31H
KTODMAXDAYSOFAPRIL          equ     30H
KTODMAXDAYSOFMAY            equ     31H
KTODMAXDAYSOFJUNE           equ     30H
KTODMAXDAYSOFJULY           equ     31H
KTODMAXDAYSOFAUGUST         equ     31H
KTODMAXDAYSOFSEPTEMBER      equ     30H
KTODMAXDAYSOFOCTOBER        equ     31H
KTODMAXDAYSOFNOVEMBER       equ     30H
KTODMAXDAYSOFDECEMBER       equ     31H


;==============================================================================
;
; DAY OF THE WEEK EQUATES
;
;==============================================================================

SUNDAY                      equ     0
MONDAY                      equ     1
TUESDAY                     equ     2
WEDNESDAY                   equ     3
THURSDAY                    equ     4
FRIDAY                      equ     5
SATURDAY                    equ     6


;==============================================================================
;
; VARIABLE EQUATES
;
;==============================================================================

; CORESystemCommonBuffer is used during POR (Allocation of resource) and execution
;   of background handlers.
KTODTemp0                   equ     (CORESystemCommonBuffer + 0)    ; 4-byte buffer used for WK NUM calculations
KTODTemp1                   equ     (CORESystemCommonBuffer + 4)    ; 4-byte buffer used for DOW calculations
KTODTemp2                   equ     (CORESystemCommonBuffer + 8)    ; 2-byte buffer used to hold calculation results


;==============================================================================
;
; MISCELLANEOUS EQUATES
;
;==============================================================================

KTODMAXHOUR                 equ     24H     ; Maximum number of hours

KTODMAXYEAR                 equ     70H     ; Maximum year is 6999

KTODMINYEAR                 equ     00H     ; Minimum year is 0000

KTODONEYEAR                 equ     01H     ; 1 year worth

KTODONEMINUTE               equ     60H     ; Number of seconds in a minute

KTODFIRSTWEEK               equ     01H     ; First week of the year

KTODONEWEEK                 equ     01H     ; 1 week worth

KTODNUMOFMONTHS             equ     12H     ; Number of months in a year

KTODERROR                   equ     0FFH    ; TOD error code


KTODDAYOFMDYOFFSET          equ     0       ; Offset to the day data of a structure from the date data.

KTODMONTHOFMDYOFFSET        equ     1       ; Offset to the month data of a structure from the date data.

KTODYEARLOOFMDYOFFSET       equ     2       ; offset to the yearlo data of a structure from the date data.

KTODYEARHIOFMDYOFFSET       equ     3       ; offset to the yearlo data of a structure from the date data.


; Size of the whole time structure from the Seconds up to Week Number.
KTODSIZEOFTOTALSTRUCTURE    equ     (KTODWEEKOFFSET - KTODSECONDOFFSET) + 1
                                        
; Size of time structure from the Seconds up to the Year.
KTODSIZEOFTIMESTRUCTURE     equ     (KTODYEARHIOFFSET - KTODSECONDOFFSET) + 1

; Size of the structure from the Date up to the Year.
KTODSIZEOFMDYSTRUCTURE      equ     (KTODYEARHIOFFSET - KTODDATEOFFSET) + 1

; Size of the structure from the Second up to the Hour.                                     
KTODSIZEOFHMSSTRUCTURE      equ     (KTODHOUROFFSET - KTODSECONDOFFSET) + 1




KTODUPDALL                  equ     (bKTODMinuteUpd|bKTODHourUpd|bKTODDateUpd|bKTODMonthUpd|bKTODYearUpd|bKTODWeekUpd)



; Enable/Disable the TOD resource routines.
;   Some of the routine may be disabled coz nobody uses it.
KTOD_ENABLE_UNUSED_ROUTINE  equ     0