Oleg Bolshakov
08/28/2014 4:22 AM
post111583
|
Hi Aarthi,
You asked a question about QNX Neutrino (QNX 6), but this project for QNX 4 (previous version). Please, repost your
question in right forum.
Respectfully,
Oleg
28 авг. 2014 г., в 10:54:59, Aarthi CR <community-noreply@qnx.com> написала:
> Hi All,
>
> I am developing SPI driver for i.Mx6 in QNX. I have used interrupt attach to attach the interrupts.
> I get one interrupt intially (i is printed as 1 continously), but i dont receive subsequent interrupts.
> I have used InterruptAttach in the following way.Please let me know if I am using it right.
>
> volatile int n_interrupt = 0;
> int main(int argc, char *argv[])
> {
> //Initializations
> if(SPIConfigure( &dev, config.phas, config.pol, config.cs - 1 ))
> {
> printf("Configuration failed!\r\n");
> exit(1);
> }
> while(1)
> {
> printf("i - %d\n",GetNoOfInterrupt());
> }
>
> }
>
> uint8_t SPIConfigure(spiHwData_adt *dev, uint8_t phase, uint8_t polarity, uint8_t ss)
> {
> //Initialize variables
>
> if (ThreadCtl(_NTO_TCTL_IO, 0) == -1) {
> printf("ThreadCtl\r\n");
> return (!EOK);
> }
>
> //Configure SPI
>
> //Clear Rx FIFO
>
> tmp = InterruptAttach( dev->irq, spi_intr, dev, sizeof(spiHwData_adt), _NTO_INTR_FLAGS_PROCESS);
>
>
> if(tmp == -1)
> {
> if (errno == EAGAIN)
> {
> printf("Interrupt are in use\r\n");
> }else if (errno == EFAULT)
> {
> printf("A fault occurred when the kernel tried to access the buffers provided.\r\n");
> }else if (errno == EINVAL)
> {
> printf("The value of intr is not a valid interrupt number.\r\n");
> }else if (errno == EPERM)
> {
> printf("The process doesn't have I/O privileges.\r\n");
> }
> }else
> {
> printf("Attached IRQ ID = %d\r\n", tmp);
> }
>
> //Enable SPI interrupts
>
> return 0;
> }
>
>
> static const struct sigevent *spi_intr(void *area, int id)
> {
> //Clear Interrupt status
> n_interrupt++;
> return NULL;
> }
> int GetNoOfInterrupt(void)
> {
> return n_interrupt;
> }
>
> Thanks in advance.
>
>
>
> _______________________________________________
>
> QNX4 Community Support
> http://community.qnx.com/sf/go/post111582
> To cancel your subscription to this discussion, please e-mail qnx4-community-unsubscribe@community.qnx.com
|
|
|