Posted to tcl by cv19 at Mon May 03 21:10:15 GMT 2021view raw
- #########################################################
- # #
- # SDRAM_INIT #
- # BASE_ADDR: 0x0000_0000 #
- #########################################################
- puts "Initializing SDRAM....."
- set start [clock seconds]
- # Write some vertical lines to the screen
- # Starting at address 0x0, ending at address 0x2A300.
- #
- set addr [ format %x 0 ]
- for {set i 0} {$i < 720} {incr i} {
- for {set j 0} {$j < 1280} {incr j} {
- #DEBUG:
- puts "Writing Line: ${i}, Pixel: ${j} @ Address: ${addr}"
- if {$j/3 < 427} { master_write_32 $mpath 0x$addr 0xFF000000
- } elseif {$j/3 < 854} { master_write_32 $mpath 0x$addr 0x00FF0000
- } else { master_write_32 $mpath 0x$addr 0x0000FF00 }
- #DEBUG:
- puts [master_read_32 $mpath 0x$addr 1]
- set addr [ format %x [ expr {"0x$addr" + 0x4} ] ]
- }
- }
- set end [clock seconds]
- set min [expr {($end-$start)/60}]
- #DEBUG: puts "secs: [expr {$end-$start}] mins: ${min}"
- puts "SDRAM written in ${min} minutes, [expr {($end-$start)-(60*$min)}] seconds."