diff options
author | Andriy Gapon <avg@FreeBSD.org> | 2020-08-12 09:57:28 +0000 |
---|---|---|
committer | Andriy Gapon <avg@FreeBSD.org> | 2020-08-12 09:57:28 +0000 |
commit | d9fe3aed75275a25a18f14140481691e59f8158d (patch) | |
tree | 9c5b1111226c73063477afc2459bdcd888aad574 /sys/arm | |
parent | 852d1357918224c84b1f45009e69d612da9bb956 (diff) | |
download | src-d9fe3aed75275a25a18f14140481691e59f8158d.tar.gz src-d9fe3aed75275a25a18f14140481691e59f8158d.zip |
aw_cir: in the pulse encoding the actual length is one greater than value
While here change type of some variables from long to int, it's sufficient.
Also, add length reporting to a couple of debug printfs.
MFC after: 3 weeks
Notes
Notes:
svn path=/head/; revision=364149
Diffstat (limited to 'sys/arm')
-rw-r--r-- | sys/arm/allwinner/aw_cir.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/sys/arm/allwinner/aw_cir.c b/sys/arm/allwinner/aw_cir.c index 8eb6a9f711d5..eabab4cba8f2 100644 --- a/sys/arm/allwinner/aw_cir.c +++ b/sys/arm/allwinner/aw_cir.c @@ -202,9 +202,9 @@ aw_ir_read_data(struct aw_ir_softc *sc) static unsigned long aw_ir_decode_packets(struct aw_ir_softc *sc) { - unsigned long len, code; - unsigned char val, last; + unsigned int len, code; unsigned int active_delay; + unsigned char val, last; int i, bitcount; if (bootverbose) @@ -215,11 +215,11 @@ aw_ir_decode_packets(struct aw_ir_softc *sc) (AW_IR_ACTIVE_T_C_VAL != 0 ? 128 : 1); len = active_delay; if (bootverbose) - device_printf(sc->dev, "Initial len: %ld\n", len); + device_printf(sc->dev, "Initial len: %d\n", len); for (i = 0; i < sc->dcnt; i++) { val = sc->buf[i]; if (val & VAL_MASK) - len += val & PERIOD_MASK; + len += (val & PERIOD_MASK) + 1; else { if (len > AW_IR_L1_MIN) break; @@ -227,7 +227,7 @@ aw_ir_decode_packets(struct aw_ir_softc *sc) } } if (bootverbose) - device_printf(sc->dev, "len = %ld\n", len); + device_printf(sc->dev, "len = %d\n", len); if ((val & VAL_MASK) || (len <= AW_IR_L1_MIN)) { if (bootverbose) device_printf(sc->dev, "Bit separator error\n"); @@ -243,7 +243,7 @@ aw_ir_decode_packets(struct aw_ir_softc *sc) break; len = 0; } else - len += val & PERIOD_MASK; + len += (val & PERIOD_MASK) + 1; } if ((!(val & VAL_MASK)) || (len <= AW_IR_L0_MIN)) { if (bootverbose) @@ -260,23 +260,25 @@ aw_ir_decode_packets(struct aw_ir_softc *sc) val = sc->buf[i]; if (last) { if (val & VAL_MASK) - len += val & PERIOD_MASK; + len += (val & PERIOD_MASK) + 1; else { if (len > AW_IR_PMAX) { if (bootverbose) device_printf(sc->dev, - "Pulse error\n"); + "Pulse error, len=%d\n", + len); goto error_code; } last = 0; - len = val & PERIOD_MASK; + len = (val & PERIOD_MASK) + 1; } } else { if (val & VAL_MASK) { if (len > AW_IR_DMAX) { if (bootverbose) device_printf(sc->dev, - "Distant error\n"); + "Distance error, len=%d\n", + len); goto error_code; } else { if (len > AW_IR_DMID) { @@ -288,9 +290,9 @@ aw_ir_decode_packets(struct aw_ir_softc *sc) break; /* Finish decoding */ } last = 1; - len = val & PERIOD_MASK; + len = (val & PERIOD_MASK) + 1; } else - len += val & PERIOD_MASK; + len += (val & PERIOD_MASK) + 1; } } return (code); |