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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 {5 r& U. Y6 ]' w5 m4 x3 O" b6 ^( {. [3 W
  1. [code]EDMA sample test application2 x& X. |, B1 q
  2. /*
    # [0 v% b2 q+ g& _- J0 d" x( h/ @
  3. * edma_test.c
    ! A6 B4 P) y, q. |2 s/ o5 y% o
  4. *
    , |0 e" m5 @+ P% i
  5. * brief  EDMA3 Test Application
    1 B2 @5 K0 r; N. X
  6. *5 v  z" L# u4 {
  7. *   This file contains EDMA3 Test code.
    6 n, Y* a: f2 J" K1 c- p
  8. *+ m& v1 E+ ]" }' i! e
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; `* [* r0 I3 @0 X: ^# y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- o' y3 d) O$ L" o' l3 B7 U% w
  11. *         TO CHANGE.
    $ F  d7 g  k8 O
  12. *
    ! x/ S$ R) o; P  M4 v
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ' {! I- _3 p1 ~) v. T! F
  14. *
    " f+ \+ x4 a! m
  15. * This program is free software; you can redistribute it and/or
    8 [# q; v6 @6 F; J# L' M* [9 f
  16. * modify it under the terms of the GNU General Public License as
    . h+ I9 y; A: w  G4 o+ C  @
  17. * published by the Free Software Foundation version 2.
    2 u# `! z9 M* b1 I" Y5 U5 d
  18. *5 D+ X% Z$ V7 H7 f. g: \& T
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& Z+ b: |6 Q+ O9 D' W6 Y
  20. * kind, whether express or implied; without even the implied warranty
    ! \& R- A; W1 Y# f: O; r
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ( l0 @: t6 j8 _0 w0 d3 f5 d
  22. * GNU General Public License for more details.: q, Y9 }* q  \3 f; K
  23. */& |( }7 C1 z4 x, X, e) p! U& a/ F4 |

  24. * @2 k  Y) V; U
  25. #include <linux/module.h>7 R! u  J( {/ O, n' I1 r
  26. #include <linux/init.h>
    6 t) k$ d5 H( U
  27. #include <linux/errno.h>* m( `, ^) p5 v& [  y9 L, [
  28. #include <linux/types.h>
    1 R# C) }/ Y, ^. B
  29. #include <linux/interrupt.h>
    / H- }8 n0 ~8 V
  30. #include <asm/io.h>. w/ s$ Y8 F/ q9 f
  31. #include <linux/moduleparam.h>
    3 K6 ^: Z; B. v. R. A
  32. #include <linux/sysctl.h>1 g* n; A6 x6 n) N
  33. #include <linux/mm.h>; V+ q' |7 B- X  ]: u1 x3 ~3 e/ n7 w
  34. #include <linux/dma-mapping.h>* p9 c* ~# ?; V& L  T7 d
  35. & E0 C7 ?$ e% y1 Y
  36. #include <mach/memory.h>6 o5 ?) e, ]; S5 i9 I; v- a1 i
  37. #include <mach/hardware.h>
    0 \* P: |& p6 f% [3 X
  38. #include <mach/irqs.h>
    ; |7 P+ r6 R/ f" W
  39. #include <asm/hardware/edma.h>
    . c) q3 j. o  z! ]- H3 P
  40. - I9 k& J, v( m8 @4 I6 R9 ?
  41. #undef EDMA3_DEBUG: P% |9 P  @! h" g+ B/ g* F% u
  42. /*#define EDMA3_DEBUG*/
    * s1 i2 p# U: L3 T0 v3 S  e2 L
  43. 2 \( @& u* \$ j* u7 F( c+ }
  44. #ifdef EDMA3_DEBUG
    + C+ q4 \+ E: L+ j! ?
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). u2 I1 T0 y3 N! c
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    3 b0 U) q3 I" W/ |7 P
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" Q; F* h4 [# c; u% }
  48. #else% E1 e- ~5 [( h% n* B1 E
  49. #define DMA_PRINTK( x... )4 k; I" s0 X1 n; Z# g
  50. #define DMA_FN_IN0 g8 t6 ~% z# U/ W) N
  51. #define DMA_FN_OUT
    9 T( O1 z8 x5 h
  52. #endif
      Y. r# t- w4 y" a
  53. ; e7 ^8 t  x, @" ]( S/ t
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , }( f8 `6 q& L: N( h! p
  55. #define STATIC_SHIFT                3
    - A  Z9 f* Y# L3 h# g
  56. #define TCINTEN_SHIFT               20
    ! W4 e! L6 w, Q0 G( ~, D7 x" }* s
  57. #define ITCINTEN_SHIFT              217 t+ W6 y1 p  ^$ M: z
  58. #define TCCHEN_SHIFT                22; T5 n7 S! I  d. a, u& h9 B
  59. #define ITCCHEN_SHIFT               230 e& {+ o/ y/ v' Q4 M% t
  60. 2 k) s* I! E2 I. [! t
  61. static volatile int irqraised1 = 0;
    % Q7 z7 Z  H* D" A3 e& q1 _: j8 \
  62. static volatile int irqraised2 = 0;
    , B- \. b1 r) z, j* `1 \) {

  63. # V& U7 e4 w' u. _8 u
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + H2 L0 P3 N1 i3 c
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: E; j$ D3 ?4 V$ D1 o) \
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" P" D# _& U" q9 O: K4 @# D5 W
  67. . d# j5 c5 B! N
  68. dma_addr_t dmaphyssrc1 = 0;* g( O. j" I8 w
  69. dma_addr_t dmaphyssrc2 = 0;
    * z) f  s% z5 J- d4 a5 ~2 U
  70. dma_addr_t dmaphysdest1 = 0;( p- f! F4 V& |6 \8 T7 G
  71. dma_addr_t dmaphysdest2 = 0;5 n6 ?4 t' a# r

  72.   r0 I' {7 v8 R
  73. char *dmabufsrc1 = NULL;4 T/ B2 H) T' d+ x8 U" E
  74. char *dmabufsrc2 = NULL;4 a" m; F7 v6 q* H; M4 T
  75. char *dmabufdest1 = NULL;
    # Y- Z0 @( ]& p8 P" F
  76. char *dmabufdest2 = NULL;6 _. s5 q9 P$ e5 [; R+ H% \& k0 f

  77. 7 Q, g. Z! X3 e+ s8 K( Y1 |7 A  p
  78. static int acnt = 512;
    2 q* {& t- `# ?* G( `( o- N
  79. static int bcnt = 8;
    2 e: H6 J$ x4 b
  80. static int ccnt = 8;
    . k! C( s3 M- _  v% ?. x
  81. 5 S1 a6 {; r8 a  P
  82. module_param(acnt, int, S_IRUGO);
    . P5 D% ^( l6 T( o+ ~
  83. module_param(bcnt, int, S_IRUGO);+ L1 i6 U" _+ h( Z/ o; Q
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  H8 X6 D* C4 Q' v( a& p+ O
4 b1 z, s; F5 }# |3 g; d' C      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 H5 }8 H0 f0 M/ @. d' t
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# v5 e. l* \8 Z* `# G     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) m1 ?5 b/ ~  N7 Q  ]
' J7 s. l2 w3 ~

3 c. N0 C4 U2 D% x* M, y, Z. ^
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-22 07:25 , Processed in 0.042131 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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