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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  Q" j" h+ }5 T: C
  1. [code]EDMA sample test application
    3 p2 z* B  q1 m# M! V3 D
  2. /*% F) J% q6 }  f
  3. * edma_test.c
    ( N9 T$ G1 p$ L/ G
  4. *. ?" O- o% b: c+ p+ @7 J& c
  5. * brief  EDMA3 Test Application6 Z. m6 `" @, Q; i" p5 f$ _4 x" y( x
  6. *6 O( u7 X4 S$ @+ D- e9 t/ P
  7. *   This file contains EDMA3 Test code.
    , h7 J+ }7 ?" @1 k$ f* s
  8. *3 _. ~8 C& P1 ^# ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    0 j* M; w$ C- X- q3 t, a7 ~  L
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' l% C2 K, Q+ ~' l/ t
  11. *         TO CHANGE.# j7 e1 E: I1 K/ X6 R' ~
  12. *
    ' F2 R+ f) S( @8 R
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  U1 Z4 {: V( ^( f6 w
  14. *9 `* F" {! U7 H; T: [
  15. * This program is free software; you can redistribute it and/or7 `% T/ D7 p7 B7 a6 p! a
  16. * modify it under the terms of the GNU General Public License as
    / S& ]' w$ g) c' M( x
  17. * published by the Free Software Foundation version 2.
    $ m4 A2 e4 l' k& n( E0 y
  18. *
    2 E- H4 a1 j$ W  H! u5 @' _
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 Q- b" b. P) L6 V) r
  20. * kind, whether express or implied; without even the implied warranty; x6 {$ A5 D1 D2 Y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 _" X4 J3 Z/ v8 L( Q
  22. * GNU General Public License for more details.- b( a7 @- Z, [
  23. */
    % r1 P  ~4 z  ?* m0 p! U1 o) Y
  24. 0 m; x& v+ r* H4 J6 w
  25. #include <linux/module.h>
    # e1 t4 q3 H& v8 _( R, m9 N
  26. #include <linux/init.h>
    2 d; m$ B9 b; ]( x
  27. #include <linux/errno.h>1 K1 Q; g; @: V% [; W" _3 d/ g
  28. #include <linux/types.h>8 e% O5 R% `  u  X) y% j, G% s4 d
  29. #include <linux/interrupt.h>
    % f; {0 G% k3 f: W7 S
  30. #include <asm/io.h>8 w3 J' h+ R3 e" [) A) j2 p
  31. #include <linux/moduleparam.h>
    * T- ~! n* v. O1 q+ [  u
  32. #include <linux/sysctl.h># H& U+ M2 F' O' c' a
  33. #include <linux/mm.h>
    * ?- @0 Y$ `+ z
  34. #include <linux/dma-mapping.h>0 j: c  L, ^+ H7 G4 Z
  35. 8 `2 _4 Y0 `! x( o0 i( G
  36. #include <mach/memory.h>
    : Y1 v2 {$ c) |1 E
  37. #include <mach/hardware.h>/ J( S. P! i" z! O0 _4 n( K
  38. #include <mach/irqs.h>( _& R4 L3 p; P; R% [3 k1 x8 r0 V
  39. #include <asm/hardware/edma.h>+ s" n+ D: v8 }4 V& W
  40. ) m6 n5 \* ^% |# V& q5 Y2 H; H
  41. #undef EDMA3_DEBUG
    ( y" [7 X4 N( f! d5 u3 Q3 n1 l
  42. /*#define EDMA3_DEBUG*/
    + s/ w7 R2 B$ b- ?8 n1 J' R

  43. 6 g% r* t) E6 S4 o
  44. #ifdef EDMA3_DEBUG' P- p1 [# T7 n( e0 E) U/ m& d
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( |- n7 \" m) E9 u9 D4 f
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    1 F/ }* @: \( x, Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 n9 @9 W5 T! A
  48. #else
    + Z' g' v- m6 p# u! X( K8 k
  49. #define DMA_PRINTK( x... ): g3 T7 X6 h4 A6 Z. v# L& M: a
  50. #define DMA_FN_IN5 p% q9 j- M+ \
  51. #define DMA_FN_OUT; [& a6 `- i: @# L# Z2 l% d; L
  52. #endif
    * t( h4 q* Y; M

  53. * I) }: e3 S+ y+ R
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ) @2 \& p" U: W. `- y1 S8 _
  55. #define STATIC_SHIFT                3
    ; U" |0 _6 d- V" T4 ]" e
  56. #define TCINTEN_SHIFT               20
    5 J5 o' g, c6 n! Q( Z( a
  57. #define ITCINTEN_SHIFT              21
    9 w9 G/ t5 |8 ]( E
  58. #define TCCHEN_SHIFT                22
    * `; E" l% v+ H* p/ {" A  o
  59. #define ITCCHEN_SHIFT               235 X* y4 p" T9 V+ X
  60. : N! r/ h) ~3 J& P
  61. static volatile int irqraised1 = 0;- x( A9 \! d: p% y" s
  62. static volatile int irqraised2 = 0;/ k* J2 G) c: ?6 f& A' q; G

  63. . y8 ~6 a  }! C1 W
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. K7 Q/ x; {! s
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' e5 |4 Q: m# Z  G9 e& T
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      z+ I9 L" D1 {: }" [! R$ N; e! t3 p
  67. 9 ~* g7 R; ?- N  y+ w, N+ Z
  68. dma_addr_t dmaphyssrc1 = 0;
    0 W+ a/ i# x: `: R& s+ _* o
  69. dma_addr_t dmaphyssrc2 = 0;, H1 L0 [" _: [1 B! X& A
  70. dma_addr_t dmaphysdest1 = 0;
    5 M$ I- n( l3 n; L- Q; v
  71. dma_addr_t dmaphysdest2 = 0;
    . ~+ ]2 \1 }0 H0 x* z

  72. * l" Y5 h3 N0 q$ j; q' B' |2 f8 H# p# L
  73. char *dmabufsrc1 = NULL;
    1 L, }% F  t$ G# y" v% ?
  74. char *dmabufsrc2 = NULL;
    1 [5 M; K* N0 B7 O% m! P. {( I( e
  75. char *dmabufdest1 = NULL;
    7 M) z# g& ]% x/ [: `
  76. char *dmabufdest2 = NULL;
    2 i2 D  n2 x4 m7 |) M
  77.   m& Y9 n4 I+ j- {, e
  78. static int acnt = 512;( I* y- P, ]) q" N
  79. static int bcnt = 8;
    1 q  H* J& f6 x+ X  Z
  80. static int ccnt = 8;
    3 j8 P) a8 ~9 W0 y. k4 z0 n2 o
  81.   v# |5 D2 z3 b+ M$ f% ~5 B
  82. module_param(acnt, int, S_IRUGO);6 |; M" D/ ?( f6 s2 Y* D
  83. module_param(bcnt, int, S_IRUGO);( ~7 K3 O% V- Y9 f+ G
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 {5 c* @# V7 W$ f
" o& c- [, Z' l5 g3 v$ Z$ n      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) R2 g1 z9 d* V6 x- Y7 ~( iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 V0 D" `# F8 D; W! {
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ R* ^9 K1 \. a! t' D

8 J$ S- w. {! k% Q/ N6 _* d& D- e, c' D6 B& @- V
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-28 05:08 , Processed in 0.041831 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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