[En-Nut-Discussion] NutOS Dbgu Interrupt
Ulrich Prinz
uprinz2 at netscape.net
Wed Jan 20 20:58:31 CET 2010
Hi!
I started to write a full featured USART driver for the DBGU myself some
month ago. I didn't finish cause of missing time. But I remember the
following:
The registers of the DBGU are the same as for other full features
USARTs. Only the bits representing not supported things of the DBGU are
unused. Therefore you can use the same but reduced USART routines as for
the other USARTs.
But in the interrupts, there is a difference as the standard ports have
an interrupt for them self (like your timers). The DBGU Interrupt is
handled through the system interrupt. So you cannot write your own
interrupt routine called by an interrupt, you have to write one that is
called from the system interrupt routine, or lets call it the system
interrupt manager.
THe code can be a copy'n'paste from the USART drivers, then you throw
out any code that handles not supported things. DBGU can only used 8
Bits and 1 stop bit. It has no hardware handshake support, but you can
keep the part of the GPIO emulated RTS/CTS signals if you like.
I have my code somewhere, may be I can pass it over to you. My interest
was to enable RX on the DBGU what is missing in the NutOS
implementation. I would like to use the DBGU interface for configuration
things.
Best regards, Ulrich
kafka85 schrieb:
> 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.
> _______________________________________________
> http://lists.egnite.de/mailman/listinfo/en-nut-discussion
More information about the En-Nut-Discussion
mailing list