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

Subversion Repositories openarty

[/] [openarty/] [trunk/] [sw/] [host/] [flashdrvr.cpp] - Diff between revs 18 and 30

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 18 Rev 30
Line 188... Line 188...
bool    FLASHDRVR::write(const unsigned addr, const unsigned len,
bool    FLASHDRVR::write(const unsigned addr, const unsigned len,
                const unsigned *data, const bool verify) {
                const unsigned *data, const bool verify) {
 
 
        if (!verify_config()) {
        if (!verify_config()) {
                set_config();
                set_config();
                if (!verify_config())
                if (!verify_config()) {
 
                        printf("Invalid configuration, cannot program flash\n");
                        return false;
                        return false;
        }
        }
 
        }
 
 
        // Work through this one sector at a time.
        // Work through this one sector at a time.
        // If this buffer is equal to the sector value(s), go on
        // If this buffer is equal to the sector value(s), go on
        // If not, erase the sector
        // If not, erase the sector
 
 
Line 221... Line 223...
                        base = (addr>s)?addr:s;
                        base = (addr>s)?addr:s;
                        ln=((addr+len>s+SECTORSZW)?(s+SECTORSZW):(addr+len))-base;
                        ln=((addr+len>s+SECTORSZW)?(s+SECTORSZW):(addr+len))-base;
                        m_fpga->readi(base, ln, sbuf);
                        m_fpga->readi(base, ln, sbuf);
 
 
                        dp = &data[base-addr];
                        dp = &data[base-addr];
 
                        SETSCOPE;
                        for(unsigned i=0; i<ln; i++) {
                        for(unsigned i=0; i<ln; i++) {
                                if ((sbuf[i]&dp[i]) != dp[i]) {
                                if ((sbuf[i]&dp[i]) != dp[i]) {
                                        printf("\nNEED-ERASE @0x%08x ... %08x != %08x (Goal)\n",
                                        printf("\nNEED-ERASE @0x%08x ... %08x != %08x (Goal)\n",
                                                i+base-addr, sbuf[i], dp[i]);
                                                i+base-addr, sbuf[i], dp[i]);
                                        need_erase = true;
                                        need_erase = true;

powered by: WebSVN 2.1.0

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