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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: _8 H/ d& q# O+ h8 O
  1. [code]EDMA sample test application
    6 Z  Q7 h; G2 Z0 k5 w5 r% U) P4 c
  2. /*' m( P- V" y6 }# W
  3. * edma_test.c
    ' P* S" |0 b. c! `6 m" f
  4. *- B9 Y" o" ^& E/ C2 c
  5. * brief  EDMA3 Test Application! R0 j  U( Y. O$ D4 `
  6. *& f; C5 S' y' {: y( c( ~9 l% E
  7. *   This file contains EDMA3 Test code.
    0 C0 Y$ |0 V# [0 O. b) I
  8. *
    , N( s% G9 @0 w8 W- M
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    7 y, C4 l& ?- v6 \: h: w; |6 K; D# l
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + {( Q0 H. V! E! X% o0 G
  11. *         TO CHANGE.
    5 w2 U" }! \. n7 B$ P5 j
  12. *9 A" W+ y9 |1 U7 J
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, C  b9 B: Z  u& J' ~* p1 o2 F
  14. *
    ! w, t- a! r$ K* S) ~: E
  15. * This program is free software; you can redistribute it and/or- d  ^' F- |$ E; j
  16. * modify it under the terms of the GNU General Public License as
    ' u) {% i0 L0 ?% s- w$ {" u
  17. * published by the Free Software Foundation version 2.: T0 o  G" O9 t" v
  18. *4 I: ]5 ~3 u! n! w7 d: E9 o
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    $ o3 Y2 i" ]6 n/ g: X7 q
  20. * kind, whether express or implied; without even the implied warranty3 ^7 L. [- G1 m7 `
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' J8 A3 Q- T% T, O, x
  22. * GNU General Public License for more details.1 x+ J# l$ `% O! p% Z1 s# j/ R
  23. */2 C$ B. ^8 P& {( M$ d
  24. - @  \4 z& R3 G( G+ G7 [4 I
  25. #include <linux/module.h>( }7 H% f. q6 w" \) ^5 _1 k
  26. #include <linux/init.h>7 r, y; z: e2 t9 Z7 t/ `
  27. #include <linux/errno.h>
    / A. p! B  C0 p! O9 {$ C6 T
  28. #include <linux/types.h>
    ( p# W+ F  q) r# ~2 p- b1 K; F
  29. #include <linux/interrupt.h>
    % k4 f1 G5 E- I" ]% `4 x! v, U2 |1 F7 g
  30. #include <asm/io.h>7 P) m1 h( G( K- B
  31. #include <linux/moduleparam.h>
    , I4 f$ n$ \) q4 R
  32. #include <linux/sysctl.h>
    , q& F. h6 i5 j" |$ ]6 W( h  j
  33. #include <linux/mm.h>
    0 g/ T* g3 ~7 V3 c% a! c
  34. #include <linux/dma-mapping.h>
    / o$ {! {) K' I% M+ @$ c
  35.   |- E# q5 d  ^% `" u# S" J. _6 ~
  36. #include <mach/memory.h>1 i" v! X  [8 e* D% I0 j  }
  37. #include <mach/hardware.h>
    - r2 }( @4 n' q! ^0 j
  38. #include <mach/irqs.h>( m$ l, M- v0 n$ _
  39. #include <asm/hardware/edma.h>$ G9 E( [7 U# b$ }6 Y9 J3 _2 K

  40. 5 P" _2 v& x$ c
  41. #undef EDMA3_DEBUG9 [( Y' R- g! g/ W
  42. /*#define EDMA3_DEBUG*/
    4 ^' o" d5 M: C( D! R/ E2 D

  43. : q6 c# z" C! H" x# t( I2 o
  44. #ifdef EDMA3_DEBUG; T; |3 z/ w" K8 T. _% M+ q% }
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ; g# g. h; i1 M
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & t% t' ?7 w9 n4 x
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 L" j6 S" N8 \, f6 H2 }
  48. #else+ W. l" b' ]- y3 s, S4 y
  49. #define DMA_PRINTK( x... )% o/ z$ m! j: X" ~: R; t
  50. #define DMA_FN_IN, k) A$ ]: c0 v  N
  51. #define DMA_FN_OUT
    5 B! D6 T' H& c) k* N6 d. ~
  52. #endif
    7 w) s+ }) J9 t0 f; K! N
  53. 7 }& o2 r4 L; |# Z  _! Z% g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)% {9 v) a& T" n
  55. #define STATIC_SHIFT                3
    + A+ ^* X$ B6 C( x& U
  56. #define TCINTEN_SHIFT               20
    ) x7 ?* ~8 y6 R! Q
  57. #define ITCINTEN_SHIFT              21) Q3 B3 Q7 L2 K1 M
  58. #define TCCHEN_SHIFT                224 q) s8 C# s! M6 Q8 H
  59. #define ITCCHEN_SHIFT               23
    ) K. d- ]& [9 x8 i) a7 T& V* B

  60. 2 ?$ F9 q2 L+ h) D$ n% N# q  q$ q
  61. static volatile int irqraised1 = 0;
      k' {1 s- Z& l. C6 I% Z
  62. static volatile int irqraised2 = 0;
    # [* I! X/ c1 A) B+ l( u

  63. 5 m7 x! Y/ r1 m2 S, [4 _6 D2 d) D# V
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. l3 h& q0 i+ P5 O# ^% G. a
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 l6 ]* X9 I1 [* Y6 c9 E) Y( e; T
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' P0 U: r, t; e9 o9 n$ B

  67. , m2 l0 a8 h9 A% A+ D' g# Z
  68. dma_addr_t dmaphyssrc1 = 0;
    * A/ \  r  Q$ e7 A( f4 J* t
  69. dma_addr_t dmaphyssrc2 = 0;; M* I# K7 o2 G4 y$ g6 v, \
  70. dma_addr_t dmaphysdest1 = 0;
    # L+ w6 M& E" d$ ?, L  _
  71. dma_addr_t dmaphysdest2 = 0;
    # f0 H. y2 P5 _) C  R
  72. ; P7 l2 ?0 D; H- F" y  L+ _
  73. char *dmabufsrc1 = NULL;6 u" z+ ^2 W; I$ R+ F2 j
  74. char *dmabufsrc2 = NULL;9 W) M. i; S# h( |$ V0 f
  75. char *dmabufdest1 = NULL;, T7 M& |8 N$ e) z* `$ @
  76. char *dmabufdest2 = NULL;
    2 L# N- A, ^8 P$ V& w% @" E4 Z7 N! G
  77. - X- R" E5 E# X+ h% O
  78. static int acnt = 512;4 M& w. q% C2 S
  79. static int bcnt = 8;& B2 g( B0 O* C: T
  80. static int ccnt = 8;
    : p# W3 k' a7 ?- P2 C

  81. . k) d/ D0 l" ?' A+ p8 u/ g4 J
  82. module_param(acnt, int, S_IRUGO);
    $ C3 y" S) S$ T7 f0 ~" d
  83. module_param(bcnt, int, S_IRUGO);7 L( |2 |# `, @+ j( E- h
  84. module_param(ccnt, int, S_IRUGO);
复制代码
" Q& F7 A: S6 n0 V7 Y% x9 O6 r

* X; O4 k: \! s( v8 D% |      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 l" S! ^8 |) B# t2 ]5 p  w
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* N; |6 t) D2 B4 o5 Q/ T     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 v, Z/ }1 }7 h8 v0 h2 n# f( E( s
; v/ Q# s& p/ g/ z( J0 w3 ]  g8 V2 D/ z7 ?, }
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-11 16:44 , Processed in 0.039337 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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