2009-09-17 06:42:46     about driver/char/bfin_sport.c

Document created by Aaronwu Employee on Aug 19, 2013
Version 1Show Document
  • View in full screen mode

2009-09-17 06:42:46     about driver/char/bfin_sport.c

steven O (AFGHANISTAN)

Message: 80076   

 

HI :

 

           I used the driver/char/bfin_sport.c  in   TDM mode and the configuration of  the sport  in user space as following :

 

    if ((sport = open (DEVICE, O_RDWR)) < 0) {

        perror("open");

        return 1;

    }

 

    scon.mode            = TDM_MODE;

    scon.channels        = 32;

    scon.frame_delay    = 0;

    scon.right_first    = 0;

    scon.lsb_first     = 0;

    scon.fsync        = 0;

    scon.data_indep    = 0;

    scon.act_low        = 1;

    scon.late_fsync    = 0;

    scon.tckfe        = 0;

    scon.sec_en        = 0;

    scon.int_clk        = 0;

    scon.serial_clk    = 0;

    scon.fsync_clk    = 0;

    scon.data_format    = NORM_FORMAT;

    scon.word_len        = 8;

    scon.dma_enabled    = 0;

 

    if (ioctl (sport, SPORT_IOC_CONFIG, &scon) != 0) {

        perror ("ioctl");

        close (sport);

        return 1;

    }

 

when i write some datas into the device,   i find that  the tx DMA interrupt   function can't    be  entered  . Is   someone   can help   me  ??     Thanks.

QuoteReplyEditDelete

 

 

2009-09-17 06:58:00     Re: about driver/char/bfin_sport.c

Appalayagari Sreedhar (INDIA)

Message: 80077   

 

Steven:

 

Are u able to get the L R and Bit clocks properly. if these are generated properly you should be able to get the interrupt propeprly.

QuoteReplyEditDelete

 

 

2009-09-17 20:59:53     Re: about driver/char/bfin_sport.c

steven O (AFGHANISTAN)

Message: 80099   

 

the frame Sync (8k) and the clock (2.048M) are good on board .  the Tx and the Rx are in loop now.    So  it should be able to get  the inerrupt  properply !  but not

QuoteReplyEditDelete

 

 

2009-09-18 03:26:31     Re: about driver/char/bfin_sport.c

steven O (AFGHANISTAN)

Message: 80125   

 

SIC_IMASK 0008d810

SIC_IAR0 10000000

SIC_IAR1 33322221

SIC_IAR2 66655444

SIC_ISR 00000000

SIC_IWR ffffffff

SPORT1_TCR1 00001001

SPORT1_TCR2 00000007

SPORT1_RCR1 00001000

SPORT1_RCR2 00000007

SPORT1_STAT 00000040

SPORT1_CHNL 00000000

SPORT1_MCMC1 00003000

SPORT1_MCMC2 0000001c

SPORT1_MTCS0 ffffffff

SPORT1_MTCS1 00000000

SPORT1_MTCS2 00000000

SPORT1_MTCS3 00000000

SPORT1_MTCS0 ffffffff

SPORT1_MTCS1 00000000

SPORT1_MTCS2 00000000

SPORT1_MTCS3 00000000

 

this is the configuration which read in sport_write function!!!

 

Is it right??????????????

QuoteReplyEditDelete

 

 

2009-09-18 04:24:20     Re: about driver/char/bfin_sport.c

steven O (AFGHANISTAN)

Message: 80126   

 

SIC_IMASK 0008d810

SIC_IAR0 10000000

SIC_IAR1 33322221

SIC_IAR2 66655444

SIC_ISR 00000000

SIC_IWR ffffffff

IMASK 0000ffff

ILAT 00000000

IPEND 00008000

SPORT1_TCR1 00004001

SPORT1_TCR2 00000007

SPORT1_RCR1 00004000

SPORT1_RCR2 00000007

SPORT1_STAT 00000040

SPORT1_CHNL 00000000

SPORT1_MCMC1 00003000

SPORT1_MCMC2 0000001c

SPORT1_MTCS0 ffffffff

SPORT1_MTCS1 00000000

SPORT1_MTCS2 00000000

SPORT1_MTCS3 00000000

SPORT1_MRCS0 ffffffff

SPORT1_MRCS1 00000000

SPORT1_MRCS2 00000000

SPORT1_MRCS3 00000000

QuoteReplyEditDelete

 

 

2009-09-18 06:23:23     Re: about driver/char/bfin_sport.c

steven O (AFGHANISTAN)

Message: 80128   

 

SIC_IMASK 0008d810

SIC_IAR0 10000000

SIC_IAR1 33322221

SIC_IAR2 66655444

SIC_ISR 00000000

SIC_IWR ffffffff

IMASK 0000ffff

ILAT 00000000

IPEND 00008000

SPORT1_TCR1 00004001

SPORT1_TCR2 00000007

SPORT1_RCR1 00004000

SPORT1_RCR2 00000007

SPORT1_STAT 00000040

SPORT1_CHNL 00000000

SPORT1_MCMC1 00003000

SPORT1_MCMC2 0000001c

SPORT1_MTCS0 ffffffff

SPORT1_MTCS1 00000000

SPORT1_MTCS2 00000000

SPORT1_MTCS3 00000000

SPORT1_MRCS0 ffffffff

SPORT1_MRCS1 00000000

SPORT1_MRCS2 00000000

SPORT1_MRCS3 00000000

 

---

 

Somebody can help me !!  why the interrupt can't  settup??

QuoteReplyEditDelete

 

 

2009-09-18 06:27:47     Re: about driver/char/bfin_sport.c

Sonic Zhang (CHINA)

Message: 80130   

 

What hardware and software release do you use?

QuoteReplyEditDelete

 

 

2009-09-18 07:37:00     Re: about driver/char/bfin_sport.c

steven O (AFGHANISTAN)

Message: 80136   

 

Thanks for your support !

 

I use the device BF531 and the SDK is  uClinux-dist-2008R1-RC8. Can you give me some suggestion ?

QuoteReplyEditDelete

 

 

2009-09-22 04:14:10     Re: about driver/char/bfin_sport.c

Sonic Zhang (CHINA)

Message: 80232   

 

Thanks for your support !

 

I use the device BF531 and the SDK is  uClinux-dist-2008R1-RC8. Can you give me some suggestion ?

 

---

 

What sport device do you connect? According to the sport config data you provided, you use the external sport clock from your sport device. Please make sure the external clock input is correct before start dma transfer.

QuoteReplyEditDelete

 

 

2009-09-23 04:18:54     Re: about driver/char/bfin_sport.c

steven O (AFGHANISTAN)

Message: 80302   

 

Yes, i use the external clock and the FS which is generated from CPLD. the sport device connect to the SLIC device.

 

now, i can't  send the data correctly(not use DMA), but the  RX DMA  can't   be  generated  !   How  to set  the  dma ?

 

can you give me some example?

 

thanks

QuoteReplyEditDelete

 

 

2009-09-23 06:08:21     Re: about driver/char/bfin_sport.c

Sonic Zhang (CHINA)

Message: 80303   

 

Sorry, I can't understand you sentence.

 

Do you mean you can neither send data nor receive data on sport?

 

Did you check your input sport clock?

QuoteReplyEditDelete

 

 

2009-09-23 21:57:52     Re: about driver/char/bfin_sport.c

steven O (AFGHANISTAN)

Message: 80326   

 

when i used driver/char/bfin_sport.c to test and i writen some datas to /dev/sport1 in user space,  the Tx DMA interrupt  routine

 

can not be entered, In other words ,  the Tx DMA interrupt  is not  occured!  it is block on this line "wait_event_interruptible(dev->waitq, dev->wait_con ) ".

 

 

 

I had writed another driver byself yesterday.  now, the Tx DMA interrupt  can be occured.  but the Rx DMA interrupt is not.

 

my configuration as following :

 

    *((volatile unsigned short *) SPORT1_TCR1) &= ~TSPEN;

    *((volatile unsigned short *) SPORT1_RCR1) &= ~RSPEN;

 

    *((volatile unsigned short *) SPORT1_TCR1) = 0x0000;

    *((volatile unsigned short *) SPORT1_TCR2) = 0x0007;

    *((volatile unsigned short *) SPORT1_RCR1) = 0x0000;

    *((volatile unsigned short *) SPORT1_RCR2) = 0x0007;

 

    *((volatile unsigned short *) SPORT1_MCMC1) = 0x3000;

    *((volatile unsigned short *) SPORT1_MCMC2) = 0x001c;

 

    *((volatile unsigned int *) SPORT1_MTCS0) = 0xffffffff;

    *((volatile unsigned int *) SPORT1_MTCS1) = 0x000000000;

    *((volatile unsigned int *) SPORT1_MTCS2) = 0x000000000;

    *((volatile unsigned int *) SPORT1_MTCS3) = 0x000000000;

 

    *((volatile unsigned int *) SPORT1_MRCS0) = 0xffffffff;

    *((volatile unsigned int *) SPORT1_MRCS0) = 0x000000000;

    *((volatile unsigned int *) SPORT1_MRCS0) = 0x000000000;

    *((volatile unsigned int *) SPORT1_MRCS0) = 0x000000000;

 

    *((volatile unsigned short *) DMA3_CONFIG) = 0x0000;

    *((volatile unsigned short *) DMA4_CONFIG) = 0x0000;

    SSYNC();

 

    if (request_dma (CH_SPORT1_TX, "sport_tx_dma_chan") < 0) {

        DVR_DEBUG("%s %d : Unable to request sport tx dma irq\n",

            __FUNCTION__, __LINE__);

        free_irq (IRQ_SPORT1_ERROR, &dev);

        return -EBUSY;

    }

    set_dma_callback(CH_SPORT1_TX, dvrSPORT_dma_tx_irq_handler, &dev);

 

    *((volatile unsigned short *)DMA4_CONFIG) &= ~DMAEN;

    *((volatile unsigned int *)DMA4_NEXT_DESC_PTR) = (unsigned int) tx_buf;

    *((volatile unsigned int *)DMA4_START_ADDR) =  (unsigned int) tx_buf;

    *((volatile unsigned short *)DMA4_X_COUNT) = 32;

    *((volatile unsigned short *)DMA4_Y_COUNT) = 0;

    *((volatile unsigned short *)DMA4_X_MODIFY) = 1;

    *((volatile unsigned short *)DMA4_Y_MODIFY) = 0;

    *((volatile unsigned short *)DMA4_PERIPHERAL_MAP) = 0x4000;

    *((volatile unsigned short *)DMA4_CONFIG) = DMAEN | RESTART | DI_EN;

 

    if (request_dma (CH_SPORT1_RX, "sport_rx_dma_chan") < 0) {

        DVR_DEBUG("%s %d : Unable to request sport rx dma irq\n",

            __FUNCTION__, __LINE__);

        free_irq (IRQ_SPORT1_ERROR, &dev);

        return -EBUSY;

    }

    set_dma_callback(CH_SPORT1_RX, dvrSPORT_dma_rx_irq_handler, &dev);

 

    *((volatile unsigned short *) DMA3_CONFIG) &= ~DMAEN;

    *((volatile unsigned int *) DMA3_NEXT_DESC_PTR) = (unsigned int) rx_buf;

    *((volatile unsigned int *) DMA3_START_ADDR) =  (unsigned int) rx_buf;

    *((volatile unsigned short *) DMA3_X_COUNT) = 32;

    *((volatile unsigned short *) DMA3_Y_COUNT) = 0;

    *((volatile unsigned short *) DMA3_X_MODIFY) = 1;

    *((volatile unsigned short *) DMA3_Y_MODIFY) = 0;

    *((volatile unsigned short *) DMA3_PERIPHERAL_MAP) = 0x3000;

    *((volatile unsigned short *) DMA3_CONFIG) = DMAEN | WNR | RESTART | DI_EN;

 

    *((volatile unsigned int *)SIC_IMASK) |= 0x00001800;

    *((volatile unsigned int *)SIC_IMASK) &= 0xfffff9e7;

    *((volatile unsigned int *)SIC_IAR0) &= 0xfff0ffff;

    *((volatile unsigned int *)SIC_IAR0) |= 0x000f0000;

    *((volatile unsigned int *)SIC_IAR1) &= 0xfff0000f;

    *((volatile unsigned int *)SIC_IAR1) |= 0x00020ff0;

 

    *((volatile unsigned short *) SPORT1_TCR1) |= TSPEN;

    *((volatile unsigned short *) SPORT1_RCR1) |= RSPEN;

    SSYNC();

 

the clock and the FS signal is ok, i had check them;

QuoteReplyEditDelete

 

 

2009-09-24 03:48:40     Re: about driver/char/bfin_sport.c

Sonic Zhang (CHINA)

Message: 80363   

 

Do you get output on SPORT DT0PRI PIN after you start TX DMA?

QuoteReplyEditDelete

 

 

2009-09-24 04:07:52     Re: about driver/char/bfin_sport.c

steven O (AFGHANISTAN)

Message: 80366   

 

Yes, i had check it by using oscilloscope

QuoteReplyEditDelete

 

 

2009-09-24 22:57:59     Re: about driver/char/bfin_sport.c

Sonic Zhang (CHINA)

Message: 80408   

 

From Steven O:

 

        昨晚我经过测试,multichannel operation模式下,发送和接受数据DMA没有使用packed模式,接收和发送中断都可以正常,但是如果两个同时都打开的话,其中一个中断会把另一个中断给屏蔽掉(比方说,发送中断在一直中断,一直没有停止,接收中断起不来)。如果DMA使用packed模式,只有发送中断可以起来。

        我个人认为在我固定开32个通道的情况下,开不开packed模式都是一样的(不知道我理解是否正确?)。这些有区别马?还有接受和发送中断同时打开的情况下,是否允许?允许的话,我该如何处理?

QuoteReplyEditDelete

 

 

2009-09-24 23:59:42     Re: about driver/char/bfin_sport.c

Cliff Cai (CHINA)

Message: 80409   

 

Hi Steven

 

I think things are the same whether packed mode is set or not in your case.We use packed mode for ac97 codec,it works just fine,the only difference is that the enabled channel number is not equal to the window size(we use 10 of 16 channels).

 

So,you can use unpacked mode in your case,and I will take a look at the problem you encountered.

 

Cliff

QuoteReplyEditDelete

 

 

2009-09-25 01:41:42     Re: about driver/char/bfin_sport.c

steven O (AFGHANISTAN)

Message: 80415   

 

Yes, i used the unpacked mode now.  but i can't   understand that why  the rx DMA interrupt  can't occured while the packed mode  was opened.   I worry about that   something wrong may be existed  in my configuration.

 

could you give me  the example configuration in the user program which used "driver/char/bfin_sport.c ??

QuoteReplyEditDelete

 

 

2009-09-25 02:08:48     Re: about driver/char/bfin_sport.c

Sonic Zhang (CHINA)

Message: 80417   

 

See uClinux-dist/user/blkfin-test/sport_test/sport_test.c

QuoteReplyEditDelete

 

 

2009-09-28 02:22:35     Re: about driver/char/bfin_sport.c

steven O (AFGHANISTAN)

Message: 80544   

 

TX and Rx are in loop.  when TX is enable and Rx  not, the Tx dma interrupt routine can't  be entered!   both TX and Rx are

 

enable . the Tx intrrupt routine is donging well. is it required to enable TX and Rx at the same time When using DMA mode by using an external clock and an external frame synchronization ?

 

when going into Tx DMA interrupt  rooutine,   the  value of  SPORT STAT  is 0x55.   TUVF and RUVF are happened. How to solove this case?

 

thanks

Attachments

    Outcomes