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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / x  P  j2 \0 N
  1. [code]EDMA sample test application
    2 A2 w9 {9 ^& p9 ~- h7 R! r1 p+ Q) ]9 {
  2. /*
    ( c/ Y5 u: E3 M
  3. * edma_test.c4 ?# L: @7 x: Y% d. R  z0 \
  4. *
    8 g* ?9 U* \6 e6 K' E+ H4 ~% ]0 k
  5. * brief  EDMA3 Test Application) n8 t) e7 u9 X0 ?
  6. *
    . F9 ~/ O. h/ C: C0 j1 a
  7. *   This file contains EDMA3 Test code.
    4 l- D' ^$ q+ B! \# B9 {1 H
  8. *5 X; h* [6 Q7 n7 E( Q; `
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      s; D  {/ l, |% W5 a4 V: Z& n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 O: L7 d* ~0 i6 S
  11. *         TO CHANGE.
    + x4 P( P+ n* y' T0 j' _
  12. *
      g% E( i+ [$ E1 s, {
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    * R0 Z7 |/ k* p6 r. j- p
  14. *
    7 ]" R  u# _; D4 F) V
  15. * This program is free software; you can redistribute it and/or
    2 x  g  ~( J% V  D4 B7 }
  16. * modify it under the terms of the GNU General Public License as
    ) X" k% P5 A5 h$ F5 V
  17. * published by the Free Software Foundation version 2.
    $ z4 R$ u2 |3 z( Z$ t
  18. *7 E& }3 J; d' P5 _6 w9 D) P  _) c
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& k  e5 x% E! c
  20. * kind, whether express or implied; without even the implied warranty
    5 H. g. v3 R0 B/ C: ^
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the9 C4 _/ c# K& }* R  H
  22. * GNU General Public License for more details.
    : S: h# x. k: y5 N& r) w2 t
  23. */9 |# W( V5 p  L! b

  24. + C  [9 P* j; L" N7 u
  25. #include <linux/module.h>) V/ y' e. F8 M3 c+ m) }1 M
  26. #include <linux/init.h>$ J( Q& C: i# t* T+ }  W1 w  U$ H
  27. #include <linux/errno.h>% S5 @1 d- }1 W5 M" n( Z
  28. #include <linux/types.h>
    ' V! _) W" _1 m- e
  29. #include <linux/interrupt.h>. t! y2 H+ y7 T. ~- ]7 f
  30. #include <asm/io.h>, R6 G" P& z" C8 E8 g
  31. #include <linux/moduleparam.h>
    8 C8 \) y; A+ q$ k7 Z
  32. #include <linux/sysctl.h>2 I( P) m( Q3 r" `* i% {; Q9 k
  33. #include <linux/mm.h>
    - @- H! ~0 @. |- J  @
  34. #include <linux/dma-mapping.h>! j! H7 s1 L$ v1 P+ ^
  35. 0 x2 f9 E) m+ G- i: c2 T3 t) ]
  36. #include <mach/memory.h>
    2 I- f  R% S3 z0 J% r. \3 Z
  37. #include <mach/hardware.h>$ r6 Q& _% M9 X: X
  38. #include <mach/irqs.h>7 c- j9 G. O! D
  39. #include <asm/hardware/edma.h>
    $ I7 G0 k+ g/ P

  40. 6 H; u( o3 k+ ~( _4 q8 h% d
  41. #undef EDMA3_DEBUG: \+ a. J, B7 E# K2 t
  42. /*#define EDMA3_DEBUG*/
    1 N; \1 D  H4 H6 L) p7 z& T

  43. " n7 x4 I; d5 O1 m1 t0 N
  44. #ifdef EDMA3_DEBUG
    : ?+ Z. k% L* G4 P( [
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 N/ X  r; y9 Q4 d5 E8 R
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # J; X) I4 f# P( B4 a% }
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 ]( r3 x3 X) n) l8 U9 L6 V
  48. #else
    , X- i, o; p. U! N
  49. #define DMA_PRINTK( x... )
    4 }! s1 H1 ?& m7 Y2 h
  50. #define DMA_FN_IN$ ?$ J! _4 C2 U4 X2 I2 P
  51. #define DMA_FN_OUT7 g" `" Q6 D9 Y. o9 o/ S! r, A
  52. #endif
    2 m$ a& \6 [/ z0 V% x$ ?; l# e4 L( h
  53. ) H, b2 ]) p+ n- K/ ~
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)' k* }- ]1 r  M- H- q% s
  55. #define STATIC_SHIFT                3+ O/ t3 [$ x5 U$ ?% R, V$ }
  56. #define TCINTEN_SHIFT               20
    , X: x, v) `, c0 |1 v5 |. b
  57. #define ITCINTEN_SHIFT              21. b( w5 [( \- j, S) a) A, |
  58. #define TCCHEN_SHIFT                220 A, ?! r" S" R  \' `/ t3 H
  59. #define ITCCHEN_SHIFT               23
    # E5 b4 B# x9 r2 u0 J. P9 N) u
  60. . [9 S& C8 i0 t$ E# q' M4 L9 `
  61. static volatile int irqraised1 = 0;- M" N/ g6 m0 R6 x
  62. static volatile int irqraised2 = 0;
    9 G6 j7 ~) h: w8 m9 F# [

  63. 3 m$ x" z+ u; k9 V& a. @  H* M0 q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' T  J# D( @; w1 R
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# }, K/ V% v& G+ B
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * c4 S5 r2 O% R4 n+ |# v

  67. 2 S5 M! f) |& R: E
  68. dma_addr_t dmaphyssrc1 = 0;- ~% S, H3 A4 |. w! B: v, M0 m
  69. dma_addr_t dmaphyssrc2 = 0;
    0 k9 I1 Z4 D2 |
  70. dma_addr_t dmaphysdest1 = 0;
    + L0 Q3 ?+ V% [; X! x! |
  71. dma_addr_t dmaphysdest2 = 0;8 |* L7 E9 @. ^: f+ n! V* l
  72. 2 Z, C' j4 E% D/ E  O' Z/ L0 s
  73. char *dmabufsrc1 = NULL;
    : e7 y6 k6 q3 s8 O0 `- X
  74. char *dmabufsrc2 = NULL;
    * t) G0 c' N  M& o5 Q/ k
  75. char *dmabufdest1 = NULL;2 Y* J+ @( n8 x2 b8 `7 F
  76. char *dmabufdest2 = NULL;
    7 z. a: \6 K1 l* \9 U

  77.   J; ^( T% X% }6 u9 l
  78. static int acnt = 512;$ u' V6 U& p; p- d6 t
  79. static int bcnt = 8;6 G) ^& J" ]1 a$ _7 I
  80. static int ccnt = 8;- E  P4 b% c: ]; h5 ]2 B

  81. ! W4 k+ @3 L1 G4 e) s% v; G" x
  82. module_param(acnt, int, S_IRUGO);, s! d5 i/ I+ A* q/ U
  83. module_param(bcnt, int, S_IRUGO);4 t/ \7 D: j% P* t. K0 r4 f+ A3 X
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 Q( L& U7 \4 }, Y) ?
$ ^8 F, _. F1 A) I& w0 [
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 K. O6 S( g0 d5 ], y( _6 Rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
  l! M3 ]2 Y. A     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
  F) }0 Y* m1 k8 ]" t: F- m: h" m- {# d6 Z  G4 z8 n% X0 Q
5 F; C" d9 G" [- o- W) V
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-4 04:11 , Processed in 0.041253 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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