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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  }; `3 [% W* a- V, ^/ ~8 i
  1. [code]EDMA sample test application6 E3 R  f* C  l) ^- _  q# z+ G
  2. /*4 v4 Z2 M' r8 P0 l0 ^7 j; Z- R
  3. * edma_test.c) B% Z2 j1 T* i) ~/ T
  4. *
    * w. k( {3 R, z' \& f/ R$ Y, j; {
  5. * brief  EDMA3 Test Application7 ~. v/ I. b* m1 |- {8 j$ @
  6. *
    8 J0 l0 W: l/ f6 F( N& k5 n
  7. *   This file contains EDMA3 Test code.& C7 V/ p8 }/ s) Q
  8. *
    $ ~1 Z; l0 B7 V3 |
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, M1 E) \) D( {9 C# P) \
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + G0 a; Z, a# A# ^% m. f
  11. *         TO CHANGE.
    $ j2 W* L2 N% J: p1 A1 `
  12. *( b" E% T( {3 i- E/ m
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    4 A3 Z( y$ g  M0 G2 K8 T! m  p
  14. *
    . q+ p5 @7 |9 G6 f3 W
  15. * This program is free software; you can redistribute it and/or: D: V2 H/ c: z& U
  16. * modify it under the terms of the GNU General Public License as( ^, [8 A. G* A' o4 g/ Z: f
  17. * published by the Free Software Foundation version 2.
      G4 ~+ C% Q- i) O/ R+ ~
  18. *
    . Y7 Z+ T6 ~# y7 s% I! D2 @
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: W8 P) z! R/ N  q4 o5 ]
  20. * kind, whether express or implied; without even the implied warranty3 E/ k2 E% r9 C! q/ X& L' |
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2 X5 i1 A# O3 a5 s$ T3 r9 S
  22. * GNU General Public License for more details.
    6 D& ^6 U) }) Q4 _( F2 f7 T6 e
  23. */
    ; T  Q0 U8 y& D- Z! T
  24. + k2 m* y/ u" a9 x
  25. #include <linux/module.h>" C$ X4 ~- v9 K: {- `. l" O
  26. #include <linux/init.h>
    # \6 z7 k" s- X1 C2 |
  27. #include <linux/errno.h>
    0 u4 x$ v0 y8 R  }
  28. #include <linux/types.h>2 a) E8 R3 B4 X6 K6 D( ~7 o
  29. #include <linux/interrupt.h>- D" A# y2 K7 c, R) o
  30. #include <asm/io.h>8 n* w* u2 t1 E  C9 ?' ?' E
  31. #include <linux/moduleparam.h>3 G( g6 u& X* e' S: i7 Z6 l: W
  32. #include <linux/sysctl.h>
    # y: T) H! p& x2 I
  33. #include <linux/mm.h>
    1 @+ f" g3 F9 r1 j% i1 U+ T
  34. #include <linux/dma-mapping.h>7 i4 w7 @. v3 A
  35. ! ^; W& t; `4 p7 L, I- J, [+ d& }, [
  36. #include <mach/memory.h>/ j- h1 t. `3 J+ f/ N& e) B
  37. #include <mach/hardware.h>
    6 Q& r; D7 y1 s& ?
  38. #include <mach/irqs.h>$ G2 b! z1 F$ g% h7 B9 D
  39. #include <asm/hardware/edma.h>
    1 [; k9 M  t* m# o; J
  40. 2 G# E1 x! C9 B6 f
  41. #undef EDMA3_DEBUG
    , N5 e" e, q8 b0 d+ m. l
  42. /*#define EDMA3_DEBUG*/
    1 N% B% o: o5 H9 N

  43. : Y$ s" V, Q2 _: c# j
  44. #ifdef EDMA3_DEBUG# _3 d! W$ J' I, ]
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' i$ h- y, v' k0 |+ W
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ) a/ z2 w  H5 y8 C) J; I
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), K9 _+ h7 X( h3 q  B" ^
  48. #else
    $ H! r/ b9 k6 y/ {
  49. #define DMA_PRINTK( x... ); v5 D6 n: l" m, p! b0 z+ ?( E; H( L
  50. #define DMA_FN_IN' K( E6 T( a. z! w: w& Q- e
  51. #define DMA_FN_OUT* c8 Y' s' g* Y4 y
  52. #endif
    3 V1 W4 O$ Z# v

  53. ( I, r9 s' v( K! h; ~
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    1 E4 }5 b& l1 |9 z" _3 I% @
  55. #define STATIC_SHIFT                3
    / i/ }/ h% u  e4 |% X1 j$ n' [2 _4 Y
  56. #define TCINTEN_SHIFT               20
    * [3 l, m' h4 J3 Y9 b. j/ p: t
  57. #define ITCINTEN_SHIFT              21
    / X. p+ n! P' `2 b. J$ M5 h2 Y: A
  58. #define TCCHEN_SHIFT                22
    & I9 R- G$ u7 n9 Y
  59. #define ITCCHEN_SHIFT               23! ]' n2 w6 ?; R) o/ V# ^) ^) `+ {
  60. 3 K' H: X0 {3 A2 o8 b) I
  61. static volatile int irqraised1 = 0;
    # H  n# ~5 t4 t, j4 A
  62. static volatile int irqraised2 = 0;
    ) h; d$ i8 a7 a0 s0 t0 P

  63. 5 q! @( z0 X& o
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) ~, b7 {, ?' T" m3 B
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 R6 c: o' @, @# y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ n# f0 M, G3 O, S5 u, ]

  67. 4 ~* F% x+ V; P* I& n# j+ c
  68. dma_addr_t dmaphyssrc1 = 0;
    3 L9 T) D9 Z8 c' ?  `4 G  p. r
  69. dma_addr_t dmaphyssrc2 = 0;
    % C  o* U; @1 R) ]
  70. dma_addr_t dmaphysdest1 = 0;
    2 U& }- u  V0 Y2 X& m8 v4 e
  71. dma_addr_t dmaphysdest2 = 0;" f2 C. O! i( H7 u2 `

  72.   K9 P# P% ~- E( I2 b( W
  73. char *dmabufsrc1 = NULL;# F- `& y' n- u- Q9 j/ ^
  74. char *dmabufsrc2 = NULL;
    $ l  V1 L) M3 v/ L
  75. char *dmabufdest1 = NULL;
    % Y! ?; d$ Y9 Q/ a3 P
  76. char *dmabufdest2 = NULL;' M. I+ i8 t# l6 x" G' B0 y
  77. & W: k9 _( Z- Z: ]" a
  78. static int acnt = 512;
    8 T2 u, T! S! x- O
  79. static int bcnt = 8;
    9 B9 W# \/ x' I+ B, Z: H! V+ z
  80. static int ccnt = 8;1 f' m) a% g3 |5 d+ V' n

  81. 1 \: M. R3 w* m4 a
  82. module_param(acnt, int, S_IRUGO);% ^2 s9 a% S$ {' E
  83. module_param(bcnt, int, S_IRUGO);; W2 d& Y* W* l9 T  n: B9 A. D
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 P  R: x2 K8 s1 Q0 y2 i
/ ]( Q7 h, K/ v      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: M! a. P& b. C# ?* F
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 A$ C1 v# L! k5 I3 M3 D     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 K+ L! L9 w9 ^+ I# u

2 J# g; }( N# V# k. e$ p; H& w! n* j0 q* F$ o  q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-17 19:18 , Processed in 0.045850 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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