未验证 提交 8b161fad 编写于 作者: B Bernard Xiong 提交者: GitHub

Merge pull request #1794 from AubrCool/fix-bxcan.fif1.filter.error

[bsp] stm32f10x correct fifo1 alloc error
...@@ -512,12 +512,14 @@ static rt_err_t bxcancalcbaseoff(struct stm_bxcan *pbxcan, rt_int32_t hdr, ...@@ -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 fifo1start, fifo1end;
rt_uint32_t ptr; rt_uint32_t ptr;
fifo0start = 0; fifo0start = 0;
fifo0end = pbxcan->filtermap[0].id32mask_cnt fifo0end = fifo0start
+ pbxcan->filtermap[0].id32mask_cnt
+ pbxcan->filtermap[0].id32bit_cnt + pbxcan->filtermap[0].id32bit_cnt
+ pbxcan->filtermap[0].id16mask_cnt + pbxcan->filtermap[0].id16mask_cnt
+ pbxcan->filtermap[0].id16bit_cnt ; + pbxcan->filtermap[0].id16bit_cnt ;
fifo1start = pbxcan->fifo1filteroff * 4; 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].id32bit_cnt
+ pbxcan->filtermap[1].id16mask_cnt + pbxcan->filtermap[1].id16mask_cnt
+ pbxcan->filtermap[1].id16bit_cnt ; + pbxcan->filtermap[1].id16bit_cnt ;
...@@ -525,17 +527,18 @@ static rt_err_t bxcancalcbaseoff(struct stm_bxcan *pbxcan, rt_int32_t hdr, ...@@ -525,17 +527,18 @@ static rt_err_t bxcancalcbaseoff(struct stm_bxcan *pbxcan, rt_int32_t hdr,
{ {
*pbase = 0; *pbase = 0;
ptr = 0; ptr = 0;
hdr -= fifo0start;
} }
else if (hdr >= fifo1start && hdr < fifo1end) else if (hdr >= fifo1start && hdr < fifo1end)
{ {
*pbase = pbxcan->fifo1filteroff; *pbase = pbxcan->fifo1filteroff;
ptr = 1; ptr = 1;
hdr -= fifo1start;
} }
else else
{ {
return RT_ERROR; return RT_ERROR;
} }
ptr = 0;
if (hdr > pbxcan->filtermap[ptr].id32mask_cnt) if (hdr > pbxcan->filtermap[ptr].id32mask_cnt)
{ {
hdr -= pbxcan->filtermap[ptr].id32mask_cnt; hdr -= pbxcan->filtermap[ptr].id32mask_cnt;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册