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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * \) O! j1 N9 Q' }+ K3 b* i
  1. [code]EDMA sample test application& ]1 N" e) H7 t( u
  2. /*
      Z9 c! F! j( e( W4 o3 l1 m
  3. * edma_test.c
    2 L- F8 ~; i: _
  4. *
    ( a% ^* L. O4 `# W
  5. * brief  EDMA3 Test Application  a' q$ a& K  I* a
  6. *, Q* v/ S( `2 X
  7. *   This file contains EDMA3 Test code.; u& d9 x- `& h
  8. *9 P# I& j; |$ Q7 d, W. x; M' a$ Y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ ^2 W& T8 [1 Q5 S
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* l( W/ ^, `  L, l
  11. *         TO CHANGE.
    9 B$ y" d& d; S' I
  12. *
    9 M  p/ x. G5 @) O, C
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 m1 c# {) x$ E3 v! i* L
  14. *
    & }  Y0 s3 s: j) s' f5 I& [6 k: Q
  15. * This program is free software; you can redistribute it and/or8 N. w* U; y: @! _! [& _, i
  16. * modify it under the terms of the GNU General Public License as
    9 B: ]+ X+ t: a1 f5 Y! W
  17. * published by the Free Software Foundation version 2.9 }, l; x% C$ D& Y2 I
  18. *
    3 k% G8 N/ R2 z) G, W: z5 j
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    1 }7 E0 U% X+ w& u- V
  20. * kind, whether express or implied; without even the implied warranty- u- J/ v+ O3 O4 A
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the0 T/ f  {+ l. I8 ]& K( j- V
  22. * GNU General Public License for more details.
    4 o6 J% Y9 Y: o# J" D: S
  23. */5 c$ g, ~( x$ j
  24. 2 C9 ~( F4 M+ U, m! b; i  ^
  25. #include <linux/module.h>
    % g* R* T2 X4 V: @! c
  26. #include <linux/init.h>
    , b& T) z4 W: [* `  h- J
  27. #include <linux/errno.h>4 ~' W+ i! }' D$ ~; T8 p
  28. #include <linux/types.h>5 y. Z* b7 \  J1 y1 J7 M- y
  29. #include <linux/interrupt.h>$ h  `0 s) d5 \1 j
  30. #include <asm/io.h>+ Q5 l2 A; g" I( R; u
  31. #include <linux/moduleparam.h>6 W: }2 g+ C+ s6 S! p
  32. #include <linux/sysctl.h>' N6 @% {5 [- B- b2 x  {) d
  33. #include <linux/mm.h>
    + y4 e0 @0 @7 V  Q. c
  34. #include <linux/dma-mapping.h>
    8 d6 r6 q: J! m3 d

  35. 1 m; W0 S! d( t: ^& `
  36. #include <mach/memory.h>% ~. n: J8 J! {# I+ k8 P8 d0 ~
  37. #include <mach/hardware.h>
    ; O5 k/ }7 V: S3 v! C  X
  38. #include <mach/irqs.h>
    / P% A# Z8 C* w9 E. P, N. T
  39. #include <asm/hardware/edma.h>1 w+ N6 Z, y: Y( j0 P6 M+ @- c# B
  40. * ^1 E* ~. F" s; _" ~; u0 I0 \1 z
  41. #undef EDMA3_DEBUG
    ! f+ `# n. v( i' t
  42. /*#define EDMA3_DEBUG*/- Y/ ^* N$ K9 P

  43. 1 Y/ k" P' o- q/ t
  44. #ifdef EDMA3_DEBUG
    ! l* f4 u, l; e% e) g4 K! H
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), I( Q- ~; f1 C; _! f; m
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 w4 L, M! b: s8 q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % K. f0 j7 i; N2 A
  48. #else0 W+ J7 @6 h* ?! _% ]5 Z
  49. #define DMA_PRINTK( x... )- z# y, \# u6 |
  50. #define DMA_FN_IN8 r! O& G! X% o  Q* x8 [" B
  51. #define DMA_FN_OUT/ D' C/ k: _' g. |, z0 C1 g( Z# F
  52. #endif; t& Q% f7 K  Z6 G2 N

  53. ) a8 C4 x# z& d1 ?/ I9 _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( Y% z, u5 D$ U
  55. #define STATIC_SHIFT                3
    3 K6 X7 C3 q% h* x* c, L0 S
  56. #define TCINTEN_SHIFT               20; [' g1 B1 m: P+ P) C3 }2 q
  57. #define ITCINTEN_SHIFT              21
    $ w4 w0 c6 c- b* f& K& O- c9 t
  58. #define TCCHEN_SHIFT                22
    ' c, n( n1 C1 e* V
  59. #define ITCCHEN_SHIFT               23
    + `$ c2 j9 r0 p6 z! X/ T+ u

  60. 2 r) X8 N1 J5 `" ]
  61. static volatile int irqraised1 = 0;
    ; U) _( ]- E/ b4 d0 o- ?- t. H( f
  62. static volatile int irqraised2 = 0;$ [& l! v& W( X! ~

  63. * G! {, P$ z5 P" ]$ e/ j$ q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) o/ D3 }$ ?! p' o0 ?: y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ V. U! ~8 K6 h3 X
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( A4 a( f" z. t0 s" D& r# h

  67. ) q1 Q/ z+ `$ C: f
  68. dma_addr_t dmaphyssrc1 = 0;
    + m& c. [$ D8 ?  K- {" b6 c3 B5 j
  69. dma_addr_t dmaphyssrc2 = 0;' v9 v" @* H: M; ]6 i6 H
  70. dma_addr_t dmaphysdest1 = 0;& h/ b* d, {3 U9 L" j
  71. dma_addr_t dmaphysdest2 = 0;
    + o4 m& m. ~( O- D$ a1 i* c8 ]* H
  72. 0 W- E2 v& U- J4 k
  73. char *dmabufsrc1 = NULL;& }3 ]9 F' D) H3 Y) g$ {
  74. char *dmabufsrc2 = NULL;, I! W  b' a7 ?5 D* ^, G/ q: }. v
  75. char *dmabufdest1 = NULL;
    / O$ n# M" w7 Y' _0 I
  76. char *dmabufdest2 = NULL;4 W" l$ W( `( K4 h. H

  77. 5 Z0 a2 m+ s1 d: G, b( b
  78. static int acnt = 512;
    1 t5 a7 O0 S; n9 o2 W
  79. static int bcnt = 8;% l4 E) T) N+ f' V7 n) C) T& B( h0 K
  80. static int ccnt = 8;
    7 S! V: ?- |6 e7 z; w6 n- E! Q

  81. : }, O4 y. X8 u+ p+ b' w
  82. module_param(acnt, int, S_IRUGO);! f7 d; [, D& m# X. ~. ^3 v1 b
  83. module_param(bcnt, int, S_IRUGO);
    ' L6 M( t* V" H0 e* h* o
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 A  o* a3 D: N5 _! o+ e
# x2 u" D, D) x& }      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ ~7 |* W7 i% s0 [
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 c, A; D$ o; b     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 Q' n5 W0 {1 I: V; o! l. z2 [

$ `. z3 ]# r( b6 z( F' a
- l  E1 z! Q! I5 B3 [& _
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-14 01:20 , Processed in 0.050564 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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