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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; ^; C1 m' g5 i7 [& ?# K
  1. [code]EDMA sample test application2 S, t  S6 a* J0 ~0 k' S: x* S6 G
  2. /*6 u. x* H9 K3 ]  y) L% x
  3. * edma_test.c
    ( e8 p" l" \0 R% {8 J9 i9 b  T
  4. *
    % v' k* y  `6 m
  5. * brief  EDMA3 Test Application
    # U$ @; U- [9 Q* B
  6. *) x8 w6 m/ X* m" Y: u
  7. *   This file contains EDMA3 Test code.
    / I  q0 h( T9 {9 T; I, v4 r
  8. *
      M  W# P- `9 x
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 \& _, G+ B% n6 h
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ t$ f2 F& e5 R! T* p" t' m1 p7 X
  11. *         TO CHANGE.. m* `" V1 P8 ^4 C
  12. *
    # P- [4 e2 g2 y$ }5 Q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) T+ C; g6 g. m' h+ Z" d6 x
  14. *
    2 f8 x% ~9 I- U$ W* R
  15. * This program is free software; you can redistribute it and/or. m% {, v- b) h1 z( E% R! D
  16. * modify it under the terms of the GNU General Public License as& X5 d2 P+ E3 ^2 Y2 U: o
  17. * published by the Free Software Foundation version 2.
      L! _8 i, v; G! w. H; o
  18. *' k2 o* H9 c- f* H+ p
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / Y0 H8 {0 c1 G- v3 a: l! P5 W: l
  20. * kind, whether express or implied; without even the implied warranty0 ~' d& r; o8 _) l1 k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    , Y8 Z; b: F0 n5 L8 `  o
  22. * GNU General Public License for more details.
    8 u+ C$ C3 J' ^
  23. */$ ^0 L1 S- G2 u. Y5 V# \: |

  24. 6 R4 }% P4 T$ H+ i7 D
  25. #include <linux/module.h>
      |7 r1 C3 m% Y( M* y" C
  26. #include <linux/init.h>/ h& J1 s9 F& {/ I' `' K
  27. #include <linux/errno.h>
    8 \- J8 A# @3 P( H
  28. #include <linux/types.h>
    7 o- a/ Y8 E) N- v
  29. #include <linux/interrupt.h>
    & j% f+ P# h$ r3 n5 t
  30. #include <asm/io.h>
    6 u5 v  r  c; Y1 A& z
  31. #include <linux/moduleparam.h>. w- Y& Y% A; j2 ?. I( Z
  32. #include <linux/sysctl.h>
    / j% n, c5 A1 [2 C
  33. #include <linux/mm.h>
    & P& a- S0 w5 x! D" ~3 ]
  34. #include <linux/dma-mapping.h>
    ( H3 i& n, U" Q* Y5 L
  35. $ p& }8 }1 [1 R( w
  36. #include <mach/memory.h>
    + Q# W. Y8 [3 [6 V! q
  37. #include <mach/hardware.h>
    2 S8 `* i! k$ |  j3 c3 t4 s3 C/ {* f
  38. #include <mach/irqs.h>
    0 A0 L" b8 e, z4 r! r2 U
  39. #include <asm/hardware/edma.h>
    3 Z' c* _# y3 Q
  40. / W" R$ _8 c- ]6 H" Q1 k4 F
  41. #undef EDMA3_DEBUG% j9 f: u, K. m; ]
  42. /*#define EDMA3_DEBUG*/
    - G# [4 ~, L: B* v
  43. * `: }/ F' O  G' I. Y
  44. #ifdef EDMA3_DEBUG1 M: Q' Z, L% A  B
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    / p/ _# b& D: Y* d" x
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 A, f) O, q' b
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    : _- ?" m( h% V$ o
  48. #else* u9 L9 k( i# N" s  h/ }% m. w
  49. #define DMA_PRINTK( x... )) l; H* `' E) n  |/ V
  50. #define DMA_FN_IN8 D: t; P  ]; N# ~4 s
  51. #define DMA_FN_OUT
      Q) S' A! m: P& ]: D
  52. #endif& M# i6 n, D5 @1 J! {, \0 Q5 [% C& a

  53. ; `5 n* |0 x5 f, Z7 L- |) }" g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)% S. {* @9 x7 }: A  W! I
  55. #define STATIC_SHIFT                3, A  W3 w6 V/ t" y0 e
  56. #define TCINTEN_SHIFT               20  G2 H- Y  x7 H: w4 n
  57. #define ITCINTEN_SHIFT              211 \+ ^5 X. ~1 B; s5 g  J
  58. #define TCCHEN_SHIFT                22
    & @, x  |" [6 C4 A& s
  59. #define ITCCHEN_SHIFT               23
    $ k$ |! b9 ]% r: r) A4 ?
  60. 0 B4 E( S9 s9 y9 g) `; c0 o) s
  61. static volatile int irqraised1 = 0;
    " S4 Z3 i, f( }* Y
  62. static volatile int irqraised2 = 0;9 N7 r, U0 ^" K; c$ ?9 x' j  [7 Q

  63. ) q+ f; A* b+ Z& P2 P# Y6 c3 M4 W  Q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% D8 x1 u3 I! x) D% @9 a8 ]
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 t7 _( h' B/ z, u; r! C1 r7 z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- N4 a2 A7 e( P( ~
  67. / V9 K# X7 E. M3 \) t* ^
  68. dma_addr_t dmaphyssrc1 = 0;
    6 V" h& R  A6 o* ^9 H7 u
  69. dma_addr_t dmaphyssrc2 = 0;  t5 ~7 B4 \  b6 |1 G/ K
  70. dma_addr_t dmaphysdest1 = 0;  D% \* o9 E# R! C7 I. k8 m! w
  71. dma_addr_t dmaphysdest2 = 0;
    ! ?. i4 L/ B- h# D' N8 e; I/ r
  72. 0 w1 D/ R0 O) z: h
  73. char *dmabufsrc1 = NULL;9 X1 d6 u" O8 L2 V- P) l# ]7 D
  74. char *dmabufsrc2 = NULL;
      n% W7 b' P5 E& z* F* d- \
  75. char *dmabufdest1 = NULL;3 h1 @. v$ v4 i# ?
  76. char *dmabufdest2 = NULL;# _6 g& Y2 v+ F; H$ f6 W) V# Q& S

  77. 6 k* S& P1 f7 M" @) h
  78. static int acnt = 512;  X4 |1 [! T1 ^) w2 i: ?0 A
  79. static int bcnt = 8;
    1 k! Z9 R3 M$ u: t: T( y
  80. static int ccnt = 8;
    & b3 N, b% K$ Q) v2 b

  81. ; E7 z1 H8 H" l5 E
  82. module_param(acnt, int, S_IRUGO);8 g, z3 S5 O# m
  83. module_param(bcnt, int, S_IRUGO);+ [, d  P  c  l  U$ y
  84. module_param(ccnt, int, S_IRUGO);
复制代码
+ s3 T+ ~0 Z% r5 r, F8 O+ e! Y9 B8 z

" C: h0 n/ h5 M# M4 h8 S      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 W& i; y8 d5 _
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 ^: g2 J" p+ O- w: `* a+ t9 j# |
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 O) m5 S% l, K5 S3 k5 @6 K' v6 N

4 `; K2 e& q& _$ C$ V: b* y2 e
7 s  }( |1 e4 {6 F2 g% c" d5 B4 \1 ~
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-24 18:19 , Processed in 0.042526 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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