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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 O, y# Q5 E# M+ y) Z/ ~
  1. [code]EDMA sample test application1 i. p6 a5 s& ~; l. y
  2. /*8 ], J4 \2 ^' i2 n2 s
  3. * edma_test.c3 H; n4 U3 V3 j5 G
  4. *
    " s9 o; p1 \! M1 ?
  5. * brief  EDMA3 Test Application, x; X  U5 f, F8 q; N, E
  6. *# {& _: i  B( I3 {: ^- E
  7. *   This file contains EDMA3 Test code.
    ' T! j! S* q2 M8 a: |8 Y- a) T8 w& k
  8. *( D- h# x  i! @. h, `: S
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      T8 h* x% _% ?
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 I: Y5 U+ {( o9 u  s3 w% o7 z
  11. *         TO CHANGE.& e8 B4 b* _: w$ e5 w
  12. *6 i2 N  V3 L/ f1 O2 [/ N
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- y5 b+ R. W) p+ w
  14. *
    $ p) x1 z4 u6 H, v  o8 \$ W
  15. * This program is free software; you can redistribute it and/or  L4 U" K1 S% H, V
  16. * modify it under the terms of the GNU General Public License as
    4 o- B% o! U& U# ~5 ]) g
  17. * published by the Free Software Foundation version 2.
    : s/ h$ U7 e% A& q
  18. */ h5 {1 n1 T& T) j! z) f
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    & ^" x9 Y  ~4 x7 o/ m
  20. * kind, whether express or implied; without even the implied warranty9 a0 ~/ ^6 r* F2 z& R6 \' V- b
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! L8 L( Y# s9 L: H  l
  22. * GNU General Public License for more details.) P0 Y: L' W1 q4 H! _
  23. */' E1 v& |5 x, @  ?: G* ]* [9 E, q
  24. & D- D, H  Y7 p! m
  25. #include <linux/module.h>1 i6 D2 v! s. N% i* g# r: N8 o  X
  26. #include <linux/init.h>; x/ o; t* n0 P  c  C* K; d/ w
  27. #include <linux/errno.h>7 a0 |1 ^4 d- D7 ~. p
  28. #include <linux/types.h>
    + |7 r( o  T( y$ Y0 N% Z+ F" n$ D6 K
  29. #include <linux/interrupt.h>
    5 r5 k: N4 d8 Z- W2 ^2 k
  30. #include <asm/io.h>
    0 ?* K4 q4 p5 y8 C
  31. #include <linux/moduleparam.h>
    . A3 |' T6 {9 _' c6 }- I
  32. #include <linux/sysctl.h>
    - H7 G1 L! h1 ]. c
  33. #include <linux/mm.h>1 [3 }$ ?9 j- X+ g; h
  34. #include <linux/dma-mapping.h>( f) p5 t: }* b; }
  35. * @4 J! P! j' C* J
  36. #include <mach/memory.h>
    ; ^2 H) W/ o$ `5 c- _9 m7 {" b) e4 r
  37. #include <mach/hardware.h>
    & d5 p  F- c  @4 E7 S) G. Q2 Q
  38. #include <mach/irqs.h>
    6 D' S9 X; n1 o7 K5 d" W
  39. #include <asm/hardware/edma.h>9 C  u2 c/ }, R- t
  40. . K* Z, g# h2 j% s/ q# l0 w
  41. #undef EDMA3_DEBUG( y1 u: E( a/ T) x& O
  42. /*#define EDMA3_DEBUG*/4 z5 {8 k* l$ w( {4 I. V) i) e
  43. 5 }! |2 @, [( v$ x0 |& H. G' G
  44. #ifdef EDMA3_DEBUG3 j, X1 }# T' M" Y" n/ ?$ d! |1 f
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ) p  l$ }% {- E3 D, |. O7 H
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 V) \2 d4 v5 h' z6 a
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% G+ ~+ |3 F) E1 C6 v" r( }7 z
  48. #else
      G& {' ~' D7 \1 s+ m
  49. #define DMA_PRINTK( x... )
    ) \/ l1 H1 s- [: Z+ q8 D( M; O
  50. #define DMA_FN_IN
    6 P' t1 e+ z9 \# o$ L
  51. #define DMA_FN_OUT. X* }$ ^. a! `# l
  52. #endif% R6 y6 Z' l1 Q* ]7 x- T

  53. . M: z, L, }6 g" {' L# t
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)3 O( M8 W, n1 l
  55. #define STATIC_SHIFT                3, l# t: v- V% x: i5 I
  56. #define TCINTEN_SHIFT               20
    4 E% o; y+ H! h. x. N! B+ D
  57. #define ITCINTEN_SHIFT              21
    + H( l5 E8 |) r: q: T+ O# W
  58. #define TCCHEN_SHIFT                22% `* P9 j) T" d0 J0 P3 j: e) m; [" w
  59. #define ITCCHEN_SHIFT               23
    " H. q7 t# [% j" ^3 d
  60. ' C3 o, ~+ ~7 H
  61. static volatile int irqraised1 = 0;- h( X% [* X/ F- d6 O& w- }7 B
  62. static volatile int irqraised2 = 0;0 }, z9 l  |! s- {+ t
  63. - [* s. u3 _  R& i
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ i/ \7 {7 a2 Q7 y' F$ P
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 `9 a" U  e! X5 W
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 `/ \4 Y- i* Y" N

  67. ) c$ j! Y' q8 a$ k- s
  68. dma_addr_t dmaphyssrc1 = 0;  ~- w6 Y6 a! M* {" B
  69. dma_addr_t dmaphyssrc2 = 0;1 v3 q! l% S( S$ Z: z1 E  M, \
  70. dma_addr_t dmaphysdest1 = 0;
    & k* f) |. }4 w5 P
  71. dma_addr_t dmaphysdest2 = 0;
    0 Q$ M+ G, n; g, N
  72. 4 [- P: ]! I5 X, B& ]
  73. char *dmabufsrc1 = NULL;
    + @( u. t9 `! ]  g* M
  74. char *dmabufsrc2 = NULL;9 P! h# N7 Y! H; T
  75. char *dmabufdest1 = NULL;
    0 L% b* g. r1 _
  76. char *dmabufdest2 = NULL;
    5 Q3 }4 U! U- x& Q

  77. 3 H4 Q0 h+ _  ^0 h- L! H7 Z% g+ L! i1 i
  78. static int acnt = 512;
    : r% E2 e* f/ t% ^" N1 j
  79. static int bcnt = 8;
    9 J; Y- {9 p; o$ ?" ^! k) [6 ?" c
  80. static int ccnt = 8;
    5 B* k0 W1 E& `+ C4 w
  81. 1 L4 n* @0 Q5 {. L, _2 Y$ t7 d  u
  82. module_param(acnt, int, S_IRUGO);
    1 C  ]9 U  b& ~/ t3 a6 u
  83. module_param(bcnt, int, S_IRUGO);
    / v3 j  U  U$ B4 O
  84. module_param(ccnt, int, S_IRUGO);
复制代码
8 m8 }' w6 M" m  w+ H, v
* h7 p! _5 Y7 Z+ _# f* U
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ N& @8 j- K6 l# R" {5 ]7 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' i) _5 o" r: ]6 X0 ~$ A     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 b9 X+ K) V7 I' X% y$ h
0 \+ ]" o- q' s- {, I2 T! K7 X( s) W' z0 u
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-12 14:16 , Processed in 0.037587 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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