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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  w+ o* k& y! _# p0 W* m* Q, ~
  1. [code]EDMA sample test application
    + G, a' n! m1 L4 M. V
  2. /*
    $ Z( w8 F2 A. M/ ]. z
  3. * edma_test.c$ `1 M) y; @$ o, i4 [
  4. *
    ) r- \0 H2 a8 d3 F# C
  5. * brief  EDMA3 Test Application$ s- p  v& f1 @
  6. *  z* Z' c6 o" e; a
  7. *   This file contains EDMA3 Test code.5 m$ Q( U7 C' i# g
  8. ** G1 r3 K5 h) M2 I
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + I; t' Y8 M" v# ]; |
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    . _7 D; c' c' R$ M- a3 g& f
  11. *         TO CHANGE.
    ! y5 q6 j5 ]5 @' m" Y" d3 _
  12. *
    2 M; f8 E$ H' N: }
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 }1 n1 }/ B7 P! e
  14. *1 z0 I2 }3 Z& ?5 U  F
  15. * This program is free software; you can redistribute it and/or
    8 _/ \1 D. T4 S( M! S7 R% z+ o
  16. * modify it under the terms of the GNU General Public License as# t7 I; P; k' e1 l( e, b
  17. * published by the Free Software Foundation version 2.* A0 a" N( y/ M8 Q4 T6 O4 j
  18. *3 I. e3 p& U9 O! {
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any% w$ W3 @! O" g8 U7 K
  20. * kind, whether express or implied; without even the implied warranty
    / ]$ D' ~0 U- g. s" Y0 E
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / ]) M5 K# ~; O5 b6 F
  22. * GNU General Public License for more details.2 r& M  j2 I* J7 r2 n$ T7 }" N
  23. */9 ]- u* C5 s. Z3 p
  24. 7 }$ |& u# b/ `3 ?7 W1 y% N4 g
  25. #include <linux/module.h>
    " p% z! k% E/ G8 z
  26. #include <linux/init.h>  }' p; v' d# s8 ^
  27. #include <linux/errno.h>
    / @; ^: U% ^7 [+ [% R9 d$ |* w
  28. #include <linux/types.h>) j( {- _3 s4 l9 [0 z5 v0 \
  29. #include <linux/interrupt.h>' J8 P5 @* k& I
  30. #include <asm/io.h>
    # o$ p0 W7 Z* p: ~
  31. #include <linux/moduleparam.h>
    ' T; b" b1 j: Q9 n6 t
  32. #include <linux/sysctl.h>
    4 ]# Q" `4 M6 v2 [9 g0 @4 N
  33. #include <linux/mm.h>
    " X8 p  p, Z  u! G9 o; h& |  _+ k
  34. #include <linux/dma-mapping.h># G0 i  [! }; g

  35. ( L2 z; V% m% ]& E3 I' a/ N' B2 q, X
  36. #include <mach/memory.h>
    3 Y& h, ~! ]0 J. S/ b
  37. #include <mach/hardware.h>' l/ W1 D* \8 V- [  A# @8 s
  38. #include <mach/irqs.h>$ g! i+ }& c5 b
  39. #include <asm/hardware/edma.h>. o2 _0 ~7 p; [7 E& N; _6 K

  40. ! Z5 W& B  M  v/ |" {" {$ B6 K, G
  41. #undef EDMA3_DEBUG3 s; C; y' B; K3 N0 ~
  42. /*#define EDMA3_DEBUG*/
    5 t3 O0 n3 e; D

  43. 6 A9 ?8 j# H; c/ }: _; X$ i2 c2 b
  44. #ifdef EDMA3_DEBUG  r2 F  E' L8 l5 ]; E
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    9 x& X5 O; v1 w2 m6 B3 A
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 f& r4 s8 e# l3 x0 [4 T
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    7 j, y3 _, K1 X0 U  x
  48. #else
    : w& Z2 Y5 }/ i; z3 s3 I0 L
  49. #define DMA_PRINTK( x... )
    , Y  y( r' J: {( V+ m3 P' @, V6 d4 m5 N
  50. #define DMA_FN_IN
      }- M- L( b) K
  51. #define DMA_FN_OUT4 j. O. E: Q2 R1 m. n
  52. #endif
    - x) ]8 d7 K' M9 e  }& @0 e
  53. % ]/ a1 s1 w1 g; k: P( S
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ B, O( B4 H& e' E
  55. #define STATIC_SHIFT                3
    ' ~* q* n2 `/ l( p5 v# _+ f9 S
  56. #define TCINTEN_SHIFT               200 i. Z; U/ m" N
  57. #define ITCINTEN_SHIFT              21/ u+ A$ X( _' h8 u  q8 e7 C
  58. #define TCCHEN_SHIFT                22: G3 V- p/ P; e- W
  59. #define ITCCHEN_SHIFT               23) |+ B. b* \) b, j7 H7 L) T
  60. & k5 \& o8 a2 B8 V
  61. static volatile int irqraised1 = 0;3 P( E7 T( n1 W0 a) c
  62. static volatile int irqraised2 = 0;! q7 u; H. N% e

  63. # O& P" n. C* e$ k' G; s
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! b. q' L1 i- {- Y- `; A$ M
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 k# D  X' P. _
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 v4 P" Y6 Z8 M) Y) m
  67. 2 N3 j: Y' t- e/ `3 C
  68. dma_addr_t dmaphyssrc1 = 0;: A( f, j: Y  [4 i5 X/ j
  69. dma_addr_t dmaphyssrc2 = 0;" i0 A' h, U0 U* U" `- w
  70. dma_addr_t dmaphysdest1 = 0;/ D5 |+ s* {; F' }4 Z. W( Q
  71. dma_addr_t dmaphysdest2 = 0;, B9 `! J% K; T+ L

  72. # y% S0 C0 ~' b- i
  73. char *dmabufsrc1 = NULL;
    9 N  K4 W6 M# @& I. `
  74. char *dmabufsrc2 = NULL;2 x* Z! [7 w; ], C9 ~  y
  75. char *dmabufdest1 = NULL;6 Q: q5 f- E  z* b3 Q9 ~. f
  76. char *dmabufdest2 = NULL;. Q4 j' M% t* L' V6 l. B

  77. + W( t( P8 V( |5 }
  78. static int acnt = 512;; Y" G# e8 X& i6 i) ^
  79. static int bcnt = 8;3 h- p7 f1 e0 n  A, ^' {# b4 W
  80. static int ccnt = 8;. o3 o, c9 o* f7 ?9 @7 q
  81.   \, i3 p" l2 [! B: ~
  82. module_param(acnt, int, S_IRUGO);3 A7 D# y: X# X3 D
  83. module_param(bcnt, int, S_IRUGO);; t; w6 G' A# m/ i
  84. module_param(ccnt, int, S_IRUGO);
复制代码

4 h1 _0 B9 E, B0 B  h! \: c+ c+ t. c) A8 {9 h6 E; M$ M* m
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- Z; Z* _# p. Y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: D1 x$ X4 n. i6 Y% k
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- R% d. M& Q- l+ A2 T+ s
8 O  F* r$ Q! }  j% g
1 f4 L- `. l; E# c. U0 J# F, y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-21 23:18 , Processed in 0.038995 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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