OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 10375|回复: 0
打印 上一主题 下一主题

[未解决] OMAPL138如何在Linux下使用EDMA3驱动

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % M8 f: Q( c& x0 f
  1. [code]EDMA sample test application# v  Z5 B% o, E8 v9 k  |$ z* k
  2. /*
    ) r1 |, W5 [  K" B  i
  3. * edma_test.c. A) y, a  t3 M" @5 k* X
  4. *
    : s( [! N' q, I7 c5 j
  5. * brief  EDMA3 Test Application0 G- }( c3 o5 v6 m+ C+ l
  6. *
    ; Q* A% o! G4 \, J9 Z9 b
  7. *   This file contains EDMA3 Test code.$ n2 R# b: e% K# E% ^6 I% w
  8. *& d2 V2 f+ ]2 ?) z% e, b
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 n, P, x! ]$ t7 |3 Z# R- _) n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: ]7 H! N9 ^% V/ o  _2 Q7 A
  11. *         TO CHANGE.
    ' r( b; r: K) Q9 \! _/ J
  12. *
    # c: N1 m" {* Y4 V$ O
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. U; Y( I. O9 g( }+ G
  14. *" ^4 a% I4 l' `: j8 b. j+ E
  15. * This program is free software; you can redistribute it and/or
    ' M5 u( c: E( L$ O' E& G# d9 Q4 z
  16. * modify it under the terms of the GNU General Public License as) t+ D/ q% \0 Z5 ?2 g
  17. * published by the Free Software Foundation version 2.
    9 A& m9 ~) U6 |' _
  18. *( H# z1 C) I" X6 {0 `6 A/ Z$ h
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- \  _) J/ p+ `; X: @
  20. * kind, whether express or implied; without even the implied warranty  O8 J* L/ j2 m8 t
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the+ R# U* m( L- n- d  K9 q
  22. * GNU General Public License for more details.7 O* C" R% \: @2 b2 ^
  23. */
    4 p* _2 {$ Q* @/ ^7 F2 t* [, s9 p

  24. 3 H) n/ L8 O. n4 d+ @
  25. #include <linux/module.h>
    0 q$ x3 @; F  f1 \  i+ X: k/ A
  26. #include <linux/init.h>
    8 L9 i4 Z7 Z1 b2 n8 g
  27. #include <linux/errno.h>( W  y- H+ R! b5 Q% X
  28. #include <linux/types.h>
    & U- G5 v; b+ |3 V6 j
  29. #include <linux/interrupt.h>: w; b& n" [7 s- ^) o
  30. #include <asm/io.h>
    5 G5 V6 Y7 N) ]9 u* i3 X
  31. #include <linux/moduleparam.h>& q1 n4 R3 e' J7 |1 V
  32. #include <linux/sysctl.h>. w4 P* w( v8 y' u+ s* \; s) X6 j
  33. #include <linux/mm.h>& ^- m( w/ Q3 T! a8 ^
  34. #include <linux/dma-mapping.h>
    1 E5 ^: o' U( S# d

  35. 2 s1 N. f2 v2 o" _5 w0 s
  36. #include <mach/memory.h>
    ; \9 i# P* j5 d3 v# h
  37. #include <mach/hardware.h>  u0 D( _2 }6 G- P7 m4 a% l# Q
  38. #include <mach/irqs.h>) T! T6 _) E% ^3 J* g/ Z5 S
  39. #include <asm/hardware/edma.h>
    . {" N$ p  d7 w# B

  40. * m' w6 Y; y% R: c/ p
  41. #undef EDMA3_DEBUG9 {8 a' J  P8 x6 ?0 j- ^$ x
  42. /*#define EDMA3_DEBUG*/
    9 h, E2 A" J: `: M

  43. . z4 Z: Y3 Q) q
  44. #ifdef EDMA3_DEBUG9 m* N3 V& K9 a! h; X
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* `9 {$ G6 B" Y- I
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    : ?% @% V& x% |' [
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* [6 Z- X! }% r& |
  48. #else) ?& p9 }! `% D. X& K
  49. #define DMA_PRINTK( x... )
    ; X/ x% z6 n' W6 n. O
  50. #define DMA_FN_IN
    , z) t2 b: r; k$ t4 w& g0 w! H
  51. #define DMA_FN_OUT
    7 j% R% Q* c2 i) q* e
  52. #endif
    ' F( d4 E& I/ t
  53. : h2 E& K5 @9 ^  G+ ~; e
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)3 \/ C+ g3 J8 z' S/ s" a& k
  55. #define STATIC_SHIFT                3' w/ x! b% C( U9 j/ R! p
  56. #define TCINTEN_SHIFT               20; _3 N: U; U+ c
  57. #define ITCINTEN_SHIFT              213 Q" L) I0 N2 o: [' [5 p3 e
  58. #define TCCHEN_SHIFT                22& _+ T/ x  p; o6 s# v/ L
  59. #define ITCCHEN_SHIFT               23
    7 n. l6 y6 @' y8 H8 l

  60. 1 v5 t4 C1 @3 M$ T
  61. static volatile int irqraised1 = 0;
    ! d/ B* l0 U! K- @: d) C3 j. ~
  62. static volatile int irqraised2 = 0;) N$ I7 J3 t' ~; I  ~
  63. + u9 X# T# i  I  x# X" n( d  f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' @1 [1 m1 C5 j7 c3 y" S, i
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + M1 d) F/ k3 S; N! c
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + }7 I' J. }% C' v- s! E6 n% W7 u

  67. . s0 R+ N7 l5 e' t3 \+ ^# r
  68. dma_addr_t dmaphyssrc1 = 0;
    ( @: e7 _% i3 @  p1 @4 e3 h& W
  69. dma_addr_t dmaphyssrc2 = 0;3 _5 o2 o4 {# [9 ]2 v
  70. dma_addr_t dmaphysdest1 = 0;
    1 Y1 @- b' J# M- l  s/ m
  71. dma_addr_t dmaphysdest2 = 0;% }; O1 h* L- r# E( ?2 M

  72.   o( f9 P- j4 J& `) _9 ]+ b2 k
  73. char *dmabufsrc1 = NULL;& g" I3 E$ X& {" q7 W1 G: G8 Q
  74. char *dmabufsrc2 = NULL;
      n+ a: z! S8 i
  75. char *dmabufdest1 = NULL;( ?" {/ S" K) A5 _$ f
  76. char *dmabufdest2 = NULL;- ?) I2 k# w9 D( L0 B# ]
  77. 3 ?; s7 J: J3 Q2 ]1 H8 o- B
  78. static int acnt = 512;
    0 F/ U  g, }( `' i! G; \2 e+ ^
  79. static int bcnt = 8;4 `. w  w. C! M, d& k' Y7 i
  80. static int ccnt = 8;" H" q' |1 q5 \# Y

  81. ! A- B1 ]$ `5 U/ J, j4 R2 `" w
  82. module_param(acnt, int, S_IRUGO);8 d1 L2 H; a0 ~, F
  83. module_param(bcnt, int, S_IRUGO);1 ]& N& }/ ]6 p/ Y' Z
  84. module_param(ccnt, int, S_IRUGO);
复制代码
8 _; ~8 I/ D. d( J

9 Z' D+ r* w, d1 |$ t9 y. }      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ d, ~/ Q0 [- v4 z, j+ jarm-none-linux-gnueabi-gcc  -I /home/tl/omapl138/linux-3.3/arch/arm/include -I /home/tl/omapl138/linux-3.3/include  EDMA3test.cpp -o EDMA3这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! t+ \  C" F$ d8 n1 U3 [9 b     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 n) {5 G+ j0 I; T1 {, `+ |7 g

7 X2 `! l! b, l" f, `& U
7 |6 b5 L& Y  [0 X, A* h( G5 l; }# w0 }; w4 U
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

点击跳转“创龙科技服务通”

QQ|手机版|小黑屋|嵌入式开发者社区 ( 粤ICP备15055271号

GMT+8, 2026-1-22 15:18 , Processed in 0.038835 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

快速回复 返回顶部 返回列表