[En-Nut-Discussion] NutOS Dbgu Interrupt

kafka85 kafka85 at o2.pl
Wed Jan 20 13:07:45 CET 2010


Hi,

I'm using Nut/OS 4.8.5. I'm trying to create my own routine on DBGU receive interrupt. Can you guide me how to do that?

I succesfully created timer interrupt as follows:

void InitApiTimer(void) {
	compare_value = local_ZBTO;
	outr(AIC_IECR, _BV(TC1_ID));
	outr(PMC_PCER, _BV(TC1_ID));
	outr(TC1_CCR, TC_CLKDIS);
	outr(TC1_IDR, 0xFFFFFFFF);
	inr(TC1_SR);
	outr(TC1_CMR, TC_CLKS_MCK32);
	outr(TC1_RC, local_ZBTO);
	outr(TC1_CCR, TC_CLKEN);
	outr(TC1_IER, TC_CPCS);
	NutRegisterIrqHandler(&sig_TC1, ApiTimerIntr, 0);
	NutIrqSetPriority(&sig_TC1, 7);
	NutIrqEnable(&sig_TC1);
	outr(TC1_CCR, TC_SWTRG);
}

My DBGU setup routine is as follows:

void debug_init(AT91PS_DBGU paramDbgu, AT91PS_PIO paramPio, uint32_t pinMask,
		uint8_t periph, uint32_t baud) {

	pDbgu = paramDbgu;
	paramPio->PIO_PDR = pinMask;
	if (periph == 0) {
		paramPio->PIO_ASR = pinMask;
	} else {
		paramPio->PIO_BSR = pinMask;
	}
	pDbgu->DBGU_CR = AT91C_US_RSTRX | AT91C_US_RSTTX | AT91C_US_RXDIS
			| AT91C_US_TXDIS;
	pDbgu->DBGU_MR = AT91C_US_PAR_NONE | AT91C_US_CHRL_8_BITS;
	pDbgu->DBGU_BRGR = AT91F_US_Baudrate(MCK, baud);

	//enable interrupt source
	//pDbgu->DBGU_IER = AT91C_US_RXRDY;

	pDbgu->DBGU_CR = AT91C_US_RXEN | AT91C_US_TXEN;
}


I'd like to create my own DBGU interrupt routine in the same manner as my timer interrupt.



More information about the En-Nut-Discussion mailing list