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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  d$ x9 k! E1 s1 ]5 N: _' n, S
  1. [code]EDMA sample test application
    3 y/ X) k! y5 r. n; k2 C
  2. /*5 }% c+ z" k  U, j1 X- L
  3. * edma_test.c1 N. {; Z8 {2 K! L2 ~+ V6 A
  4. *3 s" w* ?2 T  ^. T
  5. * brief  EDMA3 Test Application7 j3 ^% d' L5 B* F/ ~/ X1 ?$ g
  6. *
    / W/ V( a" S' s; S
  7. *   This file contains EDMA3 Test code.! v( o& Z  V: t% @* E
  8. *2 j' L2 y0 G8 f2 G3 I
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - e5 d$ H+ n  X' ~! A+ c; A* V, D
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 N1 b4 H( c# u% {# H  t* m
  11. *         TO CHANGE.
    3 f* @- l5 o- F4 z: o- I' o
  12. *
    8 J6 h; A. s7 t  o. w
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, m% h$ W' s; p  W4 e
  14. *! n/ R4 ]' ^) ^% t1 w
  15. * This program is free software; you can redistribute it and/or
    4 D& J; R4 c/ ?6 r
  16. * modify it under the terms of the GNU General Public License as
    * L. F$ f5 z0 [3 z' y; m  ~2 r
  17. * published by the Free Software Foundation version 2.
    6 C/ b( b! Y; I& m8 W1 G9 D, f- o
  18. *3 W" z+ L: R3 O/ l6 ^
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 M& j8 V* Y: ^" S* e
  20. * kind, whether express or implied; without even the implied warranty
    1 x9 i: a8 r2 l& E0 P; p
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' D2 b1 \6 W( Q' V! Y3 {% x3 H; E
  22. * GNU General Public License for more details.
    7 ~  ~) G+ [. y& Z7 t1 t6 |
  23. */' I3 h$ T* U2 v$ J

  24. 8 m2 c6 [% k% a) P
  25. #include <linux/module.h>
    : ^1 g* u. O8 ^# t6 H( w6 S' ]4 l
  26. #include <linux/init.h>
    2 m3 j: z4 {! N; d% g
  27. #include <linux/errno.h>! u( h7 N' |' q5 r4 F! {1 s+ [
  28. #include <linux/types.h>
    . j: l5 i7 G$ ]1 q* B" h5 ]' \8 K# O" ~
  29. #include <linux/interrupt.h>
    2 Y' E! d4 V; Y/ H
  30. #include <asm/io.h>, A5 C4 e6 \$ `' _" ~
  31. #include <linux/moduleparam.h>  h# a8 F$ O' A9 p) E
  32. #include <linux/sysctl.h>. T+ d0 T. Q2 g, E" ]# g
  33. #include <linux/mm.h>7 X6 E, D/ {. ~# f6 T
  34. #include <linux/dma-mapping.h>; e* i1 n8 ?! ^* B
  35. 6 z* ^3 ?4 C3 d5 h/ @) U! _8 x: L
  36. #include <mach/memory.h>+ \3 n# h2 U, l
  37. #include <mach/hardware.h>6 @: }8 v; ?0 [+ }- L& {; {
  38. #include <mach/irqs.h>- t. P" ]6 Y4 L# B- h& Y
  39. #include <asm/hardware/edma.h>8 v( y! Q. f3 o9 i+ c
  40. 5 q3 Q. C% O; |0 P7 {  K% _" E/ h
  41. #undef EDMA3_DEBUG  j: T' \( p" X/ j- W6 q. \! L2 n9 Y
  42. /*#define EDMA3_DEBUG*/; w; @" @; ~1 R( G( k

  43.   B; U% J- A2 j; H: y/ J
  44. #ifdef EDMA3_DEBUG! A3 a3 ~4 i7 o: v# ~" d
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' }; r5 J" {( x2 z2 m
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    0 u* E" F! H0 H0 }% ]& t
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 O8 c# L) V3 M7 P/ L4 X
  48. #else9 x0 z# g; W8 s# c
  49. #define DMA_PRINTK( x... )
    ( {' O: [9 p0 ]1 c8 _' _0 Z
  50. #define DMA_FN_IN1 C0 A" B+ C6 U: j$ G
  51. #define DMA_FN_OUT) g" H& P, Y: J0 v
  52. #endif. ^' K" ?! H- p% i, q
  53. ; s) P3 p6 [! ?- E0 T
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)0 e; ~' K3 d# o! ^) j% B) P
  55. #define STATIC_SHIFT                3
    9 Y5 `8 n5 H. Y3 _/ c  V  ~
  56. #define TCINTEN_SHIFT               20
    : T, G. n5 F5 {! s5 I
  57. #define ITCINTEN_SHIFT              21! [/ `: }- u& ~- {8 N* w3 o- i
  58. #define TCCHEN_SHIFT                22+ ~- Y) M9 g& x6 `4 W5 w) A
  59. #define ITCCHEN_SHIFT               237 W- v( u) `! c/ L: ~! I* I. G; D
  60. ' T0 q, y8 X+ `* x6 x" B0 ~
  61. static volatile int irqraised1 = 0;
    $ F: Q& Q) j/ y
  62. static volatile int irqraised2 = 0;
    " @& k9 v! g8 p+ D

  63. ; a- {5 {  g) z! }# c, U% i1 L
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 |* i$ Y6 R2 B. s% I! Z' u, @" H* h
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 I, o, G& R$ L
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 K9 Y7 z! c* `$ u

  67. . h- [7 {7 y( ?+ _* {; w8 t
  68. dma_addr_t dmaphyssrc1 = 0;
    , H% V) d+ i* V  \: M
  69. dma_addr_t dmaphyssrc2 = 0;
    ; ]1 r. a. }+ f; [& p* i; m
  70. dma_addr_t dmaphysdest1 = 0;
    + V7 s. l) J& x& ]# [7 X
  71. dma_addr_t dmaphysdest2 = 0;+ X, v$ ~6 P! R/ G2 k/ y
  72. ) {2 n5 w+ G/ H2 L8 f2 |
  73. char *dmabufsrc1 = NULL;
    : o: G. x' \5 m. G
  74. char *dmabufsrc2 = NULL;
    8 M) _( i, W) m1 Q$ g9 O! H% W
  75. char *dmabufdest1 = NULL;
    % p, w! M7 v) c! I0 v0 }
  76. char *dmabufdest2 = NULL;
    2 R3 [$ C& a; U5 d; g6 w

  77. 7 z+ V  s& R& a
  78. static int acnt = 512;
    9 z$ N' r2 y0 [/ r# {( d
  79. static int bcnt = 8;
    ; k# L1 e% s5 W# r3 A. U
  80. static int ccnt = 8;
    , ]& L5 H! \8 M7 \
  81. ! R" B+ n4 F) i
  82. module_param(acnt, int, S_IRUGO);
    1 L  ~: D: J& |; C% @$ O
  83. module_param(bcnt, int, S_IRUGO);
    $ S2 X2 A6 I) L: Q/ S7 F
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 v/ f& N) m& z+ i& s

. s5 I# Y& V+ [7 f) M/ B  F      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( o/ M9 a, d& Q( w9 a7 h% Earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" {$ K) s5 o4 f: L7 y0 ~
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 @; r: M$ b0 X4 G9 s5 Z% C$ f# |

) t( X! r0 d+ n- W# I- \6 w7 @* e4 C- N6 a, i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-19 18:24 , Processed in 0.038242 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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