summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHao Zhang2019-09-30 07:56:33 -0500
committerMahesh Radhakrishnan2019-09-30 14:04:06 -0500
commit6666c8f858e7209a77e1dfef745c4d0fd50cc4bd (patch)
tree6d8f93bbfba1ec88ebd310e2d6d2c98833791522
parentdeb767f7c02f072cbccb3b07778e0fe169df079a (diff)
downloaduart-lld-6666c8f858e7209a77e1dfef745c4d0fd50cc4bd.tar.gz
uart-lld-6666c8f858e7209a77e1dfef745c4d0fd50cc4bd.tar.xz
uart-lld-6666c8f858e7209a77e1dfef745c4d0fd50cc4bd.zip
uart: PRSDK-6347: fix Misra-C & KW issues
Signed-off-by: Hao Zhang <hzhang@ti.com>
-rw-r--r--UART.h42
-rw-r--r--UART_stdio.h4
-rw-r--r--src/UART_drv.c2
-rw-r--r--src/v0/UART_v0.c29
-rw-r--r--src/v1/UART_v1.h2
5 files changed, 40 insertions, 39 deletions
diff --git a/UART.h b/UART.h
index 0958fc7..63c590a 100644
--- a/UART.h
+++ b/UART.h
@@ -436,7 +436,7 @@ typedef struct UART_FxnTable_s {
436 /*! Function to implementation specific control function */ 436 /*! Function to implementation specific control function */
437 UART_ControlFxn controlFxn; 437 UART_ControlFxn controlFxn;
438 /*! Function to initialize the given data object */ 438 /*! Function to initialize the given data object */
439 UART_InitFxn initFxn; 439 UART_InitFxn uartInitFxn;
440 /*! Function to open the specified peripheral */ 440 /*! Function to open the specified peripheral */
441 UART_OpenFxn openFxn; 441 UART_OpenFxn openFxn;
442 /*! Function to read from the specified peripheral */ 442 /*! Function to read from the specified peripheral */
@@ -481,11 +481,11 @@ typedef UART_Config UART_config_list[UART_MAX_CONFIG_CNT];
481 * 481 *
482 * @pre UART_open() had to be called first. 482 * @pre UART_open() had to be called first.
483 * 483 *
484 * @param handle A UART_Handle returned from UART_open 484 * @param uartHnd A UART_Handle returned from UART_open
485 * 485 *
486 * @sa UART_open 486 * @sa UART_open
487 */ 487 */
488extern void UART_close(UART_Handle handle); 488extern void UART_close(UART_Handle uartHnd);
489 489
490/*! 490/*!
491 * @brief Function performs implementation specific features on a given 491 * @brief Function performs implementation specific features on a given
@@ -493,18 +493,18 @@ extern void UART_close(UART_Handle handle);
493 * 493 *
494 * @pre UART_open() has to be called first. 494 * @pre UART_open() has to be called first.
495 * 495 *
496 * @param handle A UART handle returned from UART_open() 496 * @param uartHnd A UART handle returned from UART_open()
497 * 497 *
498 * @param cmd A command value defined by the driver specific implementation 498 * @param cmd A command value defined by the driver specific implementation
499 * 499 *
500 * @param arg An optional argument that is accompanied with cmd 500 * @param arg An optional argument that is accompanied with cmd
501 * 501 *
502 * @return Implementation specific return codes. Negative values indicate 502 * @return Implementation specific return codes. Negative values indicate
503 * unsuccessful operations. 503 * unsuccessful operations.
504 * 504 *
505 * @sa UART_open() 505 * @sa UART_open()
506 */ 506 */
507extern int32_t UART_control(UART_Handle handle, uint32_t cmd, void *arg); 507extern int32_t UART_control(UART_Handle uartHnd, uint32_t cmd, void *arg);
508 508
509/*! 509/*!
510 * @brief Function to initializes the UART module 510 * @brief Function to initializes the UART module
@@ -526,7 +526,7 @@ extern void UART_init(void);
526 * @param idx Logical peripheral number indexed into the HWAttrs 526 * @param idx Logical peripheral number indexed into the HWAttrs
527 * table 527 * table
528 * 528 *
529 * @param params Pointer to an parameter block, if NULL it will use 529 * @param uartParams Pointer to an parameter block, if NULL it will use
530 * default values 530 * default values
531 * 531 *
532 * @return A UART_Handle on success or a NULL on an error or if it has been 532 * @return A UART_Handle on success or a NULL on an error or if it has been
@@ -534,7 +534,7 @@ extern void UART_init(void);
534 * 534 *
535 * @sa UART_close 535 * @sa UART_close
536 */ 536 */
537extern UART_Handle UART_open(uint32_t idx, UART_Params *params); 537extern UART_Handle UART_open(uint32_t idx, UART_Params *uartParams);
538 538
539/*! 539/*!
540 * @brief Function to initialize the UART_Params struct to its defaults 540 * @brief Function to initialize the UART_Params struct to its defaults
@@ -554,9 +554,9 @@ extern UART_Handle UART_open(uint32_t idx, UART_Params *params);
554 * stopBits = UART_STOP_ONE; 554 * stopBits = UART_STOP_ONE;
555 * parityType = UART_PAR_NONE; 555 * parityType = UART_PAR_NONE;
556 * 556 *
557 * @param params Parameter structure to initialize 557 * @param uartParams Parameter structure to initialize
558 */ 558 */
559extern void UART_Params_init(UART_Params *params); 559extern void UART_Params_init(UART_Params *uartParams);
560 560
561 561
562/*! 562/*!
@@ -570,7 +570,7 @@ extern void UART_Params_init(UART_Params *params);
570 * In UART_MODE_CALLBACK, UART_write does not block task execution an calls a 570 * In UART_MODE_CALLBACK, UART_write does not block task execution an calls a
571 * callback function specified by writeCallback. 571 * callback function specified by writeCallback.
572 * 572 *
573 * @param handle A UART_Handle 573 * @param uartHnd A UART_Handle
574 * 574 *
575 * @param buffer A pointer to buffer containing data to be written 575 * @param buffer A pointer to buffer containing data to be written
576 * 576 *
@@ -580,7 +580,7 @@ extern void UART_Params_init(UART_Params *params);
580 * @return Returns the number of bytes that have been written to the UART, 580 * @return Returns the number of bytes that have been written to the UART,
581 * UART_ERROR on an error. 581 * UART_ERROR on an error.
582 */ 582 */
583extern int32_t UART_write(UART_Handle handle, const void *buffer, size_t size); 583extern int32_t UART_write(UART_Handle uartHnd, const void *buffer, size_t size);
584 584
585/*! 585/*!
586 * @brief Function that writes data to a UART 586 * @brief Function that writes data to a UART
@@ -589,7 +589,7 @@ extern int32_t UART_write(UART_Handle handle, const void *buffer, size_t size);
589 * 589 *
590 * UART_write will not return until all the data was written to the UART. 590 * UART_write will not return until all the data was written to the UART.
591 * 591 *
592 * @param handle A UART_Handle 592 * @param uartHnd A UART_Handle
593 * 593 *
594 * @param buffer A pointer to buffer containing data to be written 594 * @param buffer A pointer to buffer containing data to be written
595 * 595 *
@@ -599,7 +599,7 @@ extern int32_t UART_write(UART_Handle handle, const void *buffer, size_t size);
599 * @return Returns the number of bytes that have been written to the UART, 599 * @return Returns the number of bytes that have been written to the UART,
600 * UART_ERROR on an error. 600 * UART_ERROR on an error.
601 */ 601 */
602extern int32_t UART_writePolling(UART_Handle handle, const void *buffer, 602extern int32_t UART_writePolling(UART_Handle uartHnd, const void *buffer,
603 size_t size); 603 size_t size);
604 604
605/*! 605/*!
@@ -677,7 +677,7 @@ extern void UART_readCancel(UART_Handle handle);
677 * 677 *
678 * @param handle A UART_Handle 678 * @param handle A UART_Handle
679 * 679 *
680 * @param transaction A pointer to a UART_Transaction. All of the fields within 680 * @param uartTrans A pointer to a UART_Transaction. All of the fields within
681 * transaction except UART_Transaction.count and 681 * transaction except UART_Transaction.count and
682 * UART_Transaction.status are WO (write-only) unless 682 * UART_Transaction.status are WO (write-only) unless
683 * otherwise noted in the driver implementations. If a 683 * otherwise noted in the driver implementations. If a
@@ -692,7 +692,7 @@ extern void UART_readCancel(UART_Handle handle);
692 * 692 *
693 * @return Returns UART_SUCCESS or UART_ERROR on an error. 693 * @return Returns UART_SUCCESS or UART_ERROR on an error.
694 */ 694 */
695extern int32_t UART_read2(UART_Handle handle, UART_Transaction *transaction); 695extern int32_t UART_read2(UART_Handle handle, UART_Transaction *uartTrans);
696 696
697/*! 697/*!
698 * @brief Extended function that writes data to a UART 698 * @brief Extended function that writes data to a UART
@@ -707,7 +707,7 @@ extern int32_t UART_read2(UART_Handle handle, UART_Transaction *transaction);
707 * 707 *
708 * @param handle A UART_Handle 708 * @param handle A UART_Handle
709 * 709 *
710 * @param transaction A pointer to a UART_Transaction. All of the fields within 710 * @param uartTrans A pointer to a UART_Transaction. All of the fields within
711 * transaction except UART_Transaction.count and 711 * transaction except UART_Transaction.count and
712 * UART_Transaction.status are WO (write-only) unless 712 * UART_Transaction.status are WO (write-only) unless
713 * otherwise noted in the driver implementations. If a 713 * otherwise noted in the driver implementations. If a
@@ -722,7 +722,7 @@ extern int32_t UART_read2(UART_Handle handle, UART_Transaction *transaction);
722 * 722 *
723 * @return Returns UART_SUCCESS or UART_ERROR on an error. 723 * @return Returns UART_SUCCESS or UART_ERROR on an error.
724 */ 724 */
725extern int32_t UART_write2(UART_Handle handle, UART_Transaction *transaction); 725extern int32_t UART_write2(UART_Handle handle, UART_Transaction *uartTrans);
726 726
727/*! 727/*!
728 * @brief Function to initialize the UART_Transaction struct to its defaults 728 * @brief Function to initialize the UART_Transaction struct to its defaults
@@ -733,9 +733,9 @@ extern int32_t UART_write2(UART_Handle handle, UART_Transaction *transaction);
733 * count = 0; 733 * count = 0;
734 * status = UART_TRANSFER_STATUS_SUCCESS; 734 * status = UART_TRANSFER_STATUS_SUCCESS;
735 * 735 *
736 * @transaction transaction parameter structure to initialize 736 * @uartTrans transaction parameter structure to initialize
737 */ 737 */
738extern void UART_transactionInit(UART_Transaction *transaction); 738extern void UART_transactionInit(UART_Transaction *uartTrans);
739 739
740#ifdef __cplusplus 740#ifdef __cplusplus
741} 741}
diff --git a/UART_stdio.h b/UART_stdio.h
index e5c709d..d74d3cf 100644
--- a/UART_stdio.h
+++ b/UART_stdio.h
@@ -203,7 +203,7 @@ uint8_t UART_getc(void);
203 203
204/** 204/**
205 * \brief This function initializes the specified UART instance for use for 205 * \brief This function initializes the specified UART instance for use for
206 * console operations , with a configuration specified by 'params' 206 * console operations , with a configuration specified by 'uartParams'
207 * 207 *
208 * \param uart instance ID. 208 * \param uart instance ID.
209 * 209 *
@@ -212,7 +212,7 @@ uint8_t UART_getc(void);
212 * \return None. 212 * \return None.
213 * 213 *
214 */ 214 */
215void UART_stdioInit2(uint32_t instance,UART_Params *params); 215void UART_stdioInit2(uint32_t instance,UART_Params *uartParams);
216 216
217/** 217/**
218 * \brief This function initializes the specified UART instance for use for 218 * \brief This function initializes the specified UART instance for use for
diff --git a/src/UART_drv.c b/src/UART_drv.c
index 8d5191f..669f87b 100644
--- a/src/UART_drv.c
+++ b/src/UART_drv.c
@@ -113,7 +113,7 @@ void UART_init(void)
113 if (UART_count == (-((int32_t)1))) { 113 if (UART_count == (-((int32_t)1))) {
114 /* Call each driver's init function */ 114 /* Call each driver's init function */
115 for (UART_count = 0; UART_config[UART_count].fxnTablePtr != NULL; UART_count++) { 115 for (UART_count = 0; UART_config[UART_count].fxnTablePtr != NULL; UART_count++) {
116 UART_config[UART_count].fxnTablePtr->initFxn((UART_Handle)&(UART_config[UART_count])); 116 UART_config[UART_count].fxnTablePtr->uartInitFxn((UART_Handle)&(UART_config[UART_count]));
117 } 117 }
118 } 118 }
119 119
diff --git a/src/v0/UART_v0.c b/src/v0/UART_v0.c
index acd9bde..a516cbb 100644
--- a/src/v0/UART_v0.c
+++ b/src/v0/UART_v0.c
@@ -887,13 +887,9 @@ static int32_t UART_write2_v0(UART_Handle handle, UART_Transaction * transaction
887 SemaphoreP_Status semStatus; 887 SemaphoreP_Status semStatus;
888 888
889 /* Input parameter validation */ 889 /* Input parameter validation */
890 OSAL_Assert(!((handle != NULL) && (transaction != NULL))); 890 if ((handle != NULL) &&
891 891 (transaction != NULL) &&
892 if (transaction->count == 0) 892 (transaction->count != 0U))
893 {
894 ret_val = UART_ERROR;
895 }
896 else
897 { 893 {
898 /* Get the pointer to the hwAttrs */ 894 /* Get the pointer to the hwAttrs */
899 hwAttrs = (UART_HwAttrs const *)handle->hwAttrs; 895 hwAttrs = (UART_HwAttrs const *)handle->hwAttrs;
@@ -1083,6 +1079,10 @@ static int32_t UART_write2_v0(UART_Handle handle, UART_Transaction * transaction
1083 transaction->status = UART_TRANSFER_STATUS_SUCCESS; 1079 transaction->status = UART_TRANSFER_STATUS_SUCCESS;
1084 } 1080 }
1085 } 1081 }
1082 else
1083 {
1084 ret_val = UART_ERROR;
1085 }
1086 1086
1087 return(ret_val); 1087 return(ret_val);
1088} 1088}
@@ -1411,13 +1411,9 @@ static int32_t UART_read2_v0(UART_Handle handle, UART_Transaction *transaction)
1411 SemaphoreP_Status semStatus; 1411 SemaphoreP_Status semStatus;
1412 1412
1413 /* Input parameter validation */ 1413 /* Input parameter validation */
1414 OSAL_Assert(!((handle != NULL) && (transaction != NULL))); 1414 if ((handle != NULL) &&
1415 1415 (transaction != NULL) &&
1416 if (transaction->count == 0) 1416 (transaction->count != 0U))
1417 {
1418 ret_val = UART_ERROR;
1419 }
1420 else
1421 { 1417 {
1422 /* Get the pointer to the hwAttrs */ 1418 /* Get the pointer to the hwAttrs */
1423 hwAttrs = (UART_HwAttrs const *)handle->hwAttrs; 1419 hwAttrs = (UART_HwAttrs const *)handle->hwAttrs;
@@ -1601,6 +1597,11 @@ static int32_t UART_read2_v0(UART_Handle handle, UART_Transaction *transaction)
1601 transaction->status = UART_TRANSFER_STATUS_SUCCESS; 1597 transaction->status = UART_TRANSFER_STATUS_SUCCESS;
1602 } 1598 }
1603 } 1599 }
1600 else
1601 {
1602 ret_val = UART_ERROR;
1603 }
1604
1604 return(ret_val); 1605 return(ret_val);
1605} 1606}
1606 1607
diff --git a/src/v1/UART_v1.h b/src/v1/UART_v1.h
index 6b04c48..356c796 100644
--- a/src/v1/UART_v1.h
+++ b/src/v1/UART_v1.h
@@ -225,7 +225,7 @@ typedef struct UART_HWAttrs {
225 225
226} UART_HwAttrs; 226} UART_HwAttrs;
227 227
228extern void UART_v1_callback(UART_Handle handle, bool readTrans); 228extern void UART_v1_callback(UART_Handle uartHnd, bool readTrans);
229 229
230#ifdef UART_DMA_ENABLE 230#ifdef UART_DMA_ENABLE
231extern void UART_receiveDMA(UART_Handle handle, const void *buffer, size_t size); 231extern void UART_receiveDMA(UART_Handle handle, const void *buffer, size_t size);