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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) W2 K+ O) H$ B+ N* ?. W( P
  1. [code]EDMA sample test application' Y$ T% i$ T# J2 s* B- i8 e! x
  2. /*
    5 p2 ~$ F4 a7 L2 p' V/ e
  3. * edma_test.c8 Y1 H* Z- v  ^) A
  4. *  L% |+ y' B- H2 ^0 q1 D0 ~
  5. * brief  EDMA3 Test Application
    ; [8 @. E; I7 P
  6. *6 z  I2 V8 g( |. E& P: P- [3 u
  7. *   This file contains EDMA3 Test code.0 G5 z5 P, t' q# M/ A! y7 J# R% z
  8. *
    2 X$ Y4 }* L9 t" d  w* t( t# \
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    , m( O0 m$ x3 F: ^2 s( M( h/ u
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + X' L' F" W" A3 X
  11. *         TO CHANGE.* a8 o  y3 w. }4 r; [$ f- D% |0 y
  12. *( J" t' D/ i- G: [7 E, x$ h" T' |/ M
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- p( \- A1 g5 o4 \& d6 s2 @
  14. *6 }6 R' r5 D+ L, a% {
  15. * This program is free software; you can redistribute it and/or$ ^4 W  L. D7 s9 D1 L/ Z3 m
  16. * modify it under the terms of the GNU General Public License as3 @0 G' O7 m" G: g; |0 ]4 h$ j
  17. * published by the Free Software Foundation version 2.# _8 b1 K) d% ?" F1 @) h" Y
  18. *
    3 `5 p4 S( ]; a& c5 ^$ B0 w1 M
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    " c. U: I/ t* ~* k: G3 O1 X( X
  20. * kind, whether express or implied; without even the implied warranty3 ?7 L  m" H2 S+ Q. z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the" @1 a( \' x" _3 V8 T
  22. * GNU General Public License for more details.4 J3 i1 S+ [. w+ D4 Y4 S
  23. */
    , f% C9 S; h& B- J) {- C
  24. + P  N7 l+ I( M% {1 v* J+ v
  25. #include <linux/module.h>8 V) t$ R; |1 Q; S
  26. #include <linux/init.h>
    & E0 g4 h. y( i) E. X
  27. #include <linux/errno.h>% |6 S! j0 a% R
  28. #include <linux/types.h>/ r. C, `9 Z: n) Q: M
  29. #include <linux/interrupt.h>( s) m# u. d7 G, l+ M
  30. #include <asm/io.h>
    + D( U8 G6 X8 {, ?
  31. #include <linux/moduleparam.h>6 D3 S9 }4 i1 A9 |
  32. #include <linux/sysctl.h>: t5 \6 i# [/ H/ R$ X
  33. #include <linux/mm.h>
    : m: O4 `: [; L: G- V& g) h; B
  34. #include <linux/dma-mapping.h>2 U" S9 l: W. U; I) D$ f" L

  35. ' s" A8 ^6 a$ z/ X6 L$ f2 l( S
  36. #include <mach/memory.h>$ m; P3 j' X0 A1 f+ b3 f; t# f0 H9 M7 ]
  37. #include <mach/hardware.h>
    # W- b+ H/ o# J9 h. t  ~
  38. #include <mach/irqs.h>& b* s+ u9 K- T5 H+ ?$ \/ J
  39. #include <asm/hardware/edma.h>
    0 Z2 @% |& v% d# }

  40.   j( H; s' d. d0 r+ ]
  41. #undef EDMA3_DEBUG
    $ N. R0 C4 o% |# k% u1 e5 C
  42. /*#define EDMA3_DEBUG*/, C0 s! q; Z- ]  V  u3 e! B
  43. , _2 n" B" X' {
  44. #ifdef EDMA3_DEBUG
    $ n6 w' n- V5 U+ P! b
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    9 s7 ]2 K7 O, M& ?* o# m' c
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    0 ]& Z- ]& H  s# o& Q4 q: g
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 q0 K, Q1 E4 }  B: e7 X  E
  48. #else/ L2 W1 l2 m5 `: |
  49. #define DMA_PRINTK( x... )
    * c) p& G& Z6 t
  50. #define DMA_FN_IN  `1 T, H% t, f# e
  51. #define DMA_FN_OUT
    * d& |2 O( a: ], Z7 i' y  v
  52. #endif
    $ B0 h' @- g! K1 t& c

  53.   D3 O* m0 o! L0 A  _' l& L3 }' z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)$ P4 h1 L4 K/ B, K) E
  55. #define STATIC_SHIFT                3: S: _+ \: A$ _
  56. #define TCINTEN_SHIFT               20
    3 O' I. R$ o3 U0 K
  57. #define ITCINTEN_SHIFT              21
    # ]/ E! ]  s" j0 N: r
  58. #define TCCHEN_SHIFT                22
    - f1 N& ^( D* h) u, w; W
  59. #define ITCCHEN_SHIFT               23
    / w0 ?: f) \' U" ]5 W$ J* V2 A" n
  60. 1 e$ J, d$ B/ Y% U+ W
  61. static volatile int irqraised1 = 0;- _& Q( @. j$ M: Y- t6 n9 r
  62. static volatile int irqraised2 = 0;% z# a: z/ u. z, K) N
  63. ! u7 B0 L, ^1 [6 ~7 ^
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / h+ a) E" X- a3 m" C  z7 b/ d0 T
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ V9 x" V) `. O
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , W  V! X  k. h1 i. E

  67. " q) k1 Q0 R9 N0 c1 ?. `3 e
  68. dma_addr_t dmaphyssrc1 = 0;
    ( y& ^, H: B+ I( _  m3 D" W6 v
  69. dma_addr_t dmaphyssrc2 = 0;
    8 t# c' ~2 v: ~  {+ ?' z
  70. dma_addr_t dmaphysdest1 = 0;
    ) s7 k+ Z+ ]' F* f3 B0 R. U9 @
  71. dma_addr_t dmaphysdest2 = 0;
    # }$ z" R* R* W9 s3 s$ x( ]
  72. 4 ^% h! k6 e! m4 M
  73. char *dmabufsrc1 = NULL;
    ) c: p% q3 u; k* H
  74. char *dmabufsrc2 = NULL;
    , j5 f( P% t: k2 O- e
  75. char *dmabufdest1 = NULL;
    . C7 x- t4 C2 ?
  76. char *dmabufdest2 = NULL;  ?* P5 c/ v7 D* {
  77. . m1 a, H3 E/ S  a2 E# p
  78. static int acnt = 512;
    , ?( Z) o# L9 H% l/ j# J
  79. static int bcnt = 8;% t* Y! p  T' P" M( C# _  E; \) j
  80. static int ccnt = 8;
    3 T5 N# T' j: o6 \
  81. ) M5 k6 Q* A) P: t) m4 z; T- |
  82. module_param(acnt, int, S_IRUGO);
    " Z; v' x# N, v6 W$ t
  83. module_param(bcnt, int, S_IRUGO);  S& j# t0 ]: y  ]  N3 ?* B
  84. module_param(ccnt, int, S_IRUGO);
复制代码

7 Y+ @4 A& e) g# c& m+ Z) }
5 S3 z7 H; L$ [; z2 v. a% t; ]% F      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ D# J( i  q8 ]7 ~! T7 n# b6 t" Q( ]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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 @4 i$ X7 u/ [! B) V: x1 ?     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 r$ n& [8 `/ Y+ ?! u

( {3 m0 P2 M; F
& d9 C( J/ K6 q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-4 14:46 , Processed in 0.038927 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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