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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) y; v2 a1 |. ^/ x- {* d3 ?; x, q1 e
  1. [code]EDMA sample test application
    4 G2 B" n" s8 |# c% i! X
  2. /*
    * T: u% V) b2 T& D3 ?
  3. * edma_test.c1 ~; B3 K! l; l- z0 ]
  4. *
    " @: `: ~/ B1 H& |  X( C
  5. * brief  EDMA3 Test Application/ _$ ?. g+ k* c
  6. *
    2 x# K! x* g, U3 j5 d' m0 S
  7. *   This file contains EDMA3 Test code.- L- a/ ?& P/ ?0 q. x, `
  8. *+ D) w/ m& B8 ?' J. v; o8 l
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& G! P- q# e! }9 f
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    8 L: f% ^, R6 J
  11. *         TO CHANGE.
    9 q( q: {1 k1 B* _! G1 V! B' k
  12. */ @4 c% n" r1 }6 v! L% q6 x) g1 H
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    6 m9 O3 J! g! v! a! S- Y
  14. *+ O7 U. X: Q; U- u5 @! U
  15. * This program is free software; you can redistribute it and/or- C& {4 }, x2 H$ J3 w
  16. * modify it under the terms of the GNU General Public License as
    5 O  r. _$ Z. f* |! ?) _' S
  17. * published by the Free Software Foundation version 2.: `3 P2 \6 I- P
  18. *, \8 V: y& ]( v7 p
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ k, a# D6 b! }6 y: @0 {
  20. * kind, whether express or implied; without even the implied warranty
    3 E# W' T1 _, d! R; }- ~
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' `! F% B) ]8 B
  22. * GNU General Public License for more details.
    ( ?0 C; }" c4 V1 f
  23. */
    % j. W! W) L1 U

  24. 9 L' a) ]8 {. H+ K3 c
  25. #include <linux/module.h>7 G. @6 ?- p3 Y3 T
  26. #include <linux/init.h>* F. k& Q# v" `1 J* a
  27. #include <linux/errno.h>
    2 M% ~1 d9 n2 c8 j, x, m
  28. #include <linux/types.h>
    ; Q8 K& p# n1 H, p+ k' \
  29. #include <linux/interrupt.h>  n6 E$ [' e( k' p8 w2 `" U% p. L
  30. #include <asm/io.h>
    0 s7 S6 b5 l' h2 T" Z
  31. #include <linux/moduleparam.h>$ |% M$ q' {  R, ~* f4 _( V1 V
  32. #include <linux/sysctl.h>
    + Y; f, X! d+ ?
  33. #include <linux/mm.h>
    / W' H- {* B0 R6 }' B8 e8 N; R) x
  34. #include <linux/dma-mapping.h>
    / u. Y2 e; W, ]" |$ G( t9 m

  35. 1 o6 X$ ?. I" N4 j8 ~) V; B
  36. #include <mach/memory.h>
    * n! V  r1 x3 _" ^
  37. #include <mach/hardware.h>
    $ Z* L2 s! X3 c% |
  38. #include <mach/irqs.h>
    # A/ U% r5 p" D. P
  39. #include <asm/hardware/edma.h>
    ) v1 G0 q8 n. b" j4 p& w4 a1 ^
  40. / G  X3 }: y3 p/ c
  41. #undef EDMA3_DEBUG' E$ q; p$ i. h
  42. /*#define EDMA3_DEBUG*/3 v/ A* _" X4 k6 n; l% k
  43. 8 @% I1 N0 ~6 i
  44. #ifdef EDMA3_DEBUG) U( I% w7 [* Y6 s! B8 {
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# c# w* b% X* p1 Y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 b( T( y8 _- e; j6 i& I
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , A2 R4 n+ s# t( j# _4 m3 l
  48. #else7 U* {0 _; q2 j% V9 K% k
  49. #define DMA_PRINTK( x... )8 |7 N) i* ?1 l  e( S9 N
  50. #define DMA_FN_IN4 D% A1 M5 Y* b! p9 ?7 H2 @
  51. #define DMA_FN_OUT: m4 V! m/ j3 ], U- E
  52. #endif( v- F6 ?5 W. P9 c, ^9 h

  53. ! j- E  |, B9 F1 k
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)9 Q4 _9 P$ M, ]4 |5 l4 J, s5 b# }
  55. #define STATIC_SHIFT                3
    + F# V6 N& }' w; q6 D* [  _
  56. #define TCINTEN_SHIFT               20
    # a- W: X% @  E0 f& `4 n* N  X3 Z
  57. #define ITCINTEN_SHIFT              21
    - Y& u! K0 w4 U! I5 g
  58. #define TCCHEN_SHIFT                229 G/ g5 @0 U" v- ~6 f' N% a9 b# q
  59. #define ITCCHEN_SHIFT               23
    # J6 ~! h" j" c
  60. $ w- o3 p7 J  ^6 ^+ H: b
  61. static volatile int irqraised1 = 0;
    : k) k% O/ u' ]8 d6 w
  62. static volatile int irqraised2 = 0;
    - c* W$ M. u1 l8 G( R/ a

  63. 0 u: e5 g! z+ u6 J, u0 I3 U
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; ^/ U5 p/ W8 l1 i  H, L) U+ H; D& D
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # B( x) z8 }+ \3 S. }& l( C7 q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' F  n# Q6 s2 a1 F
  67. " h7 r% R8 U2 H9 i& z
  68. dma_addr_t dmaphyssrc1 = 0;/ q3 H, D4 n1 S
  69. dma_addr_t dmaphyssrc2 = 0;
    1 A& P( |* i9 N6 I5 ]! D+ {/ V& v
  70. dma_addr_t dmaphysdest1 = 0;3 ^$ o- E# M8 d+ h9 t, b! I
  71. dma_addr_t dmaphysdest2 = 0;
    : B) t% }" k2 S( c* g

  72. 8 @5 {0 h# E; M1 m3 k
  73. char *dmabufsrc1 = NULL;' C! e/ j0 k3 v4 Q
  74. char *dmabufsrc2 = NULL;; h  b8 y. t$ R) q
  75. char *dmabufdest1 = NULL;
    / c' N9 d) a3 |2 Y
  76. char *dmabufdest2 = NULL;
    - M/ }2 ^/ V6 V; d6 L

  77. : v5 r+ `5 z* p  S2 C1 h
  78. static int acnt = 512;
    ) y- p4 _. e6 W: F
  79. static int bcnt = 8;
    1 n, r5 U1 Z% F3 S
  80. static int ccnt = 8;
    . `( s9 S6 ~# }( ]

  81. # f5 }. {2 }2 f
  82. module_param(acnt, int, S_IRUGO);. o1 a' p1 v7 H/ c% W; _* k
  83. module_param(bcnt, int, S_IRUGO);$ I& `0 n; w" b4 y5 I# F
  84. module_param(ccnt, int, S_IRUGO);
复制代码

2 z# k( o: i' y- D
/ q& Y! J2 e/ }/ k4 m8 v      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 k) ?! k  a! s8 T- D) o9 h4 karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 V$ {, a% l( ?! J; g( c3 p     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" P3 d  b( n8 Q' ?

2 G8 D! @, p+ W5 W- f3 B% S, u+ z% }% B
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-22 22:43 , Processed in 0.057008 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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