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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( _" P1 t9 F2 a+ X8 O* F
  1. [code]EDMA sample test application( y! \( k" O3 J4 e' T& u
  2. /*
    ! c9 E  b4 P2 U$ L, c
  3. * edma_test.c
    1 A# \6 R* `0 [4 c3 \+ x- M3 w
  4. *
    1 d9 a" ?, j* f9 H
  5. * brief  EDMA3 Test Application
    0 P- j8 Q: u/ ?8 M- i) Y
  6. *
    0 M4 Q. C# J! ^* Q& e- r
  7. *   This file contains EDMA3 Test code.) ^. Y; D$ m% m/ I4 j9 T" Y! u
  8. *
    8 h, J5 g) L: B. D
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* T5 q- D+ n  }% L3 t
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    0 l! o4 b% A. Z1 X+ \& R# k
  11. *         TO CHANGE.
      |! H: [& [9 H( [8 J. w" K3 j$ d4 N4 j
  12. *) l! C1 i6 H4 Y# W7 i: L9 h5 p+ r
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 I) T' S6 d- o# P) e& l
  14. *$ r0 b, u0 T, V6 \2 V2 y
  15. * This program is free software; you can redistribute it and/or
    5 s- [6 S' Z  ^/ S9 d( Z$ H
  16. * modify it under the terms of the GNU General Public License as
    4 \: u. H# g* _- A3 N
  17. * published by the Free Software Foundation version 2.+ V% c1 ]  \, [2 s
  18. *! J; T- e. N7 _
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # x# z1 J9 J. C1 B! Q4 p" M
  20. * kind, whether express or implied; without even the implied warranty
    2 r( B. b& Y4 {
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ' V% u9 j+ `2 f( V  `! {7 S
  22. * GNU General Public License for more details.
    ( [. P5 y; u2 p' i3 h. N9 ]* G/ y
  23. */, s1 y; U1 v& |3 c2 E# a

  24. 7 f2 x6 j$ J8 e8 D0 W7 h% F5 I
  25. #include <linux/module.h>% s, t5 q* _2 I8 D0 h
  26. #include <linux/init.h>! M( G3 N: a  S- G1 c0 s' g
  27. #include <linux/errno.h>: @! u: Q3 p5 {- m( Q
  28. #include <linux/types.h>: P1 w( }1 z5 A
  29. #include <linux/interrupt.h>
    ) h" N  I7 C3 ?' @9 h0 P
  30. #include <asm/io.h>1 W, y, ~/ ]/ c) {; l; q
  31. #include <linux/moduleparam.h># s" L; T4 B% e& x) ^5 T
  32. #include <linux/sysctl.h>9 d  t* F2 J. X& `
  33. #include <linux/mm.h>4 g+ X/ K9 |% m6 @* ~% Z# |
  34. #include <linux/dma-mapping.h>$ G5 I6 |2 [3 C6 S, d. c

  35. # N/ \% X6 J- U7 G" u! R
  36. #include <mach/memory.h>
    ( i- `) ?+ I7 T+ K( c
  37. #include <mach/hardware.h>
    ) U: s+ M, @# L- r; e+ N1 c
  38. #include <mach/irqs.h>2 e9 b' K- p  y/ x
  39. #include <asm/hardware/edma.h>
    3 F9 Y/ n  Q. Q4 b$ ~% x. u# c! P
  40. ' E( T8 M' P2 F
  41. #undef EDMA3_DEBUG) g  Q$ V4 T% l3 \1 u5 e* j
  42. /*#define EDMA3_DEBUG*/
    - n" H9 I, c8 q; N2 i
  43. + V- Z. i0 O9 g, `6 s$ `/ o, o, F
  44. #ifdef EDMA3_DEBUG
    # Y. g) v6 O# u" c8 Z4 H3 a
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) U# F+ {2 N8 C" K
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 l7 a$ A- T8 j. O$ G
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' J: H5 Z' i7 {; T& a* K
  48. #else
    9 ]* |% n5 t9 M7 K
  49. #define DMA_PRINTK( x... )
    0 z: @1 s4 }  v$ F4 X8 A
  50. #define DMA_FN_IN
    7 J1 B6 G- h: x8 E! B$ a7 h
  51. #define DMA_FN_OUT
    + E8 M3 _6 U$ A( [/ u0 X% _
  52. #endif
    8 ?& A' r' k( ?0 P

  53. . Q# o  c$ z8 J. b' F6 Q& Y. V1 y% z# B
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( O( q( A! ]4 u& ~- Q
  55. #define STATIC_SHIFT                3; p% ?0 _6 [! f& n! A8 ?3 M- m
  56. #define TCINTEN_SHIFT               20  z  R( U( j: a8 p+ Z9 a' a
  57. #define ITCINTEN_SHIFT              21
    ' `# D& n% D* i/ S; x
  58. #define TCCHEN_SHIFT                22
    % R" c8 r- }& e  n! K( s
  59. #define ITCCHEN_SHIFT               23
    % q4 V: H4 |) F- f- z: }
  60. 1 P6 V( z, v0 i: Y
  61. static volatile int irqraised1 = 0;5 p, N' y6 r$ Z; s! v' V% {# p
  62. static volatile int irqraised2 = 0;6 ?, \- g& P/ S$ c: _& P3 o9 X

  63. + i" }- ]/ p, P3 @: ^+ j
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # E+ ^: V7 y1 U. L0 I, q& G
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - d' C9 j+ I$ k; P
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 @3 O8 C% u0 q+ n  \* O* `
  67. ' b# G2 x. r+ A. g: ]" m, @
  68. dma_addr_t dmaphyssrc1 = 0;; f( e. U1 Q! {5 V! H1 h
  69. dma_addr_t dmaphyssrc2 = 0;
    . Y% B6 U& v7 A7 u  l
  70. dma_addr_t dmaphysdest1 = 0;
    ; j  G" W# x" a" z; d9 o8 H% {
  71. dma_addr_t dmaphysdest2 = 0;
    ) i8 k* q" k% e  y8 p' R
  72.   I, K7 ^6 y' X: \0 e. U7 T# `0 ]
  73. char *dmabufsrc1 = NULL;
    $ b  w6 @) f- ?3 |6 v, A2 m
  74. char *dmabufsrc2 = NULL;5 o# `: p. K% p/ }( Y
  75. char *dmabufdest1 = NULL;
    " i1 u6 t. G8 X$ L3 ~& B
  76. char *dmabufdest2 = NULL;
      `3 ]6 B+ ]' R8 X; m* o& q4 Q

  77. " a! j1 Z1 u( w' x
  78. static int acnt = 512;
    $ w# S# a3 }9 [, S0 r+ b
  79. static int bcnt = 8;3 i, a$ T; X4 j
  80. static int ccnt = 8;# m6 C/ G: O4 u' \

  81. : k8 @3 y$ G) B4 j& O- H0 Z3 G
  82. module_param(acnt, int, S_IRUGO);. d2 _0 U1 d6 S$ U. T
  83. module_param(bcnt, int, S_IRUGO);4 `* ]& f/ u; e% `
  84. module_param(ccnt, int, S_IRUGO);
复制代码

; Q' ?" u. i) h9 [2 \4 m/ A" @* T# Q# b1 v: q8 i7 n/ N: p
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* O1 H, M( i4 S  Y* B7 ~
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# x5 d( m2 p" j; C# K- T     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 ?5 a# }; v) v/ z: d0 l
# v3 x) k+ w0 G; y% Y  r, f- w
* x$ R, v1 {* |' M
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-9 20:07 , Processed in 0.040256 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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