This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Interrupt driven serial communication on AT91SAM9260


Hi,

I am new to this and I can not figure out how to set up interrupt driven serial communication on AT91SAM9260. I need to use USART3 and all I want is to have interrupt when data received. 

This is what I have so far. Not sure if any part of it is true or not, but here it is. Can anybody help me on this?

Thanks.

cyg_uint32 serialIsr(cyg_vector_t vector, cyg_addrword_t data)
{
    hal_interrupt_mask(CYGNUM_HAL_VECTOR_US3);

    diag_printf("Interrupt worked...");
    
    hal_interrupt_acknowledge(CYGNUM_HAL_VECTOR_US3);

    return CYG_ISR_HANDLED;
}

    /* Declare the ISR variables. */
    cyg_handle_t serialInterruptHdl;
    cyg_interrupt serialInterruptObj;
    cyg_vector_t serialInterruptVector = CYGNUM_HAL_VECTOR_US3;

int main(void)
{

    ...
    
    cyg_interrupt_create(serialInterruptVector,
                         0,
                         0,
                         serialIsr,
                         0,
                         &serialInterruptHdl,
                         &serialInterruptObj);

    //hal_interrupt_configure(serialInterruptVector,0,1);
    HAL_INTERRUPT_ATTACH(serialInterruptVector, serialIsr, &serialInterruptHdl, &serialInterruptObj);
    hal_interrupt_acknowledge(CYGNUM_HAL_INTERRUPT_US3);
    hal_interrupt_unmask(CYGNUM_HAL_INTERRUPT_US3);
    
    HAL_WRITE_UINT32( SAM9_UART3+_UART_IER, 0x00000001 );
    HAL_WRITE_UINT32( SAM9_UART3+_UART_IDR, 0x00000000 );

    while(1)
    {
    ...
    }

}



      

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]