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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 |9 a( ~0 V2 v+ i% z$ {1 M
  1. [code]EDMA sample test application2 b- v1 a' z1 h/ q
  2. /*, s2 {1 N' I3 D: v- G
  3. * edma_test.c
    3 g7 E3 Y% O0 i) Q2 k# T
  4. *
    4 v- G: m( i' D* y
  5. * brief  EDMA3 Test Application1 i* O& J/ k! O+ o* d
  6. *
    + N2 ]: d+ B& D. R* t
  7. *   This file contains EDMA3 Test code.' }8 v3 B0 i( Q6 U' P2 c, ~6 R
  8. *
    * ^. C/ i! k6 }2 u1 F) d
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + Q4 A7 @- Z! v9 T7 f% p
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: O, L/ U- n( m$ w# x
  11. *         TO CHANGE.
    ! `  M: u+ k' f; I
  12. *6 L+ }9 m* l2 s) Y9 M
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    5 j# W! t" H3 |
  14. *( I) \" G* p2 l' b0 W# |. v% F9 O
  15. * This program is free software; you can redistribute it and/or
    # k: H2 B% T+ t% P7 Y
  16. * modify it under the terms of the GNU General Public License as% q. k6 }3 L& s! [/ j
  17. * published by the Free Software Foundation version 2.* i; ^& Y" |- g7 L& V$ d4 v
  18. *
    & {7 X. g. L4 h8 [' Y2 d$ T
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, r  d1 g; C/ a3 E
  20. * kind, whether express or implied; without even the implied warranty
    / W6 O& W1 B; Z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the2 W1 w# {, a# n- m7 D; k5 W
  22. * GNU General Public License for more details.
    5 K! V# h, Q" J' z8 Y
  23. */
    ) J4 Z$ y( F4 z6 k4 }2 g

  24. 9 z, e2 e5 o6 o/ _( \2 J! z8 y
  25. #include <linux/module.h>
    . N- A8 V/ T  T
  26. #include <linux/init.h>+ p1 W# N  }6 E+ K% g6 N. y
  27. #include <linux/errno.h>
    $ a- R5 v1 I' y- k3 N
  28. #include <linux/types.h>( m3 S+ y) E; U: Y* f4 z  h
  29. #include <linux/interrupt.h>& C) p  o, V4 U3 c4 y$ l4 e8 N
  30. #include <asm/io.h>
    6 x& |" h8 R$ |/ q: K& U
  31. #include <linux/moduleparam.h>
    - D+ t2 J1 k& M) A7 h) E) b  v
  32. #include <linux/sysctl.h>
    $ K: i( M, D2 j: r" @
  33. #include <linux/mm.h>3 H0 n" Q$ U$ R8 S
  34. #include <linux/dma-mapping.h>) v$ U# e  c  r

  35. / r3 w3 \4 _! R( Z. [2 h
  36. #include <mach/memory.h>
    4 c1 x$ g$ h8 ~9 Y! r. Q
  37. #include <mach/hardware.h>1 V, j7 F) R( n5 G4 g
  38. #include <mach/irqs.h>
    ; O; J2 d" P3 p6 D
  39. #include <asm/hardware/edma.h>
    ( d9 _* k' G6 Z1 ^( @
  40. 3 z( n6 J! c/ x8 e( n& f
  41. #undef EDMA3_DEBUG
    " X) r% J+ _6 \$ S8 l* j* ], z
  42. /*#define EDMA3_DEBUG*/
    ; k8 L. D- @1 y% l* R9 L1 r7 v

  43. , _: C. ], @4 `& [$ ~
  44. #ifdef EDMA3_DEBUG  N3 m! i! y* ~: K) _0 a' S
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), b# P  _9 \, B7 C1 Z% r. _
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), j$ u. ^/ o; q* W  s' A
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % `* S% M; u: \6 Q6 J
  48. #else* @( f* L! _8 T8 X6 I" y9 m
  49. #define DMA_PRINTK( x... )
    % c- y8 p1 q8 S: w. j1 J, [
  50. #define DMA_FN_IN/ q$ o: Z' c0 R7 t+ v3 {
  51. #define DMA_FN_OUT: P0 q, `# v2 |; ^
  52. #endif
    . D8 G" Q6 h7 m

  53. 1 |. P3 [; `. ?
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    - q2 m5 F3 X8 J& M6 ]
  55. #define STATIC_SHIFT                3
    ( C& c6 F6 W  a" ~2 C- g# `, @
  56. #define TCINTEN_SHIFT               20# ?3 }5 f. x0 ]  n
  57. #define ITCINTEN_SHIFT              21, R' w* p! C4 ?( X9 ], J+ o
  58. #define TCCHEN_SHIFT                22
    , @4 a* u' D  B+ b# P; H: _
  59. #define ITCCHEN_SHIFT               23$ O5 r0 ?% |! }* L" t
  60. 0 P! x9 ?/ t0 r2 v
  61. static volatile int irqraised1 = 0;
    ' i2 Z/ i5 o) K( @9 E2 S4 K7 r: Q
  62. static volatile int irqraised2 = 0;- a& V* }# j: n( `

  63. " t0 y4 V$ G' r) n& C
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 u( k; {# ~' m6 V
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + W- ]; F' `2 J1 g& o. A) F8 f
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - S3 c2 o% b; t
  67. 6 \% ]# t: U- N0 `" |" S
  68. dma_addr_t dmaphyssrc1 = 0;
    ! Y6 d/ R8 ?# o4 v
  69. dma_addr_t dmaphyssrc2 = 0;) C2 L/ o7 U: B# }8 E) O
  70. dma_addr_t dmaphysdest1 = 0;
    1 w" z2 f2 w- i0 p
  71. dma_addr_t dmaphysdest2 = 0;& H: R; A8 q- s1 Q5 h2 l8 B7 L
  72. : t! B8 e% h7 X' }
  73. char *dmabufsrc1 = NULL;
    * V- T# p: D5 e. x
  74. char *dmabufsrc2 = NULL;2 o7 t+ G) p: B/ J
  75. char *dmabufdest1 = NULL;
    3 v# f. C$ W- u. u
  76. char *dmabufdest2 = NULL;
    3 ]7 b! e% c3 s( r" T

  77. 6 d' v5 ~9 n0 a8 }' M
  78. static int acnt = 512;
    7 Y7 Z5 R: g$ Z
  79. static int bcnt = 8;
    1 W& a* i: J' z2 r6 \' y
  80. static int ccnt = 8;
    % o) F5 V( V  U2 Q- X8 ^

  81. & C% x9 ~3 X3 x3 S9 Y
  82. module_param(acnt, int, S_IRUGO);; s& _1 P" K* j; I2 G
  83. module_param(bcnt, int, S_IRUGO);
    + E9 J% _. @! P$ b( \! s
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ m: I! ]8 S9 X, c  _) k! x
+ g+ @, z  I& {      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! v+ D" X9 V, u
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! K5 [+ J2 L- H$ c& r; t( }
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" v4 }" r6 [; j2 b1 I, H. n

: T) ~9 F/ b' E
  j) K5 ^% ^, {' U' ?" {
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-21 18:47 , Processed in 0.039922 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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