You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
86 lines
4.9 KiB
86 lines
4.9 KiB
//#############################################################################################################################################################################################################
|
|
#ifndef _INC_IDIBUS_IMPL_H_
|
|
#define _INC_IDIBUS_IMPL_H_
|
|
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
#ifndef F_CPU
|
|
#define F_CPU 16000000UL
|
|
#endif
|
|
|
|
#include <avr/io.h>
|
|
#include <util/delay.h>
|
|
#include <inttypes.h>
|
|
#include <avr/interrupt.h>
|
|
|
|
#include "../Required/USART_COM.h"
|
|
#include "../Required/SYSTEM.h"
|
|
|
|
#include "IDIBUS_DEFS.h"
|
|
#include "MODBUS_CRC.h"
|
|
|
|
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
|
#define IDIBUS_LONGOP_VARSN_IP_WRITE_DURATION_MS 200
|
|
#define IDIBUS_LONGOP_VARSN_VERF_EXP_WRITE_DURATION_MS 200
|
|
#define IDIBUS_LONGOP_VARSN_AES_WRITE_DURATION_MS 200
|
|
|
|
// EEPROM_FAST BLOCK
|
|
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
#define EEPROM_BUF_SIZE 32
|
|
extern uint16_t EEPROM_ADDR;
|
|
extern uint8_t EEPROM_BUF[EEPROM_BUF_SIZE];
|
|
extern uint8_t EEPROM_BUF_COUNT;
|
|
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
void EEPROM_WriteEepBuf(uint8_t count, uint16_t addr);
|
|
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
#define IDIBUS_SYSTEM_SW_VERSION 0x3133U
|
|
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
#ifdef _LONG_ADDR_SPACE_
|
|
void IdiBus_ModuleInit(USART_INTERFACE_TYPE *USART_INTERFACE, uint_farptr_t PROGMEM_SN);
|
|
#else
|
|
void IdiBus_ModuleInit(USART_INTERFACE_TYPE *USART_INTERFACE, const volatile uint8_t *PROGMEM_SN);
|
|
#endif
|
|
|
|
void IDIBUS_ModuleCommandHandler(idibus_farg_t *farg);
|
|
uint8_t IDIBUS_CnannelStaticFunc(struct IDIBUS_CHANNEL_STR* CH, idibus_farg_t *farg);
|
|
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
void IDIBUS_ResponseProtectedWrite(idibus_farg_t *farg, uint8_t *Data, uint16_t DataLength, uint8_t ErrorCode);
|
|
void IDIBUS_ModuleBackgroundHandler(void);
|
|
void IDIBUS_ChannelBackgroundHandler(void);
|
|
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
void IDIBUS_ServiceFunc(uint8_t *InpData, uint16_t InpDataLength, uint8_t *OutData, uint16_t *OutDataLength);
|
|
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
void IdiBus_pass_module(idibus_slave_module_t* MODULE);
|
|
|
|
|
|
|
|
|
|
// Typedef for callback function
|
|
typedef void (*idibus_func_t)(void);
|
|
|
|
// Callback registration
|
|
void IdiBus_register_init(idibus_func_t callback);
|
|
void IdiBus_register_shutdown(idibus_func_t callback);
|
|
void IdiBus_register_freeze(idibus_func_t callback);
|
|
void IdiBus_register_resume(idibus_func_t callback);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
#endif // #ifndef _INC_IDIBUS_IMPL_H_
|
|
//#############################################################################################################################################################################################################
|
|
|