rendered paste body/* in init */
GPIOA_ENABLE |= (1 << 7);
GPIOA_OUTPUT_EN &= ~(1 << 7);
/* enable interupt for the mSD card */
GPIOA_INT_CLR = (1 << 7);
GPIOA_INT_EN |= (1 << 7);
CPU_INT_EN = HI_MASK;
CPU_HI_INT_EN = GPIO_MASK;
/* in irq handler */
void microsd_int(void)
{
/* 0x00:inserted, 0x80:not inserted */
int current_status = GPIOA_INPUT_VAL & 0x80;
GPIOA_INT_LEV = (GPIOA_INT_LEV & ~0x80) | (current_status ^ 0x80);
GPIOA_INT_CLR = GPIOA_INT_STAT & 0x80;
card_info[1].initialized = false;
if (!current_status)
{
queue_broadcast(SYS_HOTSWAP_INSERTED, 0);
}
else
{
queue_broadcast(SYS_HOTSWAP_EXTRACTED, 0);
/* sd_status = SD_UNKNOWN; NEEDED? */
}
}
/* in irq() in system-pp...c */
if (GPIOA_INT_STAT & 0x80)
microsd_int();