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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- e& w1 o3 z' y3 P
  1. [code]EDMA sample test application
      ^7 ?2 _: E1 d7 k% ~
  2. /*' j; a# X' T! f) D- w; M
  3. * edma_test.c
    % m( K/ ?8 q% |
  4. *$ K  y/ @5 ^, ]  Y
  5. * brief  EDMA3 Test Application& D) H* Z% |  W( y
  6. *
    6 S3 [. v! }6 [4 h
  7. *   This file contains EDMA3 Test code.7 f9 N7 `# K( [; c  y
  8. *
    7 [3 o& s6 y, p
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " [, ~9 D2 p- ^& F8 e
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# j( @- w2 H# `  t' _3 _1 e" `
  11. *         TO CHANGE./ L; @! `& x6 T0 ?5 Z* a' f
  12. *! E2 D' G" j. b
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 s" u- L5 `4 g$ w
  14. *
    ( _& y6 h3 K& c* Z
  15. * This program is free software; you can redistribute it and/or5 ~$ c- u$ e" v5 _/ W0 t
  16. * modify it under the terms of the GNU General Public License as
    $ {5 o5 O/ i& H1 J$ u+ k( F9 C% S4 v
  17. * published by the Free Software Foundation version 2.
    & A5 C; V' W; e! F3 t
  18. *6 G# T2 Q6 T& K: `9 d
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: `, B" D  ?7 l) y& S
  20. * kind, whether express or implied; without even the implied warranty5 P! E9 k' M1 l. t5 j# D( P
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the3 ?$ o7 V5 j0 h( [5 M5 a
  22. * GNU General Public License for more details.
    " V0 u3 E* o$ H' G$ U
  23. */
    5 T7 q2 h8 u3 o4 T
  24. % s( |$ j& N5 ]; c* P
  25. #include <linux/module.h>7 ~# H) _0 h& Y! e  Y5 Q% d' z( G7 D
  26. #include <linux/init.h>
    5 c3 K$ t* N. G0 z6 ^. a
  27. #include <linux/errno.h>
    ' A/ Y6 b) h: T6 X9 p* V% h
  28. #include <linux/types.h>
    0 T2 ~3 i# b$ g( L+ z& E
  29. #include <linux/interrupt.h>
    2 u; n! [* m8 p- q
  30. #include <asm/io.h>6 q- Q1 h' p1 `; P% G
  31. #include <linux/moduleparam.h>
    1 v6 z) e# w; h$ Q: i
  32. #include <linux/sysctl.h>: v  ^6 k; O. ?( ~
  33. #include <linux/mm.h>
    : T' [4 y. p, I( v9 y1 F' M
  34. #include <linux/dma-mapping.h>$ v: Q, r8 Y* o1 h

  35. ( Z/ R+ w( K: z- Q) Q; }* l
  36. #include <mach/memory.h>
    ) x' |3 q5 m! [
  37. #include <mach/hardware.h>. z. E, I8 C. q8 ^' S
  38. #include <mach/irqs.h>) \# l7 e7 c9 \* f0 _5 ?( m
  39. #include <asm/hardware/edma.h>) o% v8 d8 {& S: d0 h- A) K; e1 R

  40. - u/ g% G0 p& d5 u5 T
  41. #undef EDMA3_DEBUG1 g- L5 e2 v  g# s
  42. /*#define EDMA3_DEBUG*/
    . k& G3 U6 t$ x6 P' k  G0 U
  43. 8 `. V9 [" E$ T) m: l& o
  44. #ifdef EDMA3_DEBUG
    ) i( B/ S6 w8 X
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ; r; A6 r2 n- U4 W6 M4 [/ @6 U" e, O0 @
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 O  A* r- B; [; H  d& c/ W* m
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 i! C, y$ @$ d1 F
  48. #else2 h0 G' b$ m& _9 h* Y
  49. #define DMA_PRINTK( x... )
    # M3 t3 y# A2 D1 Q: U
  50. #define DMA_FN_IN
    7 Z" `* G7 D2 p* p3 u: v
  51. #define DMA_FN_OUT
    6 S! h" E: y6 a- i. d: N7 i. Y
  52. #endif
    7 b2 S! }% [! a! G1 ?0 P  i5 T/ B, x

  53. ' w/ U2 U! `5 E" A( d- Z  @! N
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)5 x8 }% T- y/ Q$ L
  55. #define STATIC_SHIFT                3
    / V% z; \; {) C+ b6 E
  56. #define TCINTEN_SHIFT               20) R. Q' O5 c. Y9 e' r( d3 k
  57. #define ITCINTEN_SHIFT              21
    ! E# r3 f5 I$ C- l: `& N
  58. #define TCCHEN_SHIFT                22
    ' g1 |2 w. f0 {" S' r7 [! O7 [
  59. #define ITCCHEN_SHIFT               23. K- J/ ]1 y1 |; A% t5 h0 G

  60. ) ]: l7 K5 Z7 e; b% x" E) p
  61. static volatile int irqraised1 = 0;
    + L4 M% a+ n$ n3 e5 C
  62. static volatile int irqraised2 = 0;$ v% s3 E- I3 q! F* Y) k
  63. 7 Y8 I& K$ e& L7 Y8 v! E9 x
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! }- E0 A8 M0 Z( [0 k
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! w! t( f8 K' ]! q& U. l
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 P: F  n$ Q$ ~, I9 y

  67. 5 d, i# h3 L+ O3 d  L6 s& a+ P# @
  68. dma_addr_t dmaphyssrc1 = 0;
    + u9 J* F, t7 y7 t3 R* v
  69. dma_addr_t dmaphyssrc2 = 0;& X" N$ I7 t, S4 i! n$ K$ j
  70. dma_addr_t dmaphysdest1 = 0;. b! B: g  l; b$ G/ G2 l: h
  71. dma_addr_t dmaphysdest2 = 0;/ w1 E% s& C( s

  72. 3 G: c( J# Y+ G4 X- V! ?
  73. char *dmabufsrc1 = NULL;
    3 R2 a5 V" d0 Z5 Y
  74. char *dmabufsrc2 = NULL;$ v/ o% y' O0 Z3 ~
  75. char *dmabufdest1 = NULL;
    + _& Y& E' I5 I2 z, b
  76. char *dmabufdest2 = NULL;
    ) N+ _. s& u0 X! g/ x; }& _5 z0 N

  77. # u; I+ _% h" f
  78. static int acnt = 512;
    , n! X) v9 T/ v7 L4 w" r% w
  79. static int bcnt = 8;. P$ p, g! m. E+ T9 F
  80. static int ccnt = 8;/ |0 X6 U7 Y/ e4 F

  81. ) S4 q5 I/ s. Y: Q6 F
  82. module_param(acnt, int, S_IRUGO);
    + o5 N/ j, ^4 a8 |0 {9 l
  83. module_param(bcnt, int, S_IRUGO);8 ?& J& J  ?5 K' L$ y
  84. module_param(ccnt, int, S_IRUGO);
复制代码
: I% K( E, Q. J3 }/ @9 }: }3 ~
; p4 j* i: q+ Z$ k1 _
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. j  U' u8 p$ y2 v9 [
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 K$ }! F7 X5 E3 M+ M/ C4 u5 d* x
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- _% b: T$ }) u$ \

. {; p" K. C2 u
( {' T& D7 b+ P' V% [
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-18 08:35 , Processed in 0.037435 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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