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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) s) A# @4 ?1 ^4 W9 u
  1. [code]EDMA sample test application: s  `* C. H7 s5 U5 x. \& V6 R
  2. /*
    ! x3 f7 R3 P/ {1 U  ~' B
  3. * edma_test.c
    . ~$ j8 Y' r6 m8 B& [
  4. *
    & [- e4 \& F. ?2 E+ s; f' L
  5. * brief  EDMA3 Test Application/ O3 _6 L6 V& V: {0 }
  6. *
    2 K' r* k) k4 T/ y- `
  7. *   This file contains EDMA3 Test code.: M3 H, a" D! E/ N% c* J0 X) m- L
  8. *) @8 g  L! }* S$ _8 C( e# W
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " S7 A8 d- U1 e2 `, ~! ~: x
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 {# Q* O7 u/ T' ?" t2 x3 }4 G
  11. *         TO CHANGE.
    1 L1 B/ Y: o. U( ?: x4 j- e
  12. *" J' _* L% ~5 ]/ r: p* i
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    $ C# Q5 _8 \9 [8 Q
  14. *7 i7 ?9 S6 c1 P
  15. * This program is free software; you can redistribute it and/or
    % Z9 s+ }& `6 s! Z: M* Q
  16. * modify it under the terms of the GNU General Public License as% W- A! i) d7 l& j; X6 b, i# L  O
  17. * published by the Free Software Foundation version 2.
    ! a( E$ X7 {( D, F
  18. *
    , x$ e! c! f+ R
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ e  u, M) G4 z; X! D- j4 P
  20. * kind, whether express or implied; without even the implied warranty
    4 T9 \& `5 Y- T5 P: m; a
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . K; S* {+ w8 P; e0 D1 ~. O5 T
  22. * GNU General Public License for more details.0 N& h9 K2 L$ W# V0 M
  23. *// z+ O2 T! ]5 k- h- g( i- i) Y

  24. 8 F' V3 v5 r( Z  u
  25. #include <linux/module.h>
    ; Y& p1 ]% |+ {$ l: y+ ?( d
  26. #include <linux/init.h>
    & W3 \) |. d3 |# J; u5 ]
  27. #include <linux/errno.h>8 T( E3 N/ k  F/ P5 ?* V; C3 e
  28. #include <linux/types.h>4 [" r8 P" o# _- K
  29. #include <linux/interrupt.h>
    6 `6 @: g. G2 d+ o7 N" g
  30. #include <asm/io.h>8 W; n1 ?' C% [" w
  31. #include <linux/moduleparam.h>+ }: J4 [3 A; [* f
  32. #include <linux/sysctl.h>- g6 _2 n9 ~  `8 O' [/ Q% i8 Q
  33. #include <linux/mm.h>! N" y  Q2 w7 c8 n8 U
  34. #include <linux/dma-mapping.h>
    ( R& n! [0 s2 c+ B
  35. 8 c  o/ [6 a6 B% u) b
  36. #include <mach/memory.h>9 |. {. i0 R- j2 ?7 D  K9 ?! X
  37. #include <mach/hardware.h>
    % Q  [0 V; l9 W1 Z' [  ~; A3 A
  38. #include <mach/irqs.h>
    ' Y! Y) ?' L3 j3 ^1 c) U2 }7 f1 M  Q
  39. #include <asm/hardware/edma.h>' f7 z# o! t' F8 V: R4 w3 P

  40. 5 h$ e. z! M, W9 E7 j- R3 a9 ~
  41. #undef EDMA3_DEBUG* g/ R; j6 Q, K( t" _0 O+ ^
  42. /*#define EDMA3_DEBUG*/
    ) X1 i" _( C6 H; w. f9 M
  43.   X6 u1 j' T+ D! Q9 w% t! ]2 W
  44. #ifdef EDMA3_DEBUG
    3 I. X5 c" V6 u  |1 n
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    9 r( W, E* c! b4 \# A
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); X* p- P/ P; N7 z& V* U8 L
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 Q3 D) j9 f2 S, o8 `# b; a+ ]" ]
  48. #else$ }+ F7 ~. R) Z( C) E2 V8 H
  49. #define DMA_PRINTK( x... )
    8 ?# G+ a( h9 j" H- P
  50. #define DMA_FN_IN2 g* P# g3 ?: G+ }2 I; E2 m
  51. #define DMA_FN_OUT7 [, I7 e( A- k
  52. #endif& I# @# g% `2 V2 N

  53. 9 C0 L. Y# t! D5 m2 H
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; a) ?2 J. N, D& z
  55. #define STATIC_SHIFT                3' a& b. n7 E: m7 i! c' {2 L
  56. #define TCINTEN_SHIFT               206 e% Y9 _2 x6 e0 y9 Z! f* t
  57. #define ITCINTEN_SHIFT              21
    ; @, `; i% J3 ]1 t
  58. #define TCCHEN_SHIFT                22
    ' f- ~4 Z6 A# I  @9 E
  59. #define ITCCHEN_SHIFT               23) `' I! e% _) A! O

  60. ; Y' g& M" T' r3 S& n" P
  61. static volatile int irqraised1 = 0;' A; S3 {3 ^- {6 y
  62. static volatile int irqraised2 = 0;
    ) j% @8 R# Y% {

  63. 8 A9 [8 D: i% _# T, t
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# P4 {+ V+ r1 W+ y4 T0 s
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, m4 r) e: D0 D0 y8 g
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 }& Z4 u) c; m# V8 x/ w
  67. % o& d3 x* \4 L* V5 U* a# O+ w
  68. dma_addr_t dmaphyssrc1 = 0;
    ) S) W- K& O& u  ?' W1 }0 ?
  69. dma_addr_t dmaphyssrc2 = 0;
    ; m0 |4 i- q2 n" k0 o% B* x
  70. dma_addr_t dmaphysdest1 = 0;
    6 @: [1 d% ?! @$ j7 ^8 T5 i
  71. dma_addr_t dmaphysdest2 = 0;* V5 }) }# G4 n$ o

  72. * d6 _0 Q+ N0 g% x( U$ Y9 E% Z" f
  73. char *dmabufsrc1 = NULL;- I" W7 ^2 _+ O% p
  74. char *dmabufsrc2 = NULL;8 X2 H5 D$ z' J: b6 v, J/ \
  75. char *dmabufdest1 = NULL;1 \" j7 h5 H& _0 i/ q1 Y9 f$ D0 _
  76. char *dmabufdest2 = NULL;3 Y. A/ W) ]% w4 Z  }4 S# @& w

  77. 4 L, _7 i3 ?+ \
  78. static int acnt = 512;
    " U. o2 m: g* S- _. y6 A
  79. static int bcnt = 8;, o9 ~6 S9 i5 E  o
  80. static int ccnt = 8;
    % Z1 E$ r0 h9 s- N& n6 x

  81. 0 B3 B  n/ n" C+ k( y' g
  82. module_param(acnt, int, S_IRUGO);6 w3 a% m: o, O1 b8 P. o/ c
  83. module_param(bcnt, int, S_IRUGO);4 i% D, }9 I: b) S& g
  84. module_param(ccnt, int, S_IRUGO);
复制代码

' o3 P  K# J, P0 H& t  r+ F! h9 T# _8 p, f- \8 o1 A
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ e+ K  K7 h; j7 V5 Varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. x/ _% ~$ N$ s, n$ S
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* X. e! v  @; o! ?8 V
( i" g6 i6 K, G' n9 q! o# A, W6 c# b- p3 F' e/ W- |$ v3 R1 T
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-6 02:05 , Processed in 0.062676 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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