dp_inc.h
资源名称:Profibus.rar [点击查看]
上传用户:hualang
上传日期:2022-04-11
资源大小:104k
文件大小:16k
源码类别:
能源行业(电力石油煤炭)
开发平台:
C/C++
- /************************** Filename: dp_inc.h *****************************/
- /* ========================================================================= */
- /* */
- /* 0000 000 000 00000 0 000 0 0 0 0000 */
- /* 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 */
- /* 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Einsteinstra遝 6 */
- /* 0000 000 0 0 000 0 0 00000 0 0000 91074 Herzogenaurach */
- /* 0 00 0 0 0 0 0 0 0 0 0 */
- /* 0 0 0 0 0 0 0 0 0 0 0 0 0 Tel: ++49-9132-744-200 */
- /* 0 0 0 000 0 0 000 0 0 0 0 GmbH Fax: ++49-9132-744-204 */
- /* */
- /* ========================================================================= */
- /* */
- /* Description: Extern modules to be included in all DP files. */
- /* */
- /* ------------------------------------------------------------------------- */
- /* */
- /* Technical support: P. Fredehorst */
- /* Tel. : ++49-9132/744-214 */
- /* Fax. : -204 */
- /* eMail: pfredehorst@profichip.com */
- /* */
- /*****************************************************************************/
- /*****************************************************************************/
- /* contents:
- - header include hierarchy for system environment
- */
- /*****************************************************************************/
- /* reinclude protection */
- #ifndef DP_INC_H
- #define DP_INC_H
- /*****************************************************************************/
- /* header include hierarchy for system environment */
- /*------------------------------------------------------------------------*/
- /* Debug Codes */
- /*------------------------------------------------------------------------*/
- typedef enum
- {
- START__ = ((UBYTE)0x01),
- DP_INTERRUPT__ = ((UBYTE)0x20),
- DP_INTERRUPT_PRM__ = ((UBYTE)0x21),
- DP_INTERRUPT_CFG__ = ((UBYTE)0x22)
- } DEBUG_CODE;
- /*------------------------------------------------------------------------*/
- /* Debug Structure */
- /*------------------------------------------------------------------------*/
- #define MAX_NR_OF_DEBUG 256
- typedef struct
- {
- DEBUG_CODE bDebugCode;
- UBYTE bDetail1;
- UBYTE bDetail2;
- } sDP_DEBUG_BUFFER_ITEM;
- #define psDP_BUFFER_ITEM sDP_DEBUG_BUFFER_ITEM PTR_ATTR *
- /*------------------------------------------------------------------------*/
- /* Debug function, external defines */
- /*------------------------------------------------------------------------*/
- #ifdef DP_DEBUG_ENABLE
- #define DP_WriteDebugBuffer__(dev_num, _bDebugCode, _bDetail1, _bDetail2 )
- DP_WriteDebugBuffer(dev_num, _bDebugCode, _bDetail1, _bDetail2 )
- extern sDP_DEBUG_BUFFER_ITEM asDebugBuffer[MAX_DEV_NUM][ MAX_NR_OF_DEBUG ];
- extern UBYTE bDebugBufferIndex[MAX_DEV_NUM];
- extern UBYTE bDebugBufferOverlapped[MAX_DEV_NUM];
- extern void DP_ClearDebugBuffer(dev_num);
- #else
- #define DP_WriteDebugBuffer__(dev_num, _bDebugCode, _bDetail1, _bDetail2 )
- /* not used (DP_WriteDebugBuffer__ ) */
- #endif//#ifdef DP_DEBUG_ENABLE
- /*------------------------------------------------------------------------*/
- /* dp_user.c */
- /*------------------------------------------------------------------------*/
- extern VPC3_STRUC VPC3_PTR p_Vpc3[MAX_DEV_NUM]; // pointer to Vpc3 structure
- extern VPC3_SYSTEM_STRUC dp_sys[MAX_DEV_NUM]; // global system structure
- /*------------------------------------------------------------------------*/
- /* dp_main.c */
- /*------------------------------------------------------------------------*/
- //extern void delay(dev_num);
- /*------------------------------------------------------------------------*/
- /* dp_user.c */
- /*------------------------------------------------------------------------*/
- extern void print_hexbyte(UBYTE mByte);
- extern void print_hexword(UWORD mWord);
- extern void print_string(UBYTE* s);
- extern void fatal_error (UBYTE dev_num, DP_ERROR_FILE file, UWORD line, VPC3_ERRCB_PTR errcb_ptr );
- extern DPV1_RET_VAL user_dpv1_read_req (UBYTE dev_num, UBYTE sap, DPV1_PTR pdu );
- extern DPV1_RET_VAL user_dpv1_write_req (UBYTE dev_num, UBYTE sap, DPV1_PTR pdu );
- extern DPV1_RET_VAL user_c2_initiate_req (UBYTE dev_num, UBYTE sap, DPV1_PTR pdu );
- extern DPV1_RET_VAL user_c2_data_transport_req (UBYTE dev_num, UBYTE sap, DPV1_PTR pdu );
- extern DPV1_RET_VAL user_c2_abort_ind (UBYTE dev_num, UBYTE sap,DPV1_PTR pdu );
- extern void user_alarm_ack_req (UBYTE dev_num, ALARM_STATUS_PDU_PTR alarm_ptr );
- extern void user_alarm_state_info (UBYTE dev_num, UBYTE alarm_type_bit_field, UBYTE sequence_depth );
- #ifdef DP_FDL
- extern UBYTE user_alarm (UBYTE dev_num, UBYTE alarm_type, UBYTE seq_nr, ALARM_STATUS_PDU_PTR alarm_ptr, UBYTE check_diag_flag );
- #endif //#ifdef DP_FDL
- /*------------------------------------------------------------------------*/
- /* dp_if.c */
- /*------------------------------------------------------------------------*/
- extern void DP_GetVersion (UBYTE dev_num, psDP_VERSION pVersion );
- extern DP_ERROR_CODE vpc3_initialization (UBYTE dev_num, UBYTE slave_address, CFG_STRUCT cfg );
- extern void START_VPC3 (UBYTE dev_num );
- extern void vpc3_dpv1_statemachine (UBYTE dev_num );
- extern UBYTE vpc3_cfg_data_ok (UBYTE dev_num );
- extern UBYTE vpc3_cfg_data_update (UBYTE dev_num );
- extern UBYTE vpc3_cfg_data_not_ok (UBYTE dev_num );
- extern DP_ERROR_CODE vpc3_calculate_inp_outp_len (UBYTE dev_num, UBYTE PTR_ATTR *cfg_ptr, UBYTE cfg_len );
- extern void vpc3_set_io_data_len (UBYTE dev_num );
- extern VPC3_UNSIGNED8_PTR vpc3_get_dinbufptr (UBYTE dev_num);
- extern VPC3_UNSIGNED8_PTR vpc3_get_doutbufptr (UBYTE dev_num, UBYTE PTR_ATTR *state_ptr );
- extern VPC3_UNSIGNED8_PTR vpc3_get_diagbufptr (UBYTE dev_num);
- extern UBYTE vpc3_get_master (UBYTE dev_num);
- extern DP_ERROR_CODE set_diagnosis (UBYTE dev_num, VPC3_UNION_DIAG_PTR user_diag, UBYTE user_diag_len, UBYTE diag_control, UBYTE check_diag_flag );
- extern void reset_diagnostic_buffer (UBYTE dev_num);
- extern VPC3_UNSIGNED8_PTR vpc3_get_free_memory (UBYTE dev_num, UWORD PTR_ATTR *mem_len );
- extern UBYTE set_alarm (UBYTE dev_num, ALARM_STATUS_PDU_PTR user_alarm_ptr, UBYTE callback );
- #ifdef DP_SUBSCRIBER
- extern void dxb_subscriber_table_to_dxb_link_table (UBYTE dev_num, PRM_SUBSCRIBER_TABLE_PTR dxb_ptr, UBYTE NrOfLinks );
- extern UBYTE check_dxb_link_table (UBYTE dev_num);
- extern void build_dxb_link_status (UBYTE dev_num);
- extern VPC3_UNSIGNED8_PTR vpc3_get_dxb_outbufptr (UBYTE dev_num, UBYTE PTR_ATTR *state_ptr );
- #endif//#ifdef DP_SUBSCRIBER
- #ifdef DP_DEBUG_ENABLE
- extern void DP_WriteDebugBuffer (UBYTE dev_num, DEBUG_CODE bDebugCode, UBYTE bDetail1, UBYTE bDetail2 );
- #endif//#ifdef DP_DEBUG_ENABLE
- /*------------------------------------------------------------------------*/
- /* dp_isr.c */
- /*------------------------------------------------------------------------*/
- extern void vpc3_neta_isr();
- extern void vpc3_netb_isr();
- extern void vpc3_isr(int dev_num);
- /*------------------------------------------------------------------------*/
- /* dp_fdl.c */
- /*------------------------------------------------------------------------*/
- #ifdef DP_FDL
- extern DP_ERROR_CODE fdl_init (UBYTE dev_num);
- extern void fdl_set_poll_timeout (UBYTE dev_num, UWORD poll_timeout );
- extern void fdl_mac_indication (UBYTE dev_num);
- extern void fdl_flc_indication (UBYTE dev_num);
- extern void fdl_cyclic_service (UBYTE dev_num );
- extern void fdl_set_sa_ssap (UBYTE dev_num, UBYTE sap_nr, UBYTE req_sa, UBYTE req_ssap );
- extern FDL_SAP_HEADER_PTR fdl_get_sap_header_ptr (UBYTE dev_num, UBYTE sap );
- extern void fdl_ind_provide (UBYTE dev_num, UBYTE sap_nr, IND_RESP_BUF PTR_ATTR * ind_ptr );
- extern void fdl_resp_provide (UBYTE dev_num, UBYTE sap_nr, UBYTE prim_sec );
- extern void fdl_reset_pcntrl_resp_bit (UBYTE dev_num, UBYTE sap_nr, UBYTE prim_sec );
- extern void fdl_ind_disable (UBYTE dev_num, UBYTE sap_nr );
- extern UBYTE fdl_ind_await (UBYTE dev_num, UBYTE sap_nr );
- extern void fdl_perform_ind_disable (UBYTE dev_num, FDL_SAP_HEADER PTR_ATTR *fdl_h_ptr );
- extern UBYTE fdl_open_channel (UBYTE dev_num);
- extern void fdl_close_channel (UBYTE dev_num, UBYTE chan_ident );
- extern UBYTE fdl_get_resp_ptr (UBYTE dev_num, UBYTE sap_nr, UBYTE prim_sec, IND_RESP_BUF PTR_ATTR* PTR_ATTR* u_resp_buf );
- extern void fdl_ind_disable_SAP50 (UBYTE dev_num);
- extern void fdl_perform_ind_disable_SAP50 (UBYTE dev_num, FDL_SAP_HEADER_PTR fdl_h_ptr );
- /*------------------------------------------------------------------------*/
- /* dp_msac1.c */
- /*------------------------------------------------------------------------*/
- #ifdef DP_MSAC_C1
- extern DP_ERROR_CODE msac_c1_init (UBYTE dev_num);
- extern UBYTE msac_c1_check_ind_new_prm_data (UBYTE dev_num);
- extern void msac_c1_pdu_received (UBYTE dev_num, UBYTE sap_nr, IND_RESP_BUF PTR_ATTR * ind_ptr, UBYTE req_add );
- extern void msac_c1_process (UBYTE dev_num );
- extern void msac_c1_leave_dx (UBYTE dev_num );
- extern void msac_c1_check_ind_dx_out (UBYTE dev_num );
- extern void msac_c1_do_cfg_not_ok (UBYTE dev_num );
- extern void msac_c1_do_cfg_ok (UBYTE dev_num );
- extern void msac_c1_ind_disable_done (UBYTE dev_num, UBYTE sap_nr, UBYTE ret_val );
- extern UBYTE msac_c1_transmit_delay (UBYTE dev_num, UBYTE sap, UBYTE event, DPV1_RET_VAL status, DPV1_PTR pdu );
- #ifdef DP_ALARM
- extern void alarm_process (UBYTE dev_num );
- extern UBYTE set_alarm__ (UBYTE dev_num, ALARM_STATUS_PDU_PTR user_alarm_ptr, UBYTE callback );
- extern void clear_alarm (UBYTE dev_num, UBYTE alarm_type_bit_field, UBYTE sequence_number );
- #endif//#ifdef DP_ALARM
- #endif//#ifdef DP_MSAC_C1
- /*------------------------------------------------------------------------*/
- /* dp_msac2.c */
- /*------------------------------------------------------------------------*/
- #ifdef DP_MSAC_C2
- extern DP_ERROR_CODE msac_c2_init (UBYTE dev_num );
- extern void msac_c2_process (UBYTE dev_num );
- extern void msac_c2_open_channel_sap (UBYTE dev_num, UBYTE sap_nr );
- extern DP_ERROR_CODE msac_c2_open_channel (UBYTE dev_num );
- extern UBYTE msac_c2_initiate_req_to_res (UBYTE dev_num, DPV1_PTR pdu );
- extern void msac_c2_input_queue (UBYTE dev_num, MSAC_C2_DATA_BUF_PTR buf_ptr, UBYTE ret_value ,UBYTE user_id, UBYTE fdl_code );
- extern void msac_c2_timer_tick_10msec (UBYTE dev_num );
- extern UBYTE msac_c2_transmit_delay (UBYTE dev_num, UBYTE sap, UBYTE status, DPV1_PTR pdu );
- extern void msac_c2_set_timeout (UBYTE dev_num );
- #endif//#ifdef DP_MSAC_C2
- #endif //#ifdef DP_FDL
- #if( ISR_ENABLE_VPC3_INT_NEW_PRM_DATA == 1 )
- extern UBYTE user_chk_new_prm_data(UBYTE dev_num, VPC3_UNSIGNED8_PTR prm_ptr, UBYTE len );
- #endif//#if( ISR_ENABLE_VPC3_INT_NEW_PRM_DATA == 1 )
- #if( ISR_ENABLE_VPC3_INT_NEW_EXT_PRM_DATA == 1 )
- extern UBYTE user_chk_new_ext_prm_data(UBYTE dev_num, VPC3_STRUC_PRM_BLOCK_PTR prmblock_ptr, UBYTE len );
- #endif//#if( ISR_ENABLE_VPC3_INT_NEW_EXT_PRM_DATA == 1 )
- #if( ISR_ENABLE_VPC3_INT_NEW_CFG_DATA == 1 )
- extern UBYTE user_chk_new_cfg_data(UBYTE dev_num );
- #endif//#if( ISR_ENABLE_VPC3_INT_NEW_CFG_DATA == 1 )
- #if( ISR_ENABLE_VPC3_INT_GO_LEAVE_DATA_EX == 1 )
- extern void user_isr_go_leave_data_ex(UBYTE dev_num );
- #endif//#if( ISR_ENABLE_VPC3_INT_GO_LEAVE_DATA_EX == 1 )
- #if( ISR_ENABLE_VPC3_INT_DX_OUT == 1 )
- extern void user_isr_dx_out(UBYTE dev_num );
- #endif//#if( ISR_ENABLE_VPC3_INT_DX_OUT == 1 )
- #if( ISR_ENABLE_VPC3_INT_DIAG_BUF_CHANGED == 1 )
- extern void user_isr_diag_buf_changed(UBYTE dev_num );
- #endif//#if( ISR_ENABLE_VPC3_INT_DIAG_BUF_CHANGED == 1 )
- #if( ISR_ENABLE_VPC3_INT_WD_DP_TIMEOUT == 1 )
- extern void user_isr_new_wd_dp_timeout(UBYTE dev_num );
- #endif//#if( ISR_ENABLE_VPC3_INT_WD_DP_TIMEOUT == 1 )
- #if( ISR_ENABLE_VPC3_INT_MAC_RESET == 1 )
- extern void user_isr_mac_reset(UBYTE dev_num );
- #endif//#if( ISR_ENABLE_VPC3_INT_MAC_RESET == 1 )
- #if( ISR_ENABLE_VPC3_INT_BAUDRATE_DETECT == 1 )
- extern void user_isr_baudrate_detect(UBYTE dev_num );
- #endif//#if( ISR_ENABLE_VPC3_INT_BAUDRATE_DETECT == 1 )
- #if( ISR_ENABLE_VPC3_INT_NEW_GC_COMMAND == 1 )
- extern void user_isr_new_gc_command(UBYTE dev_num );
- #endif//#if( ISR_ENABLE_VPC3_INT_NEW_GC_COMMAND == 1 )
- #if( ISR_ENABLE_VPC3_INT_NEW_SSA_DATA == 1 )
- extern void user_isr_new_ssa_data(UBYTE dev_num );
- #endif//#if( ISR_ENABLE_VPC3_INT_NEW_SSA_DATA == 1 )
- #if( ISR_ENABLE_VPC3_INT_USER_TIMER_CLOCK == 1 )
- extern void user_isr_user_timer_clock(UBYTE dev_num );
- #endif//#if( ISR_ENABLE_VPC3_INT_USER_TIMER_CLOCK == 1 )
- #ifdef DP_SUBSCRIBER
- #if( ISR_ENABLE_VPC3_INT_DXB_OUT == 1 )
- extern void user_isr_dxb_out(UBYTE dev_num );
- #endif//#if( ISR_ENABLE_VPC3_INT_DXB_OUT == 1 )
- #if( ISR_ENABLE_VPC3_INT_DXB_LINK_ERROR == 1 )
- extern void user_isr_dxb_link_error(UBYTE dev_num );
- #endif//#if( ISR_ENABLE_VPC3_INT_DXB_LINK_ERROR == 1 )
- #endif//#ifdef DP_SUBSCRIBER
- /*****************************************************************************/
- /* reinclude-protection */
- #else
- #pragma message "The header DP_INC.H is included twice or more !"
- #endif
- /*****************************************************************************/
- /* Copyright (C) profichip GmbH 2004. Confidential. */
- /*****************************************************************************/