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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: V& V& w: e* z) S4 p* p
  1. [code]EDMA sample test application2 O2 D9 }1 D( Y- {
  2. /*1 M$ Q( U" K% A* X$ ^9 n7 b
  3. * edma_test.c. v( D" J* n& P# _
  4. *5 F  M0 o7 D" Z/ R
  5. * brief  EDMA3 Test Application
    . S' I2 b4 C/ c* e5 [4 Y9 n2 }
  6. *
    ' W7 d' N2 ?  p* l* s9 Y
  7. *   This file contains EDMA3 Test code.
    ! X  H7 y/ G% M' e+ h
  8. *
    6 X' D1 N  ^# k
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 ]1 }! U1 r. \7 [- E
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; j2 i4 w# O. Z7 v% u
  11. *         TO CHANGE.* Y3 `2 t, t. v& q4 Q5 o
  12. *
    ( {, s% S$ W# A; X6 p  D2 K$ s
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ _$ ^2 k# g/ S% f
  14. *
    0 |2 A4 I3 v1 Z, i
  15. * This program is free software; you can redistribute it and/or' d# ~) u/ _! v$ s0 M) i& ?, Z
  16. * modify it under the terms of the GNU General Public License as& T  i) x: V7 Q) c! r* r  x
  17. * published by the Free Software Foundation version 2." ^8 h5 j% @+ G. X. b5 w
  18. *$ i5 Y0 |3 K5 S8 Z- ^' k' H
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    & O: r' x. k( d8 z% b7 E% A) v
  20. * kind, whether express or implied; without even the implied warranty
    * _) d7 |- v) B; V
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0 z- `# g8 {% l: k
  22. * GNU General Public License for more details.+ O' }+ l; l( S9 h* H: {' P9 ?6 c
  23. */- w& i' ~: G  A  a: g

  24. ) G% S8 ^6 K( g  R& H; n3 D
  25. #include <linux/module.h>$ s- M% C4 j8 u
  26. #include <linux/init.h>0 S4 D; G$ W! G- L+ f
  27. #include <linux/errno.h>6 p5 N+ B8 P+ B) U& B+ o; _
  28. #include <linux/types.h>- P/ S% V8 ]* _$ c$ y/ k. w9 g& j
  29. #include <linux/interrupt.h>
    5 @) Y- I) X% a! W/ |1 [
  30. #include <asm/io.h>
    6 W; h* Q+ R$ l
  31. #include <linux/moduleparam.h>
    4 [6 C( g2 b+ K0 m5 w- L: Y" r
  32. #include <linux/sysctl.h>
    0 ?3 Z4 b. p4 r1 O! Z3 {4 U
  33. #include <linux/mm.h>, [- z$ [; Q) ]. `5 u* V
  34. #include <linux/dma-mapping.h>
    ! p! t3 }" ]  g  W6 b! \
  35. 2 N7 d( g5 z" q. h$ F# P7 v
  36. #include <mach/memory.h>: y4 k4 W, n' @& G5 ~5 d
  37. #include <mach/hardware.h>% E' C" Z8 h6 R  o& `$ n
  38. #include <mach/irqs.h>2 {) _- y0 |4 w. c
  39. #include <asm/hardware/edma.h>
    " T* l* T( ]9 W- i. Y

  40. 0 I2 X6 b8 J# Q' q
  41. #undef EDMA3_DEBUG1 u: s, k: T* s3 d
  42. /*#define EDMA3_DEBUG*/
    % F% u/ K7 F4 r. P

  43. 7 ~7 C4 H1 _% M* j. C5 ~
  44. #ifdef EDMA3_DEBUG
    7 M$ @" B: k% [: C# D0 ~( B8 x" I! ^
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    / T. C1 ^! ?+ _/ c$ h( }
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ r. H: B! z) M* G
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 C+ Q! Y2 E, ~* F2 p0 A4 o9 D& g' k
  48. #else; l! m% s% J* a7 U  e; o
  49. #define DMA_PRINTK( x... )
    + l1 Y# c" U6 a5 `' F
  50. #define DMA_FN_IN! c& h5 ^; V( V# B) F* `6 e
  51. #define DMA_FN_OUT
      ?. [; G3 p+ l1 s
  52. #endif
    ) w+ u# d, y& U. O

  53. + O2 v9 k* X; V0 O6 u
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( A7 Q- I. S) p# G, c1 S
  55. #define STATIC_SHIFT                3) ~% h& E' @" b! s" N  O0 T% k
  56. #define TCINTEN_SHIFT               203 |0 p  ~) ~2 _0 h& I" T0 ^
  57. #define ITCINTEN_SHIFT              21, f4 F) h& E6 s
  58. #define TCCHEN_SHIFT                22
    , f/ }" `% K: w7 D% V2 V5 z. M
  59. #define ITCCHEN_SHIFT               23
    # C' x5 S( o2 Y0 `7 ]
  60. + ]0 ^- q; O# a1 W5 K3 y# f
  61. static volatile int irqraised1 = 0;! z$ H: b1 z" Q4 @; W3 W  X7 S
  62. static volatile int irqraised2 = 0;
    5 x0 L) ?* B0 n9 R8 f9 E

  63. 3 h- A1 E% \1 ]; {
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; T3 n) d# ~% w# o) R: T# S
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' W5 o# `. {$ w8 \& f% R" x5 r
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 ?5 u6 ^+ }8 X1 C
  67. + T8 c. R6 C% q' d6 I4 C, M5 u
  68. dma_addr_t dmaphyssrc1 = 0;# _9 t/ K6 d4 ]5 c4 C+ X
  69. dma_addr_t dmaphyssrc2 = 0;
    1 H. }5 J# E6 v1 H# Z
  70. dma_addr_t dmaphysdest1 = 0;8 a7 ~, x2 F! F/ J- _7 G
  71. dma_addr_t dmaphysdest2 = 0;
    " M0 F7 X* ?$ ~
  72. 8 o, g1 v! w. Y1 `  Z
  73. char *dmabufsrc1 = NULL;
      x) D0 ^8 }  A4 i: g+ h8 I4 E; w5 d
  74. char *dmabufsrc2 = NULL;
    1 v3 V" G# `9 b: C. A' w( d, ^
  75. char *dmabufdest1 = NULL;
    ( m/ [; p( s. N. R& ]
  76. char *dmabufdest2 = NULL;
    : P5 F' _$ e  x5 S  l) S

  77. 8 o; o& A. x' h2 n4 p( a, m
  78. static int acnt = 512;; N. k+ \* E4 i
  79. static int bcnt = 8;
    ; [: e. h$ `# L: ~1 s, Q) {
  80. static int ccnt = 8;4 j6 C, G& M# S9 G% [

  81. ( n* }: n9 D3 p
  82. module_param(acnt, int, S_IRUGO);
    ; h0 h5 _, ^6 ?2 u6 h
  83. module_param(bcnt, int, S_IRUGO);
    ; |% A: _) v6 r4 }" w* |
  84. module_param(ccnt, int, S_IRUGO);
复制代码

. m2 u# D4 t6 M! X1 d+ x! g3 u: b5 h( h/ z( a2 y5 c2 A, e- _
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) r# x1 T7 y2 E' tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ ?9 S$ k9 a2 m( k     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 {0 s3 x/ |6 M
, v' ]% P) J, i- _' H

: l* {' O/ P) D/ P3 X8 C
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-7 22:56 , Processed in 0.050144 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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