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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & v) v% r9 N4 I. ]$ k
  1. [code]EDMA sample test application+ R/ d) Y9 _7 q3 H
  2. /*
    * l0 ~1 H/ x" {, Q" }3 d
  3. * edma_test.c
    ' T- t2 |  C" e5 @3 ~' G
  4. *
    " u& c1 O& X& K. c
  5. * brief  EDMA3 Test Application( I/ Y' F/ ?$ g9 _5 Y
  6. *
    5 k) P6 g# N2 A5 x( T. L1 d
  7. *   This file contains EDMA3 Test code.
    2 q. t4 o% V  {& Z; p6 d
  8. ** D; g, I+ j5 Q6 C: [4 s7 A% I9 S3 G1 J
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    # q! v- f& `; l# Q! q" Z. Z* F
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 V: f# O% S* T. Y" D1 K0 @
  11. *         TO CHANGE.7 ]& `5 }% c& Z) u
  12. *: ]# S* t3 c0 [7 D
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; C+ e! @$ A# ^- T5 o+ `" v
  14. *
    9 p4 n$ a1 |- R9 a6 u
  15. * This program is free software; you can redistribute it and/or
    ! `- V+ c- c, j
  16. * modify it under the terms of the GNU General Public License as
    % E9 R- g9 w* w' n- @7 d3 E
  17. * published by the Free Software Foundation version 2." Q6 z- S1 j/ |. W% a. S4 c' @
  18. *! b- U+ N7 {" ^# C0 X0 P0 D. P, \0 J3 H
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- M; H& Q3 |! s4 g9 c$ o
  20. * kind, whether express or implied; without even the implied warranty  k9 D' I$ y4 J" G3 p3 {2 k9 M
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the0 X6 L# J# J$ V0 o& ]- M
  22. * GNU General Public License for more details.
    ( T! X# B$ D2 Y' [" t
  23. */
    2 ?% s) |) z2 n; d" ^! f

  24. 2 |, Y- [8 D1 L$ c  h
  25. #include <linux/module.h>
    1 L+ I' O2 y+ `
  26. #include <linux/init.h>
    & R4 [8 Y5 o! F9 W2 Y
  27. #include <linux/errno.h>8 f) I; u7 t3 [! `' {
  28. #include <linux/types.h>. j- M4 M( W, K& _8 k
  29. #include <linux/interrupt.h>1 @  Z. X; T6 Q- R: g' ~
  30. #include <asm/io.h>3 X  X2 N- B1 x- ?7 q! J0 ^( K3 L( @
  31. #include <linux/moduleparam.h>
    / T9 ~" k8 k" P, [5 R- m
  32. #include <linux/sysctl.h>
    " V) l% k) @  \: c5 h- t
  33. #include <linux/mm.h>9 l& Q! A# u# k4 P4 z( Y
  34. #include <linux/dma-mapping.h>
    4 Z, u7 y6 G: K3 L) D7 c

  35. 1 y7 G( h9 [. _9 ~
  36. #include <mach/memory.h>2 s6 l3 e+ Z# g/ ]; ^! ]# E3 G
  37. #include <mach/hardware.h># H! D% n0 ]. ^( e' `, P
  38. #include <mach/irqs.h>. E5 F& [6 l9 h5 M: w2 C1 [
  39. #include <asm/hardware/edma.h>
    5 x1 O' ~  |, u
  40. 9 V  n( M: `) u4 o
  41. #undef EDMA3_DEBUG) t5 k( s5 H* Q  P- b
  42. /*#define EDMA3_DEBUG*/
    ) `/ B# Y# a4 R, B2 m0 _# B

  43. " K5 |9 ?" Z& i8 t2 d/ z
  44. #ifdef EDMA3_DEBUG
    % ?: v% n# ^+ \' u' I
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    6 n/ {8 e) d  V! j8 ]) E, z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ W+ M& U. S5 e2 c7 ~* T
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ g7 X2 \* u0 c. C
  48. #else
    ( o. N# x% d, e5 ?! A5 b3 v; {
  49. #define DMA_PRINTK( x... )5 D5 h# R# ~+ b! p# t4 j6 j
  50. #define DMA_FN_IN+ g! f0 x5 O: }% G
  51. #define DMA_FN_OUT
    6 |& o" I# ]3 F1 [' u/ S3 p5 o
  52. #endif
    / n; p) b* o6 y. e% y& n
  53.   Z4 p3 @6 N* Y: ~: I4 @% F
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)0 _6 }8 x% w9 `
  55. #define STATIC_SHIFT                3: p( T$ z( F. T5 ~; R& \; D/ \! a
  56. #define TCINTEN_SHIFT               204 p8 ?. k% g3 K( C" T( I* R
  57. #define ITCINTEN_SHIFT              21! q( r- m& m/ }" U( s2 g
  58. #define TCCHEN_SHIFT                22/ e) g* T& O$ g
  59. #define ITCCHEN_SHIFT               23. G2 f$ p+ U  s$ ~. q& C
  60. 8 C: Z2 {6 D. G+ V
  61. static volatile int irqraised1 = 0;
      z- f$ p: D5 U2 ]8 Z
  62. static volatile int irqraised2 = 0;" ]- y7 E1 N: H8 T: ?! K

  63. - w1 l5 `) [) F
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& \1 c- r+ y- y! p! p6 v& I1 I$ }
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : L/ i. ^6 T4 y: C: l7 W
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : |8 H0 T- }* v5 r( R

  67. * r8 k' D: r1 H- s
  68. dma_addr_t dmaphyssrc1 = 0;" _5 G8 e) _+ z$ D$ u
  69. dma_addr_t dmaphyssrc2 = 0;
    0 b* P5 m  M* v: J) w, [
  70. dma_addr_t dmaphysdest1 = 0;, E7 I, N, j7 U4 B& u3 O; j
  71. dma_addr_t dmaphysdest2 = 0;
    ) b  w# I, M8 _; r% g+ @
  72. 8 \; S3 f: P: z  }) `
  73. char *dmabufsrc1 = NULL;
    , k, P0 f* |8 H
  74. char *dmabufsrc2 = NULL;3 q6 C( [1 U' C! O' K
  75. char *dmabufdest1 = NULL;/ q5 B% a$ Z9 [( p3 f! C! J; P! U
  76. char *dmabufdest2 = NULL;
      h& o( }; T  z

  77. 2 X/ a' a0 s" P3 E
  78. static int acnt = 512;, b) a  D" ^4 `% ?0 R' E3 {
  79. static int bcnt = 8;
    - e9 D: Z$ f) z! X1 ~
  80. static int ccnt = 8;
    2 }& h; H/ F2 b2 f! W
  81. * {0 @2 e$ G8 R: s7 Z
  82. module_param(acnt, int, S_IRUGO);! ~" D! B' f3 f# k3 x. g
  83. module_param(bcnt, int, S_IRUGO);
    4 s7 b3 P0 c7 j( s
  84. module_param(ccnt, int, S_IRUGO);
复制代码

- c$ P" m# U) E& Y6 E' S3 t8 |9 S; K  t
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; c9 h4 a' i6 K& f, d6 Sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- p( ~* G4 ~) B0 X! x* |4 d3 Q
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# q; u" n+ [0 w' j
7 b) S2 Y# _# x) b: U: G' T8 R2 D
8 `& v( Z, K% z* F0 J: E, Y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-24 04:58 , Processed in 0.038325 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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