aboutsummaryrefslogtreecommitdiffstats
path: root/os
diff options
context:
space:
mode:
authorisiora <none@example.com>2018-03-07 11:55:41 +0000
committerisiora <none@example.com>2018-03-07 11:55:41 +0000
commit88a439033e9e573d465789409bcfcc225749f47f (patch)
tree73d66c786af2920eb2e2a75f1f468469b3a143e8 /os
parente840c781aa12fab1d53eab4c4c11b43e776894e5 (diff)
downloadChibiOS-88a439033e9e573d465789409bcfcc225749f47f.tar.gz
ChibiOS-88a439033e9e573d465789409bcfcc225749f47f.tar.bz2
ChibiOS-88a439033e9e573d465789409bcfcc225749f47f.zip
Fixed mtxSetSlaveSplitAddr and mtxSetSlaveRegionSize.
git-svn-id: https://svn.code.sf.net/p/chibios/svn2/trunk@11617 110e8d01-0319-4d1e-a829-52ad28d1bb01
Diffstat (limited to 'os')
-rw-r--r--os/hal/ports/SAMA/SAMA5D2x/sama_matrix.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/os/hal/ports/SAMA/SAMA5D2x/sama_matrix.c b/os/hal/ports/SAMA/SAMA5D2x/sama_matrix.c
index da6f6f340..c24f8a703 100644
--- a/os/hal/ports/SAMA/SAMA5D2x/sama_matrix.c
+++ b/os/hal/ports/SAMA/SAMA5D2x/sama_matrix.c
@@ -171,11 +171,14 @@ void mtxSetSlaveSplitAddr(Matrix *mtxp, uint8_t slaveID,
mtxDisableWP(mtxp);
uint8_t i = mask, j = 0;
uint32_t value = 0;
+ uint32_t pmask = 0;
for (i = 1; (i <= mask) && (j < 32); i <<= 1, j += 4) {
- if (i & mask)
+ if (i & mask) {
value |= areaSize << j;
+ pmask |= 0x0F << j;
+ }
}
- mtxp->MATRIX_SASSR[slaveID] = value;
+ mtxp->MATRIX_SASSR[slaveID] = (mtxp->MATRIX_SASSR[slaveID] & ~pmask) | value;
mtxEnableWP(mtxp);
}
@@ -196,11 +199,14 @@ void mtxSetSlaveRegionSize(Matrix *mtxp, uint8_t slaveID,
mtxDisableWP(mtxp);
uint8_t i = mask, j = 0;
uint32_t value = 0;
+ uint32_t pmask = 0;
for (i = 1; (i <= mask) && (j < 32 ); i <<= 1, j += 4) {
- if (i & mask)
+ if (i & mask) {
value |= areaSize << j;
+ pmask |= 0x0F << j;
+ }
}
- mtxp->MATRIX_SRTSR[slaveID] = value;
+ mtxp->MATRIX_SRTSR[slaveID] = (mtxp->MATRIX_SRTSR[slaveID] & ~pmask) | value;
mtxEnableWP(mtxp);
}