public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
From: Gurkan Sokat <gurkansokat@yahoo.com>
To: ecos-discuss@ecos.sourceware.org
Subject: [ECOS] Interrupt driven serial communication on AT91SAM9260
Date: Fri, 02 Oct 2009 15:37:00 -0000	[thread overview]
Message-ID: <907868.75159.qm@web52802.mail.re2.yahoo.com> (raw)

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

             reply	other threads:[~2009-10-02 15:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-02 15:37 Gurkan Sokat [this message]
2009-10-06  7:21 ` Dave Milter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=907868.75159.qm@web52802.mail.re2.yahoo.com \
    --to=gurkansokat@yahoo.com \
    --cc=ecos-discuss@ecos.sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).