Esempio n. 1
0
static HAL_Status
RtkI2SIrqInit(
    IN  PHAL_I2S_ADAPTER pI2SAdapter
)
{
    PIRQ_HANDLE pIrqHandle;

    if (pI2SAdapter->DevNum > I2S_MAX_ID) {
        DBG_I2S_ERR("RtkI2SIrqInit: Invalid I2S Index(&d)\r\n", pI2SAdapter->DevNum);
        return HAL_ERR_PARA;
    }
    
    pIrqHandle = &pI2SAdapter->IrqHandle;
    
    switch (pI2SAdapter->DevNum){
        case I2S0_SEL:
            pIrqHandle->IrqNum = I2S0_PCM0_IRQ;
            break;
            
        case I2S1_SEL:
            pIrqHandle->IrqNum = I2S1_PCM1_IRQ;
            break;
            
        default:
            return HAL_ERR_PARA;
    }

    pIrqHandle->Data = (u32) (pI2SAdapter);
    pIrqHandle->IrqFun = (IRQ_FUN) I2SISRHandle;
    pIrqHandle->Priority = 3;
    InterruptRegister(pIrqHandle);
    InterruptEn(pIrqHandle);
    
    return HAL_OK;
}
Esempio n. 2
0
int32_t serial_send_stream_dma (serial_t *obj, char *ptxbuf, uint32_t len)
{
    PHAL_RUART_OP      pHalRuartOp;
    PHAL_RUART_ADAPTER pHalRuartAdapter=(PHAL_RUART_ADAPTER)&(obj->hal_uart_adp);
    u8  uart_idx = pHalRuartAdapter->UartIndex;
    int32_t ret;

    pHalRuartOp = &(obj->hal_uart_op);

    if ((serial_dma_en[uart_idx] & SERIAL_TX_DMA_EN)==0) {
        PUART_DMA_CONFIG   pHalRuartDmaCfg;
        
        pHalRuartDmaCfg = &obj->uart_gdma_cfg;
#if 0        
        pHalRuartOp->HalRuartTxGdmaLoadDef (pHalRuartAdapter, pHalRuartDmaCfg);
        pHalRuartOp->HalRuartDmaInit (pHalRuartAdapter);
        InterruptRegister(&pHalRuartDmaCfg->TxGdmaIrqHandle);
        InterruptEn(&pHalRuartDmaCfg->TxGdmaIrqHandle);
        serial_dma_en[uart_idx] |= SERIAL_TX_DMA_EN;
#else
        if (HAL_OK == HalRuartTxGdmaInit(pHalRuartOp, pHalRuartAdapter, pHalRuartDmaCfg)) {
            serial_dma_en[uart_idx] |= SERIAL_TX_DMA_EN;
        }
        else {
            return HAL_BUSY;
        }
#endif
    }    
    ret = pHalRuartOp->HalRuartDmaSend(pHalRuartAdapter, (u8*)ptxbuf, len);
    return (ret);
}
VOID
HalMiiGmacInitIrqRtl8195a(
		IN VOID *Data
		)
{
	IRQ_HANDLE	MiiIrqHandle_Master;
	PMII_ADAPTER pMiiAdapter = (PMII_ADAPTER) Data;


	MiiIrqHandle_Master.Data	 = (u32) (pMiiAdapter);
	MiiIrqHandle_Master.IrqNum	 = GMAC_IRQ;
	MiiIrqHandle_Master.IrqFun	 = (IRQ_FUN) MiiIrqHandle;
	MiiIrqHandle_Master.Priority = 0;
	InterruptRegister(&MiiIrqHandle_Master);
	InterruptEn(&MiiIrqHandle_Master);
}
Esempio n. 4
0
/**
 * Load UART HAL GDMA default setting
 *
 * Call this function to load the default setting for UART GDMA
 *
 *
 */
VOID
HalRuartTxGdmaInit(
    PRUART_ADAPTER pRuartAdapter
)
{
    PHAL_RUART_OP pHalRuartOp;
    PHAL_RUART_ADAPTER pHalRuartAdapter;
    PUART_DMA_CONFIG pUartGdmaConfig;
    PHAL_GDMA_ADAPTER pHalGdmaAdapter;
    
    if (NULL == pRuartAdapter) {
        return;
    }
    
    pHalRuartOp = pRuartAdapter->pHalRuartOp;
    pHalRuartAdapter = pRuartAdapter->pHalRuartAdapter;
    pUartGdmaConfig = pRuartAdapter->pHalRuartDmaCfg;

    if ((NULL == pHalRuartOp) || (NULL == pHalRuartAdapter) || (NULL == pUartGdmaConfig)) {
        return;
    }

    // Load default setting
    if (pHalRuartOp->HalRuartTxGdmaLoadDef != NULL) {
        HalGdmaOpInit((VOID*) (pUartGdmaConfig->pHalGdmaOp));
        pHalRuartOp->HalRuartTxGdmaLoadDef (pHalRuartAdapter, pUartGdmaConfig);
    }
    else {
        // Initial your GDMA setting here
    }

    // Start to patch the default setting
    pHalGdmaAdapter = (PHAL_GDMA_ADAPTER)pUartGdmaConfig->pTxHalGdmaAdapter;
    pHalGdmaAdapter->GdmaIndex   = 0;  // GDMA0 
    pHalGdmaAdapter->ChNum       = 4;   // GDMA Channel
    pHalGdmaAdapter->ChEn        = GdmaCh4;     // GDMA Channel Enable

//    pUartGdmaConfig->TxGdmaIrqHandle.Data = pHalRuartAdapter;
    pUartGdmaConfig->TxGdmaIrqHandle.IrqNum = GDMA0_CHANNEL4_IRQ;
//    pUartGdmaConfig->TxGdmaIrqHandle.IrqFun = (IRQ_FUN)_UartTxDmaIrqHandle
    pUartGdmaConfig->TxGdmaIrqHandle.Priority = 0x20;

    pHalRuartOp->HalRuartDmaInit (pHalRuartAdapter);
    InterruptRegister(&pUartGdmaConfig->TxGdmaIrqHandle);
    InterruptEn(&pUartGdmaConfig->TxGdmaIrqHandle);

}
Esempio n. 5
0
/**
  * @brief  Initializes a GPIO Pin as a interrupt signal
  *
  * @param  GPIO_Pin: The data structer which contains the parameters for the GPIO Pin initialization.
  *
  * @retval HAL_Status
  */
VOID 
HAL_GPIO_Irq_Init(
    HAL_GPIO_PIN  *GPIO_Pin
)
{
    if (_pHAL_Gpio_Adapter == NULL) {
        _pHAL_Gpio_Adapter = &gHAL_Gpio_Adapter;
        DBG_GPIO_INFO("%s: Initial GPIO Adapter\n ", __FUNCTION__);
    }

    if (_pHAL_Gpio_Adapter->IrqHandle.IrqFun == NULL) {
        _pHAL_Gpio_Adapter->IrqHandle.IrqFun = HAL_GPIO_MbedIrqHandler_8195a;
        _pHAL_Gpio_Adapter->IrqHandle.Priority = 8;
        HAL_GPIO_RegIrq_8195a(&_pHAL_Gpio_Adapter->IrqHandle);        
        InterruptEn(&_pHAL_Gpio_Adapter->IrqHandle);
        DBG_GPIO_INFO("%s: Initial GPIO IRQ Adapter\n ", __FUNCTION__);
    }

    DBG_GPIO_INFO("%s: GPIO(name=0x%x)(mode=%d)\n ", __FUNCTION__, GPIO_Pin->pin_name, 
        GPIO_Pin->pin_mode);
    HAL_GPIO_MaskIrq_8195a(GPIO_Pin);
    HAL_GPIO_Init_8195a(GPIO_Pin);
}
Esempio n. 6
0
//---------------------------------------------------------------------------------------------------
//Function Name:
//		RtkI2CIrqInit
//
// Description:
//         I2C interrupt initialization function.
//         For I2C interrupt operation mode, I2C module MUST register itself to the platform
//         by providing the interrupt handler which contains interrupt input data (arguments),
//         interrupt service routine, interrupt number, interrupt priority. And then the interrupt
//         should be enabled.
//		
// Arguments:
//		[in] VOID *Data -
//			I2C SAL handle
//
// Return:
//		The status of the I2C interrupt initialization process.
//          _EXIT_SUCCESS if the RtkI2CIrqInit succeeded.
//          _EXIT_FAILURE if the RtkI2CIrqInit failed.
//
// Note:
//		NA
//
// See Also:
//		NA
//
// Author:
// 		By Jason Deng, 2014-04-03.
//
//----------------------------------------------------------------------------------------------------
static RTK_STATUS
RtkDACDMAInit(
    IN  PSAL_DAC_HND    pSalDACHND
){
    PSAL_DAC_HND_PRIV   pSalDACHNDPriv      = NULL;
    PSAL_DAC_MNGT_ADPT  pSalDACMngtAdpt     = NULL;
    PHAL_GDMA_ADAPTER   pHALDACGdmaAdpt    = NULL;
    PHAL_GDMA_OP        pHALDACGdmaOp      = NULL;
    PIRQ_HANDLE         pIrqHandleDACGdma   = NULL;
    
    /* To Get the SAL_I2C_MNGT_ADPT Pointer */
    pSalDACHNDPriv  = CONTAINER_OF(pSalDACHND, SAL_DAC_HND_PRIV, SalDACHndPriv);
    pSalDACMngtAdpt = CONTAINER_OF(pSalDACHNDPriv->ppSalDACHnd, SAL_DAC_MNGT_ADPT, pSalHndPriv);
    
    pHALDACGdmaAdpt     = pSalDACMngtAdpt->pHalGdmaAdp;
    pHALDACGdmaOp       = pSalDACMngtAdpt->pHalGdmaOp;
    pIrqHandleDACGdma   = pSalDACMngtAdpt->pIrqGdmaHnd;
    
    if (RtkDACIdxChk(pSalDACHND->DevNum))
        return _EXIT_FAILURE;

    HalGdmaOpInit(pHALDACGdmaOp);
    
    _memset((void *)pHALDACGdmaAdpt, 0, sizeof(HAL_GDMA_ADAPTER));
    
    pHALDACGdmaAdpt->GdmaCtl.IntEn = 1;

    //DAC TX DMA
    pHALDACGdmaAdpt->GdmaCtl.SrcTrWidth = TrWidthFourBytes;
    pHALDACGdmaAdpt->GdmaCtl.DstTrWidth = TrWidthFourBytes;
    pHALDACGdmaAdpt->GdmaCtl.SrcMsize   = MsizeFour;
    pHALDACGdmaAdpt->GdmaCtl.DestMsize  = MsizeFour;

    pHALDACGdmaAdpt->GdmaCtl.Sinc       = IncType;
    pHALDACGdmaAdpt->GdmaCtl.Dinc       = NoChange;	

    pHALDACGdmaAdpt->GdmaCtl.Done       = 1;
    pHALDACGdmaAdpt->GdmaCtl.TtFc       = (GDMA_CTL_TT_FC_TYPE)0x01;
    
    pHALDACGdmaAdpt->GdmaCfg.DestPer    = 13;
    pHALDACGdmaAdpt->GdmaCfg.ReloadSrc  = 1;

    pHALDACGdmaAdpt->MuliBlockCunt      = 1;
    pHALDACGdmaAdpt->MaxMuliBlock       = 50000;//MaxLlp;
    
    pHALDACGdmaAdpt->GdmaIsrType        = (BlockType|TransferType|ErrType);
    pHALDACGdmaAdpt->IsrCtrl            = ENABLE;
    pHALDACGdmaAdpt->GdmaOnOff          = ON;

    pHALDACGdmaAdpt->ChNum              = 4;
    pHALDACGdmaAdpt->ChEn               = GdmaCh4;

    
    pHALDACGdmaAdpt->TestItem = 3;
    //DBG_8195A("pSalDACHND->DevNum:%x\n",pSalDACHND->DevNum);
    switch (pSalDACHND->DevNum){
#if DAC0_USED
        case DAC0_SEL:
        {   
            pHALDACGdmaAdpt->GdmaIndex          = 0;
            
            pIrqHandleDACGdma->IrqNum   = GDMA0_CHANNEL4_IRQ;
            break;
        }
#endif
#if DAC1_USED
        case DAC1_SEL:
        {
            pHALDACGdmaAdpt->GdmaIndex          = 1;
            
            pIrqHandleDACGdma->IrqNum   = GDMA1_CHANNEL4_IRQ;
            break;
        }
#endif
        default:
            return _EXIT_FAILURE;
    }

    /* GDMA interrupt register */
    pIrqHandleDACGdma->Data     = (u32) (pSalDACMngtAdpt);  
    pIrqHandleDACGdma->IrqFun   = (IRQ_FUN) DACGDMAISRHandle;
    pIrqHandleDACGdma->Priority = 2;
    InterruptRegister(pIrqHandleDACGdma);
    InterruptEn(pIrqHandleDACGdma);

    /* GDMA initialization */
    /* Enable the whole GDMA module first */
    if (pHALDACGdmaAdpt->GdmaIndex == 0) {        
        ACTCK_GDMA0_CCTRL(ON);
        SLPCK_GDMA0_CCTRL(ON);
        GDMA0_FCTRL(ON);
    }
    else {        
        ACTCK_GDMA1_CCTRL(ON);
        SLPCK_GDMA1_CCTRL(ON);
        GDMA1_FCTRL(ON);
    }

    pHALDACGdmaOp->HalGdmaOnOff((VOID*)pHALDACGdmaAdpt);
    pHALDACGdmaOp->HalGdmaChIsrEnAndDis((VOID*)pHALDACGdmaAdpt);
    pHALDACGdmaOp->HalGdmaChSeting((VOID*)pHALDACGdmaAdpt);
      
    return _EXIT_SUCCESS;
}