]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
Move ECC calculation to a more appropriate place.
authorbalrog <balrog@c046a42c-6fe2-441c-8c8c-71466251a162>
Tue, 25 Sep 2007 01:17:04 +0000 (01:17 +0000)
committerbalrog <balrog@c046a42c-6fe2-441c-8c8c-71466251a162>
Tue, 25 Sep 2007 01:17:04 +0000 (01:17 +0000)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3232 c046a42c-6fe2-441c-8c8c-71466251a162

Makefile.target
hw/ecc.c [moved from ecc.h with 87% similarity]
vl.h

index bbcd33daaa663707f7919aa532bed576d26a4bd9..6c2a4128cb544b6beb889d496ae47841cf955fa7 100644 (file)
@@ -472,7 +472,7 @@ VL_OBJS+= arm-semi.o
 VL_OBJS+= pxa2xx.o pxa2xx_pic.o pxa2xx_gpio.o pxa2xx_timer.o pxa2xx_dma.o
 VL_OBJS+= pxa2xx_lcd.o pxa2xx_mmci.o pxa2xx_pcmcia.o max111x.o max7310.o
 VL_OBJS+= spitz.o ads7846.o ide.o serial.o nand.o $(AUDIODRV) wm8750.o
-VL_OBJS+= omap.o omap_lcdc.o omap1_clk.o omap_mmc.o palm.o
+VL_OBJS+= omap.o omap_lcdc.o omap1_clk.o omap_mmc.o palm.o ecc.o
 CPPFLAGS += -DHAS_AUDIO
 endif
 ifeq ($(TARGET_BASE_ARCH), sh4)
diff --git a/ecc.h b/hw/ecc.c
similarity index 87%
rename from ecc.h
rename to hw/ecc.c
index e8e39426f5778ca79720f70a09e3ce1c5ba02c2b..970ede806a1c48782d2cced9a1880a2d2aa53881 100644 (file)
--- a/ecc.h
+++ b/hw/ecc.c
@@ -8,11 +8,7 @@
  * This code is licensed under the GNU GPL v2.
  */
 
-struct ecc_state_s {
-    uint8_t cp;                /* Column parity */
-    uint16_t lp[2];    /* Line parity */
-    uint16_t count;
-};
+#include "vl.h"
 
 /*
  * Pre-calculated 256-way 1 byte column parity.  Table borrowed from Linux.
@@ -53,7 +49,7 @@ static const uint8_t nand_ecc_precalc_table[] = {
 };
 
 /* Update ECC parity count.  */
-static inline uint8_t ecc_digest(struct ecc_state_s *s, uint8_t sample)
+uint8_t ecc_digest(struct ecc_state_s *s, uint8_t sample)
 {
     uint8_t idx = nand_ecc_precalc_table[sample];
 
@@ -68,7 +64,7 @@ static inline uint8_t ecc_digest(struct ecc_state_s *s, uint8_t sample)
 }
 
 /* Reinitialise the counters.  */
-static inline void ecc_reset(struct ecc_state_s *s)
+void ecc_reset(struct ecc_state_s *s)
 {
     s->lp[0] = 0x0000;
     s->lp[1] = 0x0000;
@@ -77,7 +73,7 @@ static inline void ecc_reset(struct ecc_state_s *s)
 }
 
 /* Save/restore */
-static inline void ecc_put(QEMUFile *f, struct ecc_state_s *s)
+void ecc_put(QEMUFile *f, struct ecc_state_s *s)
 {
     qemu_put_8s(f, &s->cp);
     qemu_put_be16s(f, &s->lp[0]);
@@ -85,7 +81,7 @@ static inline void ecc_put(QEMUFile *f, struct ecc_state_s *s)
     qemu_put_be16s(f, &s->count);
 }
 
-static inline void ecc_get(QEMUFile *f, struct ecc_state_s *s)
+void ecc_get(QEMUFile *f, struct ecc_state_s *s)
 {
     qemu_get_8s(f, &s->cp);
     qemu_get_be16s(f, &s->lp[0]);
diff --git a/vl.h b/vl.h
index d7e12ad905c6e94fa14be76018ad3d3164e07bf0..b2dde5dd014294d7cf5a24348872f9238505f48f 100644 (file)
--- a/vl.h
+++ b/vl.h
@@ -1539,7 +1539,17 @@ uint8_t nand_getio(struct nand_flash_s *s);
 #define NAND_MFR_HYNIX         0xad
 #define NAND_MFR_MICRON                0x2c
 
-#include "ecc.h"
+/* ecc.c */
+struct ecc_state_s {
+    uint8_t cp;                /* Column parity */
+    uint16_t lp[2];    /* Line parity */
+    uint16_t count;
+};
+
+uint8_t ecc_digest(struct ecc_state_s *s, uint8_t sample);
+void ecc_reset(struct ecc_state_s *s);
+void ecc_put(QEMUFile *f, struct ecc_state_s *s);
+void ecc_get(QEMUFile *f, struct ecc_state_s *s);
 
 /* GPIO */
 typedef void (*gpio_handler_t)(int line, int level, void *opaque);