prattle
驱动牛犊
驱动牛犊
  • 注册日期2004-04-01
  • 最后登录2005-08-07
  • 粉丝0
  • 关注0
  • 积分45分
  • 威望8点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
阅读:1340回复:0

为什么我的9054 DMA 只能读到偶数?(一百分求助)

楼主#
更多 发布于:2005-07-07 15:32
我使用9054+FPGA做的板卡.用windriver写的驱动程序.single cycle read/write 都没有问题.现在想实现DMA,但是遇到了问题.

      local端8位数据总线,当ready_和lholda有效时,local端每来一个lclk,数值加一.那么PC端读到的数据理论上应该是0~255循环递增.

      但我实际上得到的数据是:只能得到偶数的数据,而且每传16个偶数后,丢掉两个偶数.

      比如:
00 02 04 06 08 0A 0C 0E - 10 12 14 16 18 1A 1C 1E
24 26 28 2A 2C 2E 30 32 - 34 36 38 3A 3C 3E 40 42
58 5A......

       我的理解,当DMA过程中ready_和lholda有效时,应该是每个LCLK就传送一个8位数据,现在看起来似乎不是这样,肯定是哪里错了.还请各位大侠指教.

      ps:记得可以送分的,不知怎么操作.愿以100分寥表谢意.



附1:       FPGA中local端状态机使用的是rdk中的例子
           parameter s0 = 4'b0000; // idle
       parameter s1 = 4'b0001; // cycle start
       parameter s2 = 4'b0010; // single cycle wait state
       parameter s3 = 4'b0011; // single cycle last state
       parameter s4 = 4'b0100; // burst cycle wait state
       parameter s5 = 4'b0101; // burst cycle repeat state
       parameter s6 = 4'b0110; // burst cycle last state
      
       //Next state logic

       always @ (ADS_ or BLAST)
       casex (currentstate)
      
              s0: if (!ADS_ )
                            nextstate = s1;
                     else
                            nextstate = s0;
              s1: if (!BLAST_)
                            nextstate = s2;
                     else if (BLAST_)
                            nextstate = s4;
                     else nextstate = s1;

              s2:        nextstate = s3;

              s3:  if (!ADS_)
                            nextstate = s1;
                      else
                            nextstate = s0;
                                          
              s4:              nextstate = s5;
              
              s5:       if (BLAST_)
                            nextstate = s5;
                     else
                            nextstate = s6;

              s6:       if (!ADS_)
                            nextstate = s1;
                     else
                            nextstate = s0;
       endcase

       //output logic

       always @ (currentstate)
              casex(currentstate)

              s0:               READY_ =1;
              s1:               READY_ =1;
              s2:              READY_=0;
              s3:              READY_=1;
              s4:               READY_=0;
              s5:              READY_=0;
              s6:              READY_=1;
                            
       endcase

附2:       驱动程序使用的是windriver中的P9054_DMAReadWriteBlock()函数;
      
       P9054_DMAReadWriteBlock(hPlx,0xfffffffc,pBuff,length,1,P9054_MODE_BYTE,P9054_DMA_CHANNEL_0);
 
游客

返回顶部