[抢楼250] 菜地公告:即日起创建《菜农Cortex-M0助学园地》(盖楼入口)

[复制链接]
919105|18727
murex 发表于 2011-4-9 00:10 | 显示全部楼层
typedef volatile union
{
  NU_REG         Regs;
  I2S_IE_T    Bits;
}NU_I2S_IE_T;
murex 发表于 2011-4-9 00:10 | 显示全部楼层
typedef enum
{
    I2S_IE_RXUDFIE = 0,//接收FIFO下溢中断使能
        I2S_IE_RXOVFIE = 1,//接收FIFO溢出中断使能
        I2S_IE_RXTHIE = 2,//接收FIFO阈值水平中断
        I2S_IE_TXUDFIE = 8,//发送FIFO下溢中断使能
        I2S_IE_TXOVFIE = 9,//发送FIFO溢出中断使能
        I2S_IE_TXTHIE = 10,//发送FIFO 阈值水平中断使能
        I2S_IE_RZCIE = 11,//右声道过零检测中断使能
        I2S_IE_LZCIE = 12,//左声道过零检测中断使能
}NU_I2S_IE_ENUM;
murex 发表于 2011-4-9 00:11 | 显示全部楼层
murex 发表于 2011-4-9 00:11 | 显示全部楼层
typedef enum
{
    I2S_IE_RXUDFIE = 0,//接收FIFO下溢中断使能
        I2S_IE_RXOVFIE = 1,//接收FIFO溢出中断使能
        I2S_IE_RXTHIE = 2,//接收FIFO阈值水平中断
        I2S_IE_TXUDFIE = 8,//发送FIFO下溢中断使能
        I2S_IE_TXOVFIE = 9,//发送FIFO溢出中断使能
        I2S_IE_TXTHIE = 10,//发送FIFO 阈值水平中断使能
        I2S_IE_RZCIE = 11,//右声道过零检测中断使能
        I2S_IE_LZCIE = 12,//左声道过零检测中断使能
}NU_I2S_IE_ENUM;
murex 发表于 2011-4-9 00:11 | 显示全部楼层
typedef volatile union
{
  NU_REG         Regs;
  I2S_CLKDIV_T    Bits;
}NU_I2S_CLKDIV_T;
murex 发表于 2011-4-9 00:12 | 显示全部楼层
javascript:;
murex 发表于 2011-4-9 00:12 | 显示全部楼层
javascript:;javascript:;
murex 发表于 2011-4-9 00:13 | 显示全部楼层
typedef volatile union
{
  NU_REG         Regs;
  I2S_CLKDIV_T    Bits;
}NU_I2S_CLKDIV_T;
murex 发表于 2011-4-9 00:13 | 显示全部楼层
还差130
murex 发表于 2011-4-9 00:13 | 显示全部楼层
typedef volatile union
{
  NU_REG         Regs;
  I2S_CLKDIV_T    Bits;
}NU_I2S_CLKDIV_T;
murex 发表于 2011-4-9 00:13 | 显示全部楼层
typedef enum
{
    I2S_IE_RXUDFIE = 0,//接收FIFO下溢中断使能
        I2S_IE_RXOVFIE = 1,//接收FIFO溢出中断使能
        I2S_IE_RXTHIE = 2,//接收FIFO阈值水平中断
        I2S_IE_TXUDFIE = 8,//发送FIFO下溢中断使能
        I2S_IE_TXOVFIE = 9,//发送FIFO溢出中断使能
        I2S_IE_TXTHIE = 10,//发送FIFO 阈值水平中断使能
        I2S_IE_RZCIE = 11,//右声道过零检测中断使能
        I2S_IE_LZCIE = 12,//左声道过零检测中断使能
}NU_I2S_IE_ENUM;
murex 发表于 2011-4-9 00:13 | 显示全部楼层
typedef volatile union
{
  NU_REG         Regs;
  I2S_CLKDIV_T    Bits;
}NU_I2S_CLKDIV_T;
murex 发表于 2011-4-9 00:14 | 显示全部楼层
static void (*_pfGPABCallback)(uint32_t u32GPAStatus, uint32_t u32GPBStatus);
static void (*_pfGPCDECallback)(uint32_t u32GPCStatus, uint32_t u32GPDStatus, uint32_t u32GPEStatus);
static void (*_pfEINT0Callback)(void);
static void (*_pfEINT1Callback)(void);
murex 发表于 2011-4-9 00:14 | 显示全部楼层
void GPAB_IRQHandler(void)
{
        uint32_t u32GPAStatus, u32GPBStatus;
       
    /* Keep the interrupt source */
        u32GPAStatus = GPIOA->ISRC;
        u32GPBStatus = GPIOB->ISRC;

    /* Clear the interrupt */
    GPIOA->ISRC = u32GPAStatus;
    GPIOB->ISRC = u32GPBStatus;

    /* Call the callback function of GPIOAB interrupt */
    if ( _pfGPABCallback )
        _pfGPABCallback(u32GPAStatus, u32GPBStatus);   
}
murex 发表于 2011-4-9 00:14 | 显示全部楼层
void GPCDE_IRQHandler(void)
{
        uint32_t u32GPCStatus, u32GPDStatus, u32GPEStatus;
       
    /* Keep the interrupt source */
        u32GPCStatus = GPIOC->ISRC;
        u32GPDStatus = GPIOD->ISRC;
        u32GPEStatus = GPIOE->ISRC;

    /* Clear the interrupt */
    GPIOC->ISRC = u32GPCStatus;
    GPIOD->ISRC = u32GPDStatus;
    GPIOE->ISRC = u32GPEStatus;

    /* Call the callback function of GPIOAB interrupt */
    if ( _pfGPCDECallback )
        _pfGPCDECallback(u32GPCStatus, u32GPDStatus, u32GPEStatus);   
}
murex 发表于 2011-4-9 00:14 | 显示全部楼层
void EINT0_IRQHandler(void)
{
    /* EINT0 = GPB14. Clear the interrupt */
          GPIOB->ISRC  = 1UL << 14;
        if ( _pfEINT0Callback )
        _pfEINT0Callback();
}
murex 发表于 2011-4-9 00:15 | 显示全部楼层
快了快了
murex 发表于 2011-4-9 00:15 | 显示全部楼层
void EINT1_IRQHandler(void)
{
    /* EINT0 = GPB15. Clear the interrupt */
          GPIOB->ISRC  = 1UL << 15;
        if ( _pfEINT1Callback )
        _pfEINT1Callback();
}
murex 发表于 2011-4-9 00:15 | 显示全部楼层
int32_t DrvGPIO_Open(E_DRVGPIO_PORT port, int32_t i32Bit, E_DRVGPIO_IO mode)
{
    volatile uint32_t u32Reg;
   
    if ((i32Bit < 0) || (i32Bit > 16))
    {
        return E_DRVGPIO_ARGUMENT;
    }   

    u32Reg = (uint32_t)&GPIOA->PMD + (port*PORT_OFFSET);   
    if ((mode == E_IO_INPUT) || (mode == E_IO_OUTPUT) || (mode == E_IO_OPENDRAIN))
    {
        outpw(u32Reg, inpw(u32Reg) & ~(0x3<<(i32Bit*2)));
        if (mode == E_IO_OUTPUT)
        {
            outpw(u32Reg, inpw(u32Reg) | (0x1<<(i32Bit*2)));
        }else
        if (mode == E_IO_OPENDRAIN)
        {
            outpw(u32Reg, inpw(u32Reg) | (0x2<<(i32Bit*2)));
        }
    }else
        if (mode == E_IO_QUASI)
    {
        outpw(u32Reg, inpw(u32Reg) | (0x3<<(i32Bit*2)));
    }else
    {
        return E_DRVGPIO_ARGUMENT;
    }
        
        return E_SUCCESS;
}
murex 发表于 2011-4-9 00:15 | 显示全部楼层
int32_t DrvGPIO_Close(E_DRVGPIO_PORT port, int32_t i32Bit)
{
    volatile uint32_t u32Reg;

    if ((i32Bit < 0) || (i32Bit > 16))
    {
        return E_DRVGPIO_ARGUMENT;
    }
   
    u32Reg = (uint32_t)&GPIOA->PMD + (port*PORT_OFFSET);   
    outpw(u32Reg, inpw(u32Reg) | (0x3<<(i32Bit*2)));
       
        GPIO_DBNCECON->ICLK_ON = 0;

    return E_SUCCESS;
}
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 在线客服 返回列表 返回顶部