diff options
author | Jens Arnold <amiconn@rockbox.org> | 2006-03-24 07:57:55 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2006-03-24 07:57:55 +0000 |
commit | 6a5ef8e7420bc458993c8d56bb1ed4c1aa4804b8 (patch) | |
tree | 3f38556462a9305ef737c6b221575f1021c086ec | |
parent | 8307d0b3884b0f49c06a40b73eaac9e2efda6f73 (diff) | |
download | rockbox-6a5ef8e7420bc458993c8d56bb1ed4c1aa4804b8.tar.gz rockbox-6a5ef8e7420bc458993c8d56bb1ed4c1aa4804b8.zip |
Fixed loong-standing bug in mas_writereg().
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9222 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | firmware/drivers/mas.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/firmware/drivers/mas.c b/firmware/drivers/mas.c index 66ba6b6aff..1630255348 100644 --- a/firmware/drivers/mas.c +++ b/firmware/drivers/mas.c | |||
@@ -198,9 +198,15 @@ int mas_writereg(int reg, unsigned int val) | |||
198 | 198 | ||
199 | buf[0] = MAS_DATA_WRITE; | 199 | buf[0] = MAS_DATA_WRITE; |
200 | buf[1] = MAS_CMD_WRITE_REG | (reg >> 4); | 200 | buf[1] = MAS_CMD_WRITE_REG | (reg >> 4); |
201 | #if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) | ||
202 | buf[2] = ((reg & 0x0f) << 4) | (val >> 16 & 0x0f); | ||
203 | buf[3] = (val >> 8) & 0xff; | ||
204 | buf[4] = val & 0xff; | ||
205 | #else | ||
201 | buf[2] = ((reg & 0x0f) << 4) | (val & 0x0f); | 206 | buf[2] = ((reg & 0x0f) << 4) | (val & 0x0f); |
202 | buf[3] = (val >> 12) & 0xff; | 207 | buf[3] = (val >> 12) & 0xff; |
203 | buf[4] = (val >> 4) & 0xff; | 208 | buf[4] = (val >> 4) & 0xff; |
209 | #endif | ||
204 | 210 | ||
205 | /* send write command */ | 211 | /* send write command */ |
206 | if (i2c_write(MAS_DEV_WRITE,buf,5)) | 212 | if (i2c_write(MAS_DEV_WRITE,buf,5)) |