summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAubr.Cool <[email protected]>2018-09-11 15:15:25 +0800
committerAubr.Cool <[email protected]>2018-09-11 15:15:25 +0800
commit771d958e6fd7fd95725aabde6f993dda3809899d (patch)
tree04c3ea682460e4f1f9b2cad6aa0dce838c603ce2
parent729654f1a61c5d398abf7c1f5e139eb1da307686 (diff)
[bsp] stm32f10x correct fifo1 alloc error
-rw-r--r--bsp/stm32f10x/drivers/bxcan.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/bsp/stm32f10x/drivers/bxcan.c b/bsp/stm32f10x/drivers/bxcan.c
index a3b717b786..9a1c042b01 100644
--- a/bsp/stm32f10x/drivers/bxcan.c
+++ b/bsp/stm32f10x/drivers/bxcan.c
@@ -512,12 +512,14 @@ static rt_err_t bxcancalcbaseoff(struct stm_bxcan *pbxcan, rt_int32_t hdr,
rt_uint32_t fifo1start, fifo1end;
rt_uint32_t ptr;
fifo0start = 0;
- fifo0end = pbxcan->filtermap[0].id32mask_cnt
+ fifo0end = fifo0start
+ + pbxcan->filtermap[0].id32mask_cnt
+ pbxcan->filtermap[0].id32bit_cnt
+ pbxcan->filtermap[0].id16mask_cnt
+ pbxcan->filtermap[0].id16bit_cnt ;
fifo1start = pbxcan->fifo1filteroff * 4;
- fifo1end = pbxcan->filtermap[1].id32mask_cnt
+ fifo1end = fifo1start
+ + pbxcan->filtermap[1].id32mask_cnt
+ pbxcan->filtermap[1].id32bit_cnt
+ pbxcan->filtermap[1].id16mask_cnt
+ pbxcan->filtermap[1].id16bit_cnt ;
@@ -525,17 +527,18 @@ static rt_err_t bxcancalcbaseoff(struct stm_bxcan *pbxcan, rt_int32_t hdr,
{
*pbase = 0;
ptr = 0;
+ hdr -= fifo0start;
}
else if (hdr >= fifo1start && hdr < fifo1end)
{
*pbase = pbxcan->fifo1filteroff;
ptr = 1;
+ hdr -= fifo1start;
}
else
{
return RT_ERROR;
}
- ptr = 0;
if (hdr > pbxcan->filtermap[ptr].id32mask_cnt)
{
hdr -= pbxcan->filtermap[ptr].id32mask_cnt;