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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 P1 A. l* P1 ]6 u+ Q  h1 O
  1. [code]EDMA sample test application
    ' i. P6 K% r) _8 d: i  Y) l
  2. /*
    9 L9 [% G; w; s# t7 d5 U
  3. * edma_test.c
    ) P- I5 X2 M( B  i* {) ^
  4. *
    : V, j9 ^& V$ n# q. M
  5. * brief  EDMA3 Test Application
    8 @  d; m5 l! n# H8 Z
  6. *8 M- D. A- E) }" x3 j8 |! `. W. o: V
  7. *   This file contains EDMA3 Test code.6 ^! M) ^$ w1 S) x6 j5 L" H
  8. *
    + Z5 d) j: ^; h9 V! V0 Y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! W) S' C) d5 h) N' h$ ]
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* m! [) B! S, S% F: C+ v! x
  11. *         TO CHANGE.6 c  @6 v( E6 }1 n
  12. *1 `: `2 P. {" n+ l
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" @8 x  ?: m6 S
  14. *' {! s' J( x1 o3 b  H$ r) \
  15. * This program is free software; you can redistribute it and/or: N4 e3 }. K7 L9 r0 e5 T$ P) b2 N
  16. * modify it under the terms of the GNU General Public License as) \" E& Q7 N1 \& }* F) G
  17. * published by the Free Software Foundation version 2.9 t& e: Z0 H, P# L% L, _6 j
  18. *2 R2 N( M8 F+ u! z$ L7 c$ `+ g
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 i# q! r( n. Z
  20. * kind, whether express or implied; without even the implied warranty
    & A5 }+ {( r/ f8 a# R8 l( I/ b
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5 ?$ n; d% _* Y# M6 a
  22. * GNU General Public License for more details.
    + l4 a* y2 f: h6 o' w8 Y/ \
  23. */; [) n6 m; w2 {, R' b1 s* t

  24. 7 ?, w" k3 ^% s5 X0 Y3 I- C
  25. #include <linux/module.h>
    / {/ r7 P! u3 k  Q& Q
  26. #include <linux/init.h>$ x& k7 l7 K! a  C7 P8 x! z
  27. #include <linux/errno.h>9 \0 E3 x# I0 Z) b9 O
  28. #include <linux/types.h>
    ' K. A+ n1 z7 f$ |* H7 q, G
  29. #include <linux/interrupt.h>, k. w/ X3 @' [$ Y! U  l" k' y$ C/ F
  30. #include <asm/io.h>
    0 r: v: J4 l" n6 G1 |+ s& W4 n8 z3 Z
  31. #include <linux/moduleparam.h>
      \" s5 d& {. o9 e3 R- f4 {
  32. #include <linux/sysctl.h>' y4 x+ E0 S8 x: S, c0 C  e) D
  33. #include <linux/mm.h>
    - X  X( P( h0 G  c
  34. #include <linux/dma-mapping.h>
    6 l( Z! n% P2 z( V/ e" r1 @. f
  35. ! O  E: x6 _- K1 B8 X" ]
  36. #include <mach/memory.h>0 z9 ^- y, C* ^4 H* V" R- ?  K& F) a
  37. #include <mach/hardware.h>8 D$ y+ w# v& C: R) s% i
  38. #include <mach/irqs.h>
    / G5 g: H% n" K  ]0 i
  39. #include <asm/hardware/edma.h>$ `" ~$ O# W- E3 f1 _

  40. 2 Y% P% f8 ]* E* Y
  41. #undef EDMA3_DEBUG% t$ e" D& q( \* ^! B% w
  42. /*#define EDMA3_DEBUG*/  P9 V  X- o$ w" n' Q0 E4 ^

  43. ( s- `9 m. E3 ?+ ^4 i
  44. #ifdef EDMA3_DEBUG
      J9 M6 Q$ g0 }6 q$ ~; I3 S5 ~
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - B% S) O( j# `) ]) ?* b
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ' H! `5 ?' k' n, y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    7 s4 [4 `7 f. M  \
  48. #else
    " |! I3 z$ M2 n# O' o& H  R; z: R
  49. #define DMA_PRINTK( x... )
    - P2 Z# ?1 A2 @2 P9 h2 [
  50. #define DMA_FN_IN
    6 I  n& O5 v/ X
  51. #define DMA_FN_OUT
    ( h  j6 Y4 |2 Y- Q( i
  52. #endif8 }0 W/ o7 B  N+ B: E
  53. # y1 f( a  I4 Q: `' m' ^
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). N! D( P3 f- u0 S( x+ ]
  55. #define STATIC_SHIFT                3" |  a* e) Z% [4 F" I, r
  56. #define TCINTEN_SHIFT               20" e* ?5 `& c' Z4 C. i
  57. #define ITCINTEN_SHIFT              21
    . u5 f6 x. n- `- |4 o
  58. #define TCCHEN_SHIFT                22
    6 k6 N" t/ C6 t# v8 V& ?. ], q
  59. #define ITCCHEN_SHIFT               23" m: C( F+ D5 y; u
  60. ) o+ c6 A2 e4 j
  61. static volatile int irqraised1 = 0;* J# k0 Y5 {) C3 I9 H0 }- C3 D
  62. static volatile int irqraised2 = 0;
    $ Q$ E/ S% n3 a& E4 M

  63. ( J" P8 @7 H1 c; |) `; d
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 K# N) H! k! x
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 P$ m+ @& w  Y2 @# u4 c
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 U; J4 }( e! v

  67. 3 b7 C" J& L/ B' ~8 Z8 ]
  68. dma_addr_t dmaphyssrc1 = 0;6 W4 F0 l( o2 C/ Z
  69. dma_addr_t dmaphyssrc2 = 0;
    - a8 z  O" K  S+ K( S+ G
  70. dma_addr_t dmaphysdest1 = 0;
    3 |$ D+ k% \9 x& {5 y+ f1 ?* S
  71. dma_addr_t dmaphysdest2 = 0;
    . p/ R2 F# g4 i& y; x
  72. 9 _- Y9 B: y! }$ B% o
  73. char *dmabufsrc1 = NULL;
    , `, g. t; ~' p- k
  74. char *dmabufsrc2 = NULL;0 ~" J" ^) ~) j  x$ A
  75. char *dmabufdest1 = NULL;
    ( j- a; _' O& g! o
  76. char *dmabufdest2 = NULL;# t; p+ {; ?) F8 h5 @- y- F# a& h, F

  77. - e- S! M% O+ @0 q
  78. static int acnt = 512;# v; {2 I% s# P5 g* Z
  79. static int bcnt = 8;1 s1 c4 e, q% j! A7 q  f
  80. static int ccnt = 8;- c4 |' }  [0 k: \/ P, j8 @
  81. * X" Y5 z7 E& `3 z9 F5 A
  82. module_param(acnt, int, S_IRUGO);
    : k/ l+ e  g0 j, y/ G; Z
  83. module_param(bcnt, int, S_IRUGO);$ F7 Z0 I7 B2 h/ k& [4 y
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 ]+ l* o* d; c5 D
# G# U- t# [' I( P! B5 ?  E
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% a) c7 x! i* C- L) \, o& u
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ G' P! }9 k1 G. M8 _( j. ^/ F     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 h- T. G0 e2 u5 o7 K" C7 ?* b# D% J& {$ ?+ Y' c
+ b; e% H8 t- W* o: _" Q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-12 04:28 , Processed in 0.036391 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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