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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # D9 v9 n- u2 ]5 Z! E& Z8 z! S
  1. [code]EDMA sample test application
    # l' F; g. z0 J* z+ w- r
  2. /*+ i& g% p* `7 A  u- x
  3. * edma_test.c
    . c+ @5 r( y3 p1 _. K6 I
  4. *8 t8 M( F. U- I; a9 y
  5. * brief  EDMA3 Test Application
    . ~& e3 {1 q2 X& i
  6. *: X6 g+ b/ B' e% g4 E$ C5 U+ U! z
  7. *   This file contains EDMA3 Test code.8 H! V! ]: t0 y5 {: H% L
  8. *
    , U; f, j' Q- W% m* T1 ~  ?
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 B6 U, K% g3 w' v5 F5 V
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 S. A# m0 H6 k$ Z8 H  R1 Y4 m7 _
  11. *         TO CHANGE.) J( v' ]$ Y* s5 E7 J
  12. ** V' z6 j; r) j2 i; _4 Q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 G3 T  c7 }* J: L" Z
  14. *
      }. a0 N% Z* D4 M0 m
  15. * This program is free software; you can redistribute it and/or! @# g$ Y9 f2 m
  16. * modify it under the terms of the GNU General Public License as* y. }( f) I9 {* H  T! w
  17. * published by the Free Software Foundation version 2.
    : @9 @( i" B" R. g* S- y1 l
  18. *
    1 m- @  h9 k. Q. U* b- p
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: W- R" k; a( K% q) ^
  20. * kind, whether express or implied; without even the implied warranty% [2 v6 U0 L) A# S
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 ]2 P: B9 n) k( H* p$ D
  22. * GNU General Public License for more details.
    * |) E5 o, r* _) A' v8 o, F
  23. */
    ! S' e' y4 j+ |3 b' a% U, D$ Q
  24. 5 z" G+ }/ \, A! V9 [  V2 ?
  25. #include <linux/module.h>  k2 c* C& c: D9 v! |& m
  26. #include <linux/init.h>
    ' o' e% _4 P( P4 ^7 e" ~
  27. #include <linux/errno.h>
    % Y3 k! c$ {* z5 q5 n, |( J4 |
  28. #include <linux/types.h>" ~3 f% R. j- |3 s. z2 U+ C3 c8 L
  29. #include <linux/interrupt.h>
    ; s: [7 K& ?6 n4 I
  30. #include <asm/io.h>
    7 K6 T. ?) m( Y% ^3 M- b, j
  31. #include <linux/moduleparam.h>
    ) r; x- a* R; ?/ Y9 ?( ?
  32. #include <linux/sysctl.h>- n" i% ^0 Z$ m( g
  33. #include <linux/mm.h>
    ; s) M( ]9 ]6 I/ P- C0 z2 V0 r7 ]
  34. #include <linux/dma-mapping.h>2 h# A4 g0 X9 t

  35. & U" P' ~$ T: c6 z8 v- n
  36. #include <mach/memory.h>
    / Z; ?4 \+ m: q5 s. z; L3 D
  37. #include <mach/hardware.h>' b& G' M! Z; h$ J3 F. e
  38. #include <mach/irqs.h>
    8 `; S3 e# H$ |8 Q
  39. #include <asm/hardware/edma.h>
    $ n9 l8 i/ K6 ~3 s( t2 E: i
  40. 5 E$ r. A" z& o8 ~
  41. #undef EDMA3_DEBUG% r! L' v9 S; Q/ Q
  42. /*#define EDMA3_DEBUG*/
    / I5 @, P0 h0 H. K

  43. ; l: R" I6 F4 P6 s4 z5 Q0 l
  44. #ifdef EDMA3_DEBUG8 o7 U* O4 q. \! O9 C
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    & T. V6 p0 R# i) p
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; I3 R. Z* i& \7 L
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ |- h' P! x: p
  48. #else
    + y7 X* x9 S: I3 c5 G
  49. #define DMA_PRINTK( x... )0 d8 l1 E/ c4 l; Y
  50. #define DMA_FN_IN6 |, T5 T% [' A
  51. #define DMA_FN_OUT
    , c. ^4 p8 s1 f& |# M, t
  52. #endif* |) G+ E+ N/ O- n3 A5 ^( z
  53.   k6 P6 d4 ?' H
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    4 |0 I. k- V5 M: Z/ y; }% G+ n: i
  55. #define STATIC_SHIFT                33 ]4 @. J8 c3 `6 V, w( k; s! F
  56. #define TCINTEN_SHIFT               20
    8 [  U9 W! N* J3 n9 U1 ?" g' O
  57. #define ITCINTEN_SHIFT              21
      L8 z9 M6 d1 r$ z- M! F0 O
  58. #define TCCHEN_SHIFT                22: J7 h9 ]5 d2 H. _8 t1 |
  59. #define ITCCHEN_SHIFT               23
    " S& L. j: i2 j$ Z$ P3 n, Z& u
  60. 7 W$ f: N) {3 U, m9 w2 p
  61. static volatile int irqraised1 = 0;
    : Q  W3 {  ~. S8 ?: [
  62. static volatile int irqraised2 = 0;
    $ `+ P1 @1 O7 r" V- Q$ X$ D
  63. 7 A4 Y4 b# k7 L" c4 F
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; Q: N, p, }8 J! K
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 q- `2 @% ^' U1 E; v3 s5 m
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , N6 R/ Q3 {* B# G6 k+ w$ Q% r" J

  67. 5 U* |7 M. L" K* R0 L/ `9 R& T
  68. dma_addr_t dmaphyssrc1 = 0;
    9 M5 T- c& Q+ Y: o1 a
  69. dma_addr_t dmaphyssrc2 = 0;5 x7 W  O# S, X8 L# Q4 ]( @. n8 W
  70. dma_addr_t dmaphysdest1 = 0;! ~5 E  u+ i! T
  71. dma_addr_t dmaphysdest2 = 0;
    0 Q& E! c% x; x7 z3 d3 e6 a7 ~2 P
  72. % Y, V" k  \4 m5 \  ?3 ?+ P) y
  73. char *dmabufsrc1 = NULL;" I5 k. M  Y7 i4 p8 q1 p0 C
  74. char *dmabufsrc2 = NULL;
    ) n% a8 l0 Q" N8 e' H! O
  75. char *dmabufdest1 = NULL;
    - Z5 \3 f) s( b- H& k- ]
  76. char *dmabufdest2 = NULL;
    $ d9 c0 P* T% K
  77. : D, G4 p% {4 h" e; f3 r
  78. static int acnt = 512;- N7 f  ~; G$ q, }% C# T
  79. static int bcnt = 8;. o6 P  T) E7 u3 Z
  80. static int ccnt = 8;
    ) c2 G  ]5 R( _  {6 C, O% \

  81. 2 ^$ `8 F+ M0 s' {0 v- \
  82. module_param(acnt, int, S_IRUGO);, Z* m/ J, r4 N' L
  83. module_param(bcnt, int, S_IRUGO);: x" Z$ F- s) z# U0 U
  84. module_param(ccnt, int, S_IRUGO);
复制代码

4 }- z7 Q/ x  W
3 x# z+ k" J3 A  u* X      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" N. d2 X8 b+ H7 v0 n* f6 ^6 d
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 K, l; I/ u9 k+ Q1 H
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( S0 G5 R$ {* F! K1 z+ I
# R! A; b8 H$ O
. O6 H5 [' Y1 e9 m2 F6 W
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-17 05:37 , Processed in 0.039332 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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