Annotation of qemu/roms/SLOF/board-js2x/slof/flash.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: \ we do all flash accesses as 8-bit
        !            15: 
        !            16: ff000000 CONSTANT flash-addr
        !            17: 
        !            18: : >flash  flash-addr + ;
        !            19: : flash@  >flash rb@ ;
        !            20: : flash!  >flash rb! ;
        !            21: : wait-for-flash-ready  BEGIN 0 flash@ 80 and UNTIL ;
        !            22: : erase-flash-block ( offset -- )
        !            23:   cr dup 8 .r ."  Erasing..."
        !            24:   20 over flash! d0 swap flash! wait-for-flash-ready ;
        !            25: : write-flash ( data offset -- )
        !            26:   40 over flash! flash! wait-for-flash-ready ;
        !            27: : write-flash-buffer ( addr offset -- )
        !            28:   e8 over flash!  wait-for-flash-ready  1f over flash!
        !            29:   20 0 DO over i + c@ over i + flash! LOOP
        !            30:   d0 over flash! wait-for-flash-ready 2drop ;
        !            31: : write-flash-block ( addr offset -- ) \ always writes 128kB!
        !            32:   ."  Writing..."
        !            33:   20000 0 DO over i + over i + write-flash-buffer 20 +LOOP 2drop
        !            34:   ."  Done." ;
        !            35: : flash ( addr offset size -- )
        !            36:   BEGIN dup 0 > WHILE >r dup erase-flash-block 2dup write-flash-block
        !            37:   >r 20000 + r> 20000 + r> 20000 - REPEAT drop 2drop -1 0 flash! ;
        !            38: 
        !            39: : flash-it  load-base 0 e0000  flash ;
        !            40: : flash4    load-base 0 400000 flash ;
        !            41: 
        !            42: \ for update-flash
        !            43: : flash-image-size  ( addr -- size )  30 + rx@  ;

unix.superglobalmegacorp.com

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