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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: \* \3 S- V6 z: e
  1. [code]EDMA sample test application
    1 T9 T0 y) ^4 i; R
  2. /*
    ' i$ l$ u" y# r% l# w( q
  3. * edma_test.c5 p6 r7 \) V7 Q- Z& }% `
  4. *0 v3 \0 B* w2 a$ _2 K! L
  5. * brief  EDMA3 Test Application7 {4 D8 r8 D* a$ H
  6. *
    0 G8 V- D( I/ N3 U& u
  7. *   This file contains EDMA3 Test code.
    / B. t; n1 t4 q8 P1 a
  8. *
    + \5 Z% y( d( m, S
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' q% m  u0 n! h$ O& I* t
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 E- J1 B) Y: R' Q# Z* ]4 U! Q
  11. *         TO CHANGE.
    0 v6 q- q, \% W' {5 y
  12. *
    + k) f6 {, O" ^& M6 F. F5 w
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ' X; t+ S+ w6 i8 O% o5 y
  14. *
    9 f; K4 R$ v4 s  Q/ g- n, ~& x
  15. * This program is free software; you can redistribute it and/or
    + G/ V' v& Z/ _- I9 p
  16. * modify it under the terms of the GNU General Public License as
    % }3 ?$ |4 H! O& h% }- O; p6 k
  17. * published by the Free Software Foundation version 2.
    . a* i, ^+ s) V; ?+ n  w( ^3 z
  18. *; F& T4 X) ^7 _, r  q6 H, i+ U6 A
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ w! v6 l! U4 m( g0 a
  20. * kind, whether express or implied; without even the implied warranty
    3 c7 e2 r1 O2 ^  c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    , ^; t, M- \0 ?# A+ U
  22. * GNU General Public License for more details.: r9 w8 R* n$ K/ P0 M' x
  23. */; B& A4 ]2 V8 {& X. _  l

  24. $ Y- \; I; y" N5 ^
  25. #include <linux/module.h>6 k) H) T8 q( Z, s9 f
  26. #include <linux/init.h>" R- E7 d" v' b
  27. #include <linux/errno.h>& \6 H4 L' u/ G, v& v  W, v" ~" K
  28. #include <linux/types.h>
    % ~9 q7 T' i3 V) p" W
  29. #include <linux/interrupt.h>  _3 G3 C0 t  h" {
  30. #include <asm/io.h>1 `5 i  S; x  l; n0 q0 P' A
  31. #include <linux/moduleparam.h>. G9 r6 E% ]7 [$ k9 A
  32. #include <linux/sysctl.h>
    5 \" }. j2 e5 F2 Q
  33. #include <linux/mm.h>
    - ~3 Y) {7 x& Y: _/ s6 ^, z7 d
  34. #include <linux/dma-mapping.h>
    5 H% [/ }, W. D! j4 r0 `
  35. 4 f) H. X5 N; i; H
  36. #include <mach/memory.h>
    - n4 @( K" m6 A0 n
  37. #include <mach/hardware.h>
    % F) a+ B; t, Y) n: Y- q
  38. #include <mach/irqs.h>$ q" J/ i6 Y, E$ ?
  39. #include <asm/hardware/edma.h>/ p2 ^: l9 z( s" ]5 b- |% [
  40. / z1 ?( g) F# t: Y- w
  41. #undef EDMA3_DEBUG. o3 P+ T( D' A: k- \7 d* d
  42. /*#define EDMA3_DEBUG*/4 }, x8 z' j8 F' q* T
  43. % i6 S# T, T4 d
  44. #ifdef EDMA3_DEBUG( f% d9 B# r- A4 N% |( n
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): R3 l" p, b" \
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- k2 b- v4 P0 D  S& m
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    7 ?2 @; Z6 t7 W) I6 H3 l
  48. #else
    & i! I5 R1 D: J: o" H
  49. #define DMA_PRINTK( x... )
    ; }0 V" _+ P) i4 ]2 b0 q3 P' L
  50. #define DMA_FN_IN, z6 n3 V7 V0 }2 |5 T. z9 p
  51. #define DMA_FN_OUT8 R; o) q& y3 `  d  ]* s: _( K7 x
  52. #endif" T; g0 `( \  {0 ?; U) e& n) I8 }. m

  53. : Y( C4 p" b% G- Q! N' j1 [
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    0 @% N# R  R1 A* H" m
  55. #define STATIC_SHIFT                34 p; ]& x/ r: i6 d9 Z' a) F1 k/ D
  56. #define TCINTEN_SHIFT               20
    3 c3 T- a& b. K+ M0 z
  57. #define ITCINTEN_SHIFT              21% X" X$ x4 T7 O5 Y
  58. #define TCCHEN_SHIFT                22
    % K- J9 o+ @, V' c
  59. #define ITCCHEN_SHIFT               23' ]8 c8 H; \5 t4 G- b# p& I7 D, j: I

  60. * `$ ?: O* B) y! l+ _
  61. static volatile int irqraised1 = 0;9 n' z# \! |7 U7 n' n6 \
  62. static volatile int irqraised2 = 0;/ R. `, N5 ?4 Y% h6 L& h8 D' m

  63.   \" ]3 v! U0 S7 Q5 C
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ {& S. A) }4 y( O5 |' m8 o
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 o9 |" I" c4 I0 m6 P; r! a- X) |
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % k% N% e$ X# @% o$ E

  67. # g" w8 o0 d# `3 {7 w* K' s
  68. dma_addr_t dmaphyssrc1 = 0;
    2 I6 f$ j1 t1 w) U& _! j
  69. dma_addr_t dmaphyssrc2 = 0;" t! w+ W; z6 D# A/ J" T
  70. dma_addr_t dmaphysdest1 = 0;/ ^5 z3 K& S# R+ h0 U' e: a
  71. dma_addr_t dmaphysdest2 = 0;
    , K  C1 v/ N0 E

  72. + t$ f8 \3 y! ^
  73. char *dmabufsrc1 = NULL;
    - t' j4 l1 l# l, c& D; Q
  74. char *dmabufsrc2 = NULL;1 B& V& h# R8 q, q, s! f8 G
  75. char *dmabufdest1 = NULL;
      g& `4 j( R3 Y! M' r) `/ g
  76. char *dmabufdest2 = NULL;0 W' n9 }% }: ?1 _

  77. ; [- |* q% B0 C6 N' B
  78. static int acnt = 512;8 p& T, n. ^/ l% Z2 m" M1 L; o# o
  79. static int bcnt = 8;
    ; Q" l+ U7 ~3 p' t+ S& q$ a5 X; W
  80. static int ccnt = 8;
    + u. j* z5 B7 \+ }2 Z  z
  81. + U. g! R& {' i$ H0 R. j6 X
  82. module_param(acnt, int, S_IRUGO);
    ( _+ I; s: D! d
  83. module_param(bcnt, int, S_IRUGO);, u! K% X* g  \- b! X9 P$ U
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  q- j$ ^4 U' ]8 ]4 Y3 x  N: `3 @1 H
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ N! ]% P( p* |, ?; d) ~- s9 C
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( l2 i; b6 l- U$ a9 g
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ w/ K9 Y' l$ D; I! `
7 ^: d# t: R- i& N9 w0 G

/ }$ \6 `- \- u0 w: i) N2 n
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-10 04:23 , Processed in 0.038560 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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