Annotation of qemu/roms/SLOF/board-js2x/slof/freq.fs, revision 1.1

1.1     ! root        1: \ *****************************************************************************
        !             2: \ * Copyright (c) 2004, 2008 IBM Corporation
        !             3: \ * All rights reserved.
        !             4: \ * This program and the accompanying materials
        !             5: \ * are made available under the terms of the BSD License
        !             6: \ * which accompanies this distribution, and is available at
        !             7: \ * http://www.opensource.org/licenses/bsd-license.php
        !             8: \ *
        !             9: \ * Contributors:
        !            10: \ *     IBM Corporation - initial implementation
        !            11: \ ****************************************************************************/
        !            12: 
        !            13: 
        !            14: \ Use the HPET to calculate various frequencies.
        !            15: 
        !            16: \ Make HPET run.
        !            17: 1 10 hpet!
        !            18: 
        !            19: \ Set PMC1 to count CPU cycles.
        !            20: f00 mmcr0!
        !            21: 
        !            22: d# 1000000000000000 4 hpet@ / CONSTANT hpet-freq
        !            23: 
        !            24: : get-times  tbl@ pmc1@ f0 hpet@ ;
        !            25: 
        !            26: \ Calculate the CPU and TB frequencies.
        !            27: : calibrate  get-times dup >r swap >r swap >r hpet-freq d# 100 / + >r
        !            28:              BEGIN get-times dup r@ < WHILE 3drop REPEAT r> drop
        !            29:              rot r> - ffffffff and \ TB
        !            30:              rot r> - ffffffff and \ CPU
        !            31:              rot r> - >r           \ HPET
        !            32:              hpet-freq * r@ / swap
        !            33:              hpet-freq * r> / ;
        !            34: 
        !            35: : round-to  tuck 2/ + over / * ;
        !            36: calibrate TO tb-frequency d# 100000000 round-to TO cpu-frequency
        !            37: 
        !            38: \ Stop HPET.
        !            39: 0 10 hpet!

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.