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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 x7 T- {' Y8 J% e3 q, c8 j
  1. [code]EDMA sample test application/ P; s! Z8 D) f
  2. /*
    ! N6 K( N9 p9 y& {5 ]
  3. * edma_test.c
      m% r0 j" I; E$ u# ?' B
  4. *: y  }: E% r6 A! B! B  z
  5. * brief  EDMA3 Test Application* ^* y7 w# i. H$ b! s
  6. *
    0 Z0 b) p8 j. K; D
  7. *   This file contains EDMA3 Test code.
    9 m+ h  o/ A5 C! Z8 O% J. U8 ]
  8. *
    : q0 x& [% f( D$ `5 F$ ?; z" o
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    3 D$ g8 a! D8 ~3 q* h1 E: |& f
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    - _( w  P$ v7 s/ F! n( P7 M
  11. *         TO CHANGE.% y( a/ l* s# b$ ~/ s$ [
  12. *6 H4 r* v5 |- O" a! I" x
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! y8 g8 c; [+ W) b) X
  14. *
    ' D& d. X3 S+ M
  15. * This program is free software; you can redistribute it and/or
    # D, j2 c5 H0 o* F
  16. * modify it under the terms of the GNU General Public License as
    * |  P- d# U# c, z7 z4 @0 M) `
  17. * published by the Free Software Foundation version 2.
    8 u6 b6 A4 m: _6 G8 Y) W
  18. *
    + U$ l+ D$ d9 c' x+ _
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 w9 B& N+ t; i0 h2 [
  20. * kind, whether express or implied; without even the implied warranty
    ( K/ v0 U  C# M
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1 f, b; {& F4 D" {% n. t. v3 N4 a
  22. * GNU General Public License for more details.0 S: B- C0 C9 e9 `. n0 r1 H7 K/ N
  23. */
    4 k' x+ y1 }5 J2 g5 ?, `/ u1 X

  24. 0 T0 o; V) y- M  ]7 M! a
  25. #include <linux/module.h>8 H. ?$ w- T$ P; z1 N! e* a
  26. #include <linux/init.h>
      b' g; Z* b+ h3 `/ t7 e
  27. #include <linux/errno.h>
    3 T1 Y$ u: m1 ~( [
  28. #include <linux/types.h>
    2 |7 ~6 C: a4 k; M9 Z. C
  29. #include <linux/interrupt.h>
      M2 t# Y* _3 f1 I5 N; _
  30. #include <asm/io.h>. G- k; `  O6 _7 Y5 F3 U! A
  31. #include <linux/moduleparam.h>) H# Q- w( B# Z2 e0 O
  32. #include <linux/sysctl.h>) G' j+ q) l; ~6 D$ ]
  33. #include <linux/mm.h>
    ) G7 z1 g; ]+ y6 w: c9 t
  34. #include <linux/dma-mapping.h>$ }9 N5 Q. C9 w* s
  35. : j/ D2 o* m. |" b! |+ y
  36. #include <mach/memory.h>
    * o* h; v5 Q/ @2 x/ }
  37. #include <mach/hardware.h># R! h  S( H8 U) ^6 I/ E
  38. #include <mach/irqs.h>
    2 M# u( n( @. F* s# L( W7 R& y
  39. #include <asm/hardware/edma.h># M, p( T7 d# ~
  40. 4 R" i6 x! [  O8 F: `
  41. #undef EDMA3_DEBUG
    # o1 ]% K3 v# n+ h5 C  [1 C
  42. /*#define EDMA3_DEBUG*/$ s5 m: T9 u( B4 _

  43. 5 P! \% y9 r. g1 w* G4 f
  44. #ifdef EDMA3_DEBUG# t, Q' ]# C3 h2 ]
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ; G4 F% G  {9 }7 W
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( J; D: ]( G- o; F$ \/ t6 S
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + v7 H* ]( ?% q6 D1 \& a
  48. #else' ~! r3 _- U! ]6 M* Z( H
  49. #define DMA_PRINTK( x... )
    3 P1 v4 `" C4 T2 w+ ?+ ~4 W
  50. #define DMA_FN_IN% ]. e1 F& i0 Y& l* ^1 \$ i* l
  51. #define DMA_FN_OUT, q0 }' A1 _( G8 d7 G5 C
  52. #endif
    : |- ]0 F# s- ^5 F+ _1 F

  53. / y/ y" Z0 o- d$ `' n0 Q% v
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 R5 z. |, Q7 f: o& N
  55. #define STATIC_SHIFT                3+ k3 z2 p4 Q2 U+ |+ Y, f8 z
  56. #define TCINTEN_SHIFT               20
    % }) a& U2 q2 `1 u& p6 h8 {1 r
  57. #define ITCINTEN_SHIFT              21
    , d1 r7 A- @7 _- Z& ?
  58. #define TCCHEN_SHIFT                22
    0 P0 }: y. E- Y9 I
  59. #define ITCCHEN_SHIFT               23$ V* c8 O5 Y  `; P' j
  60. 2 x% s( M" f  s$ z. Z
  61. static volatile int irqraised1 = 0;
    + ~& u0 t: W+ a: ?2 L
  62. static volatile int irqraised2 = 0;
    ! W3 J3 w: e: Z+ n7 ?/ v
  63. 6 X" [) `. k/ v$ i, ^
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & j$ `) Z9 N; g( ?1 ~/ P
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & I4 Y) O) I7 s; B! g
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ z, j, U* y' O

  67. # ^0 I2 u% z: ^! p
  68. dma_addr_t dmaphyssrc1 = 0;
    1 j( p4 p: S8 r9 y5 B/ n
  69. dma_addr_t dmaphyssrc2 = 0;5 H# [1 b, R3 S
  70. dma_addr_t dmaphysdest1 = 0;# Z* @5 c, Q9 ]) Q# N
  71. dma_addr_t dmaphysdest2 = 0;
    3 p' P5 y' d  e( ^/ p4 y
  72. ; ?3 i* ?" @' b* j4 p! I0 t% y8 J* O
  73. char *dmabufsrc1 = NULL;
    ! c% ?; g% u/ Y) [! H- |
  74. char *dmabufsrc2 = NULL;& I" b7 U, G+ e$ \8 l; b. d
  75. char *dmabufdest1 = NULL;
    3 z% k' N" ?2 O3 a
  76. char *dmabufdest2 = NULL;
    1 N; q4 f1 ^0 M% O4 G# e6 D' d: ?6 y

  77. % B# P, V1 B6 a4 B4 \8 m; g
  78. static int acnt = 512;; w: I( G2 [8 n  x$ h& X! B. g
  79. static int bcnt = 8;
    # Y: j  E- L9 c1 C1 p/ Y6 Y
  80. static int ccnt = 8;
    4 J$ J9 n' x6 Z: V$ a

  81. 7 m8 O( h& y$ m  L4 y) w9 ^5 Z
  82. module_param(acnt, int, S_IRUGO);( w9 U; K: G- O7 A1 ^
  83. module_param(bcnt, int, S_IRUGO);
    9 i! v6 [$ K& G1 ?) P- Z
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 a' k1 L0 r& i' E! j8 }  L7 O

  g% X+ j0 z, q; v      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! [: v- D. N& S
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ E, e/ P+ f1 ]1 K5 K
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 [1 j2 \; c, [* u0 ^' B
7 M2 v, K0 f8 Z( P/ v; G6 w5 P: g
5 F. }; F* Z4 V
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-14 09:55 , Processed in 0.037830 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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