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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. ~' P! E1 D/ }1 ^. O' v2 w
  1. [code]EDMA sample test application2 q; T: }# P! S% C0 z% D
  2. /*
    5 @- p9 b. s% U, B6 w! Y
  3. * edma_test.c
      C5 p% ?  y3 C+ `! c% z, ~8 E6 u1 b
  4. *
    7 D" o1 T; m# `: S
  5. * brief  EDMA3 Test Application4 B$ Z  ~9 l/ J6 Z; n
  6. *# P+ \$ T8 e2 w. ~, {- l, m
  7. *   This file contains EDMA3 Test code.
    " U; a0 M8 a3 v: l7 M- a7 Y
  8. *
    * S  u+ B9 t0 |6 X/ t6 L2 Q" A
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! ]2 s  m& D+ {7 V
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    - ?! n+ x7 a' |, _
  11. *         TO CHANGE.
    ) E) I/ T; M/ U6 O4 b
  12. *
    ' W! p$ u' o& C: d: m2 q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    7 b5 r* g8 J6 M4 u7 I
  14. *
      s" Q" B! f, Y
  15. * This program is free software; you can redistribute it and/or
    : `# W4 A/ K8 M$ c7 h6 C* R5 G
  16. * modify it under the terms of the GNU General Public License as% ~5 L0 ~8 N; _7 _5 W
  17. * published by the Free Software Foundation version 2.0 t3 ~8 y7 }5 o3 n: i; b
  18. *
    - H2 |2 v1 O, z! P! e. O: y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
      L- D5 C8 x7 K0 ^
  20. * kind, whether express or implied; without even the implied warranty) j# Q9 k/ Q/ z4 B! e1 g7 J1 u4 C
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    : {" T9 {/ k; s; K/ z
  22. * GNU General Public License for more details.. S7 }7 W! v# R
  23. */
    % R9 v# i- G4 L" E/ X& V' ~  p% w
  24. 2 V! |4 g& r7 ^0 T. s* h7 G, [
  25. #include <linux/module.h>
    1 c- @7 ?# b" t) w' e3 }8 E+ T
  26. #include <linux/init.h>
    # h7 \& \. {% f4 Y& j1 T
  27. #include <linux/errno.h>3 N7 o, c7 L3 e9 A6 L, H
  28. #include <linux/types.h>3 ?. Y* v7 Z' m& z% k& {8 q6 @
  29. #include <linux/interrupt.h>
    & {' U8 p* g0 s* {/ t
  30. #include <asm/io.h>( {8 ?$ l' m8 b3 N
  31. #include <linux/moduleparam.h>
    $ w4 P  g6 Y( `, t6 I( w( P0 a) K
  32. #include <linux/sysctl.h>
    $ T# N9 P" P5 h$ s6 t4 Z6 E" U# ?
  33. #include <linux/mm.h>6 U( W0 L" W' S. k2 w1 G
  34. #include <linux/dma-mapping.h>. e4 Q8 b  o7 @& A% f4 D

  35. ) S0 J: Y8 q$ F) x- O7 J: S
  36. #include <mach/memory.h>
    * \8 M1 w) a0 E/ T
  37. #include <mach/hardware.h>
    + R- |) n( F6 @1 z( Y5 U
  38. #include <mach/irqs.h>
    ) S4 c2 y8 E8 k, R; G" v" e2 r
  39. #include <asm/hardware/edma.h>
    : v  @6 P/ i* I% A' Y
  40. & g: I; _8 a& P5 g' Z! i) _; p1 A
  41. #undef EDMA3_DEBUG
    . [. q% W, C; p  r
  42. /*#define EDMA3_DEBUG*/
    * ~% ~+ a9 f  |: L: G% ~- G

  43. + S* l$ {3 ~+ a/ ~3 h' y
  44. #ifdef EDMA3_DEBUG/ h+ n2 ~" `# r. e2 I: R# T
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' r' D2 e+ B) p4 I9 K  u
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ C# }5 a0 H8 \5 e) {, h) u3 `
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    8 d$ z8 P6 _9 C% ~: N+ F
  48. #else; F/ g4 r4 q* s0 z! M- D  i. r! k; J3 J
  49. #define DMA_PRINTK( x... )8 c  D) ^  \  R2 I
  50. #define DMA_FN_IN- o1 t8 t  [" |) [* `  i
  51. #define DMA_FN_OUT
    1 {  D+ t# H2 h* S/ p
  52. #endif9 S  H6 ~5 D2 J0 n* x

  53. 0 T' g+ h) n5 O1 C$ j5 N' }9 m4 ~
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)* Z, j% w9 `' B/ z: _  y
  55. #define STATIC_SHIFT                3+ Q$ T* j5 {* f+ e
  56. #define TCINTEN_SHIFT               20% I7 Y/ q6 F" ^
  57. #define ITCINTEN_SHIFT              21. b; |, S! I' l4 z0 p
  58. #define TCCHEN_SHIFT                22
    # I; m  K, H, _6 R$ x
  59. #define ITCCHEN_SHIFT               23
    9 Q7 z6 l& c9 w: I* z; q
  60. 8 p" l. \) V) R) X3 P+ O  @
  61. static volatile int irqraised1 = 0;! J, @& u$ V! W  H* @& r3 o
  62. static volatile int irqraised2 = 0;2 X, C  G; l* g, F
  63. 9 {# L# j5 v; O& \
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 a8 W8 I  G) z8 }2 D# T$ _
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: ?  f0 V/ H- x( J0 E% M
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 Q- ?2 Z/ @- Q) q% j0 H  n

  67. 0 x1 j4 s2 H9 u
  68. dma_addr_t dmaphyssrc1 = 0;8 B3 S: Q9 m% x; k9 N5 b' g
  69. dma_addr_t dmaphyssrc2 = 0;
      W' k- U- v. Z$ c' k
  70. dma_addr_t dmaphysdest1 = 0;
    5 V* Y, B# h$ L$ q, z
  71. dma_addr_t dmaphysdest2 = 0;) O* w" ]7 ]0 Q5 B# g( j  h5 D! c

  72. 4 Z2 G8 e9 n2 M  O
  73. char *dmabufsrc1 = NULL;
    . X+ u% m. J! t$ K: \" G
  74. char *dmabufsrc2 = NULL;% K2 X4 g0 v+ o/ Z# l
  75. char *dmabufdest1 = NULL;
    + n+ P4 g! [/ ?0 S1 o
  76. char *dmabufdest2 = NULL;" u0 C& h- D$ V) @5 d: Z
  77. - U; R) f( m/ D3 j1 J; [( U8 X& w; [
  78. static int acnt = 512;
    6 {% z# B( |5 t8 e
  79. static int bcnt = 8;+ N/ b/ Q# W* R9 }/ j3 W
  80. static int ccnt = 8;: K! [% U2 d# x9 `% z9 n+ ]- X
  81. ( P; R7 n5 w: g8 C5 k
  82. module_param(acnt, int, S_IRUGO);. l% A) U' a. [0 [# q% [% a+ B2 `2 Z
  83. module_param(bcnt, int, S_IRUGO);
    " f# y3 O. E. `+ u  ~* {  N0 D
  84. module_param(ccnt, int, S_IRUGO);
复制代码
" Y/ c% e2 g$ Z% z8 ^" l" {. X

) P3 a( ^) i3 I, a6 y# R      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 ~8 l5 r5 F, Marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' f4 T5 M; O' f
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* D2 [6 k& U1 W6 d  s$ I, I4 }/ q( _

: o& t4 L3 y( @  _3 j) ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-15 17:51 , Processed in 0.044752 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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