Skip to content

Commit aa56f4a

Browse files
Jacob-Scheifflerpetejohanson-adi
authored andcommitted
CAN Library Touch-Up (#400)
* Editing can_reva.c to be more readable. * Adding warning to keep request structure in scope until the operation has completed. * Adding request structure scope warnings to MAX32662 CAN header file. --------- Co-authored-by: Scheiffler <[email protected]> MSDK-Commit: 07cca94d65e2ac107c228157b287a48e4c4ea168
1 parent 7f48f2e commit aa56f4a

File tree

3 files changed

+132
-94
lines changed

3 files changed

+132
-94
lines changed

MAX/Libraries/PeriphDrivers/Include/MAX32662/can.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,8 @@ int MXC_CAN_MessageSend(uint32_t can_idx, mxc_can_req_t *req);
538538
* @return Success/Fail, see \ref MXC_Error_Codes for a list of return codes.
539539
*
540540
* @warning MAX32662 does not support CAN FD, setting req->msg_info->fdf will return an error.
541+
* @warning The structure pointed to by 'req' must remain unchanged and in scope until the
542+
* TX complete event has been signaled.
541543
*/
542544
int MXC_CAN_MessageSendAsync(uint32_t can_idx, mxc_can_req_t *req);
543545

@@ -550,6 +552,8 @@ int MXC_CAN_MessageSendAsync(uint32_t can_idx, mxc_can_req_t *req);
550552
* @return Success/Fail, see \ref MXC_Error_Codes for a list of return codes.
551553
*
552554
* @warning MAX32662 does not support CAN FD, setting req->msg_info->fdf will return an error.
555+
* @warning The structure pointed to by 'req' must remain unchanged and in scope until the
556+
* TX complete event has been signaled.
553557
*/
554558
int MXC_CAN_MessageSendDMA(uint32_t can_idx, mxc_can_req_t *req);
555559

@@ -574,6 +578,8 @@ int MXC_CAN_MessageRead(uint32_t can_idx, mxc_can_req_t *req);
574578
* @return Success/Fail, see \ref MXC_Error_Codes for a list of return codes.
575579
*
576580
* @warning MAX32662 does not support CAN FD, setting req->msg_info->fdf will return an error.
581+
* @warning The structure pointed to by 'req' must remain unchanged and in scope until the
582+
* RX complete event has been signaled.
577583
*/
578584
int MXC_CAN_MessageReadAsync(uint32_t can_idx, mxc_can_req_t *req);
579585

@@ -586,6 +592,8 @@ int MXC_CAN_MessageReadAsync(uint32_t can_idx, mxc_can_req_t *req);
586592
* @return Success/Fail, see \ref MXC_Error_Codes for a list of return codes.
587593
*
588594
* @warning MAX32662 does not support CAN FD, setting req->msg_info->fdf will return an error.
595+
* @warning The structure pointed to by 'req' must remain unchanged and in scope until the
596+
* RX complete event has been signaled.
589597
*/
590598
int MXC_CAN_MessageReadDMA(uint32_t can_idx, mxc_can_req_t *req, void (*dma_cb)(int, int));
591599

MAX/Libraries/PeriphDrivers/Include/MAX32690/can.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,12 +534,15 @@ int MXC_CAN_MessageSend(uint32_t can_idx, mxc_can_req_t *req);
534534
/**
535535
* @brief Send message (non-blocking).
536536
*
537+
*
537538
* @param can_idx Index of the CAN peripheral to send the message from
538539
* @param req Contains information about the format and data of message to send
539540
*
540541
* @return Success/Fail, see \ref MXC_Error_Codes for a list of return codes.
541542
*
542543
* @warning MAX32690 does not support CAN FD, setting req->msg_info->fdf will return an error.
544+
* @warning The structure pointed to by 'req' must remain unchanged and in scope until the
545+
* TX complete event has been signaled.
543546
*/
544547
int MXC_CAN_MessageSendAsync(uint32_t can_idx, mxc_can_req_t *req);
545548

@@ -552,6 +555,8 @@ int MXC_CAN_MessageSendAsync(uint32_t can_idx, mxc_can_req_t *req);
552555
* @return Success/Fail, see \ref MXC_Error_Codes for a list of return codes.
553556
*
554557
* @warning MAX32690 does not support CAN FD, setting req->msg_info->fdf will return an error.
558+
* @warning The structure pointed to by 'req' must remain unchanged and in scope until the
559+
* TX complete event has been signaled.
555560
*/
556561
int MXC_CAN_MessageSendDMA(uint32_t can_idx, mxc_can_req_t *req);
557562

@@ -576,6 +581,8 @@ int MXC_CAN_MessageRead(uint32_t can_idx, mxc_can_req_t *req);
576581
* @return Success/Fail, see \ref MXC_Error_Codes for a list of return codes.
577582
*
578583
* @warning MAX32690 does not support receiving CAN FD messages.
584+
* @warning The structure pointed to by 'req' must remain unchanged and in scope until the
585+
* RX complete event has been signaled.
579586
*/
580587
int MXC_CAN_MessageReadAsync(uint32_t can_idx, mxc_can_req_t *req);
581588

@@ -588,6 +595,8 @@ int MXC_CAN_MessageReadAsync(uint32_t can_idx, mxc_can_req_t *req);
588595
* @return Success/Fail, see \ref MXC_Error_Codes for a list of return codes.
589596
*
590597
* @warning MAX32690 does not support receiving CAN FD messages.
598+
* @warning The structure pointed to by 'req' must remain unchanged and in scope until the
599+
* RX complete event has been signaled.
591600
*/
592601
int MXC_CAN_MessageReadDMA(uint32_t can_idx, mxc_can_req_t *req, void (*dma_cb)(int, int));
593602

0 commit comments

Comments
 (0)