|
1 | 1 | /* |
2 | | - * Copyright (c) 2015-2020 Arm Limited. All rights reserved. |
| 2 | + * Copyright (c) 2015-2025 Arm Limited. All rights reserved. |
3 | 3 | * |
4 | 4 | * SPDX-License-Identifier: Apache-2.0 |
5 | 5 | * |
@@ -128,7 +128,7 @@ int8_t CAN_RunTransfer (uint32_t tx_obj_idx, ARM_CAN_MSG_INFO *tx_msg_info, cons |
128 | 128 | return 0; |
129 | 129 | } |
130 | 130 | } |
131 | | - while ((GET_SYSTICK() - tick) < SYSTICK_MICROSEC(CAN_TRANSFER_TIMEOUT)); |
| 131 | + while ((GET_SYSTICK() - tick) < SYSTICK_MS(CAN_TRANSFER_TIMEOUT)); |
132 | 132 | return -1; |
133 | 133 | } |
134 | 134 |
|
@@ -386,10 +386,10 @@ void CAN_Loopback_CheckBitrate (void) { |
386 | 386 | tx_data_msg_info.id = ARM_CAN_EXTENDED_ID(0x15555555U); |
387 | 387 |
|
388 | 388 | /* Measure transfer time */ |
389 | | - ticks_measured = GET_SYSTICK(); |
| 389 | + ticks_measured = GET_SYSTIMER(); |
390 | 390 | CAN_RunTransfer (tx_obj_idx, &tx_data_msg_info, buffer_out, rx_obj_idx, &rx_data_msg_info, buffer_in, CAN_MSG_SIZE); |
391 | | - ticks_measured = GET_SYSTICK() - ticks_measured; |
392 | | - ticks_expected = SYSTICK_MICROSEC((((CAN_MSG_SIZE * 8U) + CAN_EXT_FRAME_BITS) * 1000) / CAN_BR[bitrate]); |
| 391 | + ticks_measured = GET_SYSTIMER() - ticks_measured; |
| 392 | + ticks_expected = SYSTIMER_US((((CAN_MSG_SIZE * 8U) + CAN_EXT_FRAME_BITS) * 1000) / CAN_BR[bitrate]); |
393 | 393 |
|
394 | 394 | rate = (double)ticks_measured/ticks_expected; |
395 | 395 |
|
@@ -581,11 +581,11 @@ void CAN_Loopback_CheckBitrateFD (void) { |
581 | 581 | tx_data_msg_info.id = ARM_CAN_EXTENDED_ID(0x15555555U); |
582 | 582 |
|
583 | 583 | /* Measure transfer time */ |
584 | | - ticks_measured = GET_SYSTICK(); |
| 584 | + ticks_measured = GET_SYSTIMER(); |
585 | 585 | CAN_RunTransfer (tx_obj_idx, &tx_data_msg_info, buffer_out, rx_obj_idx, &rx_data_msg_info, buffer_in, CAN_MSG_SIZE_FD); |
586 | | - ticks_measured = GET_SYSTICK() - ticks_measured; |
587 | | - ticks_expected = SYSTICK_MICROSEC((((((CAN_MSG_SIZE_FD * 8U) + CAN_EXT_FRAME_BITS_FD_DATA) * 1000) / (CAN_BR[bitrate] * CAN_DATA_ARB_RATIO)) + |
588 | | - (((CAN_EXT_FRAME_BITS_NOMINAL) * 1000) / CAN_BR[bitrate] ) )); |
| 586 | + ticks_measured = GET_SYSTIMER() - ticks_measured; |
| 587 | + ticks_expected = SYSTIMER_US((((((CAN_MSG_SIZE_FD * 8U) + CAN_EXT_FRAME_BITS_FD_DATA) * 1000) / (CAN_BR[bitrate] * CAN_DATA_ARB_RATIO)) + |
| 588 | + (((CAN_EXT_FRAME_BITS_NOMINAL) * 1000) / CAN_BR[bitrate] ) )); |
589 | 589 |
|
590 | 590 | rate = (double)ticks_measured/ticks_expected; |
591 | 591 |
|
@@ -667,7 +667,7 @@ void CAN_Loopback_Transfer (void) { |
667 | 667 | } |
668 | 668 |
|
669 | 669 | /* Set output buffer with random data */ |
670 | | - srand(GET_SYSTICK()); |
| 670 | + srand(GET_SYSTIMER()); |
671 | 671 | for (cnt = 0; cnt<CAN_MSG_SIZE; cnt++) { |
672 | 672 | buffer_out[cnt] = rand()%0x100U; |
673 | 673 | } |
@@ -865,7 +865,7 @@ void CAN_Loopback_TransferFD (void) { |
865 | 865 | } |
866 | 866 |
|
867 | 867 | /* Set output buffer with random data */ |
868 | | - srand(GET_SYSTICK()); |
| 868 | + srand(GET_SYSTIMER()); |
869 | 869 | for (cnt = 0; cnt<CAN_MSG_SIZE_FD; cnt++) { |
870 | 870 | buffer_out[cnt] = rand()%0x100; |
871 | 871 | } |
|
0 commit comments