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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( g. p9 ~: g' J* y) n- @+ X$ H
  1. [code]EDMA sample test application
    2 Q6 ^+ |; [9 s2 _
  2. /*
      p- `+ E7 U  Q/ z; U- z
  3. * edma_test.c
    8 b& W, D4 ?1 l1 Z' P6 k
  4. *
    * j. q1 @+ L' D5 r9 b5 Q
  5. * brief  EDMA3 Test Application, X4 A4 M; g3 ^* i. M% Z9 k: e
  6. *6 \+ S9 T! Q- Z- `# _! I& R( ^4 Q6 q
  7. *   This file contains EDMA3 Test code.& r+ Z# V8 ]8 }; d
  8. *
    ; E: M- R* h% v4 D; p! w
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" |4 R+ A# {) n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    # k5 d* Y- t8 K) A, N* l  `
  11. *         TO CHANGE.
    8 n& Y2 X, [4 D$ a: O
  12. *# H8 w+ f; l, D* O
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 g) N  X9 ^# P; `/ O8 K9 X
  14. ** L3 F- p  t; ~# \
  15. * This program is free software; you can redistribute it and/or. y# A& t2 X) T/ p' w
  16. * modify it under the terms of the GNU General Public License as4 {6 _% L5 S& i; G
  17. * published by the Free Software Foundation version 2./ N) v: w# u+ j+ ?/ O
  18. *
    0 `) I$ z( `; h  @! v3 \+ }7 C6 c
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any( Y3 @- q* C1 {
  20. * kind, whether express or implied; without even the implied warranty
    ! }! E8 f& V/ U6 }
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # u/ F6 \, x: u! J
  22. * GNU General Public License for more details.
    ) ^! x- Q- X. j8 U- S% E8 S
  23. */
    ( b$ d" c3 N0 w9 i# m3 o3 Y
  24. . d& _( d) |$ n7 p. ~7 u
  25. #include <linux/module.h>: q3 l$ d" D5 E: e0 w. R
  26. #include <linux/init.h>8 e  @4 }4 q% y1 N1 Z) D3 S6 q0 w
  27. #include <linux/errno.h>
    8 @2 E% ^1 p" A+ A, J' j2 @
  28. #include <linux/types.h>
    0 m; c; U! H) Y/ G; ]
  29. #include <linux/interrupt.h>
    2 e2 D( F# o9 x! ~2 r# s( q
  30. #include <asm/io.h>9 L9 y$ s2 K# g( C7 m
  31. #include <linux/moduleparam.h>; h( d( D) s9 u
  32. #include <linux/sysctl.h>4 B+ q& ?1 _# a. b3 P
  33. #include <linux/mm.h>
      V/ L0 C% B( x8 G8 m+ ~3 n
  34. #include <linux/dma-mapping.h>' z- F  `3 Y: ~" m8 i7 y

  35. 9 W1 Q6 _# u  X  G
  36. #include <mach/memory.h>5 P4 o2 M& u( h7 ^
  37. #include <mach/hardware.h>
    * t3 o. \: B) _1 z5 ^8 g$ r0 r- a
  38. #include <mach/irqs.h>
    " p& B) x* m5 t
  39. #include <asm/hardware/edma.h>
    % Q$ _) w1 o' e) U& \
  40. / G: q* y3 m  o3 Q4 ~0 J* u" j+ S6 t. \
  41. #undef EDMA3_DEBUG9 V1 t& R7 q+ x0 s" _
  42. /*#define EDMA3_DEBUG*/
    2 g$ W  O$ h1 o

  43. : ?& f$ f5 m* h+ i
  44. #ifdef EDMA3_DEBUG8 A- H3 Q6 l$ h: G+ t% `
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 g2 m5 v( P4 y3 l$ v" q; i5 d) H
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% l6 C) m& M. D: E- e
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    " N" a; u9 E4 L2 A( H
  48. #else8 t4 `5 O# C: N. X0 ?
  49. #define DMA_PRINTK( x... )
    # v* N6 S3 i7 \: }' [, s
  50. #define DMA_FN_IN& F  M7 _' K8 s" G/ y
  51. #define DMA_FN_OUT& X) }2 {* N+ ~8 i# {- N( B
  52. #endif/ G0 U" c# P6 h+ M1 Q* L
  53. 7 C! b6 u/ h% K
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    $ Y: w# Z. ?" Z" o& Z
  55. #define STATIC_SHIFT                3
    ! s# p) `; ]" N" ^; n, }1 H
  56. #define TCINTEN_SHIFT               20
    & z6 i2 B( a) B* }' P' V
  57. #define ITCINTEN_SHIFT              21
    . {% M6 a5 P. @
  58. #define TCCHEN_SHIFT                22
    : i, Q  v3 e7 f2 N3 `
  59. #define ITCCHEN_SHIFT               23
    , |( m2 E0 o* g+ Z# E2 d  k

  60. + \0 M: o$ a7 j- j, N
  61. static volatile int irqraised1 = 0;
    & y! |, A8 ]$ K7 x# U
  62. static volatile int irqraised2 = 0;
    $ K4 D  q7 s$ k) u% x2 @- ~7 F- J

  63. 4 a6 `) K4 q: i5 _& C$ c! o; X
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# V0 k4 S$ C+ J6 e
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& b0 J! A* g. V2 `# H5 J% Z( y0 I9 k
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ d4 z' y# }6 x. }  @4 A

  67. ; s5 L) ^! |$ d" H5 H$ l
  68. dma_addr_t dmaphyssrc1 = 0;( b  G1 S, w( T2 H/ c* b$ ?
  69. dma_addr_t dmaphyssrc2 = 0;6 ?( t: ?4 M9 x8 Z
  70. dma_addr_t dmaphysdest1 = 0;
    8 Q# g4 Z8 O* _6 E
  71. dma_addr_t dmaphysdest2 = 0;! Q! B! }8 c7 x4 w

  72. ( s) w) `! ^/ A+ e+ ]- U. d, f- g: T
  73. char *dmabufsrc1 = NULL;) b* w- o' f" E, s% @" \. _
  74. char *dmabufsrc2 = NULL;. w% [6 R4 F0 j+ H( G$ m: S
  75. char *dmabufdest1 = NULL;# D" t2 e5 b9 A5 T
  76. char *dmabufdest2 = NULL;' _+ Q( I. X, S: @

  77. 9 f: `; |2 S4 a0 t% M: w) T
  78. static int acnt = 512;
    " ~" C0 k0 H4 v! X
  79. static int bcnt = 8;$ R7 I" R/ Z1 m3 }( n
  80. static int ccnt = 8;- `6 C3 S5 b$ n; E

  81.   J" x4 e" p* g0 T8 D% u1 i. }
  82. module_param(acnt, int, S_IRUGO);
    0 K4 D- @; w2 u& R
  83. module_param(bcnt, int, S_IRUGO);4 p$ s7 B( F9 E. A2 Y! \; t
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, `" U6 ]! T# j7 w

4 d$ N$ H3 {4 W      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. d: V4 v5 [* b' qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 c9 i0 K, o) S7 Y: m     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- c: w6 O+ ?4 m$ _( }) s' _+ @. i; i; K
- @8 \7 @% `' l! v5 ~
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-9-6 22:36 , Processed in 0.041655 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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