lpcmanager

Smarteh 485: uart data is copied to beremiz buffer even if reception was not successfull. This ensures that communication statuses are updated. Otherwise these statuses are not updated in case controller can't communicate with any slave. This bug was introduced in revision 614.
/* Code generated by LPCBus confnode */
#ifdef _WINDOWS_H
#include "iec_types.h"
#else
#include "iec_std_lib.h"
#endif
static inline int16_t getWord(char *buffer)
{
return ((int16_t)*buffer<<8) + (int16_t)*(buffer+1);
}
static inline int16_t getWordSwapped(char *buffer)
{
return (((int16_t)*(buffer+1))<<8) + (int16_t)*buffer;
}
static inline void setWord(char *buffer, int16_t word)
{
*buffer = (char)(word>>8);
*(buffer+1) = (char)(word);
}
static inline void setWordSwapped(char *buffer, int16_t word)
{
*buffer = (char)word;
*(buffer+1) = (char)(word>>8);
}
static inline int8_t getBit(char *buffer, unsigned char bitOffset)
{
return (*buffer & (0x01 << bitOffset)) && 1;
}
static inline void setBit(char *buffer, unsigned char bitOffset, int8_t bit)
{
unsigned char msk = (0x01 << bitOffset);
if(bit)
*buffer |= msk;
else
*buffer &= ~msk;
}
static void setWord16(short *buffer, uint16_t word)
{
*buffer = (short)word;
}
static int16_t getWord16(short *buffer)
{
return((uint16_t)*buffer);
}
static inline unsigned char getByte(char *buffer)
{
return((unsigned char)*buffer);
}
static inline void setByte(char *buffer, unsigned char byte)
{
*buffer = byte;
}
typedef struct
{
unsigned char status; /* Current status of timer - running / expired */
uint64_t actValue; /* Actual timer value */
uint64_t toValue; /* Timeout value - initialized at startup */
uint64_t oldTime; /* Time at previous timer increment; NOTE: if RTIME (unsigned long long) changes type, oldTime has to be adapted */
} commTimer;
#define TIM_DISABLED 0
#define TIM_EN_RUNNING 1
#define TIM_EN_EXPIRED 2
%(bus_decl)s
%(declare_code)s
/* LPCBus confnode user variables definition */
%(var_decl)s
/* LPCBus confnode functions */
int __init_%(location_str)s(int argc,char **argv)
{
%(bus_init_code)s
return 0;
}
void __cleanup_%(location_str)s(void)
{
%(bus_cleanup_code)s
}
void __retrieve_%(location_str)s(void)
{
%(bus_retrieve_code)s
}
void __publish_%(location_str)s(void)
{
%(bus_publish_code)s
}