1    /* --COPYRIGHT--,EPL
     2     *  Copyright (c) 2008 Texas Instruments and others.
     3     *  All rights reserved. This program and the accompanying materials
     4     *  are made available under the terms of the Eclipse Public License v1.0
     5     *  which accompanies this distribution, and is available at
     6     *  http://www.eclipse.org/legal/epl-v10.html
     7     * 
     8     *  Contributors:
     9     *      Texas Instruments - initial implementation
    10     * 
    11     * --/COPYRIGHT--*/
    12    /*
    13     *  ======== Clock.xdc ========
    14     */
    15    
    16    /*!
    17     *  ======== Clock ========
    18     *  Basic "wall clock" functions
    19     */
    20    @ModuleStartup
    21    
    22    module Clock {
    23        /*! 
    24         *  ======== TimeValue ========
    25         *  Time value type
    26         */
    27        typedef UInt16 TimeValue;
    28     
    29        /*!
    30         *  ======== TimerRegs ========
    31         *  Timer peripheral register definition
    32         */
    33        struct TimerRegs {
    34            Bits16  CTL;
    35            Bits16  CCTL[7];
    36            Bits16  R;
    37            Bits16  CCR[7];
    38            Bits16  EX0;
    39            Bits16  IV;
    40        };
    41        
    42        const TimerRegs *TA2  = 0x160;
    43        const TimerRegs *TA3  = 0x160;
    44        const TimerRegs *TA5  = 0x160;
    45    
    46        const TimerRegs *TB3  = 0x180;
    47        const TimerRegs *TB7  = 0x180;
    48        const TimerRegs *T1A2 = 0x180;
    49    
    50        const TimerRegs *T0A3 = 0x340;
    51        const TimerRegs *T0A5 = 0x340;
    52    
    53        const TimerRegs *T1A3 = 0x380;
    54        const TimerRegs *T1A5 = 0x380;
    55    
    56        const TimerRegs *T2A3 = 0x400;
    57    
    58        const TimerRegs *T0B7 = 0x3d0;
    59    
    60        /*!
    61         *  ======== TIMER ========
    62         *  Base address of timer peripheral to use
    63         */
    64        config TimerRegs *TIMER = TB3;    /*! Timer B on 2274 */
    65        
    66        /*!
    67         *  ======== fastClockKHz ========
    68         *  Main System clock frequency (KHz)
    69         */
    70        config Int fastClockKHz = 8000;
    71    
    72        /*!
    73         *  ======== slowClockHz ========
    74         *  Auxiliary clock frequency (Hz)
    75         */
    76        config Int slowClockHz = 12000;
    77        
    78        /*!
    79         *  ======== delay ========
    80         *  Spin for specified number of micro seconds
    81         */
    82        Void delay(UInt16 usec);
    83    
    84        /*!
    85         *  ======== sleep ========
    86         *  Idle the CPU for specified number of micro seconds
    87         */
    88        Void sleep(UInt16 usec, UInt lpm);
    89    
    90        /*!
    91         *  ======== getTime ========
    92         *  Get the current time in Auxiliary clock ticks
    93         */
    94        TimeValue getTime();
    95    }