OpenCores
URL https://opencores.org/ocsvn/or1k_old/or1k_old/trunk

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [rc203soc/] [sw/] [uClinux/] [include/] [asm-armnommu/] [arch-ebsa110/] [time.h] - Diff between revs 1633 and 1765

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 1633 Rev 1765
/*
/*
 * linux/include/asm-arm/arch-a5k/time.h
 * linux/include/asm-arm/arch-a5k/time.h
 *
 *
 * Copyright (c) 1996 Russell King.
 * Copyright (c) 1996 Russell King.
 *
 *
 * No real time clock on the evaluation board!
 * No real time clock on the evaluation board!
 *
 *
 * Changelog:
 * Changelog:
 *  10-Oct-1996 RMK     Created
 *  10-Oct-1996 RMK     Created
 *  04-Dec-1997 RMK     Updated for new arch/arm/time.c
 *  04-Dec-1997 RMK     Updated for new arch/arm/time.c
 */
 */
 
 
#define MCLK_47_8
#define MCLK_47_8
 
 
#if defined(MCLK_42_3)
#if defined(MCLK_42_3)
#define PIT1_COUNT 0xecbe
#define PIT1_COUNT 0xecbe
#elif defined(MCLK_47_8)
#elif defined(MCLK_47_8)
/*
/*
 * This should be 0x10AE1, but that doesn't exactly fit.
 * This should be 0x10AE1, but that doesn't exactly fit.
 * We run the timer interrupt at 5ms, and then divide it by
 * We run the timer interrupt at 5ms, and then divide it by
 * two in software...  This is so that the user processes
 * two in software...  This is so that the user processes
 * see exactly the same model whichever ARM processor they're
 * see exactly the same model whichever ARM processor they're
 * running on.
 * running on.
 */
 */
#define PIT1_COUNT 0x85b8
#define PIT1_COUNT 0x85b8
#define DIVISOR 2
#define DIVISOR 2
#endif
#endif
 
 
extern __inline__ unsigned long gettimeoffset (void)
extern __inline__ unsigned long gettimeoffset (void)
{
{
        return 0;
        return 0;
}
}
 
 
#ifndef DIVISOR
#ifndef DIVISOR
extern __inline__ int reset_timer (void)
extern __inline__ int reset_timer (void)
{
{
        *PIT_T1 = (PIT1_COUNT) & 0xff;
        *PIT_T1 = (PIT1_COUNT) & 0xff;
        *PIT_T1 = (PIT1_COUNT) >> 8;
        *PIT_T1 = (PIT1_COUNT) >> 8;
        return 1;
        return 1;
}
}
#else
#else
extern __inline__ int reset_timer (void)
extern __inline__ int reset_timer (void)
{
{
        static unsigned int divisor;
        static unsigned int divisor;
        static int count = 50;
        static int count = 50;
 
 
        *PIT_T1 = (PIT1_COUNT) & 0xff;
        *PIT_T1 = (PIT1_COUNT) & 0xff;
        *PIT_T1 = (PIT1_COUNT) >> 8;
        *PIT_T1 = (PIT1_COUNT) >> 8;
 
 
        if (--count == 0) {
        if (--count == 0) {
                count = 50;
                count = 50;
                *(volatile unsigned char *)0xf2400000 ^= 128;
                *(volatile unsigned char *)0xf2400000 ^= 128;
        }
        }
 
 
        if (divisor == 0) {
        if (divisor == 0) {
                divisor = DIVISOR - 1;
                divisor = DIVISOR - 1;
                return 1;
                return 1;
        }
        }
        divisor -= 1;
        divisor -= 1;
        return 0;
        return 0;
}
}
#endif
#endif
 
 
/*
/*
 * We don't have a RTC to update!
 * We don't have a RTC to update!
 */
 */
#define update_rtc()
#define update_rtc()
 
 
/*
/*
 * Set up timer interrupt, and return the current time in seconds.
 * Set up timer interrupt, and return the current time in seconds.
 */
 */
extern __inline__ unsigned long setup_timer (void)
extern __inline__ unsigned long setup_timer (void)
{
{
        /*
        /*
         * Timer 1, mode 0, 16-bit, autoreload
         * Timer 1, mode 0, 16-bit, autoreload
         */
         */
        *PIT_CTRL = 0x70;
        *PIT_CTRL = 0x70;
        /*
        /*
         * Refresh counter clocked at 47.8MHz/7 = 146.4ns
         * Refresh counter clocked at 47.8MHz/7 = 146.4ns
         * We want centi-second interrupts
         * We want centi-second interrupts
         */
         */
        reset_timer ();
        reset_timer ();
        /*
        /*
         * Default the date to 1 Jan 1970 0:0:0
         * Default the date to 1 Jan 1970 0:0:0
         * You will have to run a time daemon to set the
         * You will have to run a time daemon to set the
         * clock correctly at bootup
         * clock correctly at bootup
         */
         */
        return mktime(1970, 1, 1, 0, 0, 0);
        return mktime(1970, 1, 1, 0, 0, 0);
}
}
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.