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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * b$ ?8 V0 A3 ]# a2 V. t
  1. [code]EDMA sample test application6 A9 E2 k) T+ D$ o: ?% G
  2. /*
    4 f; S; G; @7 I% G4 ^$ Z
  3. * edma_test.c$ T) N2 x- Y% p/ c/ N- s
  4. *5 H: r: s  r) M
  5. * brief  EDMA3 Test Application
    $ k+ O% R, n1 T  n
  6. */ |/ R8 ^/ u  l9 P& h
  7. *   This file contains EDMA3 Test code.
    ! S  A' x- M; {' P6 \* B, }
  8. *7 y1 d3 }1 l/ q2 z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 i2 \! s8 h" z. n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% g* [6 f8 @# G- y) s
  11. *         TO CHANGE.
    8 g* S0 U9 R/ G+ n  r6 a) m, f
  12. *# q- ^0 S. `  X* V1 \+ I7 d
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    7 h* q" C( M6 L7 u: Y. N
  14. *
    $ I% X" _* N7 I& G; p* A
  15. * This program is free software; you can redistribute it and/or
    & g) C8 I) Q* W+ I% d
  16. * modify it under the terms of the GNU General Public License as- m/ E) U( x9 P8 g* K0 r
  17. * published by the Free Software Foundation version 2.
    3 d7 {: S: J8 Z2 S" ~/ y& E
  18. *
    6 p+ s* o. {# w+ _4 }
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any" X7 y/ Z( `. i) s, t
  20. * kind, whether express or implied; without even the implied warranty: L# K+ J- w2 P* @7 y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    " a( Y0 E& S" s( R- _
  22. * GNU General Public License for more details.
    ) O5 {( v' g8 H" ^
  23. */# Q1 i) g/ S1 R7 F( i( z' k& X4 `
  24. . Y+ ?. u9 Z$ p0 ^5 J/ |( r
  25. #include <linux/module.h>
    ! M9 X+ u; a; t# W1 b$ W% _3 W
  26. #include <linux/init.h>
    : j% @- L$ `+ y7 x6 k. l
  27. #include <linux/errno.h>% I& G# e9 f* G' B$ j
  28. #include <linux/types.h>) t& \- ]4 g0 \& z
  29. #include <linux/interrupt.h>7 D$ [2 D) B7 i# |
  30. #include <asm/io.h>
    7 B5 c: t: x( ^; [2 s9 j: j3 ^
  31. #include <linux/moduleparam.h>. o8 v5 K7 C( g( I' N  k; Q
  32. #include <linux/sysctl.h>
    9 r* o2 o* j0 \  o  t1 n
  33. #include <linux/mm.h>$ w4 l: ^* u7 D! H/ n2 D
  34. #include <linux/dma-mapping.h>- W- j  t0 L/ l  Y7 t1 C0 n
  35. ( N3 f/ C4 [3 L; `& Y8 L8 e, X
  36. #include <mach/memory.h>
    3 J# H$ K1 u: ^) i
  37. #include <mach/hardware.h>9 I- J+ n4 Q/ U  k5 e5 t
  38. #include <mach/irqs.h>) {$ @- n$ z" l/ {* K
  39. #include <asm/hardware/edma.h>( A/ h3 z8 Q" [" g3 f

  40. * \  f# I! e3 i# Z+ Q
  41. #undef EDMA3_DEBUG
    % k/ K' Z' ?/ L- x/ T
  42. /*#define EDMA3_DEBUG*/
    ; N( P) L+ y  [6 W3 X. @' @
  43. ! `- E+ @/ \" X* @& R5 S
  44. #ifdef EDMA3_DEBUG& Z/ N& M, P. J- C" H4 g
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    # h% q) |  C: e2 Z8 j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 _4 t# ?- L  a
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' [4 f1 q2 H# D, N; h/ r( a7 i
  48. #else
      v0 y$ x) U/ E$ U' ^
  49. #define DMA_PRINTK( x... )9 Z) U; ^4 A- @" f
  50. #define DMA_FN_IN5 L$ F7 z6 f: b/ W) e
  51. #define DMA_FN_OUT
    - ]/ ~) P- D. A8 u* L
  52. #endif
    1 d: M8 h! h( H7 a3 H0 z
  53. , P) R" n1 D' U) L  H. W
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). h+ @4 I( a- o, B4 Q
  55. #define STATIC_SHIFT                37 `6 s, N2 y) L
  56. #define TCINTEN_SHIFT               20
    : E% l; W( X0 X1 p; O
  57. #define ITCINTEN_SHIFT              21
    7 O% A5 |% L2 U9 ~' u* L6 |
  58. #define TCCHEN_SHIFT                220 x, L+ p9 J7 Q. V
  59. #define ITCCHEN_SHIFT               23/ p% l! a7 A9 B3 ?! b$ c
  60. $ |, @2 `: G* q9 t4 U  G
  61. static volatile int irqraised1 = 0;! j* J" o* N% ^* y# k. d
  62. static volatile int irqraised2 = 0;
      H' F3 ?# J: ^* A9 T
  63. - S; w2 ]5 V( K+ ?6 ~, g
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 l8 i+ J6 F' U6 q# n" U
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 l" m9 s) S8 }- G
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: {' b* n( o( E

  67. * ^3 B; Y. U. S+ H& z
  68. dma_addr_t dmaphyssrc1 = 0;
    2 t# ?2 Y1 ^- P! |0 J/ e) Y: x9 L
  69. dma_addr_t dmaphyssrc2 = 0;* w8 Q5 [6 {8 f0 G
  70. dma_addr_t dmaphysdest1 = 0;1 F5 H9 X: i, T
  71. dma_addr_t dmaphysdest2 = 0;2 e5 o7 M; @  `, N$ U
  72. ' x8 j# |! }0 k; d
  73. char *dmabufsrc1 = NULL;
      F! v6 p0 m2 M3 B/ i7 u
  74. char *dmabufsrc2 = NULL;
    . O* U# q, f% d, U5 a" f' Q
  75. char *dmabufdest1 = NULL;
    " x. g* o3 f: Y' P# |
  76. char *dmabufdest2 = NULL;
    + l7 W8 _( j( A9 ]% S2 ?2 Z

  77. : X! L" h; I: J; H2 R
  78. static int acnt = 512;
    9 s1 y7 ]7 d1 Y( ]4 S
  79. static int bcnt = 8;
    5 W, c, A) |$ K) X$ e
  80. static int ccnt = 8;, q+ {' T# c! k0 I! K+ _
  81.   @3 i( x8 K' p+ t  ^. o
  82. module_param(acnt, int, S_IRUGO);
    6 ]1 h: N; y  v" l3 ?3 g: f
  83. module_param(bcnt, int, S_IRUGO);
    + |6 j* M$ C) j- Y. n) y
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  B$ R# l2 I7 i$ S' r- q
' Y" y' i+ w6 R6 n3 p. V2 O      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- R5 K# a3 b9 @, Narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% Z5 }) p. Y$ P7 m2 u     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 X  N/ h% F0 ~( @! T' |
; t# c- C. Z" M2 b9 E1 {/ N: T0 Z) X
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-27 00:19 , Processed in 0.043885 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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