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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % e1 g9 j3 I4 D' l3 ~0 {
  1. [code]EDMA sample test application) ?& u8 y0 G. |1 p) r& ~
  2. /*
    3 N( k4 _) G: x4 |( T/ g
  3. * edma_test.c
    + y1 M2 i; b$ j8 x8 q
  4. *% m7 b8 j: Y/ b( @* F
  5. * brief  EDMA3 Test Application: R+ X  d+ v  Q
  6. *- X5 Y; n3 Z( [5 I
  7. *   This file contains EDMA3 Test code./ e: M; m% ^* v& H* e( D, c& v1 [7 Y
  8. *
    5 i# y0 E& d8 o6 K" P  D5 r
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; e; f! `3 F0 }2 v
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    - H) V, H1 b0 p
  11. *         TO CHANGE., \6 v  ~1 c8 k2 F5 L' ~
  12. *! i" ~) d- G" {- {0 f* ?0 K$ l
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    / I  R- O, }. }) ^  r# K) Y
  14. *
      V5 x& A9 H: v* X+ @- j' M4 \
  15. * This program is free software; you can redistribute it and/or
    / }* k0 B" Q1 S5 b; }
  16. * modify it under the terms of the GNU General Public License as
    ( f5 D: u! F( Q9 N
  17. * published by the Free Software Foundation version 2.  l. B/ ]: }2 F7 v3 n5 ^# ~3 O
  18. *
    * D% l9 O7 Z8 Y! A" o5 G. J; W3 m
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    " p* \8 a/ V$ |6 m
  20. * kind, whether express or implied; without even the implied warranty
    ; v" L% m& o0 z6 m
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    $ U/ N5 i9 b* V$ p" d
  22. * GNU General Public License for more details.
    : J+ J$ n8 X5 \$ q/ C
  23. */& r" A# Z  T( Q0 U( \3 s( _( t" O

  24. ' [; l+ q7 j5 W. M& n/ ~& d4 M
  25. #include <linux/module.h>6 u. {8 o" r  R
  26. #include <linux/init.h>
    / ?0 p& S$ O/ U/ i% {7 f
  27. #include <linux/errno.h>$ P) }/ Z5 _2 L8 A0 \
  28. #include <linux/types.h>$ x- R1 P3 d" P/ f, X1 J- X
  29. #include <linux/interrupt.h>) Z; g8 m& y. w1 C9 @
  30. #include <asm/io.h>  Q, M: D6 Q/ d; f
  31. #include <linux/moduleparam.h>+ S( d5 H1 H3 |* p% N9 S; d
  32. #include <linux/sysctl.h>+ o. h/ f  ]. g2 t7 T
  33. #include <linux/mm.h>
    4 n$ T  @2 }5 Z0 ?+ {
  34. #include <linux/dma-mapping.h>: P; W) m& g+ C5 H

  35. / G$ M  `0 z! ]# Z" Z8 l) ?
  36. #include <mach/memory.h>
    2 U; d, _) s" z0 V
  37. #include <mach/hardware.h>8 m* p# G. y# a0 {4 G7 N  b
  38. #include <mach/irqs.h>- f. ~4 e& R3 _. F
  39. #include <asm/hardware/edma.h>
      J+ `0 }- [9 _: y4 |& j6 O' F
  40. ! U5 {' L' t/ p+ U
  41. #undef EDMA3_DEBUG$ p5 I4 c6 ?: r& n
  42. /*#define EDMA3_DEBUG*/) P$ v4 z( H, ?/ R* k3 C3 p

  43. 9 k* a0 J! x- J1 a3 r( u# k0 ?
  44. #ifdef EDMA3_DEBUG* B- n# a& \* Y% S; o( }( ?* L7 w
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    5 M- @. @. Y# w8 k" p' g& A
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 \/ M! Q; J- }( f
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 Y2 G3 E' y% }% W  H
  48. #else; h# R& l( R, E" [5 H3 }2 }% M8 E
  49. #define DMA_PRINTK( x... )
    % ?2 @( |: ^1 T: a( S
  50. #define DMA_FN_IN5 g; `3 A- L2 y) B4 `3 U, X
  51. #define DMA_FN_OUT
    ) a, i) c' x; t4 ^2 j
  52. #endif0 L5 b. l% Y! F; M
  53. , b, n& ^0 B) V# ^' v: x$ e
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    & I4 ~( `2 X- Q' _. P- e
  55. #define STATIC_SHIFT                3
    8 V$ U) Z2 R1 I+ ~) s$ V9 O* {
  56. #define TCINTEN_SHIFT               20
    6 ^* V- F/ y( ?+ T: M
  57. #define ITCINTEN_SHIFT              216 n& t5 P+ E# ?0 A* ^
  58. #define TCCHEN_SHIFT                22
    ( }; K" W6 h& p9 C' q
  59. #define ITCCHEN_SHIFT               23
    # t$ b& O0 @( a# _+ A0 g7 q

  60. + ]& f* k+ w+ w3 v
  61. static volatile int irqraised1 = 0;
    7 @3 H) H1 h0 Z  \
  62. static volatile int irqraised2 = 0;/ t( a, ~4 `5 j5 p7 ]: [8 {5 r
  63. ; `# R( q3 Z/ K" y, U
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' a1 t. {1 c. A  J
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " C; _* w- |' e! a; n% h
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 N; i8 O0 w& F2 ~+ u

  67. ! f6 u) ?. e. E4 f5 c
  68. dma_addr_t dmaphyssrc1 = 0;. P' l* P" f# f0 D
  69. dma_addr_t dmaphyssrc2 = 0;
    9 d  ~' F; b1 Q
  70. dma_addr_t dmaphysdest1 = 0;# U. s8 d: E. c, U& T
  71. dma_addr_t dmaphysdest2 = 0;
    ( E% K+ A* `1 Z
  72. : v3 A, ?8 t) z1 G. @# J
  73. char *dmabufsrc1 = NULL;- |( L, w$ ~+ q/ ?( G0 k2 ?/ d
  74. char *dmabufsrc2 = NULL;
    + A! |3 K9 J+ T# e8 G; @; s
  75. char *dmabufdest1 = NULL;5 M: i7 o7 W0 o2 @- l9 Y4 |- c
  76. char *dmabufdest2 = NULL;0 }3 B0 e. |+ }7 h' b

  77. ( |5 b8 B" C$ y& E% r
  78. static int acnt = 512;
    - T' K) T) s  Z7 g: _7 W
  79. static int bcnt = 8;
    " e0 x7 F" r; w) u* G
  80. static int ccnt = 8;2 p6 g  \1 }( i! j
  81. - u1 p: I% P, `: W2 l7 H9 ?
  82. module_param(acnt, int, S_IRUGO);
    2 ]& b* d1 |; k5 P3 w. \% Q1 N
  83. module_param(bcnt, int, S_IRUGO);
    1 h# Y, \* _; S8 M; a, `. j3 H
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 M, K' u/ [- f, ]. Y
1 O! m( y9 b# ?5 Y" f
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& {1 |& d2 k. o7 j) i8 V$ {, g
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 ]$ Q+ g; C9 |9 H     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; v  G! G  b7 v- Y& a  Y8 K1 q
9 f3 [7 h& A& J" I" u# y5 V1 L" n7 `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-4 08:20 , Processed in 0.039757 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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