OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 I% s2 o# {1 y0 v* K9 ]
  1. [code]EDMA sample test application. x* o4 M( I% f* u8 z7 d
  2. /*0 t: h' W0 R; m/ B/ K
  3. * edma_test.c. v. J0 J& K5 o! G. \. G( Q
  4. *+ U" Q# g3 {, R: e8 ~
  5. * brief  EDMA3 Test Application4 J3 f: M, u' |; y; M
  6. *8 G, i4 Z: C# ^0 ^& z# D
  7. *   This file contains EDMA3 Test code.+ b, T" A# p( \1 H
  8. *
    & Q% e& o) k' [0 X! p$ I5 h! f4 s# O
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " H# Z* K! s3 ~3 f1 p
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 w5 B; d2 P9 C* w% @: B6 E/ h
  11. *         TO CHANGE.
    $ }2 F# |5 v" X: E, T" u6 Z
  12. *8 L+ m" Q$ q) G. x: M; q" c5 N( Q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    * O" x. a) u. l3 Z( M
  14. *) z0 J5 Z6 E  r: X
  15. * This program is free software; you can redistribute it and/or( a1 S! m+ F; x" V6 T, B
  16. * modify it under the terms of the GNU General Public License as
    ' y; _/ L9 S' \
  17. * published by the Free Software Foundation version 2.
    $ w+ a4 R1 `$ n7 S4 i* U/ m
  18. *3 t( A' G5 t5 _& g( n
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ( n9 p4 b+ r% A5 d3 F6 z6 X9 Y
  20. * kind, whether express or implied; without even the implied warranty  C4 z1 m: ]0 e
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    9 D! }5 m8 F1 m' d! ^
  22. * GNU General Public License for more details.
    % X, w) ]  T  E& I8 I
  23. */
    + V0 O8 ]; l4 I0 c6 Y
  24. 5 p0 V/ j) w4 g1 j# L, O! N
  25. #include <linux/module.h>
    ' P7 Y* U" T, I
  26. #include <linux/init.h>, `, ^/ ?0 O  u" Y& q  R4 `
  27. #include <linux/errno.h>
    5 c/ d) q" ^2 V) H
  28. #include <linux/types.h>
      S% {6 J' b& j) |
  29. #include <linux/interrupt.h>' G  @! e1 T0 i& f+ b7 E, p
  30. #include <asm/io.h>
    ( y- x- I$ t/ _# x! [; @9 @
  31. #include <linux/moduleparam.h>. g* w1 @, n6 Q: W& n* N: X
  32. #include <linux/sysctl.h>! N# U2 r. |8 h+ Y
  33. #include <linux/mm.h>
    * M' M6 u$ ?2 \8 `$ U- e9 a
  34. #include <linux/dma-mapping.h>
    / I$ T$ g% J9 u9 @

  35. 9 ]) ]6 p/ E' H0 S) Z2 |5 j
  36. #include <mach/memory.h>
    6 O" r  S8 Z; S8 T5 U* g
  37. #include <mach/hardware.h>
    / k- {/ \/ |  w7 Q) p
  38. #include <mach/irqs.h>+ A8 h8 T6 y5 ^
  39. #include <asm/hardware/edma.h>
    ( y/ X% X/ e& r
  40. 2 G4 a+ P# n$ Y, j/ x% I* u
  41. #undef EDMA3_DEBUG2 p5 R! `$ e9 x) k. Z2 g
  42. /*#define EDMA3_DEBUG*/
    9 {( }, z; E1 ~% _- c. P# @8 B5 S
  43. ! s2 c( B8 R% O( a7 B3 c
  44. #ifdef EDMA3_DEBUG
    ! S) j. L- z& d$ s
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    0 U1 l- S! }* s! R! s9 I
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 l6 i( I% w, O+ j( q% Y8 [! W0 Q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    # y0 F0 y# g# T6 l
  48. #else0 v0 X3 h$ ]) w! M7 D2 ^9 c6 r6 K
  49. #define DMA_PRINTK( x... )1 o2 u3 ]* F/ e) N% O( Y
  50. #define DMA_FN_IN; F0 s' v' n: Q
  51. #define DMA_FN_OUT
    ' [. s9 X4 g0 T  x
  52. #endif
    2 z( M, L1 f; F& a
  53. 3 t- L; i4 V& _$ E7 D
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ j7 z! [+ u) N4 ~
  55. #define STATIC_SHIFT                3" x2 E/ c  b6 a. A8 G
  56. #define TCINTEN_SHIFT               20
    0 w" I. q' a5 ~3 G
  57. #define ITCINTEN_SHIFT              21
    : B% n7 G- w& g! A6 V% J( h, v9 b
  58. #define TCCHEN_SHIFT                22
    4 e2 R. ^9 a9 t7 x3 n, W; N$ `
  59. #define ITCCHEN_SHIFT               23
    % ?$ V& [: \- S1 _$ x; z! m

  60. + Z; k5 s+ Q2 K9 u
  61. static volatile int irqraised1 = 0;
    9 s9 `+ E* y0 L1 x
  62. static volatile int irqraised2 = 0;3 q) n! R: b0 K% U
  63. ; b4 v. `/ S' r9 u5 c, n' C
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ R0 `" I$ A6 {9 W3 b
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 f2 `4 L  R9 O' x& I
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 ?) n" w) z0 Q- l% c$ U( P

  67. 0 B- _2 N( W9 L: k$ G
  68. dma_addr_t dmaphyssrc1 = 0;9 x' a& T' k2 q3 V
  69. dma_addr_t dmaphyssrc2 = 0;
    / `' H+ u% A/ q; H0 ?
  70. dma_addr_t dmaphysdest1 = 0;
    & E6 J2 m$ x6 m2 Y: w* |0 N, {
  71. dma_addr_t dmaphysdest2 = 0;, ?4 s6 d" ], z4 K

  72. + @2 ?$ p; r$ b" A
  73. char *dmabufsrc1 = NULL;
    3 N7 c) j3 t6 X. D' [* F- N" L
  74. char *dmabufsrc2 = NULL;! j( u  N: ~" R, z3 D& N& I
  75. char *dmabufdest1 = NULL;
    2 L& E6 ]  r5 c; e$ q( j
  76. char *dmabufdest2 = NULL;4 ^* C& a, n! y1 |

  77. 2 Y: d* h1 a/ z6 q  D
  78. static int acnt = 512;
    ; b3 d4 [( }  F' X9 H
  79. static int bcnt = 8;
    ! k- Y4 Z( Y- X  X/ v( Q
  80. static int ccnt = 8;+ Z7 o* i- ~1 a2 f  l

  81. ( t) o8 A6 g! Y9 O
  82. module_param(acnt, int, S_IRUGO);6 |% n1 ~. e- J9 x, o8 ^% `; J* d
  83. module_param(bcnt, int, S_IRUGO);8 S# ?' g+ D0 Z; A9 a
  84. module_param(ccnt, int, S_IRUGO);
复制代码

" N3 W$ B- F9 A+ d: `, y% a7 o  }( A2 p; u+ w5 L# g
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 q- G" L& r: @" {
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# P* z( o/ T. J; `0 C     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: [8 h! p$ v# l, ]* G
, ]; A) k* N& T0 b: o: v
. V2 y0 ^. J1 g' E. B. z6 S
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-17 21:58 , Processed in 0.053631 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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