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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 W. R1 P' d$ \* x
  1. [code]EDMA sample test application9 y; k4 n- V/ M) t: s$ s
  2. /*# V- V. C$ z3 l6 z2 M
  3. * edma_test.c+ L" G: x! ]6 d3 ?# H4 j. V2 ^
  4. *- H# D8 B4 J9 a8 y7 q3 ?  t
  5. * brief  EDMA3 Test Application" \4 K+ a4 u, k  o+ O3 n9 @4 T2 J8 H
  6. *3 X& u) K1 C- Y  H6 p1 M$ N
  7. *   This file contains EDMA3 Test code.8 H! J3 y) Y3 f/ j) M8 s
  8. *
    0 N4 f. [& q0 E3 L3 `
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 C  Q) r0 H7 H& `7 @% g) l
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ( O+ g, A, E" e9 r$ d
  11. *         TO CHANGE.
    % W+ H6 D+ @$ j
  12. *7 {  U. s$ C( K" ]5 q& H5 {* {5 a
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    . \& ^* B$ d/ L' z
  14. *% U& o, @$ A  m  u- r# R6 Z
  15. * This program is free software; you can redistribute it and/or
    ' D) f" C& V2 g& @, ~5 w5 T
  16. * modify it under the terms of the GNU General Public License as
    8 {0 e- m: S6 p  Y3 Z( S
  17. * published by the Free Software Foundation version 2.
    % n( ^# \; h$ m, r% n9 z" w& V9 B
  18. *
    + S, h# L0 F# j/ y; u
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ' z8 u: g+ k: L8 j" |, k8 o
  20. * kind, whether express or implied; without even the implied warranty& y( c$ E5 m8 }0 ^7 U
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 g: |" M  Z4 u% A0 ^
  22. * GNU General Public License for more details.- M: u1 j" e1 u. E
  23. */- v, Y0 v6 ^+ q7 g

  24. : i" p- a8 |* w7 J) o% F
  25. #include <linux/module.h>& q# a3 _; e  J+ i/ Q3 q
  26. #include <linux/init.h>: [9 [/ y( ]& ?- |/ r
  27. #include <linux/errno.h>8 L3 f- T; u( e% @. e
  28. #include <linux/types.h>5 ?2 c6 R, f$ t, u) I
  29. #include <linux/interrupt.h>$ ]% T% `* e/ y1 Q% [/ W1 h4 J
  30. #include <asm/io.h>
    0 K8 B% W6 M# g- r  b
  31. #include <linux/moduleparam.h>( K, ^1 ]7 o: \# o1 L/ Q! I
  32. #include <linux/sysctl.h>9 K; r$ E6 g& T5 V. T; a. b  Z
  33. #include <linux/mm.h>
    , O- P. d! t6 l  e
  34. #include <linux/dma-mapping.h>
    " S" p8 f( `) w& k+ ]" h# U' N
  35. ! b6 m9 ]& b- K8 d  z; T
  36. #include <mach/memory.h>
    ( H) u# D5 N' u. ]
  37. #include <mach/hardware.h>, U7 B, W8 E9 c3 o2 z' N
  38. #include <mach/irqs.h>. _% l5 U5 k5 h% T6 X
  39. #include <asm/hardware/edma.h>
    6 M' Q9 D# h' C3 B; _0 a) z

  40. ' R: ?0 S: O! \2 R( S" w
  41. #undef EDMA3_DEBUG! ~. G% ^7 @. V' k$ p2 V5 C1 X
  42. /*#define EDMA3_DEBUG*/+ g! I& n! \. L

  43.   \+ n* W- z" U7 W! j! O+ e9 Z
  44. #ifdef EDMA3_DEBUG' ^. P1 M$ N+ L9 d% h) j
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); q, a" c, F1 K8 r
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # v$ q+ s) ?, N6 C3 N1 u
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' w) F) F0 f/ ?7 U& j- z- A; y, _
  48. #else& R0 U. [$ ?/ C. B2 b5 N8 g! a
  49. #define DMA_PRINTK( x... )
    % d7 F1 H* L: ~) i
  50. #define DMA_FN_IN6 H" ]% u' ]4 M- K
  51. #define DMA_FN_OUT
    % N& e9 u6 D# }1 t  A/ O
  52. #endif6 W3 i% Y7 [& @+ U% ?6 L" b! S+ V  o

  53. & m3 Z' [8 o# V2 Q" T* A
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    2 [9 A! N8 |1 P+ Y5 }1 w4 K
  55. #define STATIC_SHIFT                3: z6 f7 N0 P; h' d2 @0 M2 S& A# J; T) u
  56. #define TCINTEN_SHIFT               20& Q& x$ p0 \! o( F6 q# X8 B4 W
  57. #define ITCINTEN_SHIFT              21$ H# ?* E1 [0 \  X, x- @
  58. #define TCCHEN_SHIFT                22
    9 V; W. P8 `4 s6 q5 I
  59. #define ITCCHEN_SHIFT               23
    2 V/ C- p8 D2 P; E
  60. % H9 R9 e+ |) p9 N  s- r
  61. static volatile int irqraised1 = 0;
    ' ^3 y3 l, t% V- P! h' @# v, O/ f
  62. static volatile int irqraised2 = 0;" Z- X9 Y: U+ S0 U( J5 h- _
  63. & x, a3 f3 x9 i1 i( H
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ I7 K; n% A& p5 p. `
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ A% F! F. ]7 ~$ H; i
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ [6 ]. i) c6 v8 h
  67. / F" h9 R* Y( \9 V
  68. dma_addr_t dmaphyssrc1 = 0;
    2 D) E5 R0 ^. k3 v
  69. dma_addr_t dmaphyssrc2 = 0;  K( N/ \; E& Z0 T7 W9 Y8 A
  70. dma_addr_t dmaphysdest1 = 0;$ {. a3 F1 f" }- ]! ~( ^
  71. dma_addr_t dmaphysdest2 = 0;- j$ _. x; w7 x& T& C! ~) O) _
  72. / f# n) W# s0 y& v9 E- f
  73. char *dmabufsrc1 = NULL;# m  r) m+ B: S& s1 k, A! Y
  74. char *dmabufsrc2 = NULL;
    ; v- b0 E& H6 {
  75. char *dmabufdest1 = NULL;4 Y) O* n9 j$ k5 o8 V! j
  76. char *dmabufdest2 = NULL;
    " c. Y2 T- }" Z
  77. % h7 T& }* w( `2 W* S
  78. static int acnt = 512;
    " f% m, A- W8 w% w' ~) \
  79. static int bcnt = 8;# j! k- T  z5 h0 c3 ?* E; }
  80. static int ccnt = 8;
    8 k: O$ z* S. k, I
  81. 4 m* q: `0 e$ T6 S! r
  82. module_param(acnt, int, S_IRUGO);
    % c& |" K9 O* w2 v9 C
  83. module_param(bcnt, int, S_IRUGO);5 z. s' }2 _, m, D
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 e: Y1 B! i$ ]9 S
. I% |" G0 k6 y  u& [- |/ d
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
  S& X0 k* b3 e" ]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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 O8 `) o6 m1 i- o* B3 k0 ?
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! k" [5 u4 B! ]" s1 O1 |, f2 M# m. h; L: j- {. b

. }; A9 ~1 Z/ T7 D, y! H) T# t% i9 q" \
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-14 13:22 , Processed in 0.045411 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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