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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 g' Q6 G7 ~" s' V- H# i
  1. [code]EDMA sample test application( B6 p& o8 R: A$ X. n6 L
  2. /*
    : q6 d: J1 T* @9 X
  3. * edma_test.c8 w/ V) e" C* w( ?8 R
  4. *
    - q% u; i' I* i# o. Q# K& E) b. i. m
  5. * brief  EDMA3 Test Application
    9 ]7 P% D5 U0 T, o
  6. *2 I3 |/ I& X0 J6 i2 P, C
  7. *   This file contains EDMA3 Test code.1 A6 A! R7 y, m- J6 m
  8. */ V$ P: @5 k1 _& G' [: k
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    3 k+ \: _7 z' V3 ]
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ `' [( C+ Y$ s/ K% ^2 q
  11. *         TO CHANGE.  |  o9 Y; G% O4 o- N
  12. *6 t! y. u) j2 i& f4 g5 n/ D
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 A( S% O1 p6 T/ B9 G# w
  14. *
    : E0 ^) d$ c, x8 m9 g
  15. * This program is free software; you can redistribute it and/or
    , \2 ?* [! e1 ]
  16. * modify it under the terms of the GNU General Public License as  G* J0 ^7 O( c6 s* y
  17. * published by the Free Software Foundation version 2.
    $ g& M! a- J2 T% X( o9 K* V
  18. *4 B) Y8 l3 o: `+ i0 K( ?
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: b; \; j4 U0 m. S3 i% a! T
  20. * kind, whether express or implied; without even the implied warranty3 |6 d; m; k" }/ C) O
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ e) r  u' i4 V
  22. * GNU General Public License for more details.6 y0 w- A$ U+ ]
  23. */0 K( j  H3 }0 ^; T4 w" b

  24. ; D# r, Q6 B6 f! C2 U
  25. #include <linux/module.h>
    5 i) M5 [* c. y8 J- ^+ u+ n( D0 |
  26. #include <linux/init.h>+ L  E- ]) E$ |; L6 V
  27. #include <linux/errno.h>
    6 l5 ?. u$ }3 T& x$ l$ \
  28. #include <linux/types.h>% \. H7 I: n& f
  29. #include <linux/interrupt.h>9 N% J' y6 Q) G
  30. #include <asm/io.h>
    5 i8 U, }$ g1 ?( f* Z! K/ |
  31. #include <linux/moduleparam.h>
    0 t* Y/ i2 e  c
  32. #include <linux/sysctl.h>
    6 F5 |  g+ w1 y/ Z: ?3 M9 j
  33. #include <linux/mm.h>
    / S9 ?0 R% S! ]) s0 G' Q
  34. #include <linux/dma-mapping.h>/ s, `0 l  q% ~& F

  35. % Z2 I/ j# E) r( @0 {: Y1 q( i- b
  36. #include <mach/memory.h>$ Y$ L& C, N* G; B2 L- F
  37. #include <mach/hardware.h>
    0 L9 o7 h. _  v! U, r
  38. #include <mach/irqs.h>$ t0 c" @8 ~1 _) M/ d' q
  39. #include <asm/hardware/edma.h>( R" j1 S$ d* v

  40. 6 [7 E* t- n: k% H( ^0 G
  41. #undef EDMA3_DEBUG
    ; w1 ^; r/ h; m7 }8 z  @
  42. /*#define EDMA3_DEBUG*/
    , k  O( C! c. e0 W% T/ Z1 M* y
  43.   j: r3 m0 L" S. y$ S3 u) T$ u
  44. #ifdef EDMA3_DEBUG
    # G- T. y6 }- u1 M
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ n: r. Z5 d0 a+ u
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 ^6 U' `/ O+ G3 F) _
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    & n: P! a$ I' m) D: X
  48. #else
    $ Y0 b3 s# S/ ~5 Q9 ~8 Q" [7 w8 [
  49. #define DMA_PRINTK( x... )( o* o) b" P8 z1 f
  50. #define DMA_FN_IN8 g! u, ]& l/ H+ Q+ i& I
  51. #define DMA_FN_OUT' ?- m+ S8 \. I6 Y) ]0 B) ?
  52. #endif$ N  t6 Q# ~/ ]' ~' t# v* V6 a
  53. 9 v& u) ]6 F6 X1 u9 g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    & P& K" A2 J/ u
  55. #define STATIC_SHIFT                3* w; j$ E* [' R8 P; Q0 I4 q- m
  56. #define TCINTEN_SHIFT               20
    * s/ p; b' f) I7 r: v
  57. #define ITCINTEN_SHIFT              21; Q% X7 f, T2 [9 a/ ]
  58. #define TCCHEN_SHIFT                227 V7 _6 \) c! B$ u6 `* k$ d
  59. #define ITCCHEN_SHIFT               23
    6 b1 s' \& [5 n) J  Q
  60. # x) m- D: T5 A! a. j" T" M: Y
  61. static volatile int irqraised1 = 0;4 y) ~: u$ ?! r
  62. static volatile int irqraised2 = 0;3 ?# a- E9 K+ x/ H- V2 D

  63. ; f+ A' w+ o2 o6 N$ ]4 q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 b! \3 V8 z) X) c/ X1 `
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 @: B  |' }7 f7 J2 @
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & ?0 `+ J5 p' Y( v
  67. , C, ^' H2 i& \
  68. dma_addr_t dmaphyssrc1 = 0;
    0 g! R5 o! J& j- V4 o% F/ l: t
  69. dma_addr_t dmaphyssrc2 = 0;  q- W+ f: @* a$ W' x
  70. dma_addr_t dmaphysdest1 = 0;. N5 v" g; [! t7 S% N
  71. dma_addr_t dmaphysdest2 = 0;
    1 [/ f1 K! v" T% y  Q% J4 E( f  u- C8 J
  72. 3 z5 V  P8 w; _/ t
  73. char *dmabufsrc1 = NULL;
    " w+ v0 z# S& \
  74. char *dmabufsrc2 = NULL;; @" g! B. c0 }. C+ ?
  75. char *dmabufdest1 = NULL;
    6 D6 h  {/ X/ p' y7 b
  76. char *dmabufdest2 = NULL;4 M+ s7 i8 r9 b+ F

  77. / U7 _* r$ J* N) H! _- @1 L$ Q
  78. static int acnt = 512;/ E9 t2 h4 v, O
  79. static int bcnt = 8;( w, J+ T4 j: p  }/ u& y; U7 l& W
  80. static int ccnt = 8;
    - l) l1 U8 P. @, W  ]+ H3 S/ _
  81. & r4 \6 l7 G2 |6 f  T
  82. module_param(acnt, int, S_IRUGO);
      y6 C3 ]- u: e3 x
  83. module_param(bcnt, int, S_IRUGO);4 Y# |! ~2 [2 y* p. k
  84. module_param(ccnt, int, S_IRUGO);
复制代码
' ~9 h# f  B& T  [8 e% M  X$ d
+ M9 B- n' u* N' q- ~
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 ~' x" `, r$ I+ v% H3 \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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: H' z5 v& W: A" o     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ C) L7 |7 [5 ^  ?  N$ D) {# S* Q6 `9 U- J, j  {
5 d; G6 `1 V- C! t
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-28 19:55 , Processed in 0.039278 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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