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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / S, `1 v9 i7 q2 ^! I
  1. [code]EDMA sample test application- i1 n: p- A% c
  2. /*
    6 _6 E, R$ [. l3 b2 k* D( Y
  3. * edma_test.c
    ; E0 ^" p/ B" P! j/ T8 v8 r' f! e
  4. *2 |" n. W+ s+ r/ P
  5. * brief  EDMA3 Test Application
    ) z! o$ {0 a9 i; F% ]
  6. *; @& c& e' l% m6 y2 T; m7 l
  7. *   This file contains EDMA3 Test code.
    ; \3 a1 Z: w" ?4 ]" }/ @8 N
  8. *) q2 W' j' ?% d
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    7 q- Q, H$ {6 r1 z9 |5 Q  S
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    . S# {! A9 l: Z- e' I& j3 V
  11. *         TO CHANGE.
    , |# E. B9 ~4 ?0 X- N0 }
  12. *. B" a  u3 e: I9 g6 a
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    7 u0 e7 k* [! U* |. K; l- A
  14. *; k; Q- B4 G" v. r: U$ p
  15. * This program is free software; you can redistribute it and/or
    * V8 `- V) R- M! `" Q  d
  16. * modify it under the terms of the GNU General Public License as
    5 r7 @4 ]$ @: `) M/ |3 R
  17. * published by the Free Software Foundation version 2.
    8 \4 H' F% r1 s; B8 W. S5 O. F
  18. *3 N! v5 y) ]5 |& c" A8 E
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 W5 Q5 |5 ]4 @4 I0 A8 w
  20. * kind, whether express or implied; without even the implied warranty
    4 G+ p/ z+ x8 p( b; O$ g$ z/ y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0 Z2 S. L! `% X3 d9 t& n% G2 E
  22. * GNU General Public License for more details.* y5 S* k' ^8 @( E" \  F" ~
  23. */
    3 \: b4 g0 g  X4 [

  24. 5 s. A7 m# d5 ?, o
  25. #include <linux/module.h>
    1 y- e. S2 F1 k$ l
  26. #include <linux/init.h>
    0 V6 @" X6 j5 }" @5 |) o# H* N+ b9 y
  27. #include <linux/errno.h>* S- \/ z: c! [& Z
  28. #include <linux/types.h>0 W) w3 [' W: {- m8 P( y
  29. #include <linux/interrupt.h>
    ) }, k  F9 Y% L3 o
  30. #include <asm/io.h>
    & o1 p7 f1 A6 A: y
  31. #include <linux/moduleparam.h>: t$ d! W3 s" B4 C6 i7 n0 g
  32. #include <linux/sysctl.h>
    8 k& F& D4 n# G& o& t# T8 R5 w
  33. #include <linux/mm.h>
    ! F- M5 @2 S0 Y. _: w1 b
  34. #include <linux/dma-mapping.h>) e& O8 a8 Q4 M, K# C9 F( k
  35. * {2 N/ x0 W) D' z$ s6 v
  36. #include <mach/memory.h>  u& R5 \8 F" v% j2 A7 b
  37. #include <mach/hardware.h>
    ) q" D& z% A3 k: k) ~
  38. #include <mach/irqs.h>
    : I: v( C9 |& w- o3 x9 o
  39. #include <asm/hardware/edma.h>
    1 ]& y" U4 A' q0 h5 N; t$ w5 k
  40. - g, ]! ]$ m+ b9 \
  41. #undef EDMA3_DEBUG; y; S1 h4 R" l, i6 |* A6 `, p
  42. /*#define EDMA3_DEBUG*/
    ( o; f. L! Y' v9 {, c4 _( ]1 J
  43. ) y) o+ B9 _- u& }$ D& e
  44. #ifdef EDMA3_DEBUG6 b1 k5 t7 a. h* w- v5 W& H
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& ?6 q2 \2 Z) K* ?$ E
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 U& `/ F' S/ }! ^8 k
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 _1 s- }8 ]4 P
  48. #else
    $ H" j! S6 t: w& N
  49. #define DMA_PRINTK( x... )
    3 f0 [/ I1 L7 S6 q
  50. #define DMA_FN_IN1 x4 e, l' P, w! Q! Y# @
  51. #define DMA_FN_OUT* c* |; c  j2 h. R/ V+ o
  52. #endif
    3 a. [3 Y' o( I/ i, G" E
  53. 8 L6 n+ u2 ]2 U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ y- y0 e6 B$ |1 d
  55. #define STATIC_SHIFT                3* c4 w7 j. e7 N# B" P
  56. #define TCINTEN_SHIFT               20
    ! B  s! O: u  v) c! Q
  57. #define ITCINTEN_SHIFT              211 K+ A4 K9 e3 U
  58. #define TCCHEN_SHIFT                22
    ' x9 f# q- `1 a9 ~( ?0 E
  59. #define ITCCHEN_SHIFT               23* a& f& {+ n( d3 {! t5 \, g+ @5 D

  60. ! `4 t9 v8 ]( D2 ~+ u" L' T
  61. static volatile int irqraised1 = 0;3 Y. H  y( a- \8 a9 S5 ?4 [' A
  62. static volatile int irqraised2 = 0;
    , |: X0 M* z2 @* h& \6 p

  63. & {2 u5 w. f/ F3 N4 Z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 w! ]0 E+ F3 b# a8 _* z+ @5 L
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 u$ i. O7 L- q( v! G: V+ c
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) r. K' S5 P) u) ?% I. b7 J
  67. % g, B, ?$ W1 d7 T( A* b
  68. dma_addr_t dmaphyssrc1 = 0;
    ; I+ l" d: G* D& T1 E9 H# w6 Z
  69. dma_addr_t dmaphyssrc2 = 0;5 M! j0 _/ s4 G# }0 B' u
  70. dma_addr_t dmaphysdest1 = 0;
    1 J" ]6 @% [9 A6 v+ [
  71. dma_addr_t dmaphysdest2 = 0;
    ; D  x$ h2 F8 L4 }- Y1 ?$ j: G

  72. 9 S+ x3 b$ R- H# v
  73. char *dmabufsrc1 = NULL;$ [, H- k+ y& Z; @9 J
  74. char *dmabufsrc2 = NULL;4 M1 w! C/ b+ z8 ~
  75. char *dmabufdest1 = NULL;
    7 Y# l/ N6 P9 ~; m1 e. ?8 Z
  76. char *dmabufdest2 = NULL;+ n* b$ `; S" [0 t! q

  77. 4 ^# [9 y1 ~1 G
  78. static int acnt = 512;# C& F: ?! b/ E3 [" a9 H: T
  79. static int bcnt = 8;9 s: O4 N9 v& Z& j# x' W
  80. static int ccnt = 8;2 |0 l9 @* c" E& a- S4 C' q% }
  81. . Q( j" o  Y$ C$ c. D- C
  82. module_param(acnt, int, S_IRUGO);
    ; v$ E( Z& M) ]" y# V2 Z, w
  83. module_param(bcnt, int, S_IRUGO);
    2 h3 E* E8 a+ p+ E8 E+ i# X
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  e7 I, k  T+ L. w# S3 I9 y: q0 h: h7 L: J* k! W
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 s& P, Z4 G# X4 @* r& ?0 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( a- w+ a/ F6 {( Z* Y     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 d' Z) _3 T- P, P3 s
* G& B; W! [6 }, B8 t. B0 Z: e$ C

9 K& d! w' T" Q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-21 22:35 , Processed in 0.045367 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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