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

[bsp] stm32f10x correct fifo1 alloc error
This commit is contained in:
Bernard Xiong 2018-09-15 13:14:37 +08:00 committed by GitHub
commit 8b161fad6d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 3 deletions

View File

@ -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;