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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: a6 l2 q2 m. M' H4 L' l; x2 l
  1. [code]EDMA sample test application2 L/ ~+ W5 P9 w
  2. /*3 P' _1 b, F. }7 A( c; e6 v
  3. * edma_test.c6 E$ k+ t! u  L' m8 T$ e
  4. *. X; o( v. Y. \& n/ t
  5. * brief  EDMA3 Test Application
    5 o4 \, q4 t: j2 L3 A( y5 ^
  6. *
    4 ~$ n, y( ]" T! g) E" J! b
  7. *   This file contains EDMA3 Test code.7 y' T7 K' `5 `7 [9 K, M) a
  8. *2 J0 g6 w( Z& w5 R) U
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    # r" b; {. t9 i+ z3 `3 f" Y0 b
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    3 w; F! d: n3 ~0 G. J! I* \+ Y
  11. *         TO CHANGE.
    9 L9 x- ^; o; Y7 m; R* D
  12. *
      z5 i) \" b9 k9 p: D  ^% X
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    $ J: R, G6 J' @* K: S) j6 h
  14. *
    / O( S3 x* D& [9 F4 {3 D
  15. * This program is free software; you can redistribute it and/or
    $ d9 C4 a! Z6 ^4 @
  16. * modify it under the terms of the GNU General Public License as2 m5 \* b; {9 Y  K3 O
  17. * published by the Free Software Foundation version 2.$ _9 G# W8 q! @
  18. *
    . b7 F4 A' |1 j' W9 x  H
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 I3 n/ U; E; \. B
  20. * kind, whether express or implied; without even the implied warranty3 U5 R3 u- B7 g% b  P1 A5 k" R
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ' o! e6 w# e4 L8 p8 X1 i. j
  22. * GNU General Public License for more details.4 l1 A# U. P9 y8 s0 W4 I
  23. */; F1 `0 S; u' r% B7 y6 @
  24. " V/ m, a+ B- `* U$ c9 l% ]. L, L4 l
  25. #include <linux/module.h>
    9 v: M+ x  {4 W1 E5 O$ H) ?
  26. #include <linux/init.h>, w9 @( K- l; \
  27. #include <linux/errno.h>
    8 N7 v" x+ [. I& L6 Q) H
  28. #include <linux/types.h>4 }: g+ a# {' q" B3 y0 A9 v
  29. #include <linux/interrupt.h>
    4 G$ e) `0 b. }" j
  30. #include <asm/io.h>
    / _6 U& D! L1 J7 A2 ]
  31. #include <linux/moduleparam.h>4 N+ O5 X: w$ p% a/ {2 v5 t* P: y. Y
  32. #include <linux/sysctl.h>- e2 v$ n6 ]  u4 @; \
  33. #include <linux/mm.h>
    7 G  T+ ^+ V5 }
  34. #include <linux/dma-mapping.h>
    7 t2 Z  |+ ^& K4 }9 z

  35. / ~2 o. t  }& ~  Y2 x
  36. #include <mach/memory.h>
    7 O( G0 C3 J" w. x5 V2 y! ?4 R
  37. #include <mach/hardware.h>
    4 x, H- s, T, h% o/ O
  38. #include <mach/irqs.h>
    7 k+ R( y6 z, z  v2 y1 x/ j
  39. #include <asm/hardware/edma.h>/ E% @4 s5 u# x; u& v

  40. " S$ E2 s6 b0 [, [  y: E* G
  41. #undef EDMA3_DEBUG3 D, }2 V* O" S3 d
  42. /*#define EDMA3_DEBUG*/6 O- L' P) \: ^' O5 i) y; [8 H

  43. 1 _, C  a6 M) X3 r
  44. #ifdef EDMA3_DEBUG0 O, e4 U/ f' w( V: A& y, E8 ]
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). @0 w0 k  F2 A- e
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 I& k% K+ q4 c3 `
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    8 N; c% D1 p3 c% P  T; V& \
  48. #else+ K; U- r# V& j  i0 U) l* {9 |
  49. #define DMA_PRINTK( x... )- p+ r! {' K/ g: i
  50. #define DMA_FN_IN& I  T8 @$ @3 A/ ~' p5 O$ A/ P
  51. #define DMA_FN_OUT' U1 P# \3 K) w% ]% I) {. c
  52. #endif2 L6 x2 q2 S# p6 N, `& P

  53.   w/ S2 o6 c8 L( J+ p/ \6 X
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)" g, @( ^- t% m4 |* w' k
  55. #define STATIC_SHIFT                3' X5 x) @: l: v+ b. q3 M
  56. #define TCINTEN_SHIFT               20
    , p. ~  }! A0 }& Y* E6 d
  57. #define ITCINTEN_SHIFT              21
    : K7 \! A: r. U3 e3 i
  58. #define TCCHEN_SHIFT                22
    3 r$ Y& V* @7 |; x9 z. L! h
  59. #define ITCCHEN_SHIFT               23
    1 f+ d! [) [- L6 O4 o* {! ]

  60. 2 `' N2 ]- q  I8 ~* n6 m
  61. static volatile int irqraised1 = 0;1 ]: v$ k+ ~: O2 K3 \/ C' N
  62. static volatile int irqraised2 = 0;! D, x! Q3 h1 J+ ]" u

  63. 0 U, F8 s0 ~% C/ t+ A
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- T+ j: l% u/ L) c+ B) ^5 @
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " ~0 X" Q' m/ G. D9 @4 t
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  D1 I9 \! _# b0 M1 p$ S

  67. . ?* X2 [6 E2 `3 l
  68. dma_addr_t dmaphyssrc1 = 0;* B% J) w3 ]/ [% }3 Q6 ~  K& q
  69. dma_addr_t dmaphyssrc2 = 0;
    3 ]7 B# J; e% n
  70. dma_addr_t dmaphysdest1 = 0;
    - X  L  g, [. _" u3 D5 K! `3 ~
  71. dma_addr_t dmaphysdest2 = 0;: W9 K: R+ ~# e" T! h3 [8 o" E

  72. 7 H- O6 u1 [% C0 H1 c2 Y/ ^5 h
  73. char *dmabufsrc1 = NULL;
    8 \1 \7 }$ c8 q$ E
  74. char *dmabufsrc2 = NULL;" A* v  H9 X4 R3 T% E! A& G' _- W% q: q
  75. char *dmabufdest1 = NULL;
    ( Y/ F& s- N% U! z; j
  76. char *dmabufdest2 = NULL;& C. {8 c7 b% V, G# r  w

  77. % e- A- J. p% z3 H( T
  78. static int acnt = 512;
    ' m4 G! [/ Q0 _8 g$ ]3 X; |
  79. static int bcnt = 8;$ P: b8 g! H. v/ _" |
  80. static int ccnt = 8;1 A7 R: s2 e8 m  f
  81. 5 D/ w, U' e, a* E8 y) a+ J  G
  82. module_param(acnt, int, S_IRUGO);
    + o! p, X1 E' p3 r" M% r$ Q
  83. module_param(bcnt, int, S_IRUGO);( _, |# f+ N7 r8 r
  84. module_param(ccnt, int, S_IRUGO);
复制代码

. a1 ?' ?- \/ D2 j2 y  r$ X0 w( \" s0 t; Y
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- ], K, K. |, @4 m& K: K1 ]
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 w; U2 `! N) o/ B4 c3 b4 W5 U     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 D$ l" M6 B$ b0 c% b
. s; Y: t( B- i; h( j6 k
* ?( j8 d' O9 @- ^: J/ t7 r
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-17 12:57 , Processed in 0.039522 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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