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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # {' d$ ?+ r* T- E  v
  1. [code]EDMA sample test application- @9 \5 ]' D! r7 K2 y# s. F, C
  2. /*
    5 c' S, n3 y; i  @. h
  3. * edma_test.c3 N% F) w% D# ]8 R
  4. *: m- h) c2 h7 t/ {( C
  5. * brief  EDMA3 Test Application
    1 d5 Y3 b& g9 A0 ]
  6. *
    / Y* Q  k' l8 h! C! ^+ Y. e5 |
  7. *   This file contains EDMA3 Test code.
    $ w1 k$ r% R5 U! q& Q: t, X
  8. *& P* n4 u9 b, c) L) D7 U, }1 D1 D
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    . Z2 K( ?$ v! {
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ a7 V' y* M0 O$ k: f8 K
  11. *         TO CHANGE.; N" y5 \7 i; }0 n: F
  12. *, _9 k) ~6 K2 A; H
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// t- i( G1 N. E# u1 O5 M
  14. *1 L6 a# l6 q9 @2 `& c- D$ v9 r
  15. * This program is free software; you can redistribute it and/or, T. q7 C( l( `. t
  16. * modify it under the terms of the GNU General Public License as
    1 f7 L' v2 W6 i! S
  17. * published by the Free Software Foundation version 2.
    ) E: g& y! F; a) E
  18. *
    ! [- r* j0 k# z3 z7 n' d
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- b4 ^, @0 u" ?+ Q+ N( j
  20. * kind, whether express or implied; without even the implied warranty
    . c  Y# s0 O' H4 O, i; W
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + u- z2 o2 A( V  \* M
  22. * GNU General Public License for more details.; N: R6 Y$ J4 o4 M% o# h6 X
  23. */
    7 q, ?8 V: C+ c' Y
  24. 8 I3 K2 d4 J+ f# v7 L
  25. #include <linux/module.h>
    2 A- K% |. ]* {. {+ R. ~, @
  26. #include <linux/init.h>! ~) O) W" [6 S$ w. `$ L: }
  27. #include <linux/errno.h>
    " A$ H. q1 V0 z
  28. #include <linux/types.h>& j7 y1 t! s+ m$ p
  29. #include <linux/interrupt.h>/ a) w% E, [# ~. A# J
  30. #include <asm/io.h>
    ( T7 F7 ]/ w2 y
  31. #include <linux/moduleparam.h>$ A/ R: w! O) \" Z% K9 V* K0 n
  32. #include <linux/sysctl.h>
    6 O3 o" S' C2 K, a3 R: x* g) b
  33. #include <linux/mm.h>
    7 O1 {+ H4 b2 U) V% [  h& Z
  34. #include <linux/dma-mapping.h>8 x. X2 l/ q' |
  35. 1 G' C: ?9 n  l. ^$ e6 y/ X
  36. #include <mach/memory.h>3 l% @8 l: ~$ s
  37. #include <mach/hardware.h>
    : F! Z" n- q% e$ v' ^
  38. #include <mach/irqs.h>
    , l7 o. v+ v: @( ~  M' g6 Y
  39. #include <asm/hardware/edma.h>* {7 }; ~$ }' [8 J7 O6 L

  40. ' y$ L; v8 D! F0 E! Q
  41. #undef EDMA3_DEBUG
    # r0 N' W4 P4 o5 s7 i4 _( \' |+ a% l
  42. /*#define EDMA3_DEBUG*/
    9 f1 m! G) Y8 i
  43. 1 O% u; Q, @* d+ z( o! |
  44. #ifdef EDMA3_DEBUG
    & e& k1 g6 W. c' x! q* v
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    * G; ]" e6 v3 z* J$ ?( u0 Y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    . ?0 b/ T4 Z5 F/ f* J+ M- y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! ]1 D! r: B$ B0 Y4 w/ a
  48. #else. v0 t2 Y2 D5 M- z- A9 x$ V
  49. #define DMA_PRINTK( x... )6 a( s) [: U, j' ]) e0 S) X& `
  50. #define DMA_FN_IN+ V; Q4 `9 \. g  ~4 t
  51. #define DMA_FN_OUT
    * P0 Q( `0 l" }5 Z' P
  52. #endif" i6 r: `8 _7 M

  53. 3 ~( [, f9 s1 |- h/ w& g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    1 e$ w& q2 T# n' u$ U
  55. #define STATIC_SHIFT                35 d* a# t7 v/ {5 y# D' b4 v
  56. #define TCINTEN_SHIFT               20
    8 c  i) Z% _- Z( ~! B
  57. #define ITCINTEN_SHIFT              21
    1 B1 ~: x+ M8 `2 |
  58. #define TCCHEN_SHIFT                22
    5 K& v1 \2 o3 c* f
  59. #define ITCCHEN_SHIFT               23
    ! l6 }6 `# [: _" f

  60. ' V& M8 ~/ l/ U5 Q% n/ N7 V+ T
  61. static volatile int irqraised1 = 0;
    / Y' s- F1 ]& A. D1 m$ N% k- D
  62. static volatile int irqraised2 = 0;
    + K6 U! ]# d2 {. @3 o2 F! g

  63. 9 [, k+ U( ?+ ~* W, ~
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 ]2 a: N0 Y7 }/ C, d! I# s+ H
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 F& G9 k& Z* Q4 E' b0 r. Q3 H
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " P% f$ P  E5 S1 m
  67. 6 b* Y5 u) g! n1 w4 K
  68. dma_addr_t dmaphyssrc1 = 0;
    / I6 A" Q, ]$ U- h4 S7 M
  69. dma_addr_t dmaphyssrc2 = 0;% q9 ]; a0 N6 q7 C/ N
  70. dma_addr_t dmaphysdest1 = 0;
    1 \2 M& L  s& c. `) U# L
  71. dma_addr_t dmaphysdest2 = 0;; y4 f9 m3 S  |* z
  72. 1 n, ^: j+ n& ~) v: Y7 E
  73. char *dmabufsrc1 = NULL;/ @, b. R% l) S
  74. char *dmabufsrc2 = NULL;4 I( A& A% p/ z* I
  75. char *dmabufdest1 = NULL;9 r; T5 ?+ ~' m) E- A8 V
  76. char *dmabufdest2 = NULL;
    3 h1 d4 z  G  {' w3 y! }3 ]1 x: A) E

  77. % o# P; C) r( h, Y1 r
  78. static int acnt = 512;
    . Z4 S) y  X% b1 ~
  79. static int bcnt = 8;
    8 @. a. E8 j1 g: X6 O9 l$ f
  80. static int ccnt = 8;: t2 T! L  Q, h) e( y- r
  81. / x& h  b( r( D
  82. module_param(acnt, int, S_IRUGO);
    , i  S# v( b4 o  e0 y
  83. module_param(bcnt, int, S_IRUGO);
    . g  Q2 V- @" j: |% [$ z
  84. module_param(ccnt, int, S_IRUGO);
复制代码
  d% R# A4 }+ B% n; h# u

/ l" t  A/ _8 {6 M  l      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) ^$ Q2 K, J. l5 E6 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( Y- {/ @! I( e7 |2 ^
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- V4 |! ]/ x0 E, B& r) C1 W2 p( k' u* B/ V* D. Y
' h7 c& ]# k9 e# c! N
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-5 07:11 , Processed in 0.039774 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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