62 *EndAddr = *StartAddr;
91 pCAN->
TX[TxBufID] = *pTxFrame;
101 if (IsFullCANEntry) {
129 uint16_t EntryCnt = 0;
132 for (i = 0; i < EntryNum; i += 2) {
134 if (CurID > pStdCANSec[i].ID_11) {
137 CurID = pStdCANSec[i].
ID_11;
139 pCanAFRamAddr[EntryCnt] = Entry << 16;
142 if ((i + 1) < EntryNum) {
143 if (CurID > pStdCANSec[i + 1].ID_11) {
146 CurID = pStdCANSec[i + 1].
ID_11;
148 pCanAFRamAddr[EntryCnt] |= Entry;
178 arr[0] = ((prevRow & 0xFFFF0000) >> 16);
179 for (i = 0; i < (num / 2); i++) {
181 arr[i + 1] = ((prevRow & 0xFFFF) << 16) | ((curRow & 0xFFFF0000) >> 16);
184 if ((num % 2) == 0) {
201 curRow = arr[((num + 1) / 2) - 1];
206 if ((num % 2) == 0) {
210 for (i = ((num + 1) / 2) - 1; i > 0; i--) {
211 prevRow = arr[i - 1];
212 arr[i - 1] = ((curRow & 0xFFFF0000) >> 16) | ((prevRow & 0xFFFF) << 16);
239 uint16_t EntryCnt = 0;
242 for (i = 0; i < EntryNum; i++) {
243 if (CurID > pExtCANSec[i].ID_29) {
246 CurID = pExtCANSec[i].
ID_29;
248 pCanAFRamAddr[EntryCnt] = Entry;
270 index = startIndex * byteNum;
272 if (startIndex % 2) {
280 for (i = 0; i < byteNum; i++) {
281 retVal |= arr[index + i] << (8 * i);
289 uint32_t LowerIndex, UpperIndex, MidIndex;
291 uint8_t *byteArray = (uint8_t *) arr;
298 UpperIndex = arrNum - 1;
299 while (LowerIndex + 1 < UpperIndex) {
300 MidIndex = (LowerIndex + UpperIndex) / 2;
301 MidVal =
getArrayVal(byteArray, MidIndex, unitSize) & mask;
305 else if (MidVal < val) {
306 LowerIndex = MidIndex + 1;
309 UpperIndex = MidIndex - 1;
313 if (((
getArrayVal(byteArray, LowerIndex, unitSize) & mask) == val) ||
314 ((
getArrayVal(byteArray, UpperIndex, unitSize) & mask) == val)) {
317 if ((
getArrayVal(byteArray, LowerIndex, unitSize) & mask) > val) {
320 if ((
getArrayVal(byteArray, UpperIndex, unitSize) & mask) < val) {
321 return UpperIndex + 1;
391 if (pBusTiming->
SAM) {
424 pMsg->
Data[i] = (RxFrame.
RD[i / 4] >> (8 * (i % 4))) & 0xFF;
454 1] << 8) | (pMsg->
Data[4 * i + 2] << 16) | (pMsg->
Data[4 * i + 3] << 24);
503 return (pCanAF->
FCANIC[ObjID / 32] & (1 << (ObjID % 32))) ?
SET :
RESET;
512 uint16_t FullCANEntryCnt;
516 pSrc += FullCANEntryCnt + ObjID * 3;
563 pCanAFRam->
MASK[i] = 0;
580 uint16_t EntryCnt = 0, FullCANEntryCnt = 0;
606 FullCANEntryCnt = EntryCnt;
654 if ((FullCANEntryCnt > 0) && ((0x800 - 6 * FullCANEntryCnt) < EntryCnt)) {
669 uint16_t StartRow, EndRow;
670 uint16_t EntryCnt = 0;
673 if (EndRow <= StartRow) {
678 EntryCnt = (EndRow - StartRow + 1) * 2;
681 (((pCanAFRam->
MASK[EndRow] >>
688 EntryCnt = EndRow - StartRow + 1;
691 EntryCnt = (EndRow - StartRow + 1) / 2;
703 uint16_t StartRow, EndRow;
704 uint16_t EntryCnt = 0;
714 if (IsFullCANEntry) {
722 if (EndRow > StartRow) {
723 EntryCnt = (EndRow - StartRow + 1) * 2;
726 (((pCanAFRam->
MASK[EndRow] >>
739 if ((IDIndex == -1) || (IDIndex > EntryCnt )) {
748 if ((EntryCnt % 2) == 0) {
749 uint16_t StartAddr, EndAddr;
752 pCanAFRam->
MASK[i] = pCanAFRam->
MASK[i - 1];
755 if (IsFullCANEntry) {
770 if ((IDIndex % 2) == 0) {
779 if ((IDIndex % 2) == 0) {
780 if (IDIndex == EntryCnt) {
786 val = pCanAFRam->
MASK[StartRow + IDIndex / 2] & 0x0000FFFF;
788 pCanAFRam->
MASK[StartRow + IDIndex / 2] = val | (tmp << 16);
793 val = pCanAFRam->
MASK[StartRow + IDIndex / 2];
794 valNext = pCanAFRam->
MASK[StartRow + IDIndex / 2 + 1];
796 if (IDIndex < EntryCnt ) {
798 pCanAFRam->
MASK[StartRow + IDIndex / 2 + 1] = (valNext & 0x0000FFFF) | ((val & 0xFFFF) << 16);
800 pCanAFRam->
MASK[StartRow + IDIndex / 2] = (val & 0xFFFF0000) | tmp;
828 uint16_t StartRow, EndRow;
829 uint16_t EntryCnt = 0;
841 if (EndRow > StartRow) {
842 EntryCnt = EndRow - StartRow + 1;
851 if ((IDIndex == -1) || (IDIndex > EntryCnt )) {
862 pCanAFRam->
MASK[i] = pCanAFRam->
MASK[i - 1];
867 pCanAFRam->
MASK[StartRow + IDIndex] = tmp;
884 uint16_t InsertIndex = 0;
885 uint16_t StartRow, EndRow;
886 uint16_t LowerID = 0, UpperID = 0;
897 for (InsertIndex = StartRow; InsertIndex <= EndRow; InsertIndex++) {
906 if (InsertIndex > 0) {
907 uint16_t PrevUpperID;
916 uint32_t val = pCanAFRam->
MASK[InsertIndex - 1] & 0xFFFF0000;
921 goto insert_grp_entry;
927 if ((EndRow) && (InsertIndex <= EndRow)) {
932 pCanAFRam->
MASK[InsertIndex] = val;
937 uint32_t val = pCanAFRam->
MASK[InsertIndex] & 0x0000FFFF;
953 pCanAFRam->
MASK[i] = pCanAFRam->
MASK[i - 1];
977 uint16_t StartRow, EndRow;
990 for (InsertIndex = StartRow; InsertIndex <= EndRow; InsertIndex += 2) {
999 if (InsertIndex > 0) {
1013 goto insert_grp_entry;
1018 if ((EndRow) && (InsertIndex < EndRow)) {
1041 pCanAFRam->
MASK[i] = pCanAFRam->
MASK[i - 2];
1060 bool IsFullCANEntry)
1062 uint16_t StartRow, EndRow;
1063 uint16_t EntryCnt = 0, i;
1076 if (IsFullCANEntry) {
1083 if (EndRow > StartRow) {
1084 EntryCnt = (EndRow - StartRow + 1) * 2;
1087 (((pCanAFRam->
MASK[EndRow] >>
1093 if (IDIndex >= EntryCnt) {
1101 tmp = pCanAFRam->
MASK[StartRow + IDIndex / 2 + 1];
1102 if ((IDIndex % 2) == 0) {
1109 pCanAFRam->
MASK[StartRow + IDIndex / 2] &= 0xFFFF0000;
1110 if (IDIndex == (EntryCnt - 1)) {
1112 tmp = (pCanAFRam->
MASK[StartRow + IDIndex / 2]) >> 16;
1117 pCanAFRam->
MASK[StartRow + IDIndex / 2] |= (tmp >> 16) & 0xFFFF;
1123 uint16_t StartAddr, EndAddr;
1126 pCanAFRam->
MASK[i] = pCanAFRam->
MASK[i + 1];
1129 if (IsFullCANEntry) {
1154 uint16_t StartRow, EndRow;
1155 uint16_t StartAddr, EndAddr;
1156 uint16_t EntryCnt = 0;
1157 uint8_t EntryRowNum = 1;
1184 if (EndRow > StartRow) {
1185 EntryCnt = (EndRow - StartRow + 1) / EntryRowNum;
1188 if (Position >= EntryCnt) {
1197 for (i = StartRow + Position * EntryRowNum; i <
getTotalEntryNum(pCanAF); i++) {
1198 pCanAFRam->
MASK[i] = pCanAFRam->
MASK[i + EntryRowNum];
1202 switch (SectionID) {
1266 bool IsFullCANEntry,
1270 uint16_t StartRow, EndRow;
1271 uint16_t EntryCnt = 0;
1274 if (IsFullCANEntry) {
1281 if (EndRow > StartRow) {
1282 EntryCnt = (EndRow - StartRow + 1) * 2;
1285 (((pCanAFRam->
MASK[EndRow] >>
1290 if (Position >= EntryCnt) {
1294 if ((Position % 2) == 0) {
1325 uint16_t StartRow, EndRow;
1326 uint16_t EntryCnt = 0;
1330 if (EndRow > StartRow) {
1331 EntryCnt = EndRow - StartRow + 1;
1333 if (Position >= EntryCnt) {
1347 uint16_t StartRow, EndRow;
1348 uint16_t EntryCnt = 0;
1352 if (EndRow > StartRow) {
1353 EntryCnt = EndRow - StartRow + 1;
1355 if (Position >= EntryCnt) {
1369 uint16_t StartRow, EndRow;
1370 uint16_t EntryCnt = 0;
1374 if (EndRow > StartRow) {
1375 EntryCnt = (EndRow - StartRow + 1) / 2;
1377 if (Position >= EntryCnt) {