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

C/C++

  1. /***********************  Filename: dp_isr.c  ********************************/
  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. /* Function:       interrupt service routine for VPC3+                       */
  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.   - function prototypes
  27.   - data structures
  28.   - internal functions
  29. */
  30. /*****************************************************************************/
  31. /* include hierarchy */
  32. #include "..dp_incplatform.h"
  33. #include "..dp_incdp_inc.h"
  34. //#include "E5_Inc.h"
  35. //void ClockSyncProcInADInt(uint8 dev_num)
  36. //{
  37. //     /*-----------------------------------------------------------------------*/
  38. //     /* IND_MAC_RESET                                                         */
  39. //     /*-----------------------------------------------------------------------*/
  40. //     #if( ISR_ENABLE_VPC3_INT_MAC_RESET == 1 )
  41. //         if(VPC3_GET_IND_MAC_RESET(dev_num))
  42. //         {
  43. //  logMsg("VPC3_GET_IND_MAC_RESET!n",0,0,0,0,0,0);
  44. //             user_isr_mac_reset(dev_num);
  45. //             VPC3_CON_IND_MAC_RESET(dev_num);
  46. //         }
  47. //     #endif//#if(ISR_ENABLE_VPC3_INT_MAC_RESET == 1 )
  48. //}
  49. /*---------------------------------------------------------------------------*/
  50. /* dp interrupt service routine                                              */
  51. /*---------------------------------------------------------------------------*/
  52. SECTION_DEF_CommuCode void vpc3_neta_isr(int dev_num)
  53. {
  54. // UBYTE dev_num = NET_A;
  55. int i;
  56. UBYTE btArray[CFG_BUFSIZE];
  57. UWORD* pSrcAddr;
  58. DP_WriteDebugBuffer__(dev_num, DP_INTERRUPT__, p_Vpc3[dev_num]->isreg.rd.int_reg2, p_Vpc3[dev_num]->isreg.rd.int_reg1 );
  59. //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);
  60.     /*-----------------------------------------------------------------------*/
  61.     /* IND_NEW_PRM_DATA                                                      */
  62.     /*-----------------------------------------------------------------------*/
  63.     #if(ISR_ENABLE_VPC3_INT_NEW_PRM_DATA == 1 )
  64.         if(VPC3_GET_IND_NEW_PRM_DATA(dev_num))
  65.         {
  66. logMsg("NEW_PRM_DATA!n",0,0,0,0,0,0);
  67. DP_WriteDebugBuffer__(dev_num, DP_INTERRUPT_PRM__, 0, 0 );
  68.             
  69.             dp_sys[dev_num].vpc3_con = VPC3_PRM_FINISHED;
  70.             do
  71.             {
  72.                 if(user_chk_new_prm_data(dev_num, VPC3_GET_PRM_BUF_PTR(dev_num), VPC3_GET_PRM_LEN(dev_num) ) == DP_OK )
  73.                 {
  74.                     #ifdef DP_MSAC_C1
  75.                         msac_c1_check_ind_new_prm_data(dev_num);
  76.                     #endif
  77.                     dp_sys[dev_num].vpc3_con = VPC3_SET_PRM_DATA_OK(dev_num);
  78. DP_WriteDebugBuffer__(dev_num, DP_INTERRUPT_PRM__, 0x33, 0 );
  79.                 }//if(user_chk_new_prm_data(dev_num, VPC3_GET_PRM_BUF_PTR(dev_num), VPC3_GET_PRM_LEN(dev_num) ) == DP_OK )
  80.                 else
  81.                 {
  82.                     dp_sys[dev_num].vpc3_con = VPC3_SET_PRM_DATA_NOT_OK(dev_num);
  83. DP_WriteDebugBuffer__(dev_num, DP_INTERRUPT_PRM__, 0x55, 0 );
  84.                 }//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 )
  85.             }
  86.             while(dp_sys[dev_num].vpc3_con == VPC3_PRM_CONFLICT );
  87.         }//if(VPC3_GET_IND_NEW_PRM_DATA(dev_num))
  88.     #endif//#if(ISR_ENABLE_VPC3_INT_NEW_PRM_DATA == 1 )
  89.     /*-----------------------------------------------------------------------*/
  90.     /* IND_NEW_EXT_PRM_DATA                                                  */
  91.     /*-----------------------------------------------------------------------*/
  92.     #if( ISR_ENABLE_VPC3_INT_NEW_EXT_PRM_DATA == 1 )
  93.         if(VPC3_GET_IND_NEW_EXT_PRM_DATA(dev_num))
  94.         {
  95.             dp_sys[dev_num].vpc3_con = VPC3_PRM_FINISHED;
  96.             do
  97.             {
  98.                 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 )
  99.                 {
  100.                     dp_sys[dev_num].vpc3_con = VPC3_SET_PRM_DATA_OK(dev_num);
  101.                 }//if( user_chk_new_ext_prm_data(dev_num, VPC3_GET_PRM_BUF_PTR(dev_num), VPC3_GET_PRM_LEN(dev_num) ) == DP_OK )
  102.                 else
  103.                 {
  104.                     dp_sys[dev_num].vpc3_con = VPC3_SET_PRM_DATA_NOT_OK(dev_num);
  105.                 }//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 )
  106.             }
  107.             while(dp_sys[dev_num].vpc3_con == VPC3_PRM_CONFLICT );
  108.         }//if(VPC3_GET_IND_NEW_EXT_PRM_DATA(dev_num))
  109.     #endif//#if(ISR_ENABLE_VPC3_INT_NEW_EXT_PRM_DATA == 1 )
  110.     /*-----------------------------------------------------------------------*/
  111.     /* check config data , application specific!                             */
  112.     /*-----------------------------------------------------------------------*/
  113.     #if( ISR_ENABLE_VPC3_INT_NEW_CFG_DATA == 1 )
  114.         if(VPC3_GET_IND_NEW_CFG_DATA(dev_num))
  115.         {
  116. logMsg("NEW_CFG_DATA!n",0,0,0,0,0,0);
  117. DP_WriteDebugBuffer__(dev_num, DP_INTERRUPT_CFG__, 0, 0 );
  118.             dp_sys[dev_num].vpc3_con = VPC3_CFG_FINISHED;
  119.             do
  120.             {
  121.                 switch(user_chk_new_cfg_data(dev_num) )
  122.                 {
  123.                     case VPC3_CFG_OK:
  124.                     {
  125.                         #ifdef DP_MSAC_C1
  126.                             msac_c1_do_cfg_ok(dev_num);
  127.                         #endif
  128.                         dp_sys[dev_num].vpc3_con = VPC3_SET_CFG_DATA_OK(dev_num);
  129. DP_WriteDebugBuffer__(dev_num, DP_INTERRUPT_CFG__, 0x33, 0 );
  130.                         break;
  131.                     }//case VPC3_CFG_OK:
  132.                     case VPC3_CFG_FAULT:
  133.                     {
  134.                         #ifdef DP_MSAC_C1
  135.                             msac_c1_do_cfg_not_ok(dev_num);
  136.                         #endif
  137.                         dp_sys[dev_num].vpc3_con = VPC3_SET_CFG_DATA_NOT_OK(dev_num);
  138. DP_WriteDebugBuffer__(dev_num, DP_INTERRUPT_CFG__, 0x44, 0 );
  139.                         break;
  140.                     }//case VPC3_CFG_FAULT:
  141.                     case VPC3_CFG_UPDATE:
  142.                     {
  143.                         // Calculate the length of the input and output using the configuration bytes
  144. //wusenlin 将配置数据转化成单字节方式
  145. pSrcAddr = (UWORD*) VPC3_GET_CFG_BUF_PTR(dev_num);
  146.                         for(i=0; i<VPC3_GET_CFG_LEN(dev_num); i++)
  147. {
  148. btArray[i] = BFWORD2BYTE(pSrcAddr[i]);
  149. }
  150.                         if( DP_OK != vpc3_calculate_inp_outp_len (dev_num, btArray/*VPC3_GET_CFG_BUF_PTR(dev_num)*/, VPC3_GET_CFG_LEN(dev_num) ) )
  151.                         {
  152. // TRACE("Update Cfg Fail. ");
  153.                             #ifdef DP_MSAC_C1
  154.                                 msac_c1_do_cfg_not_ok(dev_num);
  155.                             #endif
  156.                             dp_sys[dev_num].vpc3_con = VPC3_SET_CFG_DATA_NOT_OK(dev_num);
  157.     DP_WriteDebugBuffer__(dev_num, DP_INTERRUPT_CFG__, 0x55, 0 );
  158.                         }//if( DP_OK != vpc3_calculate_inp_outp_len (dev_num,cfg_ptr,VPC3_GET_CFG_LEN(dev_num)) )
  159.                         else
  160.                         {
  161.                             // set IO-Length
  162.                             vpc3_set_io_data_len(dev_num);
  163.                             #ifdef DP_MSAC_C1
  164.                                 msac_c1_do_cfg_ok(dev_num);
  165.                             #endif
  166.                             dp_sys[dev_num].vpc3_con = VPC3_SET_CFG_DATA_UPDATE(dev_num);
  167. DP_WriteDebugBuffer__(dev_num, DP_INTERRUPT_CFG__, 0x66, 0 );
  168.                         }//else of if(DP_OK != vpc3_calculate_inp_outp_len (dev_num,cfg_ptr,VPC3_GET_CFG_LEN(dev_num)) )
  169.                         break;
  170.                     }//case VPC3_CFG_UPDATE:
  171.                     default:
  172.                     {
  173.                         break;
  174.                     }//default:
  175.                 }//switch(user_chk_new_cfg_data(dev_num) )
  176.             }
  177.             while ( dp_sys[dev_num].vpc3_con == VPC3_CFG_CONFLICT );
  178.         }//if(VPC3_GET_IND_NEW_CFG_DATA(dev_num))
  179.     #endif//#if(ISR_ENABLE_VPC3_INT_NEW_CFG_DATA == 1 )
  180.     /*-----------------------------------------------------------------------*/
  181.     /* IND_GO_LEAVE_DATA_EX                                                  */
  182.     /*-----------------------------------------------------------------------*/
  183.     #if( ISR_ENABLE_VPC3_INT_GO_LEAVE_DATA_EX == 1 )
  184.         if(VPC3_GET_IND_GO_LEAVE_DATA_EX(dev_num))
  185.         {
  186. logMsg("GO_LEAVE_DATA_EX!n",0,0,0,0,0,0);
  187.             #ifdef DP_MSAC_C1
  188.                 msac_c1_leave_dx(dev_num);
  189.             #endif
  190.             user_isr_go_leave_data_ex(dev_num);
  191.             VPC3_CON_IND_GO_LEAVE_DATA_EX(dev_num);
  192.         }
  193.     #endif//#if(ISR_ENABLE_VPC3_INT_GO_LEAVE_DATA_EX == 1 )
  194.     /*-----------------------------------------------------------------------*/
  195.     /* IND_DX_OUT                                                            */
  196.     /*-----------------------------------------------------------------------*/
  197.     #if( ISR_ENABLE_VPC3_INT_DX_OUT == 1 )
  198.         if (VPC3_GET_IND_DX_OUT(dev_num))
  199.         {
  200. //logMsg("VPC3_GET_IND_DX_OUT!n",0,0,0,0,0,0);
  201.             #ifdef DP_MSAC_C1
  202.                 msac_c1_check_ind_dx_out(dev_num);
  203.             #endif
  204.             user_isr_dx_out(dev_num);
  205.             VPC3_CON_IND_DX_OUT(dev_num);
  206.         }
  207.     #endif//#if( ISR_ENABLE_VPC3_INT_DX_OUT == 1 )
  208.     /*-----------------------------------------------------------------------*/
  209.     /* IND_DIAG_BUF_CHANGED                                                  */
  210.     /*-----------------------------------------------------------------------*/
  211.     #if( ISR_ENABLE_VPC3_INT_DIAG_BUF_CHANGED == 1 )
  212.         if(VPC3_GET_IND_DIAG_BUF_CHANGED(dev_num))
  213.         {
  214. logMsg("VPC3_GET_IND_DIAG_BUF_CHANGED!n",0,0,0,0,0,0);
  215.             user_isr_diag_buf_changed(dev_num);
  216.             VPC3_CON_IND_DIAG_BUF_CHANGED(dev_num);
  217.         }
  218.     #endif//#if( ISR_ENABLE_VPC3_INT_DIAG_BUF_CHANGED == 1 )
  219.     /*-----------------------------------------------------------------------*/
  220.     /* IND_WD_DP_TIMEOUT                                                     */
  221.     /*-----------------------------------------------------------------------*/
  222.     #if( ISR_ENABLE_VPC3_INT_WD_DP_TIMEOUT == 1 )
  223.         if(VPC3_GET_IND_WD_DP_TIMEOUT(dev_num) )
  224.         {
  225. logMsg("WD_DP_TIMEOUT!n",0,0,0,0,0,0);
  226.             user_isr_new_wd_dp_timeout(dev_num);
  227.             VPC3_CON_IND_WD_DP_TIMEOUT(dev_num);    // acknowledge
  228.         }
  229.     #endif//#if(ISR_ENABLE_VPC3_INT_WD_DP_TIMEOUT == 1 )
  230.     /*-----------------------------------------------------------------------*/
  231.     /* IND_MAC_RESET                                                         */
  232.     /*-----------------------------------------------------------------------*/
  233.     #if( ISR_ENABLE_VPC3_INT_MAC_RESET == 1 )
  234.         if(VPC3_GET_IND_MAC_RESET(dev_num))
  235.         {
  236. logMsg("VPC3_GET_IND_MAC_RESET!n",0,0,0,0,0,0);
  237.             user_isr_mac_reset(dev_num);
  238.             VPC3_CON_IND_MAC_RESET(dev_num);
  239.         }
  240.     #endif//#if(ISR_ENABLE_VPC3_INT_MAC_RESET == 1 )
  241.     /*-----------------------------------------------------------------------*/
  242.     /* IND_BAUDRATE_DETECT                                                   */
  243.     /*-----------------------------------------------------------------------*/
  244.     #if(ISR_ENABLE_VPC3_INT_BAUDRATE_DETECT == 1 )
  245.         if(VPC3_GET_IND_BAUDRATE_DETECT(dev_num))
  246.         {
  247. logMsg("VPC3_GET_IND_BAUDRATE_DETECT!n",0,0,0,0,0,0);
  248.             #ifdef DP_MSAC_C2
  249.                 msac_c2_set_timeout(dev_num);
  250.             #endif
  251.             user_isr_baudrate_detect(dev_num);
  252.             VPC3_CON_IND_BAUDRATE_DETECT(dev_num);
  253.         }
  254.     #endif//#if(ISR_ENABLE_VPC3_INT_BAUDRATE_DETECT == 1 )
  255.     /*-----------------------------------------------------------------------*/
  256.     /* IND_NEW_GC_COMMAND                                                    */
  257.     /*-----------------------------------------------------------------------*/
  258.     #if(ISR_ENABLE_VPC3_INT_NEW_GC_COMMAND == 1 )
  259.         if(VPC3_GET_IND_NEW_GC_COMMAND(dev_num))
  260.         {
  261.             user_isr_new_gc_command(dev_num);
  262.             VPC3_CON_IND_NEW_GC_COMMAND(dev_num);
  263.         }
  264.     #endif//#if(ISR_ENABLE_VPC3_INT_NEW_GC_COMMAND == 1 )
  265.     /*-----------------------------------------------------------------------*/
  266.     /* IND_NEW_SSA_DATA                                                      */
  267.     /*-----------------------------------------------------------------------*/
  268.     #if(ISR_ENABLE_VPC3_INT_NEW_SSA_DATA == 1 )
  269.         if(VPC3_GET_IND_NEW_SSA_DATA(dev_num))
  270.         {
  271. logMsg("VPC3_GET_IND_NEW_SSA_DATA!n",0,0,0,0,0,0);
  272.             user_isr_new_ssa_data(dev_num);
  273.             dp_sys[dev_num].vpc3_con = VPC3_FREE_SSA_BUF(dev_num); //release the Set Slave Address buffer
  274.             VPC3_CON_IND_NEW_SSA_DATA(dev_num);
  275.         }
  276.     #endif//#if(ISR_ENABLE_VPC3_INT_NEW_SSA_DATA == 1 )
  277.     /*-----------------------------------------------------------------------*/
  278.     /* IND_USER_TIMER_CLOCK                                                  */
  279.     /*-----------------------------------------------------------------------*/
  280.     #if(ISR_ENABLE_VPC3_INT_USER_TIMER_CLOCK == 1 )
  281.         if(VPC3_GET_IND_USER_TIMER_CLOCK(dev_num) )
  282.         {
  283.             user_isr_user_timer_clock(dev_num);
  284.             #ifdef DP_MSAC_C2
  285.                 msac_c2_timer_tick_10msec(dev_num);
  286.             #endif//#ifdef DP_MSAC_C2
  287.             VPC3_CON_IND_USER_TIMER_CLOCK(dev_num);
  288.         }//if(VPC3_GET_IND_USER_TIMER_CLOCK(dev_num) )
  289.     #endif//#if(ISR_ENABLE_VPC3_INT_USER_TIMER_CLOCK == 1 )
  290.     #ifdef DP_SUBSCRIBER
  291.         /*-------------------------------------------------------------------*/
  292.         /* IND_DXB_OUT                                                       */
  293.         /*-------------------------------------------------------------------*/
  294.         #if(ISR_ENABLE_VPC3_INT_DXB_OUT == 1 )
  295.             if (VPC3_GET_IND_DXB_OUT(dev_num))
  296.             {
  297.                 user_isr_dxb_out(dev_num);
  298.                 VPC3_CON_IND_DXB_OUT(dev_num);
  299.             }
  300.         #endif//#if(ISR_ENABLE_VPC3_INT_DXB_OUT == 1 )
  301.         /*-------------------------------------------------------------------*/
  302.         /* IND_DXB_LINK_ERROR                                                */
  303.         /*-------------------------------------------------------------------*/
  304.         #if(ISR_ENABLE_VPC3_INT_DXB_LINK_ERROR == 1 )
  305.             if (VPC3_GET_IND_DXB_LINK_ERROR(dev_num))
  306.             {
  307.                 user_isr_dxb_link_error(dev_num);
  308.                 VPC3_CON_IND_DXB_LINK_ERROR(dev_num);
  309.             }
  310.         #endif//#if( ISR_ENABLE_VPC3_INT_DXB_LINK_ERROR == 1 )
  311.     #endif//#ifdef DP_SUBSCRIBER
  312.     #ifdef DP_FDL
  313.         /*-------------------------------------------------------------------*/
  314.         /* IND_REQ_PDU                                                       */
  315.         /*-------------------------------------------------------------------*/
  316.         #if(ISR_ENABLE_VPC3_INT_FDL_IND == 1 )
  317.             if(VPC3_GET_IND_FDL_IND(dev_num) )
  318.             {
  319. logMsg("DPV1-----step4---1,dev_num=%d!n",dev_num,0,0,0,0,0);
  320.                 if(!VPC3_GET_IND_POLL_END_IND(dev_num) )
  321.                 {
  322. logMsg("DPV1-----step4---2,dev_num=%d!n",dev_num,0,0,0,0,0);
  323.                     VPC3_CON_IND_FDL_IND(dev_num);
  324.                     fdl_mac_indication(dev_num);
  325.                 }
  326.             }
  327.         #endif//#if(ISR_ENABLE_VPC3_INT_FDL_IND == 1 )
  328.         /*-------------------------------------------------------------------*/
  329.         /* IND_POLL_END                                                      */
  330.         /*-------------------------------------------------------------------*/
  331.         #if(ISR_ENABLE_VPC3_INT_POLL_END_IND == 1 )
  332.             if(VPC3_GET_IND_POLL_END_IND(dev_num) )
  333.             {
  334. logMsg("VPC3_GET_IND_POLL_END_IND!n",0,0,0,0,0,0);
  335.                 VPC3_CON_IND_POLL_END_IND(dev_num);
  336.                 fdl_flc_indication(dev_num);
  337.             }
  338.         #endif//#if(ISR_ENABLE_VPC3_INT_POLL_END_IND == 1 )
  339.     #endif//#ifdef DP_FDL
  340.     /*-----------------------------------------------------------------------*/
  341.     /* reset interrupt line                                                  */
  342.     /*-----------------------------------------------------------------------*/
  343.  //   VPC3_SET_EOI(dev_num);
  344. }//void vpc3_neta_isr()
  345. SECTION_DEF_CommuCode void vpc3_netb_isr(int dev_num)
  346. {
  347. // UBYTE dev_num = NET_B;
  348. int i;
  349. UBYTE btArray[CFG_BUFSIZE];
  350. UWORD* pSrcAddr;
  351. DP_WriteDebugBuffer__(dev_num, DP_INTERRUPT__, p_Vpc3[dev_num]->isreg.rd.int_reg2, p_Vpc3[dev_num]->isreg.rd.int_reg1 );
  352. //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);
  353.     /*-----------------------------------------------------------------------*/
  354.     /* IND_NEW_PRM_DATA                                                      */
  355.     /*-----------------------------------------------------------------------*/
  356.     #if(ISR_ENABLE_VPC3_INT_NEW_PRM_DATA == 1 )
  357.         if(VPC3_GET_IND_NEW_PRM_DATA(dev_num))
  358.         {
  359. logMsg("NEW_PRM_DATA!n",0,0,0,0,0,0);
  360. DP_WriteDebugBuffer__(dev_num, DP_INTERRUPT_PRM__, 0, 0 );
  361.             
  362.             dp_sys[dev_num].vpc3_con = VPC3_PRM_FINISHED;
  363.             do
  364.             {
  365.                 if(user_chk_new_prm_data(dev_num, VPC3_GET_PRM_BUF_PTR(dev_num), VPC3_GET_PRM_LEN(dev_num) ) == DP_OK )
  366.                 {
  367.                     #ifdef DP_MSAC_C1
  368.                         msac_c1_check_ind_new_prm_data(dev_num);
  369.                     #endif
  370.                     dp_sys[dev_num].vpc3_con = VPC3_SET_PRM_DATA_OK(dev_num);
  371. DP_WriteDebugBuffer__(dev_num, DP_INTERRUPT_PRM__, 0x33, 0 );
  372.                 }//if(user_chk_new_prm_data(dev_num, VPC3_GET_PRM_BUF_PTR(dev_num), VPC3_GET_PRM_LEN(dev_num) ) == DP_OK )
  373.                 else
  374.                 {
  375.                     dp_sys[dev_num].vpc3_con = VPC3_SET_PRM_DATA_NOT_OK(dev_num);
  376. DP_WriteDebugBuffer__(dev_num, DP_INTERRUPT_PRM__, 0x55, 0 );
  377.                 }//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 )
  378.             }
  379.             while(dp_sys[dev_num].vpc3_con == VPC3_PRM_CONFLICT );
  380.         }//if(VPC3_GET_IND_NEW_PRM_DATA(dev_num))
  381.     #endif//#if(ISR_ENABLE_VPC3_INT_NEW_PRM_DATA == 1 )
  382.     /*-----------------------------------------------------------------------*/
  383.     /* IND_NEW_EXT_PRM_DATA                                                  */
  384.     /*-----------------------------------------------------------------------*/
  385.     #if( ISR_ENABLE_VPC3_INT_NEW_EXT_PRM_DATA == 1 )
  386.         if(VPC3_GET_IND_NEW_EXT_PRM_DATA(dev_num))
  387.         {
  388.             dp_sys[dev_num].vpc3_con = VPC3_PRM_FINISHED;
  389.             do
  390.             {
  391.                 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 )
  392.                 {
  393.                     dp_sys[dev_num].vpc3_con = VPC3_SET_PRM_DATA_OK(dev_num);
  394.                 }//if( user_chk_new_ext_prm_data(dev_num, VPC3_GET_PRM_BUF_PTR(dev_num), VPC3_GET_PRM_LEN(dev_num) ) == DP_OK )
  395.                 else
  396.                 {
  397.                     dp_sys[dev_num].vpc3_con = VPC3_SET_PRM_DATA_NOT_OK(dev_num);
  398.                 }//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 )
  399.             }
  400.             while(dp_sys[dev_num].vpc3_con == VPC3_PRM_CONFLICT );
  401.         }//if(VPC3_GET_IND_NEW_EXT_PRM_DATA(dev_num))
  402.     #endif//#if(ISR_ENABLE_VPC3_INT_NEW_EXT_PRM_DATA == 1 )
  403.     /*-----------------------------------------------------------------------*/
  404.     /* check config data , application specific!                             */
  405.     /*-----------------------------------------------------------------------*/
  406.     #if( ISR_ENABLE_VPC3_INT_NEW_CFG_DATA == 1 )
  407.         if(VPC3_GET_IND_NEW_CFG_DATA(dev_num))
  408.         {
  409. logMsg("NEW_CFG_DATA!n",0,0,0,0,0,0);
  410. DP_WriteDebugBuffer__(dev_num, DP_INTERRUPT_CFG__, 0, 0 );
  411.             dp_sys[dev_num].vpc3_con = VPC3_CFG_FINISHED;
  412.             do
  413.             {
  414.                 switch(user_chk_new_cfg_data(dev_num) )
  415.                 {
  416.                     case VPC3_CFG_OK:
  417.                     {
  418.                         #ifdef DP_MSAC_C1
  419.                             msac_c1_do_cfg_ok(dev_num);
  420.                         #endif
  421.                         dp_sys[dev_num].vpc3_con = VPC3_SET_CFG_DATA_OK(dev_num);
  422. DP_WriteDebugBuffer__(dev_num, DP_INTERRUPT_CFG__, 0x33, 0 );
  423.                         break;
  424.                     }//case VPC3_CFG_OK:
  425.                     case VPC3_CFG_FAULT:
  426.                     {
  427.                         #ifdef DP_MSAC_C1
  428.                             msac_c1_do_cfg_not_ok(dev_num);
  429.                         #endif
  430.                         dp_sys[dev_num].vpc3_con = VPC3_SET_CFG_DATA_NOT_OK(dev_num);
  431. DP_WriteDebugBuffer__(dev_num, DP_INTERRUPT_CFG__, 0x44, 0 );
  432.                         break;
  433.                     }//case VPC3_CFG_FAULT:
  434.                     case VPC3_CFG_UPDATE:
  435.                     {
  436.                         // Calculate the length of the input and output using the configuration bytes
  437. //wusenlin 将配置数据转化成单字节方式
  438. pSrcAddr = (UWORD*) VPC3_GET_CFG_BUF_PTR(dev_num);
  439.                         for(i=0; i<VPC3_GET_CFG_LEN(dev_num); i++)
  440. {
  441. btArray[i] = BFWORD2BYTE(pSrcAddr[i]);
  442. }
  443.                         if( DP_OK != vpc3_calculate_inp_outp_len (dev_num, btArray/*VPC3_GET_CFG_BUF_PTR(dev_num)*/, VPC3_GET_CFG_LEN(dev_num) ) )
  444.                         {
  445. // TRACE("Update Cfg Fail. ");
  446.                             #ifdef DP_MSAC_C1
  447.                                 msac_c1_do_cfg_not_ok(dev_num);
  448.                             #endif
  449.                             dp_sys[dev_num].vpc3_con = VPC3_SET_CFG_DATA_NOT_OK(dev_num);
  450.     DP_WriteDebugBuffer__(dev_num, DP_INTERRUPT_CFG__, 0x55, 0 );
  451.                         }//if( DP_OK != vpc3_calculate_inp_outp_len (dev_num,cfg_ptr,VPC3_GET_CFG_LEN(dev_num)) )
  452.                         else
  453.                         {
  454.                             // set IO-Length
  455.                             vpc3_set_io_data_len(dev_num);
  456.                             #ifdef DP_MSAC_C1
  457.                                 msac_c1_do_cfg_ok(dev_num);
  458.                             #endif
  459.                             dp_sys[dev_num].vpc3_con = VPC3_SET_CFG_DATA_UPDATE(dev_num);
  460. DP_WriteDebugBuffer__(dev_num, DP_INTERRUPT_CFG__, 0x66, 0 );
  461.                         }//else of if(DP_OK != vpc3_calculate_inp_outp_len (dev_num,cfg_ptr,VPC3_GET_CFG_LEN(dev_num)) )
  462.                         break;
  463.                     }//case VPC3_CFG_UPDATE:
  464.                     default:
  465.                     {
  466.                         break;
  467.                     }//default:
  468.                 }//switch(user_chk_new_cfg_data(dev_num) )
  469.             }
  470.             while ( dp_sys[dev_num].vpc3_con == VPC3_CFG_CONFLICT );
  471.         }//if(VPC3_GET_IND_NEW_CFG_DATA(dev_num))
  472.     #endif//#if(ISR_ENABLE_VPC3_INT_NEW_CFG_DATA == 1 )
  473.     /*-----------------------------------------------------------------------*/
  474.     /* IND_GO_LEAVE_DATA_EX                                                  */
  475.     /*-----------------------------------------------------------------------*/
  476.     #if( ISR_ENABLE_VPC3_INT_GO_LEAVE_DATA_EX == 1 )
  477.         if(VPC3_GET_IND_GO_LEAVE_DATA_EX(dev_num))
  478.         {
  479. logMsg("GO_LEAVE_DATA_EX!n",0,0,0,0,0,0);
  480.             #ifdef DP_MSAC_C1
  481.                 msac_c1_leave_dx(dev_num);
  482.             #endif
  483.             user_isr_go_leave_data_ex(dev_num);
  484.             VPC3_CON_IND_GO_LEAVE_DATA_EX(dev_num);
  485.         }
  486.     #endif//#if(ISR_ENABLE_VPC3_INT_GO_LEAVE_DATA_EX == 1 )
  487.     /*-----------------------------------------------------------------------*/
  488.     /* IND_DX_OUT                                                            */
  489.     /*-----------------------------------------------------------------------*/
  490.     #if( ISR_ENABLE_VPC3_INT_DX_OUT == 1 )
  491.         if (VPC3_GET_IND_DX_OUT(dev_num))
  492.         {
  493. //logMsg("VPC3_GET_IND_DX_OUT!n",0,0,0,0,0,0);
  494.             #ifdef DP_MSAC_C1
  495.                 msac_c1_check_ind_dx_out(dev_num);
  496.             #endif
  497.             user_isr_dx_out(dev_num);
  498.             VPC3_CON_IND_DX_OUT(dev_num);
  499.         }
  500.     #endif//#if( ISR_ENABLE_VPC3_INT_DX_OUT == 1 )
  501.     /*-----------------------------------------------------------------------*/
  502.     /* IND_DIAG_BUF_CHANGED                                                  */
  503.     /*-----------------------------------------------------------------------*/
  504.     #if( ISR_ENABLE_VPC3_INT_DIAG_BUF_CHANGED == 1 )
  505.         if(VPC3_GET_IND_DIAG_BUF_CHANGED(dev_num))
  506.         {
  507. logMsg("VPC3_GET_IND_DIAG_BUF_CHANGED!n",0,0,0,0,0,0);
  508.             user_isr_diag_buf_changed(dev_num);
  509.             VPC3_CON_IND_DIAG_BUF_CHANGED(dev_num);
  510.         }
  511.     #endif//#if( ISR_ENABLE_VPC3_INT_DIAG_BUF_CHANGED == 1 )
  512.     /*-----------------------------------------------------------------------*/
  513.     /* IND_WD_DP_TIMEOUT                                                     */
  514.     /*-----------------------------------------------------------------------*/
  515.     #if( ISR_ENABLE_VPC3_INT_WD_DP_TIMEOUT == 1 )
  516.         if(VPC3_GET_IND_WD_DP_TIMEOUT(dev_num) )
  517.         {
  518. logMsg("WD_DP_TIMEOUT!n",0,0,0,0,0,0);
  519.             user_isr_new_wd_dp_timeout(dev_num);
  520.             VPC3_CON_IND_WD_DP_TIMEOUT(dev_num);    // acknowledge
  521.         }
  522.     #endif//#if(ISR_ENABLE_VPC3_INT_WD_DP_TIMEOUT == 1 )
  523.     /*-----------------------------------------------------------------------*/
  524.     /* IND_MAC_RESET                                                         */
  525.     /*-----------------------------------------------------------------------*/
  526.     #if( ISR_ENABLE_VPC3_INT_MAC_RESET == 1 )
  527.         if(VPC3_GET_IND_MAC_RESET(dev_num))
  528.         {
  529. logMsg("VPC3_GET_IND_MAC_RESET!n",0,0,0,0,0,0);
  530.             user_isr_mac_reset(dev_num);
  531.             VPC3_CON_IND_MAC_RESET(dev_num);
  532.         }
  533.     #endif//#if(ISR_ENABLE_VPC3_INT_MAC_RESET == 1 )
  534.     /*-----------------------------------------------------------------------*/
  535.     /* IND_BAUDRATE_DETECT                                                   */
  536.     /*-----------------------------------------------------------------------*/
  537.     #if(ISR_ENABLE_VPC3_INT_BAUDRATE_DETECT == 1 )
  538.         if(VPC3_GET_IND_BAUDRATE_DETECT(dev_num))
  539.         {
  540. logMsg("VPC3_GET_IND_BAUDRATE_DETECT!n",0,0,0,0,0,0);
  541.             #ifdef DP_MSAC_C2
  542.                 msac_c2_set_timeout(dev_num);
  543.             #endif
  544.             user_isr_baudrate_detect(dev_num);
  545.             VPC3_CON_IND_BAUDRATE_DETECT(dev_num);
  546.         }
  547.     #endif//#if(ISR_ENABLE_VPC3_INT_BAUDRATE_DETECT == 1 )
  548.     /*-----------------------------------------------------------------------*/
  549.     /* IND_NEW_GC_COMMAND                                                    */
  550.     /*-----------------------------------------------------------------------*/
  551.     #if(ISR_ENABLE_VPC3_INT_NEW_GC_COMMAND == 1 )
  552.         if(VPC3_GET_IND_NEW_GC_COMMAND(dev_num))
  553.         {
  554.             user_isr_new_gc_command(dev_num);
  555.             VPC3_CON_IND_NEW_GC_COMMAND(dev_num);
  556.         }
  557.     #endif//#if(ISR_ENABLE_VPC3_INT_NEW_GC_COMMAND == 1 )
  558.     /*-----------------------------------------------------------------------*/
  559.     /* IND_NEW_SSA_DATA                                                      */
  560.     /*-----------------------------------------------------------------------*/
  561.     #if(ISR_ENABLE_VPC3_INT_NEW_SSA_DATA == 1 )
  562.         if(VPC3_GET_IND_NEW_SSA_DATA(dev_num))
  563.         {
  564. logMsg("VPC3_GET_IND_NEW_SSA_DATA!n",0,0,0,0,0,0);
  565.             user_isr_new_ssa_data(dev_num);
  566.             dp_sys[dev_num].vpc3_con = VPC3_FREE_SSA_BUF(dev_num); //release the Set Slave Address buffer
  567.             VPC3_CON_IND_NEW_SSA_DATA(dev_num);
  568.         }
  569.     #endif//#if(ISR_ENABLE_VPC3_INT_NEW_SSA_DATA == 1 )
  570.     /*-----------------------------------------------------------------------*/
  571.     /* IND_USER_TIMER_CLOCK                                                  */
  572.     /*-----------------------------------------------------------------------*/
  573.     #if(ISR_ENABLE_VPC3_INT_USER_TIMER_CLOCK == 1 )
  574.         if(VPC3_GET_IND_USER_TIMER_CLOCK(dev_num) )
  575.         {
  576.             user_isr_user_timer_clock(dev_num);
  577.             #ifdef DP_MSAC_C2
  578.                 msac_c2_timer_tick_10msec(dev_num);
  579.             #endif//#ifdef DP_MSAC_C2
  580.             VPC3_CON_IND_USER_TIMER_CLOCK(dev_num);
  581.         }//if(VPC3_GET_IND_USER_TIMER_CLOCK(dev_num) )
  582.     #endif//#if(ISR_ENABLE_VPC3_INT_USER_TIMER_CLOCK == 1 )
  583.     #ifdef DP_SUBSCRIBER
  584.         /*-------------------------------------------------------------------*/
  585.         /* IND_DXB_OUT                                                       */
  586.         /*-------------------------------------------------------------------*/
  587.         #if(ISR_ENABLE_VPC3_INT_DXB_OUT == 1 )
  588.             if (VPC3_GET_IND_DXB_OUT(dev_num))
  589.             {
  590.                 user_isr_dxb_out(dev_num);
  591.                 VPC3_CON_IND_DXB_OUT(dev_num);
  592.             }
  593.         #endif//#if(ISR_ENABLE_VPC3_INT_DXB_OUT == 1 )
  594.         /*-------------------------------------------------------------------*/
  595.         /* IND_DXB_LINK_ERROR                                                */
  596.         /*-------------------------------------------------------------------*/
  597.         #if(ISR_ENABLE_VPC3_INT_DXB_LINK_ERROR == 1 )
  598.             if (VPC3_GET_IND_DXB_LINK_ERROR(dev_num))
  599.             {
  600.                 user_isr_dxb_link_error(dev_num);
  601.                 VPC3_CON_IND_DXB_LINK_ERROR(dev_num);
  602.             }
  603.         #endif//#if( ISR_ENABLE_VPC3_INT_DXB_LINK_ERROR == 1 )
  604.     #endif//#ifdef DP_SUBSCRIBER
  605.     #ifdef DP_FDL
  606.         /*-------------------------------------------------------------------*/
  607.         /* IND_REQ_PDU                                                       */
  608.         /*-------------------------------------------------------------------*/
  609.         #if(ISR_ENABLE_VPC3_INT_FDL_IND == 1 )
  610.             if(VPC3_GET_IND_FDL_IND(dev_num) )
  611.             {
  612. logMsg("DPV1-----step4---1,dev_num=%d!n",dev_num,0,0,0,0,0);
  613.                 if(!VPC3_GET_IND_POLL_END_IND(dev_num) )
  614.                 {
  615. logMsg("DPV1-----step4---2,dev_num=%d!n",dev_num,0,0,0,0,0);
  616.                     VPC3_CON_IND_FDL_IND(dev_num);
  617.                     fdl_mac_indication(dev_num);
  618.                 }
  619.             }
  620.         #endif//#if(ISR_ENABLE_VPC3_INT_FDL_IND == 1 )
  621.         /*-------------------------------------------------------------------*/
  622.         /* IND_POLL_END                                                      */
  623.         /*-------------------------------------------------------------------*/
  624.         #if(ISR_ENABLE_VPC3_INT_POLL_END_IND == 1 )
  625.             if(VPC3_GET_IND_POLL_END_IND(dev_num) )
  626.             {
  627. logMsg("VPC3_GET_IND_POLL_END_IND!n",0,0,0,0,0,0);
  628.                 VPC3_CON_IND_POLL_END_IND(dev_num);
  629.                 fdl_flc_indication(dev_num);
  630.             }
  631.         #endif//#if(ISR_ENABLE_VPC3_INT_POLL_END_IND == 1 )
  632.     #endif//#ifdef DP_FDL
  633.     /*-----------------------------------------------------------------------*/
  634.     /* reset interrupt line                                                  */
  635.     /*-----------------------------------------------------------------------*/
  636. //    VPC3_SET_EOI(dev_num);
  637. }//void vpc3_netb_isr()
  638. /*****************************************************************************/
  639. /*  Copyright (C) profichip GmbH 2004. Confidential.                         */
  640. /*****************************************************************************/
  641. SECTION_DEF_CommuCode void vpc3_isr(int dev_num)
  642. {
  643. if(dev_num == NET_A)
  644. vpc3_neta_isr(dev_num);
  645. else
  646. vpc3_netb_isr(dev_num);
  647. }