OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 R$ H, e6 Q& u* a7 T" Y
  1. [code]EDMA sample test application
    2 `+ h) a3 z: ~* W+ }) G% `# q) H2 U
  2. /*$ V+ M, O- |3 x0 Q* W/ f% K
  3. * edma_test.c
    ' @/ y8 q: E0 B7 r3 q
  4. *
    * `! e8 u6 q# ^6 x6 Q
  5. * brief  EDMA3 Test Application/ P& u( w9 m7 Z" x
  6. *
    ; e; z( M7 n/ _3 S* }7 V# L6 O
  7. *   This file contains EDMA3 Test code., Q7 C. q: X& [: B6 {( J; ~
  8. *
    # j* {! U0 C) {% j7 q8 i
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 T( l! A* \" y' ^5 D. d" O7 s
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; d: f4 [# [3 Q- B8 v
  11. *         TO CHANGE.
    $ c; s" w; F7 n! G  `1 b* _
  12. *8 F& M$ Y7 @: G6 E8 z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: z4 g. [! Y9 R2 s4 t# j
  14. *
    $ h8 f4 A" C+ D4 M
  15. * This program is free software; you can redistribute it and/or7 h1 _# `. c3 a/ ?
  16. * modify it under the terms of the GNU General Public License as  `3 ?0 m- `6 ~: Z. W
  17. * published by the Free Software Foundation version 2.0 ]6 n: t% H$ `
  18. *9 d% H) |$ M/ _9 U( Q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 S0 [9 Q" G1 n! D/ i
  20. * kind, whether express or implied; without even the implied warranty
    # Z4 Z, R0 G9 b7 ~1 i
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % p; |( ^2 O0 P( a. H9 o: r
  22. * GNU General Public License for more details.# z' p2 \8 m$ x8 }" V7 {% ]
  23. */$ o1 }- }6 D) S

  24. ( G' x& @+ J. _. F, Z: A! u9 n
  25. #include <linux/module.h>3 J" C# Z! j- y) {7 J! p; \5 E  t& e8 _* z
  26. #include <linux/init.h>$ R) G& c" m6 m9 [- h3 ]
  27. #include <linux/errno.h>, v+ x9 r: ~, H' Z  R; b
  28. #include <linux/types.h>
    ' d8 {0 O/ ?1 i# G% A
  29. #include <linux/interrupt.h>
    ' E0 W8 F& s+ U$ [% l9 f8 q! f
  30. #include <asm/io.h>
    / s' f" h/ n* p5 S
  31. #include <linux/moduleparam.h>
    # G2 x. Y' [& L4 ^6 x, v& R+ i% ^+ _
  32. #include <linux/sysctl.h>* Y! c& w8 ?4 n& ]; H/ E2 _/ w0 t/ H
  33. #include <linux/mm.h>
    5 o8 p4 d5 G& C" `( S2 Y0 |
  34. #include <linux/dma-mapping.h>/ q; `' v- p3 ]- n

  35. 1 m: F  _# z7 z  F. X) I
  36. #include <mach/memory.h>
      V8 V0 T, c& F8 i+ G; u/ e
  37. #include <mach/hardware.h>" i* V( s: z# @& T5 X& r5 r
  38. #include <mach/irqs.h>& [' j+ V: ^9 x& J- d
  39. #include <asm/hardware/edma.h>; k' f+ {* o3 o

  40. . O+ o! L% N5 M8 ]1 d
  41. #undef EDMA3_DEBUG
    6 ~! [: Y; X; J7 K" z4 Q9 k
  42. /*#define EDMA3_DEBUG*/( @8 x5 i; k3 |+ ~4 s, k/ h5 x; `

  43. : Z; q. ?+ t' J8 F8 A
  44. #ifdef EDMA3_DEBUG: `! i3 F4 I0 s; ~5 L
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 }3 p' G7 e& C  x! \
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    : ?. k( K( @; X& w2 x9 \
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    . Y  B8 k1 g, v- G; Z6 o
  48. #else
    ! A5 S, K6 Q) |; u/ g
  49. #define DMA_PRINTK( x... )7 a- C9 ]) J0 }
  50. #define DMA_FN_IN
    ( j) ]& j8 M8 \' ?8 e) t4 {. |
  51. #define DMA_FN_OUT
    % }7 j' Z8 k! A
  52. #endif
    ! Y# L3 F# X5 @! t6 S0 A

  53. 9 }* g2 D1 G" D" L7 }: d1 P- G4 e
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . @6 S# o8 ^! D! ?0 f
  55. #define STATIC_SHIFT                3# v6 r$ U' l/ L1 U$ l0 a1 R
  56. #define TCINTEN_SHIFT               200 L. P' N1 L3 J# Q$ A  I
  57. #define ITCINTEN_SHIFT              21: `' y' m& q+ T- M7 [7 `/ M* v
  58. #define TCCHEN_SHIFT                22
    ; k( o( o! @2 \. G; ^5 O3 K  M
  59. #define ITCCHEN_SHIFT               234 |# q" r# L- f3 y# j

  60. # R! U2 W8 H4 N  z" k
  61. static volatile int irqraised1 = 0;
    % D  n+ g  y9 r  c
  62. static volatile int irqraised2 = 0;3 g* Y0 l3 h% D4 j  m) Z2 n2 x0 a
  63. 7 o2 |9 O: d8 C! b1 e
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! Z. e, B- {/ ~
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . |0 P$ {; u- U2 m! V2 E
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( t( D, V* Y4 L0 A
  67. + c7 z& w# ~% D- [' d. x9 }! r4 V
  68. dma_addr_t dmaphyssrc1 = 0;8 O5 E; E) K" e3 p2 I$ a
  69. dma_addr_t dmaphyssrc2 = 0;2 H' Z) r6 m5 ^" P  h0 V( s
  70. dma_addr_t dmaphysdest1 = 0;
    - b! L' \' M1 e+ {, j# v- p' H, B
  71. dma_addr_t dmaphysdest2 = 0;) C9 z  K- C5 S$ T2 E

  72. 5 Z2 w# w" N1 ?6 k
  73. char *dmabufsrc1 = NULL;
    ( H+ O% M6 q) D9 m: T
  74. char *dmabufsrc2 = NULL;# e& Q( s& V# ^0 B& _: x+ N
  75. char *dmabufdest1 = NULL;+ M, L1 i5 i4 t6 R; N  F9 n( @
  76. char *dmabufdest2 = NULL;( K7 s& c# V% ~% X$ g

  77. 6 ^8 D/ U" F3 {; p  r
  78. static int acnt = 512;
    3 r# O# h# }1 L7 Z9 M
  79. static int bcnt = 8;
    / S" `: z) k8 U
  80. static int ccnt = 8;2 ?. u4 X+ k" f2 n; C7 J# C) H

  81. 1 W+ }. k8 ^- y* Y# n
  82. module_param(acnt, int, S_IRUGO);
    % G7 h2 }. g2 W" q0 N
  83. module_param(bcnt, int, S_IRUGO);' B, f1 N- t1 B# H2 D6 N
  84. module_param(ccnt, int, S_IRUGO);
复制代码
. W0 ]+ [3 w( q9 C/ d3 H' ^8 G$ t
# Q5 K8 O. {$ c  e) l
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 {: W; {/ k0 Z" Q; l5 G, Varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 p" ^; ~, N. x7 T
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. [! h. F8 l3 j% P$ U0 ]

' c+ q3 M& W! X) F3 Y, L9 W4 W. W: B0 F* @$ I
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-20 11:25 , Processed in 0.038284 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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