dp_inc.h
上传用户:hualang
上传日期:2022-04-11
资源大小:104k
文件大小:16k
开发平台:

C/C++

  1. /**************************  Filename: dp_inc.h  *****************************/
  2. /* ========================================================================= */
  3. /*                                                                           */
  4. /* 0000  000   000  00000 0  000  0   0 0 0000                               */
  5. /* 0   0 0  0 0   0 0     0 0   0 0   0 0 0   0                              */
  6. /* 0   0 0  0 0   0 0     0 0     0   0 0 0   0      Einsteinstra遝 6        */
  7. /* 0000  000  0   0 000   0 0     00000 0 0000       91074 Herzogenaurach    */
  8. /* 0     00   0   0 0     0 0     0   0 0 0                                  */
  9. /* 0     0 0  0   0 0     0 0   0 0   0 0 0          Tel: ++49-9132-744-200  */
  10. /* 0     0  0  000  0     0  000  0   0 0 0    GmbH  Fax: ++49-9132-744-204  */
  11. /*                                                                           */
  12. /* ========================================================================= */
  13. /*                                                                           */
  14. /* Description: Extern modules to be included in all DP files.               */
  15. /*                                                                           */
  16. /* ------------------------------------------------------------------------- */
  17. /*                                                                           */
  18. /* Technical support:       P. Fredehorst                                    */
  19. /*                          Tel. : ++49-9132/744-214                         */
  20. /*                          Fax. :              -204                         */
  21. /*                          eMail: pfredehorst@profichip.com                 */
  22. /*                                                                           */
  23. /*****************************************************************************/
  24. /*****************************************************************************/
  25. /* contents:
  26.     - header include hierarchy for system environment
  27. */
  28. /*****************************************************************************/
  29. /* reinclude protection */
  30. #ifndef DP_INC_H
  31. #define DP_INC_H
  32. /*****************************************************************************/
  33. /* header include hierarchy for system environment */
  34. /*------------------------------------------------------------------------*/
  35. /* Debug Codes                                                            */
  36. /*------------------------------------------------------------------------*/
  37. typedef enum
  38. {
  39.     START__                = ((UBYTE)0x01), 
  40.                                                        
  41.     DP_INTERRUPT__ = ((UBYTE)0x20),
  42. DP_INTERRUPT_PRM__ = ((UBYTE)0x21),
  43. DP_INTERRUPT_CFG__ = ((UBYTE)0x22)
  44. } DEBUG_CODE;
  45. /*------------------------------------------------------------------------*/
  46. /* Debug Structure                                                        */
  47. /*------------------------------------------------------------------------*/
  48. #define MAX_NR_OF_DEBUG 256
  49. typedef struct
  50. {
  51.     DEBUG_CODE bDebugCode;
  52.     UBYTE       bDetail1;
  53.     UBYTE       bDetail2;
  54. } sDP_DEBUG_BUFFER_ITEM;
  55. #define psDP_BUFFER_ITEM   sDP_DEBUG_BUFFER_ITEM  PTR_ATTR *
  56. /*------------------------------------------------------------------------*/
  57. /* Debug function, external defines                                       */
  58. /*------------------------------------------------------------------------*/
  59. #ifdef DP_DEBUG_ENABLE
  60.     #define DP_WriteDebugBuffer__(dev_num, _bDebugCode, _bDetail1, _bDetail2 )
  61.                                           DP_WriteDebugBuffer(dev_num, _bDebugCode, _bDetail1, _bDetail2 )
  62. extern sDP_DEBUG_BUFFER_ITEM asDebugBuffer[MAX_DEV_NUM][ MAX_NR_OF_DEBUG ];
  63. extern UBYTE                    bDebugBufferIndex[MAX_DEV_NUM];
  64. extern UBYTE                    bDebugBufferOverlapped[MAX_DEV_NUM];
  65. extern void DP_ClearDebugBuffer(dev_num);
  66. #else
  67.     #define DP_WriteDebugBuffer__(dev_num, _bDebugCode, _bDetail1, _bDetail2 )
  68.                                          /* not used (DP_WriteDebugBuffer__ ) */
  69. #endif//#ifdef DP_DEBUG_ENABLE
  70. /*------------------------------------------------------------------------*/
  71. /* dp_user.c                                                              */
  72. /*------------------------------------------------------------------------*/
  73. extern VPC3_STRUC      VPC3_PTR     p_Vpc3[MAX_DEV_NUM];     // pointer to Vpc3 structure
  74. extern VPC3_SYSTEM_STRUC            dp_sys[MAX_DEV_NUM];     // global system structure
  75. /*------------------------------------------------------------------------*/
  76. /* dp_main.c                                                              */
  77. /*------------------------------------------------------------------------*/
  78. //extern void delay(dev_num);
  79. /*------------------------------------------------------------------------*/
  80. /* dp_user.c                                                              */
  81. /*------------------------------------------------------------------------*/
  82. extern void print_hexbyte(UBYTE mByte);
  83. extern void print_hexword(UWORD mWord);
  84. extern void print_string(UBYTE* s);
  85. extern void                 fatal_error                     (UBYTE dev_num, DP_ERROR_FILE file, UWORD line, VPC3_ERRCB_PTR errcb_ptr );
  86. extern DPV1_RET_VAL         user_dpv1_read_req              (UBYTE dev_num, UBYTE sap, DPV1_PTR pdu );
  87. extern DPV1_RET_VAL         user_dpv1_write_req             (UBYTE dev_num, UBYTE sap, DPV1_PTR pdu );
  88. extern DPV1_RET_VAL         user_c2_initiate_req            (UBYTE dev_num, UBYTE sap, DPV1_PTR pdu );
  89. extern DPV1_RET_VAL         user_c2_data_transport_req      (UBYTE dev_num, UBYTE sap, DPV1_PTR pdu );
  90. extern DPV1_RET_VAL         user_c2_abort_ind               (UBYTE dev_num, UBYTE sap,DPV1_PTR pdu );
  91. extern void                 user_alarm_ack_req              (UBYTE dev_num, ALARM_STATUS_PDU_PTR alarm_ptr );
  92. extern void                 user_alarm_state_info           (UBYTE dev_num, UBYTE alarm_type_bit_field, UBYTE sequence_depth );
  93. #ifdef DP_FDL
  94. extern UBYTE            user_alarm                      (UBYTE dev_num, UBYTE alarm_type, UBYTE seq_nr, ALARM_STATUS_PDU_PTR alarm_ptr, UBYTE check_diag_flag );
  95. #endif //#ifdef DP_FDL
  96. /*------------------------------------------------------------------------*/
  97. /* dp_if.c                                                                */
  98. /*------------------------------------------------------------------------*/
  99. extern void  DP_GetVersion (UBYTE dev_num, psDP_VERSION pVersion );
  100. extern DP_ERROR_CODE        vpc3_initialization             (UBYTE dev_num, UBYTE slave_address, CFG_STRUCT cfg );
  101. extern void                 START_VPC3                      (UBYTE dev_num );
  102. extern void                 vpc3_dpv1_statemachine          (UBYTE dev_num );
  103. extern UBYTE                vpc3_cfg_data_ok                (UBYTE dev_num );
  104. extern UBYTE                vpc3_cfg_data_update            (UBYTE dev_num );
  105. extern UBYTE                vpc3_cfg_data_not_ok            (UBYTE dev_num );
  106. extern DP_ERROR_CODE        vpc3_calculate_inp_outp_len     (UBYTE dev_num, UBYTE PTR_ATTR *cfg_ptr, UBYTE cfg_len );
  107. extern void                 vpc3_set_io_data_len            (UBYTE dev_num );
  108. extern VPC3_UNSIGNED8_PTR   vpc3_get_dinbufptr              (UBYTE dev_num);
  109. extern VPC3_UNSIGNED8_PTR   vpc3_get_doutbufptr             (UBYTE dev_num, UBYTE PTR_ATTR *state_ptr );
  110. extern VPC3_UNSIGNED8_PTR   vpc3_get_diagbufptr             (UBYTE dev_num);
  111. extern UBYTE                vpc3_get_master                 (UBYTE dev_num);
  112. 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 );
  113. extern void                 reset_diagnostic_buffer         (UBYTE dev_num);
  114. extern VPC3_UNSIGNED8_PTR   vpc3_get_free_memory            (UBYTE dev_num, UWORD PTR_ATTR *mem_len );
  115. extern UBYTE                set_alarm                       (UBYTE dev_num, ALARM_STATUS_PDU_PTR user_alarm_ptr, UBYTE callback );
  116. #ifdef DP_SUBSCRIBER
  117.     extern void                 dxb_subscriber_table_to_dxb_link_table  (UBYTE dev_num, PRM_SUBSCRIBER_TABLE_PTR dxb_ptr, UBYTE NrOfLinks );
  118.     extern UBYTE                check_dxb_link_table                    (UBYTE dev_num);
  119.     extern void                 build_dxb_link_status                   (UBYTE dev_num);
  120.     extern VPC3_UNSIGNED8_PTR   vpc3_get_dxb_outbufptr                  (UBYTE dev_num, UBYTE PTR_ATTR *state_ptr );
  121. #endif//#ifdef DP_SUBSCRIBER
  122. #ifdef DP_DEBUG_ENABLE
  123. extern void  DP_WriteDebugBuffer (UBYTE dev_num, DEBUG_CODE bDebugCode, UBYTE bDetail1, UBYTE bDetail2 );
  124. #endif//#ifdef DP_DEBUG_ENABLE
  125. /*------------------------------------------------------------------------*/
  126. /* dp_isr.c                                                                */
  127. /*------------------------------------------------------------------------*/
  128. extern void  vpc3_neta_isr();
  129. extern void  vpc3_netb_isr();
  130. extern void                 vpc3_isr(int dev_num);
  131. /*------------------------------------------------------------------------*/
  132. /* dp_fdl.c                                                               */
  133. /*------------------------------------------------------------------------*/
  134. #ifdef DP_FDL
  135. extern DP_ERROR_CODE        fdl_init                        (UBYTE dev_num);
  136. extern void                 fdl_set_poll_timeout            (UBYTE dev_num, UWORD poll_timeout );
  137. extern void                 fdl_mac_indication              (UBYTE dev_num);
  138. extern void                 fdl_flc_indication              (UBYTE dev_num);
  139. extern void                 fdl_cyclic_service              (UBYTE dev_num );
  140. extern void                 fdl_set_sa_ssap                 (UBYTE dev_num, UBYTE sap_nr, UBYTE req_sa, UBYTE req_ssap );
  141. extern FDL_SAP_HEADER_PTR   fdl_get_sap_header_ptr          (UBYTE dev_num, UBYTE sap );
  142. extern void                 fdl_ind_provide                 (UBYTE dev_num, UBYTE sap_nr, IND_RESP_BUF PTR_ATTR * ind_ptr );
  143. extern void                 fdl_resp_provide                (UBYTE dev_num, UBYTE sap_nr, UBYTE prim_sec );
  144. extern void                 fdl_reset_pcntrl_resp_bit       (UBYTE dev_num, UBYTE sap_nr, UBYTE prim_sec );
  145. extern void                 fdl_ind_disable                 (UBYTE dev_num, UBYTE sap_nr );
  146. extern UBYTE                fdl_ind_await                   (UBYTE dev_num, UBYTE sap_nr );
  147. extern void                 fdl_perform_ind_disable         (UBYTE dev_num, FDL_SAP_HEADER PTR_ATTR *fdl_h_ptr );
  148. extern UBYTE                fdl_open_channel                (UBYTE dev_num);
  149. extern void                 fdl_close_channel               (UBYTE dev_num, UBYTE chan_ident );
  150. 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 );
  151. extern void                 fdl_ind_disable_SAP50           (UBYTE dev_num);
  152. extern void                 fdl_perform_ind_disable_SAP50   (UBYTE dev_num, FDL_SAP_HEADER_PTR fdl_h_ptr );
  153. /*------------------------------------------------------------------------*/
  154. /* dp_msac1.c                                                             */
  155. /*------------------------------------------------------------------------*/
  156. #ifdef DP_MSAC_C1
  157.     extern DP_ERROR_CODE    msac_c1_init                    (UBYTE dev_num);
  158.     extern UBYTE            msac_c1_check_ind_new_prm_data  (UBYTE dev_num);
  159.     extern void             msac_c1_pdu_received            (UBYTE dev_num, UBYTE sap_nr, IND_RESP_BUF PTR_ATTR * ind_ptr, UBYTE req_add );
  160.     extern void             msac_c1_process                 (UBYTE dev_num );
  161.     extern void             msac_c1_leave_dx                (UBYTE dev_num );
  162.     extern void             msac_c1_check_ind_dx_out        (UBYTE dev_num );
  163.     extern void             msac_c1_do_cfg_not_ok           (UBYTE dev_num );
  164.     extern void             msac_c1_do_cfg_ok               (UBYTE dev_num );
  165.     extern void             msac_c1_ind_disable_done        (UBYTE dev_num, UBYTE sap_nr, UBYTE ret_val );
  166.     extern UBYTE            msac_c1_transmit_delay          (UBYTE dev_num, UBYTE sap, UBYTE event, DPV1_RET_VAL status, DPV1_PTR pdu );
  167.     #ifdef DP_ALARM
  168.         extern void         alarm_process                   (UBYTE dev_num );
  169.         extern UBYTE        set_alarm__                     (UBYTE dev_num, ALARM_STATUS_PDU_PTR user_alarm_ptr, UBYTE callback );
  170.         extern void         clear_alarm                     (UBYTE dev_num, UBYTE alarm_type_bit_field, UBYTE sequence_number );
  171.     #endif//#ifdef DP_ALARM
  172. #endif//#ifdef DP_MSAC_C1
  173. /*------------------------------------------------------------------------*/
  174. /* dp_msac2.c                                                             */
  175. /*------------------------------------------------------------------------*/
  176. #ifdef DP_MSAC_C2
  177.     extern DP_ERROR_CODE    msac_c2_init                    (UBYTE dev_num );
  178.     extern void             msac_c2_process                 (UBYTE dev_num );
  179.     extern void             msac_c2_open_channel_sap        (UBYTE dev_num, UBYTE sap_nr );
  180.     extern DP_ERROR_CODE    msac_c2_open_channel            (UBYTE dev_num );
  181.     extern UBYTE            msac_c2_initiate_req_to_res     (UBYTE dev_num, DPV1_PTR pdu );
  182.     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 );
  183.     extern void             msac_c2_timer_tick_10msec       (UBYTE dev_num );
  184.     extern UBYTE            msac_c2_transmit_delay          (UBYTE dev_num, UBYTE sap, UBYTE status, DPV1_PTR pdu );
  185.     extern void             msac_c2_set_timeout             (UBYTE dev_num );
  186. #endif//#ifdef DP_MSAC_C2
  187. #endif //#ifdef DP_FDL
  188. #if( ISR_ENABLE_VPC3_INT_NEW_PRM_DATA == 1 )
  189.     extern UBYTE user_chk_new_prm_data(UBYTE dev_num, VPC3_UNSIGNED8_PTR prm_ptr, UBYTE len );
  190. #endif//#if( ISR_ENABLE_VPC3_INT_NEW_PRM_DATA == 1 )
  191. #if( ISR_ENABLE_VPC3_INT_NEW_EXT_PRM_DATA == 1 )
  192.     extern UBYTE user_chk_new_ext_prm_data(UBYTE dev_num, VPC3_STRUC_PRM_BLOCK_PTR prmblock_ptr, UBYTE len );
  193. #endif//#if( ISR_ENABLE_VPC3_INT_NEW_EXT_PRM_DATA == 1 )
  194. #if( ISR_ENABLE_VPC3_INT_NEW_CFG_DATA == 1 )
  195.     extern UBYTE user_chk_new_cfg_data(UBYTE dev_num );
  196. #endif//#if( ISR_ENABLE_VPC3_INT_NEW_CFG_DATA == 1 )
  197. #if( ISR_ENABLE_VPC3_INT_GO_LEAVE_DATA_EX == 1 )
  198.     extern void user_isr_go_leave_data_ex(UBYTE dev_num );
  199. #endif//#if( ISR_ENABLE_VPC3_INT_GO_LEAVE_DATA_EX == 1 )
  200. #if( ISR_ENABLE_VPC3_INT_DX_OUT == 1 )
  201.     extern void user_isr_dx_out(UBYTE dev_num );
  202. #endif//#if( ISR_ENABLE_VPC3_INT_DX_OUT == 1 )
  203. #if( ISR_ENABLE_VPC3_INT_DIAG_BUF_CHANGED == 1 )
  204.     extern void user_isr_diag_buf_changed(UBYTE dev_num );
  205. #endif//#if( ISR_ENABLE_VPC3_INT_DIAG_BUF_CHANGED == 1 )
  206. #if( ISR_ENABLE_VPC3_INT_WD_DP_TIMEOUT == 1 )
  207.     extern void user_isr_new_wd_dp_timeout(UBYTE dev_num );
  208. #endif//#if( ISR_ENABLE_VPC3_INT_WD_DP_TIMEOUT == 1 )
  209. #if( ISR_ENABLE_VPC3_INT_MAC_RESET == 1 )
  210.     extern void user_isr_mac_reset(UBYTE dev_num );
  211. #endif//#if( ISR_ENABLE_VPC3_INT_MAC_RESET == 1 )
  212. #if( ISR_ENABLE_VPC3_INT_BAUDRATE_DETECT == 1 )
  213.     extern void user_isr_baudrate_detect(UBYTE dev_num );
  214. #endif//#if( ISR_ENABLE_VPC3_INT_BAUDRATE_DETECT == 1 )
  215. #if( ISR_ENABLE_VPC3_INT_NEW_GC_COMMAND == 1 )
  216.     extern void user_isr_new_gc_command(UBYTE dev_num );
  217. #endif//#if( ISR_ENABLE_VPC3_INT_NEW_GC_COMMAND == 1 )
  218. #if( ISR_ENABLE_VPC3_INT_NEW_SSA_DATA == 1 )
  219.     extern void user_isr_new_ssa_data(UBYTE dev_num );
  220. #endif//#if( ISR_ENABLE_VPC3_INT_NEW_SSA_DATA == 1 )
  221. #if( ISR_ENABLE_VPC3_INT_USER_TIMER_CLOCK == 1 )
  222.     extern void user_isr_user_timer_clock(UBYTE dev_num );
  223. #endif//#if( ISR_ENABLE_VPC3_INT_USER_TIMER_CLOCK == 1 )
  224. #ifdef DP_SUBSCRIBER
  225.     #if( ISR_ENABLE_VPC3_INT_DXB_OUT == 1 )
  226.         extern void user_isr_dxb_out(UBYTE dev_num );
  227.     #endif//#if( ISR_ENABLE_VPC3_INT_DXB_OUT == 1 )
  228.     #if( ISR_ENABLE_VPC3_INT_DXB_LINK_ERROR == 1 )
  229.         extern void user_isr_dxb_link_error(UBYTE dev_num );
  230.     #endif//#if( ISR_ENABLE_VPC3_INT_DXB_LINK_ERROR == 1 )
  231. #endif//#ifdef DP_SUBSCRIBER
  232. /*****************************************************************************/
  233. /* reinclude-protection */
  234. #else
  235.     #pragma message "The header DP_INC.H is included twice or more !"
  236. #endif
  237. /*****************************************************************************/
  238. /*  Copyright (C) profichip GmbH 2004. Confidential.                         */
  239. /*****************************************************************************/