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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 X$ r/ a$ O. e; e) H/ T8 N9 a+ K
  1. [code]EDMA sample test application' F0 a' k- w# ?
  2. /*0 c1 H: ~1 x6 ~8 \: r
  3. * edma_test.c
    0 M" f. ]9 @0 z9 G. J8 E1 {" y
  4. *5 S6 _  A; a6 x7 i" n$ G  K- g
  5. * brief  EDMA3 Test Application
    % h! c! l! G/ c& w7 F0 q: u
  6. *) k; P8 a5 H" n: z% p8 I) f/ g2 f
  7. *   This file contains EDMA3 Test code.
    , ^. N2 \) }4 a+ p6 w+ Z! m( h; J
  8. *
    * k% p, h, M3 v) ]9 V& j; g; R
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    , r$ P4 K" m/ q: Q' j/ V& q3 [4 e8 @
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 ~0 E/ d0 L9 F7 K
  11. *         TO CHANGE.
    . `( A6 x. z; l) N
  12. *- D8 E# [  P! _* D
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 i- T5 f$ \  Y/ J: n5 K  F4 b
  14. *- N8 Y+ K2 b) a* `, a
  15. * This program is free software; you can redistribute it and/or7 A% u3 \3 c" w$ t, ~5 v
  16. * modify it under the terms of the GNU General Public License as
    * T# F8 k7 }8 j* i1 w
  17. * published by the Free Software Foundation version 2.
    ; ^: |& L0 y- P- E$ F
  18. *7 O/ m1 M( Y  L) C; z; u
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / Q8 R! C1 q* T9 [: a
  20. * kind, whether express or implied; without even the implied warranty/ A" B2 n# Y# o
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & {4 d, e1 e1 u+ b) m# m
  22. * GNU General Public License for more details.
    5 e* f1 A) M0 ?
  23. */  [5 d& D% g; r6 y- S

  24. 1 v: A& n/ Q, e% {+ T
  25. #include <linux/module.h>
    & r9 g5 j" y1 I3 o& d; Q$ u
  26. #include <linux/init.h>
    5 I6 U3 r" R2 i" N
  27. #include <linux/errno.h>
    - s# q/ l7 E* J2 }$ H5 ]" ?
  28. #include <linux/types.h>9 n& s$ }* d1 u" s; v# I- A" P
  29. #include <linux/interrupt.h>4 A2 O9 |7 j  i8 A  j/ H
  30. #include <asm/io.h>8 }. L1 d/ [* l% x. A
  31. #include <linux/moduleparam.h>. k0 C' o" d5 w* b* Y" n; M
  32. #include <linux/sysctl.h>) M& R7 a7 l* \5 q) b
  33. #include <linux/mm.h>* \3 y( `1 {4 e$ D
  34. #include <linux/dma-mapping.h>
    , u9 r* q" j3 [, K% H- L

  35. 2 m" F6 D! B# s' Z6 ?+ ~1 J8 s. d
  36. #include <mach/memory.h>1 K! a* l% h# h, K
  37. #include <mach/hardware.h>
    # T" T0 h. R" a8 b
  38. #include <mach/irqs.h>
    ( u* S' z& K! A" n+ j
  39. #include <asm/hardware/edma.h>
    : t" r8 U$ a' w1 ?

  40. 7 C; G+ }5 j: q! r* o
  41. #undef EDMA3_DEBUG
    " f1 r1 l+ Q- e$ J$ m, A- ^1 s/ G
  42. /*#define EDMA3_DEBUG*/8 i' T+ m0 }1 F/ W; u

  43. 4 P( |- G7 R' n4 D. o* U, B. O
  44. #ifdef EDMA3_DEBUG# U1 h8 H" g7 r% r6 i# t1 q& H/ k
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' K6 k3 W* O& C1 ]( b/ G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    : s( N: h9 [  m) {
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ d4 T$ J* S4 V$ c! K2 ?( j
  48. #else* j+ Y* {7 d( @; I( n# j9 W
  49. #define DMA_PRINTK( x... )
    ) j  v8 l0 l1 A
  50. #define DMA_FN_IN
    2 @1 S  z9 `. w, O% z, x) `
  51. #define DMA_FN_OUT. k3 h+ p& G% B# V1 ^8 L1 V
  52. #endif
    ! Z9 j( l* t" f; I9 H: {
  53. 5 W3 U! ]% H; q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . c& \) c. ^! {% W+ V( ?6 ~7 j
  55. #define STATIC_SHIFT                3
    ( C/ d/ W8 i1 `3 k, V' j' q
  56. #define TCINTEN_SHIFT               20
    & n1 q; B& {# U% ^1 b& F2 H
  57. #define ITCINTEN_SHIFT              21/ G; p% J5 ^* K& l3 f& F! k
  58. #define TCCHEN_SHIFT                22
    - O% O0 A. W0 b$ V2 o
  59. #define ITCCHEN_SHIFT               237 M- E, @9 ?( i" z& t

  60. 6 d6 O  j: m! X2 I8 }% M- S5 @
  61. static volatile int irqraised1 = 0;
    9 T9 D* _. M5 |& \! A% w7 a3 G
  62. static volatile int irqraised2 = 0;
    1 E1 p+ r& ?+ P# I3 O2 ?& j
  63. 0 U% P8 K- J5 K& R" `
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 Q" e2 v9 O) r' t, k! r
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - `" D( Z! ]$ j
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) g) s& M8 U1 B7 Q$ R8 f

  67. 8 p* D. U- C4 \% S+ K( G, l
  68. dma_addr_t dmaphyssrc1 = 0;! y4 L7 V% F2 l& ~; {5 T- ]5 A5 @
  69. dma_addr_t dmaphyssrc2 = 0;; u. w4 h) E* P% e
  70. dma_addr_t dmaphysdest1 = 0;
    0 `% u  ~, o& t2 o
  71. dma_addr_t dmaphysdest2 = 0;: V3 u  ?/ l9 ], L" U  d9 A

  72. " d% R! l5 J7 v. d9 ]) C
  73. char *dmabufsrc1 = NULL;/ J9 B- E4 p& M2 U* u+ l
  74. char *dmabufsrc2 = NULL;' c0 E3 ]6 ]  q( r# ?. ^
  75. char *dmabufdest1 = NULL;
    - i  C1 _$ ]5 w5 K
  76. char *dmabufdest2 = NULL;
    / O: S- C& G" p9 N% |; t+ W5 y! y& V
  77. $ d( @( v4 l- P* A$ w
  78. static int acnt = 512;
    1 o: }: ?5 g# A7 E2 S
  79. static int bcnt = 8;: W+ `3 w. ~8 q
  80. static int ccnt = 8;
    / [0 c5 c; x; R+ D  j  g+ e

  81. % n& p% u1 u7 A9 y
  82. module_param(acnt, int, S_IRUGO);& @/ j& l3 O- `- f1 v% T+ k4 I: a
  83. module_param(bcnt, int, S_IRUGO);
    , s9 ^% M  x/ m" l/ R
  84. module_param(ccnt, int, S_IRUGO);
复制代码
. Q; a/ a, @  A

: I  d2 N3 u  t1 `8 Z      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; H) Q4 E( o5 q
arm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ q! ]- X3 F! |7 e0 V; f8 d     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' i  r2 X% c3 ?' ~2 w

1 F, e  Z! E( |  }7 u# b
! |  I5 F9 q' b2 }+ \) j2 v
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-24 19:40 , Processed in 0.041361 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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