From 31d78501c00890c4c81f74be2a2f9435359851ad Mon Sep 17 00:00:00 2001 From: skarg Date: Sat, 18 Aug 2007 00:04:33 +0000 Subject: [PATCH] Modified while testing the AT91SAM7S port. Needed to include MS/TP Silence Timer in ISR, and didn't want to call a function. --- bacnet-stack/dlmstp.h | 4 +++- bacnet-stack/mstp.c | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/bacnet-stack/dlmstp.h b/bacnet-stack/dlmstp.h index e2d6c0a1..df327e0a 100644 --- a/bacnet-stack/dlmstp.h +++ b/bacnet-stack/dlmstp.h @@ -59,7 +59,9 @@ extern "C" { bool dlmstp_init(char *ifname); void dlmstp_cleanup(void); - void dlmstp_millisecond_timer(void); + + /* address of the 16-bit timer. Update it in an ISR or Task. */ + volatile uint16_t *dlmstp_millisecond_timer_address(void); /* returns number of bytes sent on success, negative on failure */ int dlmstp_send_pdu(BACNET_ADDRESS * dest, /* destination address */ diff --git a/bacnet-stack/mstp.c b/bacnet-stack/mstp.c index fb14bf01..bb7363a5 100644 --- a/bacnet-stack/mstp.c +++ b/bacnet-stack/mstp.c @@ -745,16 +745,16 @@ bool MSTP_Master_Node_FSM(volatile struct mstp_port_struct_t * mstp_port) mstp_port->master_state = MSTP_MASTER_STATE_DONE_WITH_TOKEN; transition_now = true; } else if (mstp_port->SilenceTimer > Tusage_delay) { - /* if we missed our timing deadline, another token will be sent */ + /* Don't send it if we are too late in getting out. */ + /* Don't worry. If we missed our timing deadline, + another token will be sent */ mstp_port->master_state = MSTP_MASTER_STATE_IDLE; } else { - /* don't send it if we are too late in getting out */ uint8_t frame_type = mstp_port->OutputBuffer[2]; uint8_t destination = mstp_port->OutputBuffer[3]; RS485_Send_Frame(mstp_port, (uint8_t *) & mstp_port->OutputBuffer[0], length); mstp_port->FrameCount++; - /* last trasmitted frame type */ switch (frame_type) { case FRAME_TYPE_BACNET_DATA_EXPECTING_REPLY: /* SendAndWait */