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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 O! ]" g; l( \* o! q) E
  1. [code]EDMA sample test application
    # i+ V) [! X* B9 N
  2. /*
    1 m" C8 V9 }6 r7 q
  3. * edma_test.c1 {6 O% Q- W3 c8 M! ?& a3 m
  4. *
    8 V1 \$ o7 q) ~6 ]
  5. * brief  EDMA3 Test Application
    - j3 @% P: J: g, L$ _
  6. *2 y# j( Z2 T5 e, j$ }" S
  7. *   This file contains EDMA3 Test code.
    . V  Y/ f# {/ ^( S/ H
  8. *9 M* d* Z: _8 ]) Z; i3 P* K
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 j9 h: \2 P' z+ u$ y" R# n# v9 V0 Y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    8 }) T5 ?1 y& i6 t
  11. *         TO CHANGE.
    & F( y; s6 S: [" z# L& @" b
  12. *1 o/ R& Q% q3 m6 P- H6 C
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    # i7 v1 z% [& P: A* u2 |9 t- E# k; W3 M
  14. *
    $ c6 o  i; F$ q2 k7 f+ M4 v
  15. * This program is free software; you can redistribute it and/or
    6 d" D& ~0 U+ B7 r/ e1 ~/ ]# H- t
  16. * modify it under the terms of the GNU General Public License as
      _9 x! O; y4 [1 u( ~' {
  17. * published by the Free Software Foundation version 2.& ~0 f* s0 b4 I) g* T9 k( |+ N
  18. *2 U& Q$ H4 x* c+ m
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 {" v9 L4 [! R% A% i) ^2 P
  20. * kind, whether express or implied; without even the implied warranty4 R4 Q, o2 o' V1 M! N; z- ]
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % E) w/ \4 c+ }  R7 _
  22. * GNU General Public License for more details.
    1 Y$ ]. J. Q/ a8 T% |3 d
  23. */: p  ?* A2 \$ G" K  R4 @  [

  24. 4 E+ v  m9 `: E" F6 L
  25. #include <linux/module.h>
    ( W) a& |5 A) l) y
  26. #include <linux/init.h>
    $ f: S: t$ w" E- J4 T
  27. #include <linux/errno.h>
    ) r! L# ?; L% _" w1 s# Z
  28. #include <linux/types.h># D) D% ~: _8 S
  29. #include <linux/interrupt.h>
    : B0 k) u. A/ K( A
  30. #include <asm/io.h>
    $ p: `- x# i- I7 N% W+ a' a- X
  31. #include <linux/moduleparam.h>
    ' ^: ]$ v) q+ q4 _
  32. #include <linux/sysctl.h>
    & o: D; r7 N. C  w# @. O
  33. #include <linux/mm.h>: @: r! [: S" K! U% Q2 e$ ?8 ]
  34. #include <linux/dma-mapping.h>
    5 A% G- i9 p( ]7 N
  35. / x! y8 G* t2 y$ H0 _
  36. #include <mach/memory.h>
    2 h8 O( s8 q& r2 @5 @3 i
  37. #include <mach/hardware.h>
    " F1 P* \# {* m8 G  c; X
  38. #include <mach/irqs.h>
    " T+ B$ y8 e; |2 ^. w/ _  c
  39. #include <asm/hardware/edma.h>
    1 {; B" o, l7 L- M* E9 K0 r

  40. ! V2 o+ i9 `& ]  \5 s! M
  41. #undef EDMA3_DEBUG
    7 E' j  M; ^0 y5 u/ m
  42. /*#define EDMA3_DEBUG*/
    - l# V5 p2 b& R0 f" v
  43. 1 `, r1 `/ i+ Y! u8 r$ _4 O5 y
  44. #ifdef EDMA3_DEBUG
    " }+ ]/ l  v: g- e" W& P  C' V
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    7 L2 r. V! C+ c4 Q) w
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    - j* k, [) E  ?8 s& m4 L2 r* v) [/ a
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), \0 H( g* U/ }+ O+ ?
  48. #else: e  [. l# r8 C, L
  49. #define DMA_PRINTK( x... )8 c1 b$ J9 s( f' v8 ]% l
  50. #define DMA_FN_IN" Y8 o! r- D$ F& D' D9 f, b% r8 g
  51. #define DMA_FN_OUT  r1 Z$ V' a7 D$ }* c/ Z* Y# ^
  52. #endif) }; b' o) m) d8 e/ r9 m* B  E
  53. 7 Q- h( Y8 I+ O5 y' _; s
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)6 Q8 K/ l4 b- Y0 Z  S8 G% M/ c3 u
  55. #define STATIC_SHIFT                35 G% c* p9 @" ]7 ^- a4 ?
  56. #define TCINTEN_SHIFT               20
    # ?$ W* }" A  T4 R
  57. #define ITCINTEN_SHIFT              21
    ' |6 M1 ^, Z+ {1 W- Y
  58. #define TCCHEN_SHIFT                22* \4 w+ |+ t6 E
  59. #define ITCCHEN_SHIFT               23
    ) C. Q( ?' q/ }4 Y

  60. , y! ]* a' h( F# k4 T
  61. static volatile int irqraised1 = 0;
    $ i( w* e0 a9 D2 h) X
  62. static volatile int irqraised2 = 0;% m; u8 X" p6 ^# E4 `

  63. - C* Z3 R+ R+ k6 E1 C! \. y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( Z1 S. ?( g; h9 _5 N# N' R3 G; O  R
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' s& \. a1 d2 N! y2 ^
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / s9 e' f1 _% _. J. l- H
  67. 6 T6 Y  P+ U" w& G8 s
  68. dma_addr_t dmaphyssrc1 = 0;
    4 F6 y* h& }1 g
  69. dma_addr_t dmaphyssrc2 = 0;) Q! f8 t! w6 Z1 |$ K
  70. dma_addr_t dmaphysdest1 = 0;9 H# G! W" U" J, f
  71. dma_addr_t dmaphysdest2 = 0;
    ' Y: l( k" z+ Y9 L  b
  72. 3 Z6 i: k" r2 \! S
  73. char *dmabufsrc1 = NULL;% i% i7 b% E* M  d
  74. char *dmabufsrc2 = NULL;
    * {! N& g7 ]2 @( h/ X
  75. char *dmabufdest1 = NULL;
    " T% z. ?" f) d
  76. char *dmabufdest2 = NULL;8 j3 G( V( Z0 b' x
  77. 7 E, I: L. C) [2 y
  78. static int acnt = 512;
    / }6 Q+ o' R. e, z
  79. static int bcnt = 8;
    " w, g7 X$ M. b9 X, m5 y; O
  80. static int ccnt = 8;
    : n, f+ k0 y3 a) c4 M( q

  81. # W3 s; a3 u* ?/ _
  82. module_param(acnt, int, S_IRUGO);
    - V6 [0 [% R' o2 U  u' n8 y- X
  83. module_param(bcnt, int, S_IRUGO);1 A6 h/ t4 j9 d
  84. module_param(ccnt, int, S_IRUGO);
复制代码
9 w; p" W5 D2 X$ v
4 Y5 [& m0 z; u+ v, p
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, J5 @! g( Y3 m
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 S: @" r% Z4 i0 v/ M; c
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, a, H& E, w9 `& r8 J
' P& g, j# a& Z: q5 ~

. d! d2 u; ~  V5 t2 r+ o/ f$ K3 B' g; v
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-12 23:59 , Processed in 0.037579 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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