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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& p8 Q" ?# [5 V2 p/ w# v8 Z
  1. [code]EDMA sample test application/ H0 A: A0 L. B8 w, X8 P
  2. /*# @3 p2 ^, q, E2 Q
  3. * edma_test.c
    ) X: E6 F% S. q& I  {
  4. *
    7 `/ l* U# @# k9 Y
  5. * brief  EDMA3 Test Application" E1 n" u- ]6 x& Q# g' m  m
  6. *
    ; L; o2 d2 E5 D
  7. *   This file contains EDMA3 Test code.
    ( p4 P" K8 p9 Q7 _6 b
  8. *
    4 X/ L) c4 U9 N2 M4 N' `& Q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    # b) i: H2 U- K4 [/ l
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    2 C. {. ], k* g0 {7 j
  11. *         TO CHANGE.! B" Y  E( y8 N) U) u6 U
  12. *3 h$ |7 R! @% [! W( d* F
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% I1 ?" L2 K" `! N  ?
  14. *# l  i2 X4 l5 k  z. l
  15. * This program is free software; you can redistribute it and/or
    , Z. z, E+ S# F1 I0 s1 Z
  16. * modify it under the terms of the GNU General Public License as
    $ z- q, Q" L, y( d; W) \# V
  17. * published by the Free Software Foundation version 2.9 W1 p; [  x5 n, l
  18. *
    ( W- b# {) O3 |, |, \
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    2 T& x7 _/ E( |; Y% h$ f5 l1 J
  20. * kind, whether express or implied; without even the implied warranty4 y3 G- T! I' q3 z5 H6 a; f
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    8 Z5 |- Y0 N& m  p: R4 B6 ?
  22. * GNU General Public License for more details.
    . t7 R& v( q( ]3 j6 J! o. `
  23. */
    ; p. d! m! h8 m2 f5 W1 h2 l

  24. . p4 r$ v) B1 H- f/ m# @
  25. #include <linux/module.h>! r! C3 f; O8 k5 v0 X( |
  26. #include <linux/init.h>4 d. `5 g* g, ~+ _- D
  27. #include <linux/errno.h>
    ( Z/ X, I+ A, g( }! z0 Y
  28. #include <linux/types.h>
    " i2 F& |$ z. Z1 U' M4 K# V
  29. #include <linux/interrupt.h>6 {. ^& _- l& e- I
  30. #include <asm/io.h>
    8 W$ a) _! G! E/ l/ {4 p; h8 y
  31. #include <linux/moduleparam.h>
      `& A1 S4 @( U9 n( E
  32. #include <linux/sysctl.h>2 O6 g5 v7 g( n' ^
  33. #include <linux/mm.h>
    ( D" C# @/ L5 v/ z' B4 M- P4 Z
  34. #include <linux/dma-mapping.h>  J& M# r+ U4 R6 j0 u1 ]
  35.   p/ h- A3 O& S  W
  36. #include <mach/memory.h>
    ! Y5 f% a* f* B0 `
  37. #include <mach/hardware.h>
    2 n  d. u6 O7 b0 m; F
  38. #include <mach/irqs.h>
    : Q! P7 H6 |  `% d4 h! j# L$ q
  39. #include <asm/hardware/edma.h>2 P. P2 I% @# z
  40. % V0 D; n' n" Y  h: \/ t
  41. #undef EDMA3_DEBUG' S# Z& ?8 l# Y8 x- K9 L
  42. /*#define EDMA3_DEBUG*/5 i% v* z8 @) S

  43.   ]( B7 V- a% k; B# U3 j# u
  44. #ifdef EDMA3_DEBUG
    6 M1 L7 r$ R4 M- @! D6 k
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' s& F7 h0 T* Q2 r. |) l: f# X
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( G; L$ z6 D# A% L
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ X- Y( F2 h, F( [5 \  g, V2 X! |5 G
  48. #else
    ) D& Y% @- U$ _) Q9 t
  49. #define DMA_PRINTK( x... )  r! ?$ w) L- F9 O8 C
  50. #define DMA_FN_IN# E0 ?# |5 ~! A: m4 \  E
  51. #define DMA_FN_OUT
    $ j0 ^9 Z# U. A; W6 S
  52. #endif
    " _; ]7 t9 a7 I  D+ ]9 I8 q

  53. * x. D& t/ E. P. L
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    5 d$ }3 R' o5 F; {
  55. #define STATIC_SHIFT                3
    8 Q" `% ?5 X; N
  56. #define TCINTEN_SHIFT               20
      G  M) U& x' x) r7 y
  57. #define ITCINTEN_SHIFT              21
    9 T5 b0 g2 b$ t) q( r, t
  58. #define TCCHEN_SHIFT                22
    / B9 \4 W4 z" R! C( r
  59. #define ITCCHEN_SHIFT               23
    / Z) q  X6 e% ^- f/ x' q/ v6 h
  60. 0 @# t+ K' S9 w0 U
  61. static volatile int irqraised1 = 0;4 s: H6 s( \9 }& d# q
  62. static volatile int irqraised2 = 0;
    + w! v' l7 A. |+ _# A

  63. 4 p$ Y2 S: C* }- `7 R7 u* S
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 {3 r/ ?; A9 g8 r- d/ _" p
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* f1 r- {; s: V
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 R; @8 v, B' m( I) ?
  67. . z% m0 `8 j. t- l/ w
  68. dma_addr_t dmaphyssrc1 = 0;) T8 E5 g' E5 B- D& W! o- K
  69. dma_addr_t dmaphyssrc2 = 0;0 s% o  a0 z" h2 l% @3 R$ L( O
  70. dma_addr_t dmaphysdest1 = 0;  H$ L; X( S8 V7 h' e$ o/ _: R
  71. dma_addr_t dmaphysdest2 = 0;; f7 t# t( d. I
  72. / `5 {) V) b8 ?6 X2 `
  73. char *dmabufsrc1 = NULL;* P7 h8 ]  H; `: k# r
  74. char *dmabufsrc2 = NULL;- G4 m6 l! H4 a8 I
  75. char *dmabufdest1 = NULL;' q) T$ @1 U" [! O7 j' `% i$ c
  76. char *dmabufdest2 = NULL;
    4 X0 H9 g* T7 U- x

  77. * }- |! O: g+ l$ W% \
  78. static int acnt = 512;
    1 Q/ X2 j0 Y! |/ {  ?
  79. static int bcnt = 8;6 B& T$ }. r2 L# K$ A, r/ A
  80. static int ccnt = 8;
    ( \8 \' }& j/ x. L

  81. 9 p9 }$ V7 ]# ]9 e) u; ]+ x
  82. module_param(acnt, int, S_IRUGO);
    / v( a8 h# s9 p" h
  83. module_param(bcnt, int, S_IRUGO);
    3 F* V" |$ j% w+ L
  84. module_param(ccnt, int, S_IRUGO);
复制代码
: U, Q: s& z" `0 h

) u( ^9 |# M) P8 v. t& n" T( x4 c      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' M" O- x  J7 p1 q7 I% n$ z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' E# f! M7 m, C1 F6 F; D
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' W3 v% X" Y! ]& ^, |

8 O6 k" f% b4 ^, ?( v6 n( I0 ^4 T! \5 l1 R
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-25 14:12 , Processed in 0.069762 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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