⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 zl5011xinterrupts.c

📁 Zalink50114----TDMoIP芯片驱动源码
💻 C
📖 第 1 页 / 共 5 页
字号:
            /* Map external port number to internal port connected to it */
            status = zl5011xPkiExternalPortToInternal(zl5011xParams, &internalPortNum, par->portNumber);
            if (status == ZL5011X_OK)
            {
               status = zl5011xPkiEnablePcsInterrupt(zl5011xParams, internalPortNum);
            }
            intSrc = apiSrc;
            break;

         case ZL5011X_WAN_RX_ERROR_INTERRUPT:
            status = zl5011xPlaEnableInterrupts(zl5011xParams, par->context, par->interruptBits);
            break;

         case ZL5011X_WAN_RX_TASK_OVERFLOW_INTERRUPT:
            status = zl5011xPlaEnableTmiOverflowIntr(zl5011xParams, par->interruptBits);
            break;

         case ZL5011X_WAN_TX_INFO_INTERRUPT:
         case ZL5011X_WAN_TX_ERROR_INTERRUPT:
            status = zl5011xTfmEnableInterrupts(zl5011xParams, par->context, par->interruptBits);
            break;

         case ZL5011X_WAN_TX_QUEUE_INTERRUPT:
            status = zl5011xTfqEnableInterrupts(zl5011xParams, par->context, par->interruptBits);
            break;

         case ZL5011X_WAN_TX_GRANULES_INTERRUPT:
            status = zl5011xTfqEnableGranuleThresholdIntr(zl5011xParams, par->interruptBits);
            break;

         case ZL5011X_TASK_MSG_INTERRUPT:
            status = zl5011xTmEnableInterrupts(zl5011xParams, par->interruptBits);
            break;

         case ZL5011X_HOST_OVERFLOW_INTERRUPT:
            status = zl5011xCpqEnableInterrupts(zl5011xParams, par->interruptBits);
            break;

         case ZL5011X_PACKET_TX_INTERRUPT:
         case ZL5011X_MEMORY_PARITY_INTERRUPT:
         case ZL5011X_WAN_TX_ERROR_OVERFLOW_INTERRUPT:
         case ZL5011X_WAN_TX_INFO_OVERFLOW_INTERRUPT:
         case ZL5011X_WAN_TX_QUEUE_OVERFLOW_INTERRUPT:
         case ZL5011X_HOST_GRANULES_INTERRUPT:
         case ZL5011X_WAN_RX_OVERFLOW_INTERRUPT:
         case ZL5011X_HOST_DMA_RX_INTERRUPT:
            /* don't need to set any interrupt masks etc. */
            break;

         default:
            status = ZL5011X_PARAMETER_INVALID;
         break;
      }
   }

   if (status == ZL5011X_OK)
   {
      /* enable the interrupt at the top level */
      status = zl5011xAdmEnableInterruptSource(zl5011xParams, intSrc, ZL5011X_1BIT_MASK << par->interruptSource);
   }

   return status;
}

/*******************************************************************************

 Function:
    zl5011xIsrDisableInterruptSourceStructInit

 Description:
   This is the initialisation function for zl5011xIsrDisableInterruptSource

 Inputs:
   zl5011xParams      Pointer to the structure for this device instance
   par               pointer to  parameter structure

 Structure Inputs:
      interruptBits  bits set to enable the interrupt
      interruptSource   block where bits are set
      context        context (may be associated with the interrupt)
      portNumber     LAN port (may be associated with the interrupt)

 Outputs:

 Returns:
    zlStatusE

 Remarks:

*******************************************************************************/

zlStatusE zl5011xIsrDisableInterruptSourceStructInit(zl5011xParamsS *zl5011xParams,
      zl5011xIsrInterruptSourceS *par)
{
   zlStatusE status = ZL5011X_OK;

   status = ZL5011X_CHECK_POINTERS(zl5011xParams, par);

   if (status == ZL5011X_OK)
   {
      ZL5011X_TRACE(ZL5011X_ISR_FN_ID, "zl5011xIsrDisableInterruptSourceStructInit:",
            0, 0, 0, 0, 0, 0);

      par->interruptBits = 0;
      par->interruptSource = ZL5011X_NO_INTERRUPT;
      par->context = (Uint32T)ZL5011X_INVALID_CONTEXT;
      par->portNumber = (Uint8T)ZL5011X_INVALID;
   }

   return status;
}

/*******************************************************************************

 Function:
    zl5011xIsrDisableInterruptSource

 Description:
   This function is used to disable the interrupt sources used to drive the
   application interrupt (int 0 on the device).

   Note that the CPQ, CPU, MM and PKQ have interrupts
   but are not masked in the blocks themselves but in the ADM intr enable register,
   therefore their interruptBits parameter uses the bit position in this ADM reg.


 Inputs:
    zl5011xParams      Pointer to the structure for this device instance
   par               pointer to  parameter structure

 Structure Inputs:
      interruptBits  bits set to enable the interrupt
      interruptSource   block where bits are set
      context        context (may be associated with the interrupt)
      portNumber     LAN port (may be associated with the interrupt)
   The function parameters are in a structure (see above), the various parts of
   which are used as appropriate.

 Outputs:

 Returns:
    zlStatusE

 Remarks:
   see also  zl5011xIsrEnableInterruptSource()

*******************************************************************************/

zlStatusE zl5011xIsrDisableInterruptSource(zl5011xParamsS *zl5011xParams,
      zl5011xIsrInterruptSourceS *par)
{
   zlStatusE status = ZL5011X_OK;
   Uint8T internalPortNum;

   status = ZL5011X_CHECK_POINTERS(zl5011xParams, par);

   if (status == ZL5011X_OK)
   {
      ZL5011X_TRACE(ZL5011X_ISR_FN_ID,
            "zl5011xIsrDisableInterruptSource: dev %08X, intSrc %d, ctxt %d, port %d, bits %08X",
            (Uint32T)zl5011xParams, par->interruptSource, par->context, par->portNumber, par->interruptBits, 0);
   }

   if (status == ZL5011X_OK)
   {
      /* these application interrupts can only be enabled if the interrupt is running */
      if (zl5011xIsrAppIntNum == (Uint32T)ZL5011X_INVALID)
      {
         status = ZL5011X_NOT_RUNNING;
      }
   }

   if (status == ZL5011X_OK)
   {
      switch (par->interruptSource)
      {
         case ZL5011X_GRANULE_INTERRUPT:
            status = zl5011xGmDisableInterrupts( zl5011xParams, par->interruptBits);
            break;

         case ZL5011X_WAN_CLK_INTERRUPT:
            status = zl5011xPacDisableInterrupts(zl5011xParams, par->interruptBits);
            break;

         case ZL5011X_PACKET_RX_INTERRUPT:
            if ((par->interruptBits & (ZL5011X_1BIT_MASK << ZL5011X_PACKET_RX_PW_INT)) != 0)
            {
               zl5011xParams->interruptMasks.pkcPwInterruptEnabled = ZL5011X_FALSE;
            }

            status = zl5011xPkcDisableInterrupts(zl5011xParams, par->interruptBits);
            break;

         case ZL5011X_MAC_IF_INTERRUPT:
            /* Map external port number to internal port connected to it */
            status = zl5011xPkiExternalPortToInternal(zl5011xParams, &internalPortNum, par->portNumber);

            if (status == ZL5011X_OK)
            {
               status = zl5011xPkiDisablePcsInterrupt(zl5011xParams, par->portNumber);
            }
            break;

         case ZL5011X_WAN_RX_ERROR_INTERRUPT:
            status = zl5011xPlaDisableInterrupts(zl5011xParams, par->context, par->interruptBits);
            break;

         case ZL5011X_WAN_RX_TASK_OVERFLOW_INTERRUPT:
            status = zl5011xPlaDisableTmiOverflowIntr(zl5011xParams, par->interruptBits);
            break;

         case ZL5011X_WAN_TX_INFO_INTERRUPT:
         case ZL5011X_WAN_TX_ERROR_INTERRUPT:
            status = zl5011xTfmDisableInterrupts(zl5011xParams, par->context, par->interruptBits);
            break;

          case ZL5011X_WAN_TX_QUEUE_INTERRUPT:
            status = zl5011xTfqDisableInterrupts(zl5011xParams, par->context, par->interruptBits);
            break;

         case ZL5011X_WAN_TX_GRANULES_INTERRUPT:
            status = zl5011xTfqDisableGranuleThresholdIntr(zl5011xParams, par->interruptBits);
            break;

         case ZL5011X_TASK_MSG_INTERRUPT:
            status = zl5011xTmDisableInterrupts(zl5011xParams, par->interruptBits);
            break;

         case ZL5011X_HOST_OVERFLOW_INTERRUPT:
            status = zl5011xCpqDisableInterrupts(zl5011xParams, par->interruptBits);
            break;

         case ZL5011X_PACKET_TX_INTERRUPT:
         case ZL5011X_MEMORY_PARITY_INTERRUPT:
         case ZL5011X_WAN_TX_ERROR_OVERFLOW_INTERRUPT:
         case ZL5011X_WAN_TX_INFO_OVERFLOW_INTERRUPT:
         case ZL5011X_WAN_TX_QUEUE_OVERFLOW_INTERRUPT:
         case ZL5011X_HOST_GRANULES_INTERRUPT:
         case ZL5011X_WAN_RX_OVERFLOW_INTERRUPT:
         case ZL5011X_HOST_DMA_RX_INTERRUPT:
            /* no further sub-division of these interrupts in the blocks, so just disable
               at the top level */
            status = zl5011xAdmDisableInterruptSource(zl5011xParams, ZL5011X_INTERRUPT_ZERO, ZL5011X_1BIT_MASK << par->interruptSource);
            break;

         default:
            status = ZL5011X_PARAMETER_INVALID;
         break;
      }
   }

   return status;
}

/*******************************************************************************

 Function:
    zl5011xIsrEnableFreezeStructInit

 Description:
   This is the initialisation function for zl5011xIsrEnableFreeze - see below.

 Inputs:
   zl5011xParams      Pointer to the structure for this device instance
   par               Pointer to parameter structure
 Outputs:

 Returns:
    zlStatusE

 Remarks:

*******************************************************************************/

zlStatusE zl5011xIsrEnableFreezeStructInit(zl5011xParamsS *zl5011xParams,
      zl5011xIsrEnableFreezeS *par)
{
   zlStatusE status = ZL5011X_OK;

   status = ZL5011X_CHECK_POINTERS(zl5011xParams, par);

   if (status == ZL5011X_OK)
   {
      ZL5011X_TRACE(ZL5011X_ISR_FN_ID,
            "zl5011xIsrEnableFreezeStructInit: ",
            0, 0, 0, 0, 0, 0);

      par->interruptBits= 0;
   }

   return status;
}

/*******************************************************************************

 Function:
    zl5011xIsrEnableFreeze

 Description:
   This function is used to enable the interrupt sources which will cause the
   hardware/debug freeze feature .

   The top level mask contained in the ADM block is updated to enable the
   relevant block to freeze the hardware. Note that the blocks themselves
   do not have individual freeze eanbling, although some selectivity
   within some blocks is possible from the ADM freeze register

 Inputs:
   zl5011xParams      Pointer to the structure for this device instance
   par               pointer to  parameter structure

 Structure Inputs:
      interruptBits - bits set to enable the interrupt corresponding to the
                        ADM hardware freeze enable register.

 Outputs:

 Returns:
    zlStatusE

 Remarks:

*******************************************************************************/

zlStatusE zl5011xIsrEnableFreeze(zl5011xParamsS *zl5011xParams, zl5011xIsrEnableFreezeS *par)
{
   zlStatusE status = ZL5011X_OK;

   status = ZL5011X_CHECK_POINTERS(zl5011xParams, par);

   if (status == ZL5011X_OK)
   {
      ZL5011X_TRACE(ZL5011X_ISR_FN_ID,
            "zl5011xIsrEnableFreeze: dev %08X, bits %08X",
            (Uint32T)zl5011xParams, par->interruptBits, 0, 0, 0, 0);
   }

   if (status == ZL5011X_OK)
   {
      status = zl5011xAdmEnableInterruptSource(zl5011xParams,
            ZL5011X_INTERRUPT_FROZEN, par->interruptBits);
   }

   return status;
}


/*******************************************************************************
 Function:
    zl5011xIsrDisableFreezeStructInit

 Description:
   This is the initialisation function for zl5011xIsrDisableFreeze - see below.

 Inputs:
   zl5011xParams      Pointer to the structure for this device instance
   par               pointer to  parameter structure

 Structure Inputs:
      interruptBits - bits set to disable the interrupt
 Outputs:

 Returns:
    zlStatusE

 Remarks:

*******************************************************************************/

zlStatusE zl5011xIsrDisableFreezeStructInit(zl5011xParamsS *zl5011xParams, zl5011xIsrDisableFreezeS *par)
{
   zlStatusE status = ZL5011X_OK;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -