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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. x+ N4 I7 ]5 r) X. _4 g7 C; i
  1. [code]EDMA sample test application! d) y0 ^8 B, {- r9 H: U
  2. /*
    8 {5 L3 x9 Y. P& p& Z% q" }
  3. * edma_test.c
    3 Q8 [* m7 x4 ]3 P
  4. *
      B% h8 E- e  X, L
  5. * brief  EDMA3 Test Application
    " [6 q7 d9 ]* R, K- q) h2 a$ m0 W
  6. *
    ' ]& g+ P6 X4 ~
  7. *   This file contains EDMA3 Test code.
    ( t! o1 A5 Z5 T( o" a% N- q
  8. *
    / a6 i3 B9 Z( L; l
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    % |% f' G6 ^" v- q* O
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ ^0 L! o6 t3 Y* ?! r; M* q
  11. *         TO CHANGE.
    $ b( n( |, G# }% T1 y9 r
  12. *
    6 [7 \$ o" p2 d7 [8 t% c0 x
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 n5 J/ Y& q8 t) V
  14. */ X6 a8 B4 Y( @: \6 ]: K* m
  15. * This program is free software; you can redistribute it and/or, ?. F; o4 Y) S) N% C% h
  16. * modify it under the terms of the GNU General Public License as6 U" r: w6 y! e
  17. * published by the Free Software Foundation version 2.  \* P2 v$ B/ _/ [1 |) X4 s
  18. *
    2 _3 a6 O  b4 [) A
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: ^' F/ z2 n5 j& o$ G
  20. * kind, whether express or implied; without even the implied warranty
    + r2 F! p% _7 D  ^& m8 ^& T2 V
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / l6 Q/ A  I& i# @
  22. * GNU General Public License for more details.0 G# L' _( _7 p0 _) c6 \; e
  23. */
    ) N7 z% b# M/ c8 g" [1 N" k9 w
  24. 3 G  ]) T  {# t+ S4 {
  25. #include <linux/module.h>8 w6 R4 ]$ K7 o/ c
  26. #include <linux/init.h>
    : h! m) x9 n7 L" x1 z
  27. #include <linux/errno.h>
    & K& O' B% F+ I& z
  28. #include <linux/types.h>
    ! D1 W* L3 T( @4 Q
  29. #include <linux/interrupt.h>6 C" i) E9 z3 W0 U# K
  30. #include <asm/io.h>7 G8 @0 f+ }7 D3 X
  31. #include <linux/moduleparam.h>$ O5 B' M  V" `
  32. #include <linux/sysctl.h>! D: k$ I  [0 }, z& A6 ]) W
  33. #include <linux/mm.h>, i* L; A. Z; r5 y0 J
  34. #include <linux/dma-mapping.h>
    4 {; ^2 W: t/ L# F

  35. + P* \0 f, G( E6 O
  36. #include <mach/memory.h>5 p8 U1 {8 b3 E/ E" ?( o( N  I
  37. #include <mach/hardware.h>5 m, W& j+ l+ K9 F" D; L
  38. #include <mach/irqs.h>  a; b+ L+ Y0 B/ V( ^* C
  39. #include <asm/hardware/edma.h>  g. U$ `1 w; w) y9 a

  40. # e1 M  }/ I, I& p, f
  41. #undef EDMA3_DEBUG4 F3 h' Y# J: x# n" m
  42. /*#define EDMA3_DEBUG*/
    . ]/ q% j+ a  P5 o# W6 T* c

  43. 5 p- I/ j7 p4 O$ {; h6 C
  44. #ifdef EDMA3_DEBUG' h/ F- x8 L' |
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 V6 p: b* `& g# P1 x: _: H$ O# m
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & ~$ C& }9 p- T) D: F+ L1 X
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    2 r- x- @( e9 n6 E$ j
  48. #else- l5 H8 M- n& ?$ j  e. s+ w
  49. #define DMA_PRINTK( x... )
    & M% _+ w- z9 [) G0 k- R0 k
  50. #define DMA_FN_IN
    4 m  d9 {  b; K7 Q! h+ K1 b
  51. #define DMA_FN_OUT
    - M; h  j: x; E
  52. #endif  D2 f# w" X3 d3 K
  53. & H# w( V1 y' W8 W9 G2 a! h) i
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    - z) K: ]; {! n, \) f7 o
  55. #define STATIC_SHIFT                3* n1 A  u2 C! s8 |8 z6 W
  56. #define TCINTEN_SHIFT               20) R3 g) @! i. t: ^' e. k  ^3 x2 f
  57. #define ITCINTEN_SHIFT              21
      q  a! V$ Y6 f7 C
  58. #define TCCHEN_SHIFT                22
    " Q& X' f+ {; ?0 R, d
  59. #define ITCCHEN_SHIFT               23
      l: J9 X" L( B  I' r
  60. 8 y2 q! ?! B0 y$ Q
  61. static volatile int irqraised1 = 0;
    8 v; \1 Z+ [+ x' J5 \* w
  62. static volatile int irqraised2 = 0;$ R4 E" O) I3 a7 Q5 g  d" ^9 q
  63. * D/ R) y, z* y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 ~* t" M! @: F# k) ?7 d
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# i/ ~0 ]) O) W
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 t2 l6 L# |' v+ @1 N

  67. - v& q) g, h3 F/ g5 j! F
  68. dma_addr_t dmaphyssrc1 = 0;4 J' N7 O1 {" K) R" w$ s" Q+ x
  69. dma_addr_t dmaphyssrc2 = 0;
    $ \+ U& Z4 n/ `+ W9 i& O5 j
  70. dma_addr_t dmaphysdest1 = 0;- X8 X* r! O7 ^, h
  71. dma_addr_t dmaphysdest2 = 0;
    " ^4 [1 V% c1 w+ v- e
  72. 1 T# b3 y( o, A1 e* X4 W
  73. char *dmabufsrc1 = NULL;
    ' T( y. P0 U" p! K
  74. char *dmabufsrc2 = NULL;
    2 b# c! t6 i. [
  75. char *dmabufdest1 = NULL;: ?7 P# p+ s( i, O; z0 h
  76. char *dmabufdest2 = NULL;
      ~% G7 J* t( n  l
  77. # d1 ~( k, O# X% F* |3 x6 t# B
  78. static int acnt = 512;
    % y5 n) y( x) O( S( ~4 F
  79. static int bcnt = 8;
    # S+ \, e1 N* ^/ q3 R' a5 F
  80. static int ccnt = 8;
    * f% l' A- s$ H7 y- r* p
  81. 9 l- s% E: J7 q( `* R! P' x3 H
  82. module_param(acnt, int, S_IRUGO);
    # Z4 H7 e2 K/ g
  83. module_param(bcnt, int, S_IRUGO);# b! b7 z- L8 b0 |5 |+ N
  84. module_param(ccnt, int, S_IRUGO);
复制代码

& @. Y2 H/ B, W* R  z; M, h8 I+ w  {; B& c/ K+ ^4 D
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 ~* }6 o8 e; s( H6 X, Q7 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 v6 r, v0 X8 b- ]' x$ A- Y% p     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 [$ }/ Z" Q7 w7 J1 a
& p1 [0 @% x$ e' i9 f. i' j4 v: L: l8 x3 u5 [% j% A* W+ ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-19 04:28 , Processed in 0.038312 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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