Commit 9ff6755bf9f31a2aebcc1d780e4a2a3fa661cc01
1 parent
40ce0a9a
Move ECC calculation to a more appropriate place.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3232 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
3 changed files
with
17 additions
and
11 deletions
Makefile.target
... | ... | @@ -472,7 +472,7 @@ VL_OBJS+= arm-semi.o |
472 | 472 | VL_OBJS+= pxa2xx.o pxa2xx_pic.o pxa2xx_gpio.o pxa2xx_timer.o pxa2xx_dma.o |
473 | 473 | VL_OBJS+= pxa2xx_lcd.o pxa2xx_mmci.o pxa2xx_pcmcia.o max111x.o max7310.o |
474 | 474 | VL_OBJS+= spitz.o ads7846.o ide.o serial.o nand.o $(AUDIODRV) wm8750.o |
475 | -VL_OBJS+= omap.o omap_lcdc.o omap1_clk.o omap_mmc.o palm.o | |
475 | +VL_OBJS+= omap.o omap_lcdc.o omap1_clk.o omap_mmc.o palm.o ecc.o | |
476 | 476 | CPPFLAGS += -DHAS_AUDIO |
477 | 477 | endif |
478 | 478 | ifeq ($(TARGET_BASE_ARCH), sh4) | ... | ... |
ecc.h renamed to hw/ecc.c
... | ... | @@ -8,11 +8,7 @@ |
8 | 8 | * This code is licensed under the GNU GPL v2. |
9 | 9 | */ |
10 | 10 | |
11 | -struct ecc_state_s { | |
12 | - uint8_t cp; /* Column parity */ | |
13 | - uint16_t lp[2]; /* Line parity */ | |
14 | - uint16_t count; | |
15 | -}; | |
11 | +#include "vl.h" | |
16 | 12 | |
17 | 13 | /* |
18 | 14 | * Pre-calculated 256-way 1 byte column parity. Table borrowed from Linux. |
... | ... | @@ -53,7 +49,7 @@ static const uint8_t nand_ecc_precalc_table[] = { |
53 | 49 | }; |
54 | 50 | |
55 | 51 | /* Update ECC parity count. */ |
56 | -static inline uint8_t ecc_digest(struct ecc_state_s *s, uint8_t sample) | |
52 | +uint8_t ecc_digest(struct ecc_state_s *s, uint8_t sample) | |
57 | 53 | { |
58 | 54 | uint8_t idx = nand_ecc_precalc_table[sample]; |
59 | 55 | |
... | ... | @@ -68,7 +64,7 @@ static inline uint8_t ecc_digest(struct ecc_state_s *s, uint8_t sample) |
68 | 64 | } |
69 | 65 | |
70 | 66 | /* Reinitialise the counters. */ |
71 | -static inline void ecc_reset(struct ecc_state_s *s) | |
67 | +void ecc_reset(struct ecc_state_s *s) | |
72 | 68 | { |
73 | 69 | s->lp[0] = 0x0000; |
74 | 70 | s->lp[1] = 0x0000; |
... | ... | @@ -77,7 +73,7 @@ static inline void ecc_reset(struct ecc_state_s *s) |
77 | 73 | } |
78 | 74 | |
79 | 75 | /* Save/restore */ |
80 | -static inline void ecc_put(QEMUFile *f, struct ecc_state_s *s) | |
76 | +void ecc_put(QEMUFile *f, struct ecc_state_s *s) | |
81 | 77 | { |
82 | 78 | qemu_put_8s(f, &s->cp); |
83 | 79 | qemu_put_be16s(f, &s->lp[0]); |
... | ... | @@ -85,7 +81,7 @@ static inline void ecc_put(QEMUFile *f, struct ecc_state_s *s) |
85 | 81 | qemu_put_be16s(f, &s->count); |
86 | 82 | } |
87 | 83 | |
88 | -static inline void ecc_get(QEMUFile *f, struct ecc_state_s *s) | |
84 | +void ecc_get(QEMUFile *f, struct ecc_state_s *s) | |
89 | 85 | { |
90 | 86 | qemu_get_8s(f, &s->cp); |
91 | 87 | qemu_get_be16s(f, &s->lp[0]); | ... | ... |
vl.h
... | ... | @@ -1539,7 +1539,17 @@ uint8_t nand_getio(struct nand_flash_s *s); |
1539 | 1539 | #define NAND_MFR_HYNIX 0xad |
1540 | 1540 | #define NAND_MFR_MICRON 0x2c |
1541 | 1541 | |
1542 | -#include "ecc.h" | |
1542 | +/* ecc.c */ | |
1543 | +struct ecc_state_s { | |
1544 | + uint8_t cp; /* Column parity */ | |
1545 | + uint16_t lp[2]; /* Line parity */ | |
1546 | + uint16_t count; | |
1547 | +}; | |
1548 | + | |
1549 | +uint8_t ecc_digest(struct ecc_state_s *s, uint8_t sample); | |
1550 | +void ecc_reset(struct ecc_state_s *s); | |
1551 | +void ecc_put(QEMUFile *f, struct ecc_state_s *s); | |
1552 | +void ecc_get(QEMUFile *f, struct ecc_state_s *s); | |
1543 | 1553 | |
1544 | 1554 | /* GPIO */ |
1545 | 1555 | typedef void (*gpio_handler_t)(int line, int level, void *opaque); | ... | ... |