dp_isr.c
资源名称:Profibus.rar [点击查看]
上传用户:hualang
上传日期:2022-04-11
资源大小:104k
文件大小:34k
源码类别:
能源行业(电力石油煤炭)
开发平台:
C/C++
- /*********************** Filename: dp_isr.c ********************************/
- /* ========================================================================= */
- /* */
- /* 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 */
- /* */
- /* ========================================================================= */
- /* */
- /* Function: interrupt service routine for VPC3+ */
- /* */
- /* ------------------------------------------------------------------------- */
- /* */
- /* Technical support: P. Fredehorst */
- /* Tel. : ++49-9132/744-214 */
- /* Fax. : -204 */
- /* eMail: pfredehorst@profichip.com */
- /* */
- /*****************************************************************************/
- /*****************************************************************************/
- /* contents:
- - function prototypes
- - data structures
- - internal functions
- */
- /*****************************************************************************/
- /* include hierarchy */
- #include "..dp_incplatform.h"
- #include "..dp_incdp_inc.h"
- //#include "E5_Inc.h"
- //void ClockSyncProcInADInt(uint8 dev_num)
- //{
- // /*-----------------------------------------------------------------------*/
- // /* IND_MAC_RESET */
- // /*-----------------------------------------------------------------------*/
- // #if( ISR_ENABLE_VPC3_INT_MAC_RESET == 1 )
- // if(VPC3_GET_IND_MAC_RESET(dev_num))
- // {
- // logMsg("VPC3_GET_IND_MAC_RESET!n",0,0,0,0,0,0);
- // user_isr_mac_reset(dev_num);
- // VPC3_CON_IND_MAC_RESET(dev_num);
- // }
- // #endif//#if(ISR_ENABLE_VPC3_INT_MAC_RESET == 1 )
- //}
- /*---------------------------------------------------------------------------*/
- /* dp interrupt service routine */
- /*---------------------------------------------------------------------------*/
- SECTION_DEF_CommuCode void vpc3_neta_isr(int dev_num)
- {
- // UBYTE dev_num = NET_A;
- int i;
- UBYTE btArray[CFG_BUFSIZE];
- UWORD* pSrcAddr;
- DP_WriteDebugBuffer__(dev_num, DP_INTERRUPT__, p_Vpc3[dev_num]->isreg.rd.int_reg2, p_Vpc3[dev_num]->isreg.rd.int_reg1 );
- //logMsg("vpc3_neta_isr,reg1=%d,reg2=%d!n",p_Vpc3[dev_num]->isreg.rd.int_reg1,p_Vpc3[dev_num]->isreg.rd.int_reg2,0,0,0,0);
- /*-----------------------------------------------------------------------*/
- /* IND_NEW_PRM_DATA */
- /*-----------------------------------------------------------------------*/
- #if(ISR_ENABLE_VPC3_INT_NEW_PRM_DATA == 1 )
- if(VPC3_GET_IND_NEW_PRM_DATA(dev_num))
- {
- logMsg("NEW_PRM_DATA!n",0,0,0,0,0,0);
- DP_WriteDebugBuffer__(dev_num, DP_INTERRUPT_PRM__, 0, 0 );
- dp_sys[dev_num].vpc3_con = VPC3_PRM_FINISHED;
- do
- {
- if(user_chk_new_prm_data(dev_num, VPC3_GET_PRM_BUF_PTR(dev_num), VPC3_GET_PRM_LEN(dev_num) ) == DP_OK )
- {
- #ifdef DP_MSAC_C1
- msac_c1_check_ind_new_prm_data(dev_num);
- #endif
- dp_sys[dev_num].vpc3_con = VPC3_SET_PRM_DATA_OK(dev_num);
- DP_WriteDebugBuffer__(dev_num, DP_INTERRUPT_PRM__, 0x33, 0 );
- }//if(user_chk_new_prm_data(dev_num, VPC3_GET_PRM_BUF_PTR(dev_num), VPC3_GET_PRM_LEN(dev_num) ) == DP_OK )
- else
- {
- dp_sys[dev_num].vpc3_con = VPC3_SET_PRM_DATA_NOT_OK(dev_num);
- DP_WriteDebugBuffer__(dev_num, DP_INTERRUPT_PRM__, 0x55, 0 );
- }//else of if(user_chk_new_prm_data(dev_num, VPC3_GET_PRM_BUF_PTR(dev_num), VPC3_GET_PRM_LEN(dev_num) ) == DP_OK )
- }
- while(dp_sys[dev_num].vpc3_con == VPC3_PRM_CONFLICT );
- }//if(VPC3_GET_IND_NEW_PRM_DATA(dev_num))
- #endif//#if(ISR_ENABLE_VPC3_INT_NEW_PRM_DATA == 1 )
- /*-----------------------------------------------------------------------*/
- /* IND_NEW_EXT_PRM_DATA */
- /*-----------------------------------------------------------------------*/
- #if( ISR_ENABLE_VPC3_INT_NEW_EXT_PRM_DATA == 1 )
- if(VPC3_GET_IND_NEW_EXT_PRM_DATA(dev_num))
- {
- dp_sys[dev_num].vpc3_con = VPC3_PRM_FINISHED;
- do
- {
- if( user_chk_new_ext_prm_data(dev_num, (VPC3_STRUC_PRM_BLOCK_PTR)VPC3_GET_PRM_BUF_PTR(dev_num), VPC3_GET_PRM_LEN(dev_num) ) == DP_OK )
- {
- dp_sys[dev_num].vpc3_con = VPC3_SET_PRM_DATA_OK(dev_num);
- }//if( user_chk_new_ext_prm_data(dev_num, VPC3_GET_PRM_BUF_PTR(dev_num), VPC3_GET_PRM_LEN(dev_num) ) == DP_OK )
- else
- {
- dp_sys[dev_num].vpc3_con = VPC3_SET_PRM_DATA_NOT_OK(dev_num);
- }//else of if(user_chk_new_ext_prm_data(dev_num, VPC3_GET_PRM_BUF_PTR(dev_num), VPC3_GET_PRM_LEN(dev_num) ) == DP_OK )
- }
- while(dp_sys[dev_num].vpc3_con == VPC3_PRM_CONFLICT );
- }//if(VPC3_GET_IND_NEW_EXT_PRM_DATA(dev_num))
- #endif//#if(ISR_ENABLE_VPC3_INT_NEW_EXT_PRM_DATA == 1 )
- /*-----------------------------------------------------------------------*/
- /* check config data , application specific! */
- /*-----------------------------------------------------------------------*/
- #if( ISR_ENABLE_VPC3_INT_NEW_CFG_DATA == 1 )
- if(VPC3_GET_IND_NEW_CFG_DATA(dev_num))
- {
- logMsg("NEW_CFG_DATA!n",0,0,0,0,0,0);
- DP_WriteDebugBuffer__(dev_num, DP_INTERRUPT_CFG__, 0, 0 );
- dp_sys[dev_num].vpc3_con = VPC3_CFG_FINISHED;
- do
- {
- switch(user_chk_new_cfg_data(dev_num) )
- {
- case VPC3_CFG_OK:
- {
- #ifdef DP_MSAC_C1
- msac_c1_do_cfg_ok(dev_num);
- #endif
- dp_sys[dev_num].vpc3_con = VPC3_SET_CFG_DATA_OK(dev_num);
- DP_WriteDebugBuffer__(dev_num, DP_INTERRUPT_CFG__, 0x33, 0 );
- break;
- }//case VPC3_CFG_OK:
- case VPC3_CFG_FAULT:
- {
- #ifdef DP_MSAC_C1
- msac_c1_do_cfg_not_ok(dev_num);
- #endif
- dp_sys[dev_num].vpc3_con = VPC3_SET_CFG_DATA_NOT_OK(dev_num);
- DP_WriteDebugBuffer__(dev_num, DP_INTERRUPT_CFG__, 0x44, 0 );
- break;
- }//case VPC3_CFG_FAULT:
- case VPC3_CFG_UPDATE:
- {
- // Calculate the length of the input and output using the configuration bytes
- //wusenlin 将配置数据转化成单字节方式
- pSrcAddr = (UWORD*) VPC3_GET_CFG_BUF_PTR(dev_num);
- for(i=0; i<VPC3_GET_CFG_LEN(dev_num); i++)
- {
- btArray[i] = BFWORD2BYTE(pSrcAddr[i]);
- }
- if( DP_OK != vpc3_calculate_inp_outp_len (dev_num, btArray/*VPC3_GET_CFG_BUF_PTR(dev_num)*/, VPC3_GET_CFG_LEN(dev_num) ) )
- {
- // TRACE("Update Cfg Fail. ");
- #ifdef DP_MSAC_C1
- msac_c1_do_cfg_not_ok(dev_num);
- #endif
- dp_sys[dev_num].vpc3_con = VPC3_SET_CFG_DATA_NOT_OK(dev_num);
- DP_WriteDebugBuffer__(dev_num, DP_INTERRUPT_CFG__, 0x55, 0 );
- }//if( DP_OK != vpc3_calculate_inp_outp_len (dev_num,cfg_ptr,VPC3_GET_CFG_LEN(dev_num)) )
- else
- {
- // set IO-Length
- vpc3_set_io_data_len(dev_num);
- #ifdef DP_MSAC_C1
- msac_c1_do_cfg_ok(dev_num);
- #endif
- dp_sys[dev_num].vpc3_con = VPC3_SET_CFG_DATA_UPDATE(dev_num);
- DP_WriteDebugBuffer__(dev_num, DP_INTERRUPT_CFG__, 0x66, 0 );
- }//else of if(DP_OK != vpc3_calculate_inp_outp_len (dev_num,cfg_ptr,VPC3_GET_CFG_LEN(dev_num)) )
- break;
- }//case VPC3_CFG_UPDATE:
- default:
- {
- break;
- }//default:
- }//switch(user_chk_new_cfg_data(dev_num) )
- }
- while ( dp_sys[dev_num].vpc3_con == VPC3_CFG_CONFLICT );
- }//if(VPC3_GET_IND_NEW_CFG_DATA(dev_num))
- #endif//#if(ISR_ENABLE_VPC3_INT_NEW_CFG_DATA == 1 )
- /*-----------------------------------------------------------------------*/
- /* IND_GO_LEAVE_DATA_EX */
- /*-----------------------------------------------------------------------*/
- #if( ISR_ENABLE_VPC3_INT_GO_LEAVE_DATA_EX == 1 )
- if(VPC3_GET_IND_GO_LEAVE_DATA_EX(dev_num))
- {
- logMsg("GO_LEAVE_DATA_EX!n",0,0,0,0,0,0);
- #ifdef DP_MSAC_C1
- msac_c1_leave_dx(dev_num);
- #endif
- user_isr_go_leave_data_ex(dev_num);
- VPC3_CON_IND_GO_LEAVE_DATA_EX(dev_num);
- }
- #endif//#if(ISR_ENABLE_VPC3_INT_GO_LEAVE_DATA_EX == 1 )
- /*-----------------------------------------------------------------------*/
- /* IND_DX_OUT */
- /*-----------------------------------------------------------------------*/
- #if( ISR_ENABLE_VPC3_INT_DX_OUT == 1 )
- if (VPC3_GET_IND_DX_OUT(dev_num))
- {
- //logMsg("VPC3_GET_IND_DX_OUT!n",0,0,0,0,0,0);
- #ifdef DP_MSAC_C1
- msac_c1_check_ind_dx_out(dev_num);
- #endif
- user_isr_dx_out(dev_num);
- VPC3_CON_IND_DX_OUT(dev_num);
- }
- #endif//#if( ISR_ENABLE_VPC3_INT_DX_OUT == 1 )
- /*-----------------------------------------------------------------------*/
- /* IND_DIAG_BUF_CHANGED */
- /*-----------------------------------------------------------------------*/
- #if( ISR_ENABLE_VPC3_INT_DIAG_BUF_CHANGED == 1 )
- if(VPC3_GET_IND_DIAG_BUF_CHANGED(dev_num))
- {
- logMsg("VPC3_GET_IND_DIAG_BUF_CHANGED!n",0,0,0,0,0,0);
- user_isr_diag_buf_changed(dev_num);
- VPC3_CON_IND_DIAG_BUF_CHANGED(dev_num);
- }
- #endif//#if( ISR_ENABLE_VPC3_INT_DIAG_BUF_CHANGED == 1 )
- /*-----------------------------------------------------------------------*/
- /* IND_WD_DP_TIMEOUT */
- /*-----------------------------------------------------------------------*/
- #if( ISR_ENABLE_VPC3_INT_WD_DP_TIMEOUT == 1 )
- if(VPC3_GET_IND_WD_DP_TIMEOUT(dev_num) )
- {
- logMsg("WD_DP_TIMEOUT!n",0,0,0,0,0,0);
- user_isr_new_wd_dp_timeout(dev_num);
- VPC3_CON_IND_WD_DP_TIMEOUT(dev_num); // acknowledge
- }
- #endif//#if(ISR_ENABLE_VPC3_INT_WD_DP_TIMEOUT == 1 )
- /*-----------------------------------------------------------------------*/
- /* IND_MAC_RESET */
- /*-----------------------------------------------------------------------*/
- #if( ISR_ENABLE_VPC3_INT_MAC_RESET == 1 )
- if(VPC3_GET_IND_MAC_RESET(dev_num))
- {
- logMsg("VPC3_GET_IND_MAC_RESET!n",0,0,0,0,0,0);
- user_isr_mac_reset(dev_num);
- VPC3_CON_IND_MAC_RESET(dev_num);
- }
- #endif//#if(ISR_ENABLE_VPC3_INT_MAC_RESET == 1 )
- /*-----------------------------------------------------------------------*/
- /* IND_BAUDRATE_DETECT */
- /*-----------------------------------------------------------------------*/
- #if(ISR_ENABLE_VPC3_INT_BAUDRATE_DETECT == 1 )
- if(VPC3_GET_IND_BAUDRATE_DETECT(dev_num))
- {
- logMsg("VPC3_GET_IND_BAUDRATE_DETECT!n",0,0,0,0,0,0);
- #ifdef DP_MSAC_C2
- msac_c2_set_timeout(dev_num);
- #endif
- user_isr_baudrate_detect(dev_num);
- VPC3_CON_IND_BAUDRATE_DETECT(dev_num);
- }
- #endif//#if(ISR_ENABLE_VPC3_INT_BAUDRATE_DETECT == 1 )
- /*-----------------------------------------------------------------------*/
- /* IND_NEW_GC_COMMAND */
- /*-----------------------------------------------------------------------*/
- #if(ISR_ENABLE_VPC3_INT_NEW_GC_COMMAND == 1 )
- if(VPC3_GET_IND_NEW_GC_COMMAND(dev_num))
- {
- user_isr_new_gc_command(dev_num);
- VPC3_CON_IND_NEW_GC_COMMAND(dev_num);
- }
- #endif//#if(ISR_ENABLE_VPC3_INT_NEW_GC_COMMAND == 1 )
- /*-----------------------------------------------------------------------*/
- /* IND_NEW_SSA_DATA */
- /*-----------------------------------------------------------------------*/
- #if(ISR_ENABLE_VPC3_INT_NEW_SSA_DATA == 1 )
- if(VPC3_GET_IND_NEW_SSA_DATA(dev_num))
- {
- logMsg("VPC3_GET_IND_NEW_SSA_DATA!n",0,0,0,0,0,0);
- user_isr_new_ssa_data(dev_num);
- dp_sys[dev_num].vpc3_con = VPC3_FREE_SSA_BUF(dev_num); //release the Set Slave Address buffer
- VPC3_CON_IND_NEW_SSA_DATA(dev_num);
- }
- #endif//#if(ISR_ENABLE_VPC3_INT_NEW_SSA_DATA == 1 )
- /*-----------------------------------------------------------------------*/
- /* IND_USER_TIMER_CLOCK */
- /*-----------------------------------------------------------------------*/
- #if(ISR_ENABLE_VPC3_INT_USER_TIMER_CLOCK == 1 )
- if(VPC3_GET_IND_USER_TIMER_CLOCK(dev_num) )
- {
- user_isr_user_timer_clock(dev_num);
- #ifdef DP_MSAC_C2
- msac_c2_timer_tick_10msec(dev_num);
- #endif//#ifdef DP_MSAC_C2
- VPC3_CON_IND_USER_TIMER_CLOCK(dev_num);
- }//if(VPC3_GET_IND_USER_TIMER_CLOCK(dev_num) )
- #endif//#if(ISR_ENABLE_VPC3_INT_USER_TIMER_CLOCK == 1 )
- #ifdef DP_SUBSCRIBER
- /*-------------------------------------------------------------------*/
- /* IND_DXB_OUT */
- /*-------------------------------------------------------------------*/
- #if(ISR_ENABLE_VPC3_INT_DXB_OUT == 1 )
- if (VPC3_GET_IND_DXB_OUT(dev_num))
- {
- user_isr_dxb_out(dev_num);
- VPC3_CON_IND_DXB_OUT(dev_num);
- }
- #endif//#if(ISR_ENABLE_VPC3_INT_DXB_OUT == 1 )
- /*-------------------------------------------------------------------*/
- /* IND_DXB_LINK_ERROR */
- /*-------------------------------------------------------------------*/
- #if(ISR_ENABLE_VPC3_INT_DXB_LINK_ERROR == 1 )
- if (VPC3_GET_IND_DXB_LINK_ERROR(dev_num))
- {
- user_isr_dxb_link_error(dev_num);
- VPC3_CON_IND_DXB_LINK_ERROR(dev_num);
- }
- #endif//#if( ISR_ENABLE_VPC3_INT_DXB_LINK_ERROR == 1 )
- #endif//#ifdef DP_SUBSCRIBER
- #ifdef DP_FDL
- /*-------------------------------------------------------------------*/
- /* IND_REQ_PDU */
- /*-------------------------------------------------------------------*/
- #if(ISR_ENABLE_VPC3_INT_FDL_IND == 1 )
- if(VPC3_GET_IND_FDL_IND(dev_num) )
- {
- logMsg("DPV1-----step4---1,dev_num=%d!n",dev_num,0,0,0,0,0);
- if(!VPC3_GET_IND_POLL_END_IND(dev_num) )
- {
- logMsg("DPV1-----step4---2,dev_num=%d!n",dev_num,0,0,0,0,0);
- VPC3_CON_IND_FDL_IND(dev_num);
- fdl_mac_indication(dev_num);
- }
- }
- #endif//#if(ISR_ENABLE_VPC3_INT_FDL_IND == 1 )
- /*-------------------------------------------------------------------*/
- /* IND_POLL_END */
- /*-------------------------------------------------------------------*/
- #if(ISR_ENABLE_VPC3_INT_POLL_END_IND == 1 )
- if(VPC3_GET_IND_POLL_END_IND(dev_num) )
- {
- logMsg("VPC3_GET_IND_POLL_END_IND!n",0,0,0,0,0,0);
- VPC3_CON_IND_POLL_END_IND(dev_num);
- fdl_flc_indication(dev_num);
- }
- #endif//#if(ISR_ENABLE_VPC3_INT_POLL_END_IND == 1 )
- #endif//#ifdef DP_FDL
- /*-----------------------------------------------------------------------*/
- /* reset interrupt line */
- /*-----------------------------------------------------------------------*/
- // VPC3_SET_EOI(dev_num);
- }//void vpc3_neta_isr()
- SECTION_DEF_CommuCode void vpc3_netb_isr(int dev_num)
- {
- // UBYTE dev_num = NET_B;
- int i;
- UBYTE btArray[CFG_BUFSIZE];
- UWORD* pSrcAddr;
- DP_WriteDebugBuffer__(dev_num, DP_INTERRUPT__, p_Vpc3[dev_num]->isreg.rd.int_reg2, p_Vpc3[dev_num]->isreg.rd.int_reg1 );
- //logMsg("vpc3_neta_isr,reg1=%d,reg2=%d!n",p_Vpc3[dev_num]->isreg.rd.int_reg1,p_Vpc3[dev_num]->isreg.rd.int_reg2,0,0,0,0);
- /*-----------------------------------------------------------------------*/
- /* IND_NEW_PRM_DATA */
- /*-----------------------------------------------------------------------*/
- #if(ISR_ENABLE_VPC3_INT_NEW_PRM_DATA == 1 )
- if(VPC3_GET_IND_NEW_PRM_DATA(dev_num))
- {
- logMsg("NEW_PRM_DATA!n",0,0,0,0,0,0);
- DP_WriteDebugBuffer__(dev_num, DP_INTERRUPT_PRM__, 0, 0 );
- dp_sys[dev_num].vpc3_con = VPC3_PRM_FINISHED;
- do
- {
- if(user_chk_new_prm_data(dev_num, VPC3_GET_PRM_BUF_PTR(dev_num), VPC3_GET_PRM_LEN(dev_num) ) == DP_OK )
- {
- #ifdef DP_MSAC_C1
- msac_c1_check_ind_new_prm_data(dev_num);
- #endif
- dp_sys[dev_num].vpc3_con = VPC3_SET_PRM_DATA_OK(dev_num);
- DP_WriteDebugBuffer__(dev_num, DP_INTERRUPT_PRM__, 0x33, 0 );
- }//if(user_chk_new_prm_data(dev_num, VPC3_GET_PRM_BUF_PTR(dev_num), VPC3_GET_PRM_LEN(dev_num) ) == DP_OK )
- else
- {
- dp_sys[dev_num].vpc3_con = VPC3_SET_PRM_DATA_NOT_OK(dev_num);
- DP_WriteDebugBuffer__(dev_num, DP_INTERRUPT_PRM__, 0x55, 0 );
- }//else of if(user_chk_new_prm_data(dev_num, VPC3_GET_PRM_BUF_PTR(dev_num), VPC3_GET_PRM_LEN(dev_num) ) == DP_OK )
- }
- while(dp_sys[dev_num].vpc3_con == VPC3_PRM_CONFLICT );
- }//if(VPC3_GET_IND_NEW_PRM_DATA(dev_num))
- #endif//#if(ISR_ENABLE_VPC3_INT_NEW_PRM_DATA == 1 )
- /*-----------------------------------------------------------------------*/
- /* IND_NEW_EXT_PRM_DATA */
- /*-----------------------------------------------------------------------*/
- #if( ISR_ENABLE_VPC3_INT_NEW_EXT_PRM_DATA == 1 )
- if(VPC3_GET_IND_NEW_EXT_PRM_DATA(dev_num))
- {
- dp_sys[dev_num].vpc3_con = VPC3_PRM_FINISHED;
- do
- {
- if( user_chk_new_ext_prm_data(dev_num, (VPC3_STRUC_PRM_BLOCK_PTR)VPC3_GET_PRM_BUF_PTR(dev_num), VPC3_GET_PRM_LEN(dev_num) ) == DP_OK )
- {
- dp_sys[dev_num].vpc3_con = VPC3_SET_PRM_DATA_OK(dev_num);
- }//if( user_chk_new_ext_prm_data(dev_num, VPC3_GET_PRM_BUF_PTR(dev_num), VPC3_GET_PRM_LEN(dev_num) ) == DP_OK )
- else
- {
- dp_sys[dev_num].vpc3_con = VPC3_SET_PRM_DATA_NOT_OK(dev_num);
- }//else of if(user_chk_new_ext_prm_data(dev_num, VPC3_GET_PRM_BUF_PTR(dev_num), VPC3_GET_PRM_LEN(dev_num) ) == DP_OK )
- }
- while(dp_sys[dev_num].vpc3_con == VPC3_PRM_CONFLICT );
- }//if(VPC3_GET_IND_NEW_EXT_PRM_DATA(dev_num))
- #endif//#if(ISR_ENABLE_VPC3_INT_NEW_EXT_PRM_DATA == 1 )
- /*-----------------------------------------------------------------------*/
- /* check config data , application specific! */
- /*-----------------------------------------------------------------------*/
- #if( ISR_ENABLE_VPC3_INT_NEW_CFG_DATA == 1 )
- if(VPC3_GET_IND_NEW_CFG_DATA(dev_num))
- {
- logMsg("NEW_CFG_DATA!n",0,0,0,0,0,0);
- DP_WriteDebugBuffer__(dev_num, DP_INTERRUPT_CFG__, 0, 0 );
- dp_sys[dev_num].vpc3_con = VPC3_CFG_FINISHED;
- do
- {
- switch(user_chk_new_cfg_data(dev_num) )
- {
- case VPC3_CFG_OK:
- {
- #ifdef DP_MSAC_C1
- msac_c1_do_cfg_ok(dev_num);
- #endif
- dp_sys[dev_num].vpc3_con = VPC3_SET_CFG_DATA_OK(dev_num);
- DP_WriteDebugBuffer__(dev_num, DP_INTERRUPT_CFG__, 0x33, 0 );
- break;
- }//case VPC3_CFG_OK:
- case VPC3_CFG_FAULT:
- {
- #ifdef DP_MSAC_C1
- msac_c1_do_cfg_not_ok(dev_num);
- #endif
- dp_sys[dev_num].vpc3_con = VPC3_SET_CFG_DATA_NOT_OK(dev_num);
- DP_WriteDebugBuffer__(dev_num, DP_INTERRUPT_CFG__, 0x44, 0 );
- break;
- }//case VPC3_CFG_FAULT:
- case VPC3_CFG_UPDATE:
- {
- // Calculate the length of the input and output using the configuration bytes
- //wusenlin 将配置数据转化成单字节方式
- pSrcAddr = (UWORD*) VPC3_GET_CFG_BUF_PTR(dev_num);
- for(i=0; i<VPC3_GET_CFG_LEN(dev_num); i++)
- {
- btArray[i] = BFWORD2BYTE(pSrcAddr[i]);
- }
- if( DP_OK != vpc3_calculate_inp_outp_len (dev_num, btArray/*VPC3_GET_CFG_BUF_PTR(dev_num)*/, VPC3_GET_CFG_LEN(dev_num) ) )
- {
- // TRACE("Update Cfg Fail. ");
- #ifdef DP_MSAC_C1
- msac_c1_do_cfg_not_ok(dev_num);
- #endif
- dp_sys[dev_num].vpc3_con = VPC3_SET_CFG_DATA_NOT_OK(dev_num);
- DP_WriteDebugBuffer__(dev_num, DP_INTERRUPT_CFG__, 0x55, 0 );
- }//if( DP_OK != vpc3_calculate_inp_outp_len (dev_num,cfg_ptr,VPC3_GET_CFG_LEN(dev_num)) )
- else
- {
- // set IO-Length
- vpc3_set_io_data_len(dev_num);
- #ifdef DP_MSAC_C1
- msac_c1_do_cfg_ok(dev_num);
- #endif
- dp_sys[dev_num].vpc3_con = VPC3_SET_CFG_DATA_UPDATE(dev_num);
- DP_WriteDebugBuffer__(dev_num, DP_INTERRUPT_CFG__, 0x66, 0 );
- }//else of if(DP_OK != vpc3_calculate_inp_outp_len (dev_num,cfg_ptr,VPC3_GET_CFG_LEN(dev_num)) )
- break;
- }//case VPC3_CFG_UPDATE:
- default:
- {
- break;
- }//default:
- }//switch(user_chk_new_cfg_data(dev_num) )
- }
- while ( dp_sys[dev_num].vpc3_con == VPC3_CFG_CONFLICT );
- }//if(VPC3_GET_IND_NEW_CFG_DATA(dev_num))
- #endif//#if(ISR_ENABLE_VPC3_INT_NEW_CFG_DATA == 1 )
- /*-----------------------------------------------------------------------*/
- /* IND_GO_LEAVE_DATA_EX */
- /*-----------------------------------------------------------------------*/
- #if( ISR_ENABLE_VPC3_INT_GO_LEAVE_DATA_EX == 1 )
- if(VPC3_GET_IND_GO_LEAVE_DATA_EX(dev_num))
- {
- logMsg("GO_LEAVE_DATA_EX!n",0,0,0,0,0,0);
- #ifdef DP_MSAC_C1
- msac_c1_leave_dx(dev_num);
- #endif
- user_isr_go_leave_data_ex(dev_num);
- VPC3_CON_IND_GO_LEAVE_DATA_EX(dev_num);
- }
- #endif//#if(ISR_ENABLE_VPC3_INT_GO_LEAVE_DATA_EX == 1 )
- /*-----------------------------------------------------------------------*/
- /* IND_DX_OUT */
- /*-----------------------------------------------------------------------*/
- #if( ISR_ENABLE_VPC3_INT_DX_OUT == 1 )
- if (VPC3_GET_IND_DX_OUT(dev_num))
- {
- //logMsg("VPC3_GET_IND_DX_OUT!n",0,0,0,0,0,0);
- #ifdef DP_MSAC_C1
- msac_c1_check_ind_dx_out(dev_num);
- #endif
- user_isr_dx_out(dev_num);
- VPC3_CON_IND_DX_OUT(dev_num);
- }
- #endif//#if( ISR_ENABLE_VPC3_INT_DX_OUT == 1 )
- /*-----------------------------------------------------------------------*/
- /* IND_DIAG_BUF_CHANGED */
- /*-----------------------------------------------------------------------*/
- #if( ISR_ENABLE_VPC3_INT_DIAG_BUF_CHANGED == 1 )
- if(VPC3_GET_IND_DIAG_BUF_CHANGED(dev_num))
- {
- logMsg("VPC3_GET_IND_DIAG_BUF_CHANGED!n",0,0,0,0,0,0);
- user_isr_diag_buf_changed(dev_num);
- VPC3_CON_IND_DIAG_BUF_CHANGED(dev_num);
- }
- #endif//#if( ISR_ENABLE_VPC3_INT_DIAG_BUF_CHANGED == 1 )
- /*-----------------------------------------------------------------------*/
- /* IND_WD_DP_TIMEOUT */
- /*-----------------------------------------------------------------------*/
- #if( ISR_ENABLE_VPC3_INT_WD_DP_TIMEOUT == 1 )
- if(VPC3_GET_IND_WD_DP_TIMEOUT(dev_num) )
- {
- logMsg("WD_DP_TIMEOUT!n",0,0,0,0,0,0);
- user_isr_new_wd_dp_timeout(dev_num);
- VPC3_CON_IND_WD_DP_TIMEOUT(dev_num); // acknowledge
- }
- #endif//#if(ISR_ENABLE_VPC3_INT_WD_DP_TIMEOUT == 1 )
- /*-----------------------------------------------------------------------*/
- /* IND_MAC_RESET */
- /*-----------------------------------------------------------------------*/
- #if( ISR_ENABLE_VPC3_INT_MAC_RESET == 1 )
- if(VPC3_GET_IND_MAC_RESET(dev_num))
- {
- logMsg("VPC3_GET_IND_MAC_RESET!n",0,0,0,0,0,0);
- user_isr_mac_reset(dev_num);
- VPC3_CON_IND_MAC_RESET(dev_num);
- }
- #endif//#if(ISR_ENABLE_VPC3_INT_MAC_RESET == 1 )
- /*-----------------------------------------------------------------------*/
- /* IND_BAUDRATE_DETECT */
- /*-----------------------------------------------------------------------*/
- #if(ISR_ENABLE_VPC3_INT_BAUDRATE_DETECT == 1 )
- if(VPC3_GET_IND_BAUDRATE_DETECT(dev_num))
- {
- logMsg("VPC3_GET_IND_BAUDRATE_DETECT!n",0,0,0,0,0,0);
- #ifdef DP_MSAC_C2
- msac_c2_set_timeout(dev_num);
- #endif
- user_isr_baudrate_detect(dev_num);
- VPC3_CON_IND_BAUDRATE_DETECT(dev_num);
- }
- #endif//#if(ISR_ENABLE_VPC3_INT_BAUDRATE_DETECT == 1 )
- /*-----------------------------------------------------------------------*/
- /* IND_NEW_GC_COMMAND */
- /*-----------------------------------------------------------------------*/
- #if(ISR_ENABLE_VPC3_INT_NEW_GC_COMMAND == 1 )
- if(VPC3_GET_IND_NEW_GC_COMMAND(dev_num))
- {
- user_isr_new_gc_command(dev_num);
- VPC3_CON_IND_NEW_GC_COMMAND(dev_num);
- }
- #endif//#if(ISR_ENABLE_VPC3_INT_NEW_GC_COMMAND == 1 )
- /*-----------------------------------------------------------------------*/
- /* IND_NEW_SSA_DATA */
- /*-----------------------------------------------------------------------*/
- #if(ISR_ENABLE_VPC3_INT_NEW_SSA_DATA == 1 )
- if(VPC3_GET_IND_NEW_SSA_DATA(dev_num))
- {
- logMsg("VPC3_GET_IND_NEW_SSA_DATA!n",0,0,0,0,0,0);
- user_isr_new_ssa_data(dev_num);
- dp_sys[dev_num].vpc3_con = VPC3_FREE_SSA_BUF(dev_num); //release the Set Slave Address buffer
- VPC3_CON_IND_NEW_SSA_DATA(dev_num);
- }
- #endif//#if(ISR_ENABLE_VPC3_INT_NEW_SSA_DATA == 1 )
- /*-----------------------------------------------------------------------*/
- /* IND_USER_TIMER_CLOCK */
- /*-----------------------------------------------------------------------*/
- #if(ISR_ENABLE_VPC3_INT_USER_TIMER_CLOCK == 1 )
- if(VPC3_GET_IND_USER_TIMER_CLOCK(dev_num) )
- {
- user_isr_user_timer_clock(dev_num);
- #ifdef DP_MSAC_C2
- msac_c2_timer_tick_10msec(dev_num);
- #endif//#ifdef DP_MSAC_C2
- VPC3_CON_IND_USER_TIMER_CLOCK(dev_num);
- }//if(VPC3_GET_IND_USER_TIMER_CLOCK(dev_num) )
- #endif//#if(ISR_ENABLE_VPC3_INT_USER_TIMER_CLOCK == 1 )
- #ifdef DP_SUBSCRIBER
- /*-------------------------------------------------------------------*/
- /* IND_DXB_OUT */
- /*-------------------------------------------------------------------*/
- #if(ISR_ENABLE_VPC3_INT_DXB_OUT == 1 )
- if (VPC3_GET_IND_DXB_OUT(dev_num))
- {
- user_isr_dxb_out(dev_num);
- VPC3_CON_IND_DXB_OUT(dev_num);
- }
- #endif//#if(ISR_ENABLE_VPC3_INT_DXB_OUT == 1 )
- /*-------------------------------------------------------------------*/
- /* IND_DXB_LINK_ERROR */
- /*-------------------------------------------------------------------*/
- #if(ISR_ENABLE_VPC3_INT_DXB_LINK_ERROR == 1 )
- if (VPC3_GET_IND_DXB_LINK_ERROR(dev_num))
- {
- user_isr_dxb_link_error(dev_num);
- VPC3_CON_IND_DXB_LINK_ERROR(dev_num);
- }
- #endif//#if( ISR_ENABLE_VPC3_INT_DXB_LINK_ERROR == 1 )
- #endif//#ifdef DP_SUBSCRIBER
- #ifdef DP_FDL
- /*-------------------------------------------------------------------*/
- /* IND_REQ_PDU */
- /*-------------------------------------------------------------------*/
- #if(ISR_ENABLE_VPC3_INT_FDL_IND == 1 )
- if(VPC3_GET_IND_FDL_IND(dev_num) )
- {
- logMsg("DPV1-----step4---1,dev_num=%d!n",dev_num,0,0,0,0,0);
- if(!VPC3_GET_IND_POLL_END_IND(dev_num) )
- {
- logMsg("DPV1-----step4---2,dev_num=%d!n",dev_num,0,0,0,0,0);
- VPC3_CON_IND_FDL_IND(dev_num);
- fdl_mac_indication(dev_num);
- }
- }
- #endif//#if(ISR_ENABLE_VPC3_INT_FDL_IND == 1 )
- /*-------------------------------------------------------------------*/
- /* IND_POLL_END */
- /*-------------------------------------------------------------------*/
- #if(ISR_ENABLE_VPC3_INT_POLL_END_IND == 1 )
- if(VPC3_GET_IND_POLL_END_IND(dev_num) )
- {
- logMsg("VPC3_GET_IND_POLL_END_IND!n",0,0,0,0,0,0);
- VPC3_CON_IND_POLL_END_IND(dev_num);
- fdl_flc_indication(dev_num);
- }
- #endif//#if(ISR_ENABLE_VPC3_INT_POLL_END_IND == 1 )
- #endif//#ifdef DP_FDL
- /*-----------------------------------------------------------------------*/
- /* reset interrupt line */
- /*-----------------------------------------------------------------------*/
- // VPC3_SET_EOI(dev_num);
- }//void vpc3_netb_isr()
- /*****************************************************************************/
- /* Copyright (C) profichip GmbH 2004. Confidential. */
- /*****************************************************************************/
- SECTION_DEF_CommuCode void vpc3_isr(int dev_num)
- {
- if(dev_num == NET_A)
- vpc3_neta_isr(dev_num);
- else
- vpc3_netb_isr(dev_num);
- }