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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * f1 D9 x' m# [2 }' X: Y/ p5 ]% D
  1. [code]EDMA sample test application
    - s$ u2 ]; Y) e1 L' U4 [( M
  2. /*- E" }5 Q; x2 A! V
  3. * edma_test.c7 o" `8 ^5 S- _' Y
  4. *
    . m3 N& h; p8 N4 L$ |
  5. * brief  EDMA3 Test Application9 J" c- v4 A9 K& p, m' Z. Z
  6. *& y; [* a( a, a2 v1 G
  7. *   This file contains EDMA3 Test code.7 I7 B7 `9 k& f& e/ n$ J& c  O
  8. *9 g. a" Z6 A& E1 y+ h1 ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    & U. ?" v( j! |
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! H  f8 s2 a. b+ N
  11. *         TO CHANGE.
    & N  u* o! P+ [. F+ N0 K& X
  12. *0 x8 Z* l, H5 c/ |' j. V! l8 X
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 I9 Q% l* h3 V
  14. *
      [+ |1 Z$ p8 i# _, c0 P( Y: B* i
  15. * This program is free software; you can redistribute it and/or/ k2 p) g! s; ?6 R; l+ y/ d7 Q% ]
  16. * modify it under the terms of the GNU General Public License as
    0 v3 _$ H2 N9 q8 w3 k# s/ {8 p! K5 v
  17. * published by the Free Software Foundation version 2.4 p3 Z* h% M6 k8 r  g8 m
  18. *
    / @6 N0 |$ d$ F% t8 C( t  |* W
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 U7 E3 |9 ~# A7 Q) b# I+ X
  20. * kind, whether express or implied; without even the implied warranty( U/ F! Y/ u, L5 i# M8 Z  Z7 j
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3 \! O  R5 ^8 ]. I& Z
  22. * GNU General Public License for more details.
    / ~5 z3 G9 F6 C) Y% d5 o
  23. */- |4 |1 q1 o: L
  24. / Y8 p* O$ @: F
  25. #include <linux/module.h>) J8 I* Z2 n" I/ q/ l( u
  26. #include <linux/init.h>1 J1 l8 ?5 Y) R! v- h) u; V8 I
  27. #include <linux/errno.h>9 r  R  x% g9 t* x
  28. #include <linux/types.h>8 g/ r: L2 h" J2 h* H$ n
  29. #include <linux/interrupt.h>6 M5 j; C/ R4 R* q0 f
  30. #include <asm/io.h>% x  b, |- J1 I% _. b, v. C! ?; h
  31. #include <linux/moduleparam.h>
    9 t* t) ^7 G# ]$ A% u, C! q
  32. #include <linux/sysctl.h>0 n9 i) d: l+ e6 V
  33. #include <linux/mm.h>
    ! A' \. P* U( {. l7 J' v, ]1 @
  34. #include <linux/dma-mapping.h>) \7 g7 T: G3 x% |) A$ W, V% ~

  35. 0 e: o$ V; e2 p) ?6 i5 s
  36. #include <mach/memory.h>* x2 S* [  ~" q# t
  37. #include <mach/hardware.h>. ?2 |2 u* g3 N
  38. #include <mach/irqs.h>& k# W4 z8 W: E' b( N! z6 b/ a
  39. #include <asm/hardware/edma.h>
    . h4 F0 j+ W) a; I, P4 m

  40. & ?# \* C4 S/ W! A+ B0 H
  41. #undef EDMA3_DEBUG9 b" D3 \! u, G+ r; ?& E7 b' Z9 @5 b! h
  42. /*#define EDMA3_DEBUG*/- F$ b# Z8 Q% |" N

  43. 7 Z- H: D. ]# T+ K
  44. #ifdef EDMA3_DEBUG
    $ J% }) F" ^& ]) B8 z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' u* I8 v$ t5 d' n, W7 m1 V
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ' ?& v3 v, q; g  v
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , ]- l- K5 y9 j0 }) U
  48. #else
    ) M% A1 h5 A' v* W3 a. c
  49. #define DMA_PRINTK( x... )
    ( n1 u+ s  A+ U& G3 A
  50. #define DMA_FN_IN$ ?) K9 X: S' n
  51. #define DMA_FN_OUT+ V) O; [! l/ L$ D
  52. #endif0 X2 q* B. Y" e5 C" \% [& t
  53. % C: {% a9 J- i! b8 J
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)1 K5 |) ^  v2 e+ ]0 w
  55. #define STATIC_SHIFT                32 N& @9 X) v0 D+ ]5 J* y
  56. #define TCINTEN_SHIFT               20
    $ W$ W# {8 q0 o( s2 N. f; e) D& o
  57. #define ITCINTEN_SHIFT              21
    ! P: t$ |/ |: @/ E
  58. #define TCCHEN_SHIFT                223 g6 ?& u" c6 E
  59. #define ITCCHEN_SHIFT               23
    6 \. w5 H. k  E1 q
  60. - I6 @( b+ K7 T) t. Y1 V1 b
  61. static volatile int irqraised1 = 0;) e( ~3 w0 t9 F% o: M# b
  62. static volatile int irqraised2 = 0;" I6 M" I% F4 z! h  _
  63. 3 E" p; Z, h( I1 @+ O' R' j' U" `  M
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# }, s) b2 w' A* F$ k+ i  u
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. ?) b2 e) j% R. I& Z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) F; ~% E* B: B' I$ }% G% [- B+ s
  67. 5 L# s' f6 {+ x! D! T  B# B
  68. dma_addr_t dmaphyssrc1 = 0;
    9 }* F  M8 U) O* ]# I, L1 c
  69. dma_addr_t dmaphyssrc2 = 0;  e2 c6 P. }8 q3 w6 L0 Z
  70. dma_addr_t dmaphysdest1 = 0;
    : `$ u( i; f" o  g9 ^8 S
  71. dma_addr_t dmaphysdest2 = 0;( r5 e; x- O8 @( ^
  72. " }6 |$ y' J) ^
  73. char *dmabufsrc1 = NULL;, i3 @2 A9 b3 p- V0 U
  74. char *dmabufsrc2 = NULL;# U' o1 z! u; A8 Y, L2 g1 x: G
  75. char *dmabufdest1 = NULL;
    6 q4 Z' e/ [- [9 P- r$ K
  76. char *dmabufdest2 = NULL;
    - a. ]* ?3 c; A+ Z/ u, e& {7 j  z- {

  77. # _# T. }( F1 M' G8 y$ O
  78. static int acnt = 512;7 w: m) y# F2 W1 o! J! D& T
  79. static int bcnt = 8;
    9 t+ v+ H1 _3 M, T" x6 F
  80. static int ccnt = 8;% i- D/ k  }/ B0 j* V% Y' a% Z

  81. 3 a6 X* t2 v: f4 }  u1 x/ u
  82. module_param(acnt, int, S_IRUGO);9 |; l1 S) ^7 X6 Z. a& W
  83. module_param(bcnt, int, S_IRUGO);! V7 i  l. ?' y: w3 L5 P( W
  84. module_param(ccnt, int, S_IRUGO);
复制代码

# u7 T. P; J1 O4 U7 q8 p0 m
5 Z' H1 m0 i, [0 I! N5 \4 d; z      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: P$ u9 h7 A' M3 X+ S# iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( K! m/ d- T$ h* C
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* A9 O' {4 A) f9 A+ f: n0 ^$ b8 A

+ c/ I( K; ^/ q) ?# A7 ~9 A, w! A
* v$ r( \7 [& f
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-19 15:00 , Processed in 0.039708 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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