modbus_master: fix cmake build warning
Signed-off-by: Jorge Guzman <jorge.gzm@gmail.com>
This commit is contained in:
parent
faa8f6666f
commit
90ea9821df
@ -102,7 +102,6 @@ bool xMBMasterPortEventGet(eMBMasterEventType *eEvent)
|
|||||||
|
|
||||||
if (eQueuedEvent & ~(WAITER_EVENTS))
|
if (eQueuedEvent & ~(WAITER_EVENTS))
|
||||||
{
|
{
|
||||||
|
|
||||||
/* Fetch events by priority */
|
/* Fetch events by priority */
|
||||||
|
|
||||||
if (eQueuedEvent & EV_MASTER_READY)
|
if (eQueuedEvent & EV_MASTER_READY)
|
||||||
@ -136,9 +135,9 @@ bool xMBMasterPortEventGet(eMBMasterEventType *eEvent)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Poll the serial device. The serial device timeouts if no characters
|
/* Poll the serial device. The serial device timeouts if no characters
|
||||||
* have been received within for t3.5 during an active transmission or if
|
* have been received within for t3.5 during an active transmission or
|
||||||
* nothing happens within a specified amount of time. Both timeouts are
|
* if nothing happens within a specified amount of time. Both timeouts
|
||||||
* configured from the timer init functions.
|
* are configured from the timer init functions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
xMBMasterPortSerialPoll();
|
xMBMasterPortSerialPoll();
|
||||||
@ -188,6 +187,7 @@ bool xMBMasterRunResTake(int32_t lTimeOut)
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -198,6 +198,7 @@ bool xMBMasterRunResTake(int32_t lTimeOut)
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -274,7 +275,8 @@ void vMBMasterCBRequestSuccess(void)
|
|||||||
xMBMasterPortEventPost(EV_MASTER_PROCESS_SUCCESS);
|
xMBMasterPortEventPost(EV_MASTER_PROCESS_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This function will wait for Modbus Master request finish and return result.
|
/* This function will wait for Modbus Master request finish
|
||||||
|
* and return result.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
eMBMasterReqErrCode eMBMasterWaitRequestFinish(void)
|
eMBMasterReqErrCode eMBMasterWaitRequestFinish(void)
|
||||||
@ -303,6 +305,7 @@ eMBMasterReqErrCode eMBMasterWaitRequestFinish(void)
|
|||||||
{
|
{
|
||||||
eErrStatus = MB_MRE_EXE_FUN;
|
eErrStatus = MB_MRE_EXE_FUN;
|
||||||
}
|
}
|
||||||
|
|
||||||
eQueuedEvent &= ~WAITER_EVENTS;
|
eQueuedEvent &= ~WAITER_EVENTS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,17 +74,21 @@ void vMBPortLogFile(FILE * fNewLogFile)
|
|||||||
fLogFile = fNewLogFile;
|
fLogFile = fNewLogFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
void vMBPortLog(eMBPortLogLevel eLevel, const char * szModule, const char * szFmt, ...)
|
void vMBPortLog(eMBPortLogLevel eLevel, const char * szModule,
|
||||||
|
const char * szFmt, ...)
|
||||||
{
|
{
|
||||||
char szBuf[512];
|
char szBuf[512];
|
||||||
int i;
|
int i;
|
||||||
va_list args;
|
va_list args;
|
||||||
FILE *fOutput = fLogFile == NULL ? stderr : fLogFile;
|
FILE *fOutput = fLogFile == NULL ? stderr : fLogFile;
|
||||||
|
|
||||||
static const char *arszLevel2Str[] = { "ERROR", "WARN", "INFO", "DEBUG" };
|
static const char *arszLevel2Str[] =
|
||||||
|
{
|
||||||
i = snprintf(szBuf, NELEMS(szBuf), "%s: %s: ", arszLevel2Str[eLevel], szModule);
|
"ERROR", "WARN", "INFO", "DEBUG"
|
||||||
|
};
|
||||||
|
|
||||||
|
i = snprintf(szBuf, NELEMS(szBuf), "%s: %s: ",
|
||||||
|
arszLevel2Str[eLevel], szModule);
|
||||||
if (i != 0)
|
if (i != 0)
|
||||||
{
|
{
|
||||||
va_start(args, szFmt);
|
va_start(args, szFmt);
|
||||||
@ -106,7 +110,8 @@ void vMBPortEnterCritical(void)
|
|||||||
int ret = pthread_mutex_lock(&xLock);
|
int ret = pthread_mutex_lock(&xLock);
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
{
|
{
|
||||||
vMBPortLog(MB_LOG_ERROR, "OTHER", "Locking primitive failed: %d\n", ret);
|
vMBPortLog(MB_LOG_ERROR, "OTHER",
|
||||||
|
"Locking primitive failed: %d\n", ret);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -115,6 +120,7 @@ void vMBPortExitCritical(void)
|
|||||||
int ret = pthread_mutex_unlock(&xLock);
|
int ret = pthread_mutex_unlock(&xLock);
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
{
|
{
|
||||||
vMBPortLog(MB_LOG_ERROR, "OTHER", "Locking primitive failed: %d\n", ret);
|
vMBPortLog(MB_LOG_ERROR,
|
||||||
|
"OTHER", "Locking primitive failed: %d\n", ret);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,10 @@ void vMBMasterPortLog(eMBPortLogLevel eLevel, const char * szModule,
|
|||||||
va_list args;
|
va_list args;
|
||||||
FILE *fOutput = fLogFile == NULL ? stderr : fLogFile;
|
FILE *fOutput = fLogFile == NULL ? stderr : fLogFile;
|
||||||
|
|
||||||
static const char *arszLevel2Str[] = { "ERROR", "WARN", "INFO", "DEBUG" };
|
static const char *arszLevel2Str[] =
|
||||||
|
{
|
||||||
|
"ERROR", "WARN", "INFO", "DEBUG"
|
||||||
|
};
|
||||||
|
|
||||||
i = snprintf(szBuf, NELEMS(szBuf),
|
i = snprintf(szBuf, NELEMS(szBuf),
|
||||||
"%s: %s: ", arszLevel2Str[eLevel], szModule);
|
"%s: %s: ", arszLevel2Str[eLevel], szModule);
|
||||||
|
@ -114,7 +114,7 @@ bool xMBMasterPortTimersInit(uint16_t usTimeOut50us)
|
|||||||
return xMBMasterPortSerialSetTimeout(ulTimeOut);
|
return xMBMasterPortSerialSetTimeout(ulTimeOut);
|
||||||
}
|
}
|
||||||
|
|
||||||
void xMBMasterPortTimersClose()
|
void xMBMasterPortTimersClose(void)
|
||||||
{
|
{
|
||||||
/* Does not use any hardware resources. */
|
/* Does not use any hardware resources. */
|
||||||
}
|
}
|
||||||
@ -168,7 +168,7 @@ void vMBMasterPortTimerPoll( void )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void vMBMasterPortTimersDisable()
|
void vMBMasterPortTimersDisable(void)
|
||||||
{
|
{
|
||||||
bTimeoutEnable = false;
|
bTimeoutEnable = false;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user