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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 p" p) e9 S# g+ q. n$ Y) L" S3 m
  1. [code]EDMA sample test application% d3 I5 P5 A+ P2 Y; Q7 q
  2. /*
    % T' S) w1 m/ S6 D- M0 {  q* f
  3. * edma_test.c8 J" Y* N+ [8 M" [/ P$ {" b3 \& ~
  4. *) i. Q2 T! \' k2 k0 Z& E  T5 {0 y
  5. * brief  EDMA3 Test Application1 T+ z7 R8 Q& G6 f# R- f: H4 b
  6. *
    8 a3 F: e9 u( M. `$ J6 ?
  7. *   This file contains EDMA3 Test code.
    ' X  G4 W, p; N; @5 e* R0 b3 X
  8. *+ n+ d) M7 z1 [1 }/ W0 ?
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ) u, C( v( [. G, r3 k4 K
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! k+ V8 W. y3 N' ^. x3 N. w5 ]/ J
  11. *         TO CHANGE." ?  D9 C; w  p: M- f. b1 n
  12. *6 ~6 P, `& f0 D' h. }7 p7 U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      G3 V$ M, M& q; U! c2 y2 r
  14. *) N: {& g+ B# ~. `' R
  15. * This program is free software; you can redistribute it and/or/ g% \" i1 Z! ^, M" T- H, X$ j
  16. * modify it under the terms of the GNU General Public License as9 P9 p- o: w3 f) s
  17. * published by the Free Software Foundation version 2.9 f8 v2 K: ^, @) a7 [
  18. *
    % C" y/ T4 p: @8 j: `) v1 X
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any* E' Y0 y8 N8 z. |0 [* H0 R
  20. * kind, whether express or implied; without even the implied warranty0 }! \  g# |' {! t% E' k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the7 M' `# N. A9 C/ R  Y' C. b$ k
  22. * GNU General Public License for more details.
    ; f& s) L. f3 i3 s: k8 j
  23. */
    5 e/ q- Z7 I( b/ k2 l
  24. % s7 b% n) P2 I" u4 E
  25. #include <linux/module.h>
    3 ?- e, N; ]% `) S3 X& f
  26. #include <linux/init.h>
    . c" Q0 r+ t; k" t+ f: S  ^
  27. #include <linux/errno.h>! ?0 s) V; i: ~; p6 S; l
  28. #include <linux/types.h>) f' @8 y: J0 O' U8 T
  29. #include <linux/interrupt.h>
    7 i! F( z' s+ V; y. ^# \
  30. #include <asm/io.h>: `9 g/ p. C8 [
  31. #include <linux/moduleparam.h>* P7 Q- E7 }2 P) \4 J- `" `6 D4 p
  32. #include <linux/sysctl.h>8 H- g1 T8 X9 U' `# q- R8 F8 Q* k0 y
  33. #include <linux/mm.h>5 D3 r' M% |* h+ Q, H
  34. #include <linux/dma-mapping.h>0 M" K  |" @- s  |9 F& M

  35. 4 s5 @. B4 S7 K4 {, V% V
  36. #include <mach/memory.h>5 U5 [# ~5 h& }1 H- a
  37. #include <mach/hardware.h>: h( n- T" w* Q- ^4 U
  38. #include <mach/irqs.h>8 y# T* c# f- N8 Y
  39. #include <asm/hardware/edma.h>
    9 z& [) [: q" [' r4 z! J- J
  40. / O' w& @* U9 }0 H9 x  b
  41. #undef EDMA3_DEBUG5 ]: H5 |! n: i% _* Q. {" s
  42. /*#define EDMA3_DEBUG*/
    4 k  E1 M# B, [. ?

  43. 9 W& I3 c6 M3 a
  44. #ifdef EDMA3_DEBUG
    & A" E- ?5 A; p+ T
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)  v1 v2 e0 ~& [8 N6 f
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    1 z% q& G( F1 H# R+ `) @
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ \& R# |7 [: e: K* u3 U' k
  48. #else
    8 z; \/ I: Y/ r% Q
  49. #define DMA_PRINTK( x... )
    " ~- Y) s  C9 u1 S; i- F  _
  50. #define DMA_FN_IN' r9 L3 X; V/ a' C$ Q2 k3 j$ M$ {
  51. #define DMA_FN_OUT
    $ m6 C$ ]& t6 a5 [& l
  52. #endif$ R; l/ Y0 W0 Z& S1 W- f

  53. * q4 Z" ]0 d3 ^
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    * W- Z: c- Q; k% E: k
  55. #define STATIC_SHIFT                3: b: _0 X7 e/ O  U" C7 l
  56. #define TCINTEN_SHIFT               20
    2 i4 o* @# M8 u% w) P
  57. #define ITCINTEN_SHIFT              21
    6 V. |6 O$ q1 }9 l) f3 m
  58. #define TCCHEN_SHIFT                228 G7 h& ~2 L$ C
  59. #define ITCCHEN_SHIFT               23
    5 |6 ^& y: e' `

  60. * k1 l2 o/ u2 ?! T. l
  61. static volatile int irqraised1 = 0;3 @  s$ _1 f0 P( f7 e% ~1 {
  62. static volatile int irqraised2 = 0;
    , o' s; W& E" ~. P4 @! N# [
  63. . r5 V  T! G2 P3 W, F
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 A% y; M) F9 p9 M/ x
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! n, ^- X% c+ A( ]6 s5 P8 {' |
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " }" z1 M# K+ ^% A+ `( w/ C
  67. 0 I- k6 W" v7 |& j) {+ N: h! r
  68. dma_addr_t dmaphyssrc1 = 0;+ U% Z& }, l9 k
  69. dma_addr_t dmaphyssrc2 = 0;
    : ]/ r6 t0 z% \& S" Y4 X& h! v8 p
  70. dma_addr_t dmaphysdest1 = 0;& @- {6 u( H0 v* @
  71. dma_addr_t dmaphysdest2 = 0;
    9 R/ g5 `& n* M( U$ N6 D& X
  72. ) N/ X$ W, {; ^; {
  73. char *dmabufsrc1 = NULL;5 v% k" q! ]2 Q
  74. char *dmabufsrc2 = NULL;
    " b; C) w9 L% c# T6 o; R4 E% P% w$ P
  75. char *dmabufdest1 = NULL;
    % r+ A, x( N, V! X
  76. char *dmabufdest2 = NULL;& L& {! Y/ N& }' G. L8 G
  77. $ O9 M5 a' T8 Z4 l" L
  78. static int acnt = 512;: A7 g/ N6 K8 u) H0 ^3 D
  79. static int bcnt = 8;( d7 H; L' F7 w, N
  80. static int ccnt = 8;9 ^) W( ?* h; z0 ^2 X

  81. $ ~& ~# M6 A9 x& o6 U- m6 v
  82. module_param(acnt, int, S_IRUGO);
    2 l  x/ e7 q  p) w  A- `
  83. module_param(bcnt, int, S_IRUGO);
    $ k0 R6 E; w: q# F5 }
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; ^+ P" d- i" D" W
8 O; v8 W$ @+ }$ w0 b5 x- A
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- _& i0 |, ^' y7 ~) I/ A6 Z. V
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 F& Q$ V; D1 g( K) t/ r6 i) t6 `
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
  W0 ~2 z+ U. R: L4 d; Y6 K& o  f9 }4 e

, M5 D. M# r! \* S' i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-7 17:46 , Processed in 0.039575 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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