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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 M/ \1 |7 P5 [  v0 e% r5 h' J, a9 L
  1. [code]EDMA sample test application
    : {& Q+ }/ x& Y  g* y+ I8 ^; `
  2. /*- Q$ p# l$ w6 w0 [1 m% o
  3. * edma_test.c& z& K8 X; ^$ M) h* O* o
  4. *4 ?+ L  }. U3 o. v' r
  5. * brief  EDMA3 Test Application; @! Z1 t( k7 `
  6. *# S1 Y5 j' o; @$ Z0 g
  7. *   This file contains EDMA3 Test code.9 R9 `* K7 q, h* t: \
  8. *
    + E' L1 N) T$ i3 n
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) t/ N* |& j8 z0 S7 V+ c9 \( e4 |
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# a& r& z$ z1 z4 A. I
  11. *         TO CHANGE.
    4 p$ ^' ], m8 C  Q7 p( f  |2 V5 C
  12. *
    5 w- J& h+ R. y0 V; Q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" J8 y$ |6 B" M- y2 A# U) s
  14. *
    8 j$ ?! G$ P, y2 R) q$ q
  15. * This program is free software; you can redistribute it and/or
    . n/ g- u$ F3 B8 x4 d5 i. X+ p
  16. * modify it under the terms of the GNU General Public License as/ \8 h! }! Y. z6 F5 h0 M- b. n
  17. * published by the Free Software Foundation version 2.
    ; t5 _( U) o0 J( a& n
  18. *
    ( v1 V8 d, l9 D5 N* k1 S) V: M
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any" ?! [$ B' M5 r9 d# u: Y
  20. * kind, whether express or implied; without even the implied warranty
    4 k" U7 u* ^1 Z* E1 R5 j; _3 Z; m7 |
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / E: v% Z& C3 W
  22. * GNU General Public License for more details.
    8 H6 j3 @: H$ v3 u7 p/ q
  23. */2 J7 A/ H! y5 F  M# t  I
  24. . ?3 r! c2 o7 n6 e. o4 y
  25. #include <linux/module.h>
    , E; F  _$ N: o2 p1 [0 d& \- U
  26. #include <linux/init.h>
    ! L, b# n6 W, h" s( F9 }8 M! o
  27. #include <linux/errno.h>) a! O7 g' c( }# a4 Z$ u
  28. #include <linux/types.h>
    / f" X, s* g9 Z( t# g
  29. #include <linux/interrupt.h>: A2 R; E' x4 c
  30. #include <asm/io.h>! b" k( j) V; |8 F2 U
  31. #include <linux/moduleparam.h>- z9 j( h& K1 a3 O& b9 c
  32. #include <linux/sysctl.h>. k0 `9 f* F6 E, p: f7 a" v6 |' l
  33. #include <linux/mm.h>
    4 e6 g) T6 P- K/ E
  34. #include <linux/dma-mapping.h>
    + j8 j: i) |! i! g) A  Z$ e( ~; h9 a
  35. % _1 |( W4 z1 V8 b
  36. #include <mach/memory.h>+ ^, W! }! C2 ^3 N* P
  37. #include <mach/hardware.h>
    * I( X8 P; q* P$ P* k$ e9 o( K
  38. #include <mach/irqs.h>
    8 a# |1 l. c" f+ k% E0 A$ F
  39. #include <asm/hardware/edma.h>; h* z5 h+ F" ?* n% o, d$ s; C

  40. * ]  a& I1 ~- i, D" o7 l9 D% o: h
  41. #undef EDMA3_DEBUG
      b, ~# f& Z0 R* a# D& d
  42. /*#define EDMA3_DEBUG*/
    % G( E# H1 b) {' l  [# [

  43. * c: M. Z# J5 b5 Q& y2 f
  44. #ifdef EDMA3_DEBUG/ r7 [1 k* c% V2 [, r+ V
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ f! H$ o: _  m) L6 H& u- _
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), G; Y2 d0 O9 _  f4 x$ D! s
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' G3 v  B+ Y2 P: \2 M4 @
  48. #else& d% t! M. H! g1 @5 F* p+ ]4 t* o
  49. #define DMA_PRINTK( x... )
    / F3 Z% j; x3 w# l
  50. #define DMA_FN_IN1 \- U7 G+ |6 F) z, f' K8 t5 k
  51. #define DMA_FN_OUT
    8 l4 N) j  n3 l0 |5 Y8 n( g8 {2 }7 ^
  52. #endif
    . g) w7 y  |. w* c, o

  53. 9 d/ |6 g5 @  f. d! ?1 h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 C$ U7 w6 W, Z% L
  55. #define STATIC_SHIFT                3) u9 _4 m' u8 ?3 b
  56. #define TCINTEN_SHIFT               20
    9 [9 j- N0 Q$ S9 C. v; X0 N
  57. #define ITCINTEN_SHIFT              21
    " T0 N. `7 S$ M8 e8 q" \
  58. #define TCCHEN_SHIFT                22
    3 O* z' J( @; n, k# E. `2 ]" ^
  59. #define ITCCHEN_SHIFT               230 h7 I8 ^# ~- l, {
  60. + g# [. E4 \3 n: w9 c
  61. static volatile int irqraised1 = 0;/ F% p0 g+ g0 @* Q8 i) x
  62. static volatile int irqraised2 = 0;
    0 X. U, q2 P8 Z& S( P
  63. ; l: q6 G$ o9 D" N% |( \
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ ?- s, B4 |1 v! W
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - N6 i2 O! @$ I( \! o+ e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ U. e3 C5 t" K0 R+ u' N/ ~; Y

  67. * i; K- K' d9 s) x3 F2 q! K/ T8 r
  68. dma_addr_t dmaphyssrc1 = 0;! V1 U  @$ S) K/ \% R) I/ {
  69. dma_addr_t dmaphyssrc2 = 0;7 P7 l7 S  P2 M$ m' `2 p! p
  70. dma_addr_t dmaphysdest1 = 0;: ?3 o- t* d5 W. R5 V
  71. dma_addr_t dmaphysdest2 = 0;, q+ q9 K- j! p1 P3 [% l/ s

  72. ( L, H2 P2 B$ B, @) C
  73. char *dmabufsrc1 = NULL;' M* _$ S- c3 r4 Y- T
  74. char *dmabufsrc2 = NULL;
    ; K! ~' u4 C+ Y( S0 Q4 t+ z
  75. char *dmabufdest1 = NULL;
    3 t3 @* n- p+ W% Q+ h0 Y" O
  76. char *dmabufdest2 = NULL;8 x! d6 O: M5 f2 L, |) n+ W, ^6 a8 E

  77. ( L( `$ k: i5 b' L& k4 }
  78. static int acnt = 512;
      o1 m  @+ P. ?: v  {' ^
  79. static int bcnt = 8;
    + O. }7 A0 |6 a+ o: M" s# o
  80. static int ccnt = 8;
    6 t' W& s+ f# i6 S0 m' I
  81. ! L& c4 _% ^; P) a0 \8 k  W5 N
  82. module_param(acnt, int, S_IRUGO);
    8 h, K, e+ r; j2 f- ~2 H7 ~
  83. module_param(bcnt, int, S_IRUGO);- M+ N9 ^6 Y8 p/ ~+ ^
  84. module_param(ccnt, int, S_IRUGO);
复制代码

' O: F- u9 `& v2 X9 D( y! z7 B  E' t, i6 m* N) ?; k
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! R+ J/ d9 n- p: I/ @
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 I9 p8 F, K+ E1 v  V     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ Z0 {; v3 T# [* E, U8 a/ I9 \3 e; \& K( o  `8 ~. f
: Z  i, K4 v+ V& ]' Y- y5 T- ^
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-11 01:24 , Processed in 0.040437 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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