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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * v- T% X% c, o0 G+ Z# F
  1. [code]EDMA sample test application
    2 A" h6 r) B- G% T/ K' l* J
  2. /*
    ( h9 x! L- O, N
  3. * edma_test.c. B  Q6 y: F; |5 ^2 c$ G( h
  4. */ c4 E# a5 N& {& |0 t5 y9 n
  5. * brief  EDMA3 Test Application
    9 p; c3 J1 m9 M- y
  6. *
    1 C4 G, w. S0 p- C9 s* f% y
  7. *   This file contains EDMA3 Test code.
    $ K; }2 e1 v5 j" ^' @4 S
  8. */ d. l5 c3 a$ C! ?% w
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ ], z+ [: ?+ J. ]/ [. g
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" f) O$ P8 V8 b0 t$ L# o/ `/ I. ?
  11. *         TO CHANGE.( G) W8 Z6 s/ u$ h2 L
  12. *
    % h0 @0 k) p! `! E- |  X2 n
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) a& |9 W7 V5 Q1 n; Y; ]% Q  R
  14. *
    3 z. K8 K+ E. F5 I+ Z% L
  15. * This program is free software; you can redistribute it and/or
    5 d3 _' D  Z4 N* w3 O# n
  16. * modify it under the terms of the GNU General Public License as
    ) V6 Y! X9 }! }% Z* e5 c6 [
  17. * published by the Free Software Foundation version 2.4 z8 i0 y3 x  I' _2 p" d
  18. *+ h7 o3 }* p; c  }1 c0 B
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 x8 E1 n# j& [7 g% Y
  20. * kind, whether express or implied; without even the implied warranty# M* @  g  p  |1 B; Z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the9 l- D+ F* g1 y, w6 R* A/ U1 A2 s- l
  22. * GNU General Public License for more details." n2 b: R: O; u- y( J
  23. */# ?5 x; r" e; _. T9 i8 D

  24. ) Z- f& p) _# a9 I; ~
  25. #include <linux/module.h>
    : ^) d& S5 k8 {$ X0 k$ o  e1 }
  26. #include <linux/init.h>
    8 g  t% v" Y. Z- l
  27. #include <linux/errno.h>
    * _# W" e0 X- t. K
  28. #include <linux/types.h>
    5 B' [+ D+ K( |
  29. #include <linux/interrupt.h>! S0 L3 E4 y! G. R4 M: T
  30. #include <asm/io.h>
    1 u9 A8 u, r8 ?1 e
  31. #include <linux/moduleparam.h>0 p, V* Z" Q6 p8 q+ ?* v: J# X
  32. #include <linux/sysctl.h>
    ( y& l+ f2 |' ~
  33. #include <linux/mm.h>
    ) u# I0 p5 }5 [3 f/ v, b
  34. #include <linux/dma-mapping.h>
    , |2 n9 i# a8 N  W5 a
  35. & I: d( K! v$ y
  36. #include <mach/memory.h>
    8 p+ c, ^" v+ v8 C
  37. #include <mach/hardware.h>; n5 W6 j6 O$ ~0 _( o: N
  38. #include <mach/irqs.h>9 Z) }, m1 M( C1 S
  39. #include <asm/hardware/edma.h>
    $ s  j3 M% Q# x8 K+ T/ b/ g' ]. f

  40. 5 i4 {/ H) k% [" @
  41. #undef EDMA3_DEBUG
    $ E, V* `& p2 C
  42. /*#define EDMA3_DEBUG*/
    ' e/ Q3 j8 e+ v; \; s
  43. # w' W3 z5 R2 u$ m# N- h0 k  Z
  44. #ifdef EDMA3_DEBUG
    + K$ W. {: a1 L: U+ G! I
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 q9 y! m9 e% ?
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& R3 q7 X/ p3 g; N# y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% r) n; w$ t$ c! Z
  48. #else- q: @* L( L2 ~- d$ o" D( y
  49. #define DMA_PRINTK( x... )- H$ t& Z& h2 L# ^
  50. #define DMA_FN_IN
    0 P" Y+ m/ w. ^
  51. #define DMA_FN_OUT
    1 X' v; N* w, S% s
  52. #endif
    9 a+ c3 K, T- ]! e

  53. - ?4 v# T3 r6 x5 V, W
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    0 d4 [+ a. a! W  s* P
  55. #define STATIC_SHIFT                3
    % ?* |. ?- d: k/ x1 O+ V
  56. #define TCINTEN_SHIFT               20
    : {7 {5 T7 v- l3 F* K3 @
  57. #define ITCINTEN_SHIFT              213 U% a$ `  Y# J+ `. G
  58. #define TCCHEN_SHIFT                22% H8 i+ b( D) }: ~- U8 _
  59. #define ITCCHEN_SHIFT               235 c  g2 {/ B$ Z( U7 d5 `0 n* x

  60. ( B. `3 j/ g2 g4 c
  61. static volatile int irqraised1 = 0;
    + J7 x8 U, {& {. q! v
  62. static volatile int irqraised2 = 0;. E4 [/ D: h) L
  63.   |, v  T- f. ^6 }0 @% ?5 V/ y. R
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 r1 k& C/ u) h/ \
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * d. i$ Q6 \/ f2 v: G! O) z4 @: L
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - }1 C( H: V, g/ j" }0 h1 o  D

  67. 6 R9 t, S' h* Y7 \
  68. dma_addr_t dmaphyssrc1 = 0;7 @' ?& e( V9 B, C: U
  69. dma_addr_t dmaphyssrc2 = 0;
    " ?7 R9 V: O$ ^
  70. dma_addr_t dmaphysdest1 = 0;2 D2 }& h- L1 L
  71. dma_addr_t dmaphysdest2 = 0;& O0 v3 C& H; r, q0 [

  72. , s3 k( e! q9 J
  73. char *dmabufsrc1 = NULL;
    - O: M; ~6 k# e
  74. char *dmabufsrc2 = NULL;% U, v+ P* P3 X
  75. char *dmabufdest1 = NULL;
    ' b" D  \7 E% U  ?# n  ~5 I" y
  76. char *dmabufdest2 = NULL;& @! k4 d# P2 u

  77. 4 o+ F% Z- A% m3 [$ C
  78. static int acnt = 512;5 y. \- w! c" F/ j. n
  79. static int bcnt = 8;
    2 j5 @  Z% b0 Y# J+ ]
  80. static int ccnt = 8;6 F& {1 g$ D8 x9 c
  81. % |' Y/ ~9 s3 ^3 o9 G
  82. module_param(acnt, int, S_IRUGO);
    % D0 V( `' N: ?4 H$ S2 c) Z# U
  83. module_param(bcnt, int, S_IRUGO);
    2 h* z- f( Z5 ^& J. ~& a5 u
  84. module_param(ccnt, int, S_IRUGO);
复制代码

' Y! |4 {8 ]7 }% q7 N) f
/ ?0 b6 @- T$ v2 Z* g0 ^      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 B0 Z& G% E: c5 r! Xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ P. q7 i+ R" n( \
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ b% \  i2 J5 k" I; |* Y
9 N  D6 A8 o! @: ~4 f

, M: a2 w" s1 y- N6 e4 Q1 X/ c
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-28 21:14 , Processed in 0.048885 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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