//############################################################################################################################################################################################################# #ifndef _INC_IDIBUS_IMPL_H_ #define _INC_IDIBUS_IMPL_H_ //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- #include #include "Common/IDIBUS_DEFS.h" #include #include #include "SYSTEM.h" #include "MODBUS_CRC.h" #include "USART_COM.h" #include "EEPROM_Fast.h" //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- enum IDIBUS_MODULE_LONGOP_TYPES { IDIBUS_LONGOP_NOPE = 0, IDIBUS_LONGOP_VARSN_IP_WRITE, IDIBUS_LONGOP_VARSN_VERIF_EXP_WRITE, IDIBUS_LONGOP_VARSN_AES_WRITE, IDIBUS_LONGOP_FMW_WRITE, IDIBUS_LONGOP_INIT }; #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 //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- typedef struct { uint8_t ComFunc; uint8_t *InpData; uint16_t InpDataLength; uint8_t *OutData; uint16_t OutDataPos; uint16_t OutDataLength; uint16_t ErrorPos; uint8_t ErrorState; uint8_t OutLongMesState; uint8_t LongOpState; } IDIBUS_FARG_TYPE; //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- typedef struct IDIBUS_CHANNEL_STR { uint8_t BcastAddr; uint8_t ChNum; struct { uint8_t Type; uint8_t State; uint32_t StartTimeInstanceMS; uint32_t DurationMS; } LONG_OP; void (*CH_Func)(struct IDIBUS_CHANNEL_STR*, IDIBUS_FARG_TYPE*); } IDIBUS_CHANNEL; //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- typedef struct { IDIBUS_CHANNEL *Channels; uint8_t ChannelsCount; } IDIBUS_DEVICE; //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- typedef struct { USART_INTERFACE_TYPE *USI; IDIBUS_DEVICE *Devices; uint8_t DevicesCount; IDISTATUS_SLAVE_TYPE STATUS; uint8_t FreezeMemState; uint8_t Error; uint8_t c_InitAssignGroup; struct { uint8_t Type; uint8_t Switch; uint8_t State; uint32_t StartTimeInstanceMS; uint32_t DurationMS; } LONG_OP; } IDIBUS_SLAVE_MODULE; //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- #define IDIBUS_SYSTEM_SW_VERSION 0x3133U //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- IDIBUS_SLAVE_MODULE IDIBUS_MODULE; //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- #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, uint8_t *PROGMEM_SN); #endif void IDIBUS_ModuleCommandHandler(IDIBUS_FARG_TYPE *farg); uint8_t IDIBUS_CnannelStaticFunc(struct IDIBUS_CHANNEL_STR* CH, IDIBUS_FARG_TYPE *farg); //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- void IDIBUS_ResponseProtectedWrite(IDIBUS_FARG_TYPE *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_CustomInit(void); //void IDIBUS_CustomShutdown(void); //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- #endif // #ifndef _INC_IDIBUS_IMPL_H_ //#############################################################################################################################################################################################################