HelenOS sources
This source file includes following definitions.
- s3c24xx_irqc_init
- s3c24xx_irqc_inum_get
- s3c24xx_irqc_clear
- s3c24xx_irqc_src_enable
- s3c24xx_irqc_src_disable
- s3c24xx_irqc_subsrc_enable
- s3c24xx_irqc_subsrc_disable
#include <genarch/drivers/s3c24xx/irqc.h>
#include <arch/asm.h>
static unsigned s3c24xx_subsrc_src[][2] = {
{ S3C24XX_SUBINT_CAM_P, S3C24XX_INT_CAM },
{ S3C24XX_SUBINT_CAM_C, S3C24XX_INT_CAM },
{ S3C24XX_SUBINT_ADC_S, S3C24XX_INT_ADC },
{ S3C24XX_SUBINT_TC, S3C24XX_INT_ADC },
{ S3C24XX_SUBINT_ERR2, S3C24XX_INT_UART2 },
{ S3C24XX_SUBINT_TXD2, S3C24XX_INT_UART2 },
{ S3C24XX_SUBINT_RXD2, S3C24XX_INT_UART2 },
{ S3C24XX_SUBINT_ERR1, S3C24XX_INT_UART1 },
{ S3C24XX_SUBINT_TXD1, S3C24XX_INT_UART1 },
{ S3C24XX_SUBINT_RXD1, S3C24XX_INT_UART1 },
{ S3C24XX_SUBINT_ERR0, S3C24XX_INT_UART0 },
{ S3C24XX_SUBINT_TXD0, S3C24XX_INT_UART0 },
{ S3C24XX_SUBINT_RXD0, S3C24XX_INT_UART0 }
};
void s3c24xx_irqc_init(s3c24xx_irqc_t *irqc, s3c24xx_irqc_regs_t *regs)
{
irqc->regs = regs;
pio_write_32(®s->intmod, 0x00000000);
pio_write_32(®s->intmsk, 0xffffffff);
pio_write_32(®s->intsubmsk, 0xffffffff);
}
unsigned s3c24xx_irqc_inum_get(s3c24xx_irqc_t *irqc)
{
return pio_read_32(&irqc->regs->intoffset);
}
void s3c24xx_irqc_clear(s3c24xx_irqc_t *irqc, unsigned inum)
{
unsigned src, subsrc;
unsigned entries, i;
entries = sizeof(s3c24xx_subsrc_src) / sizeof(s3c24xx_subsrc_src[0]);
for (i = 0; i < entries; i++) {
subsrc = s3c24xx_subsrc_src[i][0];
src = s3c24xx_subsrc_src[i][1];
if (src == inum) {
pio_write_32(&irqc->regs->subsrcpnd,
S3C24XX_SUBINT_BIT(subsrc));
}
}
pio_write_32(&irqc->regs->srcpnd, S3C24XX_INT_BIT(inum));
pio_write_32(&irqc->regs->intpnd, S3C24XX_INT_BIT(inum));
}
void s3c24xx_irqc_src_enable(s3c24xx_irqc_t *irqc, unsigned src)
{
pio_write_32(&irqc->regs->intmsk, pio_read_32(&irqc->regs->intmsk) &
~S3C24XX_INT_BIT(src));
}
void s3c24xx_irqc_src_disable(s3c24xx_irqc_t *irqc, unsigned src)
{
pio_write_32(&irqc->regs->intmsk, pio_read_32(&irqc->regs->intmsk) |
S3C24XX_INT_BIT(src));
}
void s3c24xx_irqc_subsrc_enable(s3c24xx_irqc_t *irqc, unsigned subsrc)
{
pio_write_32(&irqc->regs->intsubmsk,
pio_read_32(&irqc->regs->intsubmsk) &
~S3C24XX_SUBINT_BIT(subsrc));
}
void s3c24xx_irqc_subsrc_disable(s3c24xx_irqc_t *irqc, unsigned subsrc)
{
pio_write_32(&irqc->regs->intsubmsk,
pio_read_32(&irqc->regs->intsubmsk) |
S3C24XX_SUBINT_BIT(subsrc));
}
HelenOS homepage, sources at GitHub