logo       

CVS: libraries/mspgcc flash_write_byte.c,1.1,1.2 flash_write_word.c,1.1,1.2: msg#00032

Subject: CVS: libraries/mspgcc flash_write_byte.c,1.1,1.2 flash_write_word.c,1.1,1.2
Update of /cvsroot/mspgcc/libraries/mspgcc
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5570/libraries/mspgcc

Modified Files:
        flash_write_byte.c flash_write_word.c 
Log Message:
fix when running the code from RAM

Index: flash_write_byte.c
===================================================================
RCS file: /cvsroot/mspgcc/libraries/mspgcc/flash_write_byte.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -w -d -r1.1 -r1.2
--- flash_write_byte.c  22 Aug 2005 11:23:20 -0000      1.1
+++ flash_write_byte.c  23 Aug 2005 18:03:22 -0000      1.2
@@ -5,6 +5,9 @@
 // FCTL2 must be initialized by the user
 // NMI, Oscillator Fault interrupts must be disabled by the user
 // byte copy (works with unaligned data)
+// waiting for the BUSY flasg is not needed when the code is run from flash as
+// the hardware halts programm execution, but it is required when running the
+// programm from RAM
 critical void flash_write(void *dst, const void *src, unsigned int size) {
     FCTL3 = FWKEY;                      // unlock
     FCTL1 = FWKEY|WRT;                  // select write
@@ -12,6 +15,7 @@
     while (size) {
         size--;   //decrement before using as array indexing starts at 0, not 1
         ((unsigned char *)dst)[size] = ((unsigned char *)src)[size];  // copy
+        while (FCTL3 & BUSY) {}         // wait until write is completed
     }
     FCTL1 = FWKEY;                      // disable flash writing
     FCTL3 = FWKEY|LOCK;                 // lock

Index: flash_write_word.c
===================================================================
RCS file: /cvsroot/mspgcc/libraries/mspgcc/flash_write_word.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -w -d -r1.1 -r1.2
--- flash_write_word.c  22 Aug 2005 11:23:20 -0000      1.1
+++ flash_write_word.c  23 Aug 2005 18:03:22 -0000      1.2
@@ -6,6 +6,9 @@
 // NMI, Oscillator Fault interrupts must be disabled by the user
 // word copy
 // data must be word aligned
+// waiting for the BUSY flasg is not needed when the code is run from flash as
+// the hardware halts programm execution, but it is required when running the
+// programm from RAM
 critical void flash_write_word(void *dst, const void *src, unsigned int size) {
     FCTL3 = FWKEY;                      // unlock
     FCTL1 = FWKEY|WRT;                  // select write
@@ -15,6 +18,7 @@
     while (size) {
         size--;   //decrement before using as array indexing starts at 0, not 1
         ((unsigned short *)dst)[size] = ((unsigned short *)src)[size];  // copy
+        while (FCTL3 & BUSY) {}         // wait until write is completed
     }
     FCTL1 = FWKEY;                      // disable flash writing
     FCTL3 = FWKEY|LOCK;                 // lock



-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
qnx.openqnx.dev...    politics.lenini...    audio.emagic.ex...    tex.texinfo.gen...    handhelds.linux...    ietf.sipping/20...    lang.erlang.gen...    cygwin.talk/200...    yellowdog.gener...    mozilla.devel.l...    xfree86.newbie/...    openbsd.ports/2...    db.oracle.devel...    kde.kalyxo.deve...    user-groups.lin...    bbc.cvs/2003-04...    gnu.libtool.bug...    redhat.k12osn/2...    emulators.wine....    freebsd.devel.d...    search.xapian.g...    java.izpack.use...    network.mrtg.us...    windows.total-c...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe