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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , l4 f% O' n  g# e* n  X+ m
  1. [code]EDMA sample test application* i$ K8 r- w1 f* f; T+ d3 \
  2. /*
    / N. H7 F7 `8 ^9 _* i, l8 w( ~
  3. * edma_test.c
    3 f) Z% W8 s( }5 T9 W
  4. *6 P$ j4 e& \8 |$ h
  5. * brief  EDMA3 Test Application6 g- L- X& p9 `) ?# w; Y6 {# z
  6. *
    4 @5 D" {& J8 `  C8 N! }7 M$ Q
  7. *   This file contains EDMA3 Test code.
    . W5 n& ~3 q0 x( P
  8. *
    0 A$ ^% e  R  r
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ) X7 B( }. k3 z4 r' H' P; {  ]) E
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 c- j1 J& b. e! U
  11. *         TO CHANGE.. Q- n* J) v1 ]
  12. *1 _% g  c! A4 x8 B. Y1 j/ q# ]
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 H( Z& R( e, |- K9 ~
  14. *( N7 T! z8 Q% O  e  n
  15. * This program is free software; you can redistribute it and/or- ^8 N, x7 H( M) Q6 C$ Y
  16. * modify it under the terms of the GNU General Public License as
    % C% K1 E, v5 O, r
  17. * published by the Free Software Foundation version 2.( Q* ^3 E& q! A; A
  18. *' D' I, M- w5 J9 T
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 u! B: F8 U9 U9 @2 P% u- G
  20. * kind, whether express or implied; without even the implied warranty; I- R& A# ]2 o) A
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 C% }9 t$ s, V0 W% ]
  22. * GNU General Public License for more details.
    8 v0 o7 b$ L% Q0 u! _: U5 O
  23. */
    ; K0 [/ `7 G. C$ N

  24. 8 M0 P& G( Y: k) ?  h4 k2 x7 o
  25. #include <linux/module.h>
    ; ^. z; E7 t/ a, n* g, Y& B
  26. #include <linux/init.h>
    3 ]+ F- x" A- j) `. K2 O# M2 y
  27. #include <linux/errno.h>  a' u# v7 F; u$ G
  28. #include <linux/types.h>
    " n' i% h( d  Z# p$ P. q* ]
  29. #include <linux/interrupt.h>
    & H2 d+ s) \# E  h  \9 @
  30. #include <asm/io.h>" m7 B  M# w) {1 y$ y2 R( I
  31. #include <linux/moduleparam.h>' k: z- [1 \5 X7 s4 u7 F/ ~
  32. #include <linux/sysctl.h>
    ) b4 R. c' A5 W+ L! g
  33. #include <linux/mm.h>
      M& {) ~) H1 k. I
  34. #include <linux/dma-mapping.h>1 v4 r6 U6 a, `2 H2 T
  35. 1 z; w3 k# Z! [- y0 i1 U, k0 Y& l
  36. #include <mach/memory.h>
    ! G, i; v6 z* y# H
  37. #include <mach/hardware.h>
    9 M+ P5 a8 I9 z# i  V3 b( ^- c, U
  38. #include <mach/irqs.h>- |8 `: g, v1 T* C
  39. #include <asm/hardware/edma.h>/ B- [; |# E3 h

  40. " R  X* B8 u' z1 J
  41. #undef EDMA3_DEBUG0 n7 J+ g7 D# n! ]& N8 M5 d
  42. /*#define EDMA3_DEBUG*/
    7 a" i* e" z  S- X1 K

  43. % x2 x4 L8 E# S% P
  44. #ifdef EDMA3_DEBUG- M- Q+ G$ f3 Y- S0 r
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 k# J1 t; \5 j" K" M( Q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ) ~3 y) B6 A9 V. Z1 a4 ^  I
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). c. i) U+ h0 N$ H
  48. #else
    ! q0 e3 }3 M0 e! y
  49. #define DMA_PRINTK( x... )
    ' t* s4 @# [% a$ Q5 F
  50. #define DMA_FN_IN9 n: |7 R( ?3 w
  51. #define DMA_FN_OUT5 t, h$ m" N9 ?
  52. #endif0 @% y  ~( H/ H2 T( r7 f8 |: m
  53. % r5 z8 N9 F+ z7 w: @
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    % O2 D7 a- t8 ]- U0 h. r4 T
  55. #define STATIC_SHIFT                3
    ! X( Q8 p& g) u5 T; i
  56. #define TCINTEN_SHIFT               205 \- k4 [: N; {
  57. #define ITCINTEN_SHIFT              21" H& Z: E6 {# u) P+ H; n
  58. #define TCCHEN_SHIFT                22
    + Y! f$ j- t4 X5 s6 h1 V
  59. #define ITCCHEN_SHIFT               235 {* x2 o2 j8 o+ k: z) y

  60. ) d7 t5 Z/ j. Q- i
  61. static volatile int irqraised1 = 0;" F  b+ L. x1 o7 D# w
  62. static volatile int irqraised2 = 0;" g5 |2 r$ ?4 b/ b8 F6 h

  63. 2 b  Y+ G* }1 @4 ~
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ D! z( d4 v! x9 d
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; }; t- T4 y/ Q( {$ u4 q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , y3 e- T3 z3 C( h- J

  67. ) n/ |" n7 y9 W0 S4 X1 z7 c
  68. dma_addr_t dmaphyssrc1 = 0;
      s; x0 f8 c' V- c& U& q+ P& T
  69. dma_addr_t dmaphyssrc2 = 0;
    6 K  o6 f8 ~( l) O' K0 X! F: y* R
  70. dma_addr_t dmaphysdest1 = 0;3 a7 M+ Q" P6 p+ Y" ~
  71. dma_addr_t dmaphysdest2 = 0;4 o! r) Q/ C) v& b5 [; D5 `

  72. 9 {9 X7 r8 }9 s
  73. char *dmabufsrc1 = NULL;
    : I3 l* s# W) S' y/ M, u
  74. char *dmabufsrc2 = NULL;
    7 X7 E/ w5 _4 w) G- E
  75. char *dmabufdest1 = NULL;% u. x- y- f1 M3 n% k
  76. char *dmabufdest2 = NULL;+ G! a& i5 e/ N0 h3 b

  77.   V8 W: Q  J1 B7 G2 p3 G
  78. static int acnt = 512;4 Q- p1 v" A' y6 _- {; S( W8 w) _
  79. static int bcnt = 8;
      \# e/ W& M7 }' A
  80. static int ccnt = 8;* K, W$ L# S% y- v/ r% t& @$ z  I8 q0 s

  81.   `. M% ?0 S- [+ t4 o
  82. module_param(acnt, int, S_IRUGO);
    $ s  [4 L' Q4 Q* \
  83. module_param(bcnt, int, S_IRUGO);
    4 R/ E: C$ |3 R& `3 n& ?
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! h. }% G/ I5 ?9 G3 j$ W2 ?3 W, d, f* f
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) x( g$ u' B, z4 O3 c0 Darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ ~( g1 [9 M( j$ C     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ q) f9 J9 g7 `- Y  n% z9 u3 X
. S! O: q/ c7 c% F) m/ x! L8 Q) l  N; K- g+ f3 R$ @
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-19 17:25 , Processed in 0.044655 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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