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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 S0 m9 h! T7 O' f
  1. [code]EDMA sample test application
    - k7 Z; z/ W# {; u# Z3 y
  2. /*5 R  E' [" C' c& j. O  T
  3. * edma_test.c
    % [5 v& Y4 f! _
  4. *- u9 V9 F, r) Z6 n8 Q7 d5 E  C
  5. * brief  EDMA3 Test Application
    6 z$ v3 [& U) ]" F
  6. *9 |& J' h- x! j) n' ~
  7. *   This file contains EDMA3 Test code.& H7 Q0 r0 b" S! T0 l# S5 a, I# Q
  8. *. d% O+ c$ k; L0 A) l
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 |: K' C: `5 N/ f* }& h
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) c; |: ~9 z* t4 z( ?
  11. *         TO CHANGE.. m$ q4 a  }& A' J* W
  12. *
    5 I8 x6 `1 r: L0 f1 e% W) S( c
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ) Z; B3 Q, A; C# c# Z
  14. *
    - L* w9 M+ C) W2 g5 v
  15. * This program is free software; you can redistribute it and/or
    " ^' t0 a( {" G7 o0 V4 h
  16. * modify it under the terms of the GNU General Public License as
    : ~! o2 G8 X2 F+ P; n
  17. * published by the Free Software Foundation version 2.- g- i/ ~' _: A
  18. *' n: `6 d. d7 |: x, v: r* a* H
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 M( F  w% d$ K6 ]- Q3 J
  20. * kind, whether express or implied; without even the implied warranty# Z1 X( ]4 P7 ~& W2 W
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' Z. R4 _) f! m8 `0 v8 M+ _
  22. * GNU General Public License for more details.
    ; T: o) _! }& P8 l- w
  23. */! A" {! X8 `  b' s8 \
  24. * h% a% z$ l# g4 @7 n1 n' a$ ^
  25. #include <linux/module.h>
    & |" D+ S  D5 r. u5 D
  26. #include <linux/init.h>  v7 p# H2 P) p( r2 g) B1 I
  27. #include <linux/errno.h>
    4 E5 }& d  h/ B( C# H
  28. #include <linux/types.h>/ ~5 k7 V; j. y: Q* ?/ q! W6 K
  29. #include <linux/interrupt.h>
    7 w7 r( S7 d" ?2 r+ {, {( G/ X
  30. #include <asm/io.h>
    7 g, h9 D3 i. D! k: l: Z8 n
  31. #include <linux/moduleparam.h>
    5 B8 u: q1 B% r/ |3 S1 z" X
  32. #include <linux/sysctl.h>
    # {+ ]0 T2 v' I4 B/ Q) p) H# E" x, Z
  33. #include <linux/mm.h>2 w/ Q/ K, R9 ^5 |/ [
  34. #include <linux/dma-mapping.h>3 x1 B" |5 G2 x! t5 o% G/ w) U

  35. * I' f, @$ d1 [  B6 Y/ V2 k- n2 r
  36. #include <mach/memory.h># X5 E3 q% r: `! F! F3 K8 `/ n& s
  37. #include <mach/hardware.h>
    ; `4 A0 o9 m% o/ g
  38. #include <mach/irqs.h>
    1 q( I: g6 T. W6 l' J3 Q' q
  39. #include <asm/hardware/edma.h>
    . r5 n0 _( q3 }
  40. ) \2 o, |# N5 n
  41. #undef EDMA3_DEBUG
    1 u. D# H0 C( I: M$ W7 C  a* g8 r% ]
  42. /*#define EDMA3_DEBUG*/
    4 }0 w0 e. k# d' }. n* C! Q
  43. 7 S& f5 b& j% x  R( B& X" p) u
  44. #ifdef EDMA3_DEBUG
    " ?( J9 ~% c# R1 q) ]" R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' [4 \+ H' y" M" N
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    + M% V8 n% L% L+ B2 s9 q- ]" @
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 n, [- t! J- s/ C# p! a' w
  48. #else
    ! G' p+ M% C8 l
  49. #define DMA_PRINTK( x... )
      T6 u2 N$ q$ i+ x+ ]9 m7 \5 M" l
  50. #define DMA_FN_IN/ `8 v, c/ P+ t5 t3 m, m4 @: B# L
  51. #define DMA_FN_OUT
    & r( M3 J/ R. h/ S" V& O
  52. #endif
    # i$ |; `# `) \: i* v1 F
  53. 7 i7 d: j! h* O  Q- Y% t$ s
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    6 H; W3 n  h; _9 Y
  55. #define STATIC_SHIFT                3
    4 U4 \3 J/ _7 G( O
  56. #define TCINTEN_SHIFT               20& i, E+ h+ l* G& d8 ^/ a( m3 {: D
  57. #define ITCINTEN_SHIFT              21
    7 A& d9 V$ c  K; {7 G; L
  58. #define TCCHEN_SHIFT                22) ?5 v+ K$ o! G, G, i* N
  59. #define ITCCHEN_SHIFT               23* n& s: d0 D& H# {
  60. 8 V& `2 f' Y! j: C4 @3 c# \  i
  61. static volatile int irqraised1 = 0;2 l/ `. i' C6 t
  62. static volatile int irqraised2 = 0;: C9 o2 |& Z# ~7 V( }
  63. : k6 P3 s8 }7 Z- w3 z1 n0 S- V- \
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 I! K5 x6 g; |: Q; \7 e
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - m) F* T& Z+ u
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 t% y' {: b1 Q; F

  67.   _' N7 I5 D$ x, M9 c  {
  68. dma_addr_t dmaphyssrc1 = 0;) K9 r% r3 i% T7 M0 [+ w, a
  69. dma_addr_t dmaphyssrc2 = 0;
    8 V7 M7 o' d5 l. N/ M# S
  70. dma_addr_t dmaphysdest1 = 0;
    8 B8 C3 q, J$ p
  71. dma_addr_t dmaphysdest2 = 0;# s: O  X) G% @( t0 t9 X' X
  72. 8 s; v$ X# w7 G" p( O, g
  73. char *dmabufsrc1 = NULL;' b5 M7 w; |; r1 c# o/ y- k
  74. char *dmabufsrc2 = NULL;
    * A( V; B3 X- N
  75. char *dmabufdest1 = NULL;% |3 h/ ~7 Q, U9 g, N2 [: K
  76. char *dmabufdest2 = NULL;
    % G: [+ _1 ]6 M" E

  77. ( M" m2 O, q& S6 W
  78. static int acnt = 512;! N6 }: b7 s9 r/ k$ m; `
  79. static int bcnt = 8;
    4 ~/ W/ {9 B3 [% M$ g
  80. static int ccnt = 8;- m$ z/ C( X, e- S! X- v, s  s
  81. - t. _9 e3 F0 H1 A, P! Y
  82. module_param(acnt, int, S_IRUGO);& Y7 ~9 W) u& D* ]
  83. module_param(bcnt, int, S_IRUGO);
    1 [0 ?0 f, s  ~) N
  84. module_param(ccnt, int, S_IRUGO);
复制代码

' c. s; x+ i1 @6 b! M* J, C; n- B
4 T0 |! U( W1 g) I! N9 u1 a      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ A: T0 T- U3 A, }, V4 }/ 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 \0 a2 X# j7 J7 n$ ]     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ r9 }$ M9 }( x$ ^& v* `
8 L2 [- X1 K& ?& l* }: p3 c  S6 k5 x3 v# d7 m
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-2 21:51 , Processed in 0.042774 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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