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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 v- v+ P, S. S% w" f/ {# U' `
  1. [code]EDMA sample test application4 f* n1 B/ Y; {2 b% B! ]
  2. /*/ [7 x. c( n  ~
  3. * edma_test.c
    2 I& g: `) g4 U, O2 q4 V
  4. *
    3 V7 o" H: K5 }" v
  5. * brief  EDMA3 Test Application- b- A" K% c' G
  6. *. U8 z& C5 x5 O& m
  7. *   This file contains EDMA3 Test code.2 t- w1 _* u* X% O/ n& n7 f
  8. *2 ]! P& ]) T9 ^5 B$ r" Y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; b+ o0 e2 T2 l
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 ^: Y/ O: J! b! Z% \9 m4 d
  11. *         TO CHANGE.7 o0 x  r, k% E4 Q9 v  o' I' N; t% H
  12. *
    6 I, T# n! q0 @5 e0 J0 u
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    $ s; k/ t2 l5 _9 h$ \- }
  14. *5 q' p7 _1 z! f. j+ n
  15. * This program is free software; you can redistribute it and/or
    % G9 h0 }. @) ?/ M# S7 \4 H+ }) R
  16. * modify it under the terms of the GNU General Public License as
    8 n/ R- G  G- \
  17. * published by the Free Software Foundation version 2.
    4 c7 T5 U: ^% g0 T4 Q
  18. *
    ) L! j& y: b" Z! `" u" n
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    * ?. w& N, p6 x: T* c5 P3 H
  20. * kind, whether express or implied; without even the implied warranty
    ( }; O3 ^  B" d1 k+ I$ g2 J
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) e8 o/ ~5 a) R3 [7 O
  22. * GNU General Public License for more details.
    % s! C6 H5 d4 L' M$ _
  23. */
    & Q  x# s; c4 [) A4 \  T$ W9 O8 ^
  24. " u: x, C( w4 W& F7 Q+ ?
  25. #include <linux/module.h>8 R$ |4 X  r, B: G: k7 O* }
  26. #include <linux/init.h>
    : M- W4 k# ?0 U9 J7 |$ _9 `. Q
  27. #include <linux/errno.h>5 ~" I  ^' a# e
  28. #include <linux/types.h>
    ! [! l% Z* v, v' z: X, w  w) Z
  29. #include <linux/interrupt.h>
    1 W1 D0 j4 e& p- S$ ^4 l
  30. #include <asm/io.h>: p+ H  Q" g# W- R, H" i  R
  31. #include <linux/moduleparam.h>, @, T8 h$ J- r! z; i. w: w
  32. #include <linux/sysctl.h>
      l  u1 c* |4 p  U! {
  33. #include <linux/mm.h>
      V2 o  n* X% H/ i! E( P
  34. #include <linux/dma-mapping.h>
    ! M# ~- i0 n* A; I. u4 |, M

  35. : l; P0 a. K7 I! j2 [3 F
  36. #include <mach/memory.h>/ z! ]+ _; I2 l2 g
  37. #include <mach/hardware.h>( `$ \, `2 E4 Z% s
  38. #include <mach/irqs.h>
    $ [) W" x9 a5 B4 ]
  39. #include <asm/hardware/edma.h>) Q6 T9 d3 x9 d' [3 E: x
  40. ! V( r& ^# M0 I% I
  41. #undef EDMA3_DEBUG: r$ s  a  P( s  a) D  e. p
  42. /*#define EDMA3_DEBUG*/
    8 a  ~2 v7 Z3 C7 C) X7 _( m- P
  43. ' l) |3 `2 _7 M$ w. n- T  s
  44. #ifdef EDMA3_DEBUG
      a. x# c( p) k5 y6 e
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" \1 i6 Q# }8 P& k6 p" K! m6 N3 }7 R
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 m6 H" d" R9 Z3 @* ?  N  C
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - y' W' z# s0 z8 ]; c' ^" r4 C
  48. #else6 l) |# w- G3 \/ \) h
  49. #define DMA_PRINTK( x... )
    : x: S  h7 U5 C6 z! g& D3 ?
  50. #define DMA_FN_IN0 F* ^& i1 h1 J2 n1 o% m9 P
  51. #define DMA_FN_OUT( q2 Z6 G/ L7 r- J. m8 d* X' n
  52. #endif
    + f5 h- _8 c; \1 ]0 `5 ^( O

  53. / \8 p. J7 R- a' j
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    % ~5 h9 Z0 z4 j9 }- z3 Y
  55. #define STATIC_SHIFT                3
    ! j3 W# |8 t, b
  56. #define TCINTEN_SHIFT               20
    0 ^: I4 o5 {$ Z7 R
  57. #define ITCINTEN_SHIFT              21+ {  _7 o5 K' M) M
  58. #define TCCHEN_SHIFT                22! j" Z& v3 e  M: y
  59. #define ITCCHEN_SHIFT               23
    0 Z. l2 i  x- B$ o

  60. ! H. l. ~2 ]; X+ F  Z% H6 d( t
  61. static volatile int irqraised1 = 0;
    1 V/ z# a  ~2 X, d9 {
  62. static volatile int irqraised2 = 0;
    ' W7 J: h9 S/ ?
  63. & `; H: \2 a9 p* P
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * Z) q! L$ Z& f9 ~* T; z: k- R
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      A' b$ V4 D/ A& q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" _2 t0 ~6 G, ^% Y* H9 b

  67. . L- w# Q# `: b0 N2 e$ [. ?# h
  68. dma_addr_t dmaphyssrc1 = 0;% a. [5 r: j4 J5 b) i3 V
  69. dma_addr_t dmaphyssrc2 = 0;
    & F( J. v- K9 `) I2 P3 h$ x
  70. dma_addr_t dmaphysdest1 = 0;
    : r6 v# `  y9 m4 {, [; S
  71. dma_addr_t dmaphysdest2 = 0;* H& D, P# F. t) k0 c2 j
  72. . g* b3 T9 ^3 _9 k, X7 l
  73. char *dmabufsrc1 = NULL;3 l  z5 Q+ ]- l, G# p. f: _
  74. char *dmabufsrc2 = NULL;% l; z' F3 n( B3 `' w' H2 x( A  U
  75. char *dmabufdest1 = NULL;
      e( l# G7 D3 G* s
  76. char *dmabufdest2 = NULL;2 E8 Y( `% u# X$ @; m) s

  77. , B9 t) M! b8 |/ I! z
  78. static int acnt = 512;
    2 }3 r! ^( X/ k+ q$ x- ]
  79. static int bcnt = 8;
    + D, v0 B7 W) M; r
  80. static int ccnt = 8;
    ) F1 n/ u4 G7 r* k& J

  81. * ?: o3 T2 k& L: u1 B9 X* I9 F: p4 `
  82. module_param(acnt, int, S_IRUGO);; K% \  S1 w% B6 _/ _+ F
  83. module_param(bcnt, int, S_IRUGO);
    : R& K" G" u9 r; V
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 ~5 P; ?$ X% D, m6 _' ^- {

8 ]0 y$ @+ W/ X      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' K, _! Z2 u$ oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. U2 m2 T9 r# u0 v) Y1 M* S* ]
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: g0 M7 A) Z8 z5 T* D# x
0 B. h0 J/ b+ T4 o$ v

* M) \, G' E( Z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-12 13:40 , Processed in 0.102155 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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