Converted C++ comments to C comments
This commit is contained in:
@@ -36,7 +36,7 @@
|
|||||||
#include "npdu.h"
|
#include "npdu.h"
|
||||||
#include "eeprom.h"
|
#include "eeprom.h"
|
||||||
|
|
||||||
// Number of MS/TP Packets Rx/Tx
|
/* Number of MS/TP Packets Rx/Tx
|
||||||
*/
|
*/
|
||||||
uint16_t MSTP_Packets = 0;
|
uint16_t MSTP_Packets = 0;
|
||||||
|
|
||||||
@@ -50,7 +50,7 @@ volatile struct mstp_port_struct_t MSTP_Port;
|
|||||||
#pragma udata
|
#pragma udata
|
||||||
|
|
||||||
#define INCREMENT_AND_LIMIT_UINT16(x) {if (x < 0xFFFF) x++;}
|
#define INCREMENT_AND_LIMIT_UINT16(x) {if (x < 0xFFFF) x++;}
|
||||||
// This defines the number of edit fields for this module
|
|
||||||
/* This defines the number of edit fields for this module
|
/* This defines the number of edit fields for this module
|
||||||
*/
|
*/
|
||||||
#define MAX_EDIT_FIELD 1
|
#define MAX_EDIT_FIELD 1
|
||||||
@@ -204,7 +204,7 @@ void dlmstp_task(void)
|
|||||||
} while (bytes_remaining);
|
} while (bytes_remaining);
|
||||||
}
|
}
|
||||||
/* only do master state machine while rx is idle */
|
/* only do master state machine while rx is idle */
|
||||||
//MSTP_Master_Node_FSM(&MSTP_Port);
|
if (MSTP_Port.receive_state == MSTP_RECEIVE_STATE_IDLE) {
|
||||||
while (MSTP_Master_Node_FSM(&MSTP_Port)) {};
|
while (MSTP_Master_Node_FSM(&MSTP_Port)) {};
|
||||||
/*MSTP_Master_Node_FSM(&MSTP_Port);
|
/*MSTP_Master_Node_FSM(&MSTP_Port);
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -766,7 +766,7 @@ bool MSTP_Master_Node_FSM(volatile struct mstp_port_struct_t *mstp_port)
|
|||||||
mstp_port->DataLength);
|
mstp_port->DataLength);
|
||||||
break;
|
break;
|
||||||
case FRAME_TYPE_BACNET_DATA_EXPECTING_REPLY:
|
case FRAME_TYPE_BACNET_DATA_EXPECTING_REPLY:
|
||||||
//mstp_port->ReplyPostponedTimer = 0;
|
/*mstp_port->ReplyPostponedTimer = 0; */
|
||||||
/* indicate successful reception to the higher layers */
|
/* indicate successful reception to the higher layers */
|
||||||
dlmstp_put_receive(mstp_port->SourceAddress,
|
dlmstp_put_receive(mstp_port->SourceAddress,
|
||||||
(uint8_t *) & mstp_port->InputBuffer[0],
|
(uint8_t *) & mstp_port->InputBuffer[0],
|
||||||
@@ -1213,12 +1213,12 @@ void MSTP_Init(volatile struct mstp_port_struct_t *mstp_port)
|
|||||||
mstp_port->ReceivedValidFrame = false;
|
mstp_port->ReceivedValidFrame = false;
|
||||||
mstp_port->RetryCount = 0;
|
mstp_port->RetryCount = 0;
|
||||||
mstp_port->SilenceTimer = 0;
|
mstp_port->SilenceTimer = 0;
|
||||||
// mstp_port->ReplyPostponedTimer = 0;
|
/* mstp_port->ReplyPostponedTimer = 0; */
|
||||||
mstp_port->SoleMaster = false;
|
mstp_port->SoleMaster = false;
|
||||||
mstp_port->SourceAddress = 0;
|
mstp_port->SourceAddress = 0;
|
||||||
mstp_port->TokenCount = 0;
|
mstp_port->TokenCount = 0;
|
||||||
#if 0
|
#if 0
|
||||||
// these are adjustable, so should already be set
|
/* these are adjustable, so should already be set */
|
||||||
mstp_port->Nmax_info_frames = DEFAULT_MAX_INFO_FRAMES;
|
mstp_port->Nmax_info_frames = DEFAULT_MAX_INFO_FRAMES;
|
||||||
mstp_port->Nmax_master = DEFAULT_MAX_MASTER;
|
mstp_port->Nmax_master = DEFAULT_MAX_MASTER;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ struct mstp_port_struct_t {
|
|||||||
/* Machine when a Data Expecting Reply Answer activity is completed. */
|
/* Machine when a Data Expecting Reply Answer activity is completed. */
|
||||||
/* note: we always send a reply postponed since a message other than
|
/* note: we always send a reply postponed since a message other than
|
||||||
the reply may be in the transmit queue */
|
the reply may be in the transmit queue */
|
||||||
// uint16_t ReplyPostponedTimer;
|
/* uint16_t ReplyPostponedTimer; */
|
||||||
|
|
||||||
/* Used to store the Source Address of a received frame. */
|
/* Used to store the Source Address of a received frame. */
|
||||||
uint8_t SourceAddress;
|
uint8_t SourceAddress;
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ uint32_t RS485_Baud_Rate = 9600;
|
|||||||
/* the ISR and other use this for status and control */
|
/* the ISR and other use this for status and control */
|
||||||
COMSTAT RS485_Comstat;
|
COMSTAT RS485_Comstat;
|
||||||
|
|
||||||
//#pragma udata MSTPPortData
|
/*#pragma udata MSTPPortData */
|
||||||
/* the buffer for receiving characters */
|
/* the buffer for receiving characters */
|
||||||
volatile uint8_t RS485_Rx_Buffer[MAX_MPDU];
|
volatile uint8_t RS485_Rx_Buffer[MAX_MPDU];
|
||||||
|
|
||||||
@@ -87,11 +87,11 @@ void RS485_Send_Frame(volatile struct mstp_port_struct_t *mstp_port, /* port
|
|||||||
RS485_Comstat.TxHead = 0;
|
RS485_Comstat.TxHead = 0;
|
||||||
memcpy((void *)&RS485_Tx_Buffer[0], (void *)buffer, nbytes);
|
memcpy((void *)&RS485_Tx_Buffer[0], (void *)buffer, nbytes);
|
||||||
|
|
||||||
//for (i = 0; i < nbytes; i++) {
|
/*for (i = 0; i < nbytes; i++) { */
|
||||||
// /* put the data into the buffer */
|
/* /* put the data into the buffer */ */
|
||||||
// RS485_Tx_Buffer[i] = *buffer;
|
/* RS485_Tx_Buffer[i] = *buffer; */
|
||||||
// buffer++;
|
/* buffer++; */
|
||||||
//}
|
/*} */
|
||||||
RS485_Comstat.Tx_Bytes = nbytes;
|
RS485_Comstat.Tx_Bytes = nbytes;
|
||||||
/* disable the receiver */
|
/* disable the receiver */
|
||||||
PIE3bits.RC2IE = 0;
|
PIE3bits.RC2IE = 0;
|
||||||
@@ -205,7 +205,7 @@ void RS485_Interrupt_Tx(void)
|
|||||||
/* enable the receiver */
|
/* enable the receiver */
|
||||||
RS485_TX_ENABLE = 0;
|
RS485_TX_ENABLE = 0;
|
||||||
RS485_RX_DISABLE = 0;
|
RS485_RX_DISABLE = 0;
|
||||||
// FIXME: might not be necessary
|
/* FIXME: might not be necessary */
|
||||||
PIE3bits.RC2IE = 1;
|
PIE3bits.RC2IE = 1;
|
||||||
RCSTA2bits.CREN = 1;
|
RCSTA2bits.CREN = 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ void RTOS_Initialize(void)
|
|||||||
(void) kbhit();
|
(void) kbhit();
|
||||||
RTKernelInit(5); /* get the kernel going */
|
RTKernelInit(5); /* get the kernel going */
|
||||||
RTKeybrdInit();
|
RTKeybrdInit();
|
||||||
//(void)CPUMoniInit(); /* not needed - just monitor idle task */
|
/*(void)CPUMoniInit(); /* not needed - just monitor idle task */ */
|
||||||
RTComInit();
|
RTComInit();
|
||||||
ITimerInit();
|
ITimerInit();
|
||||||
|
|
||||||
@@ -100,23 +100,23 @@ void RTOS_Initialize(void)
|
|||||||
/* Win32 structured exception - if no handler is
|
/* Win32 structured exception - if no handler is
|
||||||
installed, TerminateProcess() will be called,
|
installed, TerminateProcess() will be called,
|
||||||
which will reboot - a good thing in our case. */
|
which will reboot - a good thing in our case. */
|
||||||
RTRaiseCPUException(0); // Divide Error DIV and IDIV instructions.
|
RTRaiseCPUException(0); /* Divide Error DIV and IDIV instructions. */
|
||||||
RTRaiseCPUException(1); // Debug Any code or data reference.
|
RTRaiseCPUException(1); /* Debug Any code or data reference. */
|
||||||
RTRaiseCPUException(2); // NMI
|
RTRaiseCPUException(2); /* NMI */
|
||||||
RTRaiseCPUException(3); // Breakpoint INT 3 instruction.
|
RTRaiseCPUException(3); /* Breakpoint INT 3 instruction. */
|
||||||
RTRaiseCPUException(4); // Overflow INTO instruction.
|
RTRaiseCPUException(4); /* Overflow INTO instruction. */
|
||||||
RTRaiseCPUException(5); // BOUND Range Exceeded BOUND instruction.
|
RTRaiseCPUException(5); /* BOUND Range Exceeded BOUND instruction. */
|
||||||
RTRaiseCPUException(6); // Invalid Opcode (Undefined Opcode)
|
RTRaiseCPUException(6); /* Invalid Opcode (Undefined Opcode) */
|
||||||
// RTRaiseCPUException(7); // Device Not Available (No Math Coprocessor)
|
/* RTRaiseCPUException(7); // Device Not Available (No Math Coprocessor) */
|
||||||
RTRaiseCPUException(8); // Double Fault any exception instruction,NMI,INTR.
|
RTRaiseCPUException(8); /* Double Fault any exception instruction,NMI,INTR. */
|
||||||
RTRaiseCPUException(9); // Co-Processor overrun
|
RTRaiseCPUException(9); /* Co-Processor overrun */
|
||||||
RTRaiseCPUException(10); // Invalid TSS Task switch or TSS access.
|
RTRaiseCPUException(10); /* Invalid TSS Task switch or TSS access. */
|
||||||
RTRaiseCPUException(11); // Segment Not Present Loading segment registers
|
RTRaiseCPUException(11); /* Segment Not Present Loading segment registers */
|
||||||
RTRaiseCPUException(12); // Stack Seg Fault Stack ops /SS reg loads.
|
RTRaiseCPUException(12); /* Stack Seg Fault Stack ops /SS reg loads. */
|
||||||
RTRaiseCPUException(13); // General Protection Any memory reference
|
RTRaiseCPUException(13); /* General Protection Any memory reference */
|
||||||
RTRaiseCPUException(14); // Page Fault Any memory reference.
|
RTRaiseCPUException(14); /* Page Fault Any memory reference. */
|
||||||
RTRaiseCPUException(15); // reserved
|
RTRaiseCPUException(15); /* reserved */
|
||||||
RTRaiseCPUException(16); // Floating-Point Error (Math Fault)
|
RTRaiseCPUException(16); /* Floating-Point Error (Math Fault) */
|
||||||
}
|
}
|
||||||
/* setup 1ms timer tick */
|
/* setup 1ms timer tick */
|
||||||
SetTimerIntVal(1000);
|
SetTimerIntVal(1000);
|
||||||
|
|||||||
@@ -62,8 +62,8 @@ void RS485_Print_Frame(int port,
|
|||||||
uint8_t * buffer, /* frame to send (up to 501 bytes of data) */
|
uint8_t * buffer, /* frame to send (up to 501 bytes of data) */
|
||||||
uint16_t nbytes)
|
uint16_t nbytes)
|
||||||
{
|
{
|
||||||
uint16_t i; // byte counter
|
uint16_t i; /* byte counter */
|
||||||
unsigned long duration; // measures the time from last output to this one
|
unsigned long duration; /* measures the time from last output to this one */
|
||||||
unsigned long seconds;
|
unsigned long seconds;
|
||||||
unsigned long milliseconds;
|
unsigned long milliseconds;
|
||||||
|
|
||||||
@@ -112,9 +112,9 @@ static int TestCOMPort(int Base)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < 256; i++) {
|
for (i = 0; i < 256; i++) {
|
||||||
RTOut(Base + 7, (BYTE) i); // write scratch register
|
RTOut(Base + 7, (BYTE) i); /* write scratch register */
|
||||||
RTOut(Base + 1, RTIn(Base + 1)); // read/write IER
|
RTOut(Base + 1, RTIn(Base + 1)); /* read/write IER */
|
||||||
if (RTIn(Base + 7) != i) // check scratch register
|
if (RTIn(Base + 7) != i) /* check scratch register */
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|||||||
@@ -430,7 +430,7 @@ void ethernet_debug_address(const char *info, BACNET_ADDRESS * dest)
|
|||||||
if (info) {
|
if (info) {
|
||||||
sprintf(msgBuf, "%s", info);
|
sprintf(msgBuf, "%s", info);
|
||||||
LogError(msgBuf);
|
LogError(msgBuf);
|
||||||
} // if
|
} /* if */
|
||||||
|
|
||||||
if (dest) {
|
if (dest) {
|
||||||
sprintf(msgBuf,
|
sprintf(msgBuf,
|
||||||
@@ -439,7 +439,7 @@ void ethernet_debug_address(const char *info, BACNET_ADDRESS * dest)
|
|||||||
for (i = 0; i < MAX_MAC_LEN; i++) {
|
for (i = 0; i < MAX_MAC_LEN; i++) {
|
||||||
sprintf(msgBuf, "%02X ", (unsigned) dest->mac[i]);
|
sprintf(msgBuf, "%02X ", (unsigned) dest->mac[i]);
|
||||||
LogInfo(msgBuf);
|
LogInfo(msgBuf);
|
||||||
} // for
|
} /* for */
|
||||||
LogInfo("\n");
|
LogInfo("\n");
|
||||||
sprintf(msgBuf,
|
sprintf(msgBuf,
|
||||||
" Net=%hu\n Len=%d\n Adr=", dest->net, dest->len);
|
" Net=%hu\n Len=%d\n Adr=", dest->net, dest->len);
|
||||||
@@ -447,9 +447,9 @@ void ethernet_debug_address(const char *info, BACNET_ADDRESS * dest)
|
|||||||
for (i = 0; i < MAX_MAC_LEN; i++) {
|
for (i = 0; i < MAX_MAC_LEN; i++) {
|
||||||
sprintf(msgBuf, "%02X ", (unsigned) dest->adr[i]);
|
sprintf(msgBuf, "%02X ", (unsigned) dest->adr[i]);
|
||||||
LogInfo(msgBuf);
|
LogInfo(msgBuf);
|
||||||
} // for
|
} /* for */
|
||||||
LogInfo("\n");
|
LogInfo("\n");
|
||||||
} // if ( dest )
|
} /* if ( dest ) */
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user