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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 A/ G0 u* W+ n' R8 p
  1. [code]EDMA sample test application
    8 J3 n, q% L3 ~5 J9 |" m  g$ ?
  2. /*+ O" B5 S$ ~: A
  3. * edma_test.c" O+ b' c8 T4 w* M) o7 r
  4. *
    ; Y: ]7 y2 Q7 I5 \" s2 r! i
  5. * brief  EDMA3 Test Application3 Y" W1 I2 @% @3 [: d
  6. *9 n" P8 e8 f' ?) N2 n' a  X% {/ ^
  7. *   This file contains EDMA3 Test code.
    : @6 r, B( h9 H/ M7 d9 L
  8. *
    - e9 x4 f" C# I/ H" w1 J4 }5 |
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 k4 S3 r& e1 X* V4 ]
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; I" x1 d3 R, c0 @
  11. *         TO CHANGE.
    ' J' R% V" H5 }4 W2 ^
  12. *1 C- l! c  M. i' C1 V* k
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 V$ B  y) S# |+ ^5 F5 y7 m
  14. *
    & n, y  Z! n% W( a4 i
  15. * This program is free software; you can redistribute it and/or9 x% s" Z  w1 p: e4 [5 a3 `( o
  16. * modify it under the terms of the GNU General Public License as
    + a2 w5 G" d- e* w& Y
  17. * published by the Free Software Foundation version 2.
    ; y8 Y8 J& A+ q7 D
  18. *! l* |  E+ u+ W
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any# J# _2 h! j2 f' J4 S1 q/ R) z! h) i
  20. * kind, whether express or implied; without even the implied warranty: Y2 }6 _* o: Y. S
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + Z3 o/ O5 C- y+ |+ B
  22. * GNU General Public License for more details.
    : h1 g) h2 ]1 f1 c$ A- N7 u
  23. */
    $ K/ N( Y, j6 K' v

  24. 6 |% y5 }- S+ |4 y
  25. #include <linux/module.h>1 z# [% ^( |. ]( J0 S7 ?7 z: v! ~
  26. #include <linux/init.h>2 A# h( {5 l  }7 G& I+ m8 U
  27. #include <linux/errno.h>. z5 k! \8 |; P6 u0 T
  28. #include <linux/types.h>$ |0 ]$ X" }& ^  U# F# R
  29. #include <linux/interrupt.h>- l. M+ I8 o* {) l8 H
  30. #include <asm/io.h>9 b. e9 M5 r0 Q  |
  31. #include <linux/moduleparam.h>$ ^1 \) C1 Q. O% t4 y% i  {
  32. #include <linux/sysctl.h>1 C. N5 h, ?  e1 @, v
  33. #include <linux/mm.h>
    ; a# y0 N% D  o' f+ Y# V4 ]
  34. #include <linux/dma-mapping.h>
    : i" q3 d, N6 _+ V3 J3 |7 H

  35. 0 G( I( N0 _9 B( E
  36. #include <mach/memory.h>; A4 A9 ~# S$ b/ r. f- e: e
  37. #include <mach/hardware.h>
    4 ^9 S+ y# P# R  G/ _8 B. ^/ x
  38. #include <mach/irqs.h>+ Q# h8 r5 r0 R  I- j
  39. #include <asm/hardware/edma.h>
      x- |" r! v- ]6 E6 X6 j3 M/ F

  40. / F/ x8 M( k4 L/ X/ w& E
  41. #undef EDMA3_DEBUG
    . |+ h* P! ^% m3 @5 B4 H
  42. /*#define EDMA3_DEBUG*/* S  o2 }- _( \5 w7 c

  43.   i4 \5 c, o( D! A
  44. #ifdef EDMA3_DEBUG; Y& K& c' p+ ?0 G5 \9 U- E* u
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 T) L" c. R  k* d; n  `) N# ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 d' }% f( M. s# o/ v
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* e$ v# l" U% D7 R! B
  48. #else, y: Q0 f' w- d& J4 l6 `  Q6 D& h
  49. #define DMA_PRINTK( x... )
    - a( r: f+ c8 c- A& b) d
  50. #define DMA_FN_IN
    4 V! @% ?# j" s* I1 s8 h2 }$ T9 a. ?5 r
  51. #define DMA_FN_OUT& s! S' }! B9 ^0 g# f4 i$ k
  52. #endif- t- y7 U* S: a: w

  53. & s1 t5 Q5 m# ^' u$ T: s4 a  l
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ @0 g* T2 m+ C3 m9 X% Z& C3 |
  55. #define STATIC_SHIFT                3! T. A& I! E7 u2 S6 m" K1 _/ Q
  56. #define TCINTEN_SHIFT               20
    * h' N! }- Z. V1 B
  57. #define ITCINTEN_SHIFT              21
    + a* I( d$ h: g
  58. #define TCCHEN_SHIFT                22! p/ O7 q0 v( @& K! y8 @
  59. #define ITCCHEN_SHIFT               23
      n* A( Y% ~& l# P
  60. ; k7 \+ v+ i5 A
  61. static volatile int irqraised1 = 0;
    4 f$ N9 l! r5 U) W
  62. static volatile int irqraised2 = 0;
    1 [6 _% u1 N" L% Y* l' L* {, G7 b

  63. / s$ n7 `  s8 P1 P1 ?
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 j% [' W- _! M2 r
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, d/ w' q4 h9 O0 E
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: g  r% a0 }. [4 I" o% ]
  67. $ ~/ |& i/ E) T: u1 {; y2 f
  68. dma_addr_t dmaphyssrc1 = 0;
    6 `' q1 e. R6 X- f" Q
  69. dma_addr_t dmaphyssrc2 = 0;
    0 a& @5 t# K  K  v+ k' }$ b
  70. dma_addr_t dmaphysdest1 = 0;0 V6 O  {  E9 j9 A. Q
  71. dma_addr_t dmaphysdest2 = 0;
    : w5 c7 R$ M* G  U

  72. ( S2 g8 o1 \, I1 {$ L4 W" k6 d
  73. char *dmabufsrc1 = NULL;
    8 j( ^' J* ?0 s4 F4 K
  74. char *dmabufsrc2 = NULL;
    ) f9 p% y; W3 a
  75. char *dmabufdest1 = NULL;
    : ?3 S" t* _! o$ C
  76. char *dmabufdest2 = NULL;0 X8 S7 O0 Q1 c/ {3 r" i/ X
  77. % I  a3 E: `% ^* f* \( P
  78. static int acnt = 512;: g' g1 a0 {5 E/ m# X; }1 R- ?( A
  79. static int bcnt = 8;
    ; s; G, m. \* `0 v, V& c6 |
  80. static int ccnt = 8;! V- ~+ f/ y% T4 c
  81. 6 I- b3 l' u$ B: p, k* e
  82. module_param(acnt, int, S_IRUGO);
    " u4 Z2 p2 D- F2 m  s
  83. module_param(bcnt, int, S_IRUGO);& v) Q9 z+ x6 P* m: x7 u
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 j6 u* m& P  m; G9 `1 W- y9 ]5 ~3 g/ r; z4 Z+ {9 F
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# C  p1 U0 @2 |3 }: C$ ]5 K& Zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. y+ ]) R' i. \; O2 I     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* T% i- `# p; v$ g# n& }, e0 O0 a8 l; _

. y7 Y3 x8 g- j/ _0 j3 s
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-24 06:03 , Processed in 0.040530 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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