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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 v8 Q% ?3 L, k$ z4 V& @" i
  1. [code]EDMA sample test application: w8 z9 ]3 d  `+ h% [- m- O
  2. /*
      z4 C* o& k5 k) ?: h
  3. * edma_test.c
    ) n: M: W% ~# [5 V% {) j' m
  4. *: p0 f/ a" Y  X  M
  5. * brief  EDMA3 Test Application+ n' v- a8 i! d* S
  6. *3 q( k+ X9 g% ]' [
  7. *   This file contains EDMA3 Test code.+ e5 n, H: A; c0 F
  8. *8 L, T; r+ W+ l0 S" I
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 F$ r' n1 ?5 s: y" h( z, J2 `
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    % z8 o3 U: M4 h. ?
  11. *         TO CHANGE.
    2 `5 W2 L& d" B2 m/ `3 @
  12. *
    " Z4 t3 [! K& x. w9 u! a
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 g3 L6 Z; ^' E# [& S
  14. *
    5 g& @' b  t; |; |
  15. * This program is free software; you can redistribute it and/or  V$ k9 v3 F9 l4 s# I
  16. * modify it under the terms of the GNU General Public License as. o" ~% s5 y* P! P
  17. * published by the Free Software Foundation version 2.
    & m! v6 K! W* y" _  M1 }5 Z
  18. *4 B' ~' C/ M, R# J& T9 s
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 f6 F0 _/ h' U' m  R8 z( @' w' b
  20. * kind, whether express or implied; without even the implied warranty
    8 f+ G& g# d4 i2 B6 P. N
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - }/ g# V* \7 f7 v- U0 C% R- g) K
  22. * GNU General Public License for more details.. l0 U4 z: R( X% u$ D0 ]5 b5 ~. M+ D
  23. */
    6 c! Y& `& ~! A/ n

  24. 2 I/ Q# u8 c8 f7 ]: `$ ^
  25. #include <linux/module.h>
    % A9 v! G! G% s; z
  26. #include <linux/init.h>; ?6 X. [: i( R0 {5 R
  27. #include <linux/errno.h>8 v9 o8 U: P9 B9 ~) I# }4 K
  28. #include <linux/types.h>, \* L7 R( y* G( |
  29. #include <linux/interrupt.h>, a8 g+ `# M) }2 k4 ?
  30. #include <asm/io.h>
    . W! K4 U; Q' `8 S6 a
  31. #include <linux/moduleparam.h>
    + _/ c1 W' m- G  {3 x
  32. #include <linux/sysctl.h>7 g/ J+ W8 Q% E6 F
  33. #include <linux/mm.h>' G9 ?: |' S; s$ G+ g7 p
  34. #include <linux/dma-mapping.h>
    * g- z" t" V8 S" g( }6 t! N

  35. 3 p; U% m& a+ }: o2 S" ~7 C7 ]
  36. #include <mach/memory.h>
    $ n+ f" d! S. P( l% J& C4 A+ V
  37. #include <mach/hardware.h>9 M( h4 n' R9 j. W) g& z+ f; Y2 y2 S8 c
  38. #include <mach/irqs.h>2 Q! v) J9 U% j  j! p1 |2 F
  39. #include <asm/hardware/edma.h>1 l) F' W$ _1 e8 }" c+ M

  40. ' n. }3 E  ?! y0 o! v, r: d
  41. #undef EDMA3_DEBUG
    $ |& x& C' x# N" t( m8 ~
  42. /*#define EDMA3_DEBUG*/7 P: ?+ x" `" N4 `  }/ x

  43. 9 V8 u! o1 q1 t- F6 k
  44. #ifdef EDMA3_DEBUG
    6 N8 z/ E% X+ Q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 G8 @. u0 g' r6 @$ q: G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    9 \/ m1 c5 v" |2 K; c
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), }" G" F3 T3 e8 Z6 E( B
  48. #else3 t' D# P  e2 B' m; S  \/ p) C8 S
  49. #define DMA_PRINTK( x... )* V! H7 M  S* k9 g
  50. #define DMA_FN_IN
    # T# t4 l! m- Q# e
  51. #define DMA_FN_OUT. q- c" C: T: s! Q0 R( ^" j
  52. #endif
    - k5 J/ o- m" Q$ V, P7 {- ~2 G1 Z( s% d

  53. ) i+ d6 N$ Q3 O* i
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , w, m( |( C) ^( L: J8 C
  55. #define STATIC_SHIFT                38 ?5 o" `1 o4 ~- C9 g. }
  56. #define TCINTEN_SHIFT               20
    7 c7 \( K5 j% J" U
  57. #define ITCINTEN_SHIFT              21
    # V0 r5 W7 J7 [" K4 [* j
  58. #define TCCHEN_SHIFT                22
    ( `/ W' [% R" M% \
  59. #define ITCCHEN_SHIFT               23/ D0 w5 x& ~/ r5 V
  60. ' Z2 X( c7 P5 V3 k! |& a! V
  61. static volatile int irqraised1 = 0;
    + W3 _( z5 A" O5 a# E/ c0 d
  62. static volatile int irqraised2 = 0;
      C& z" z  d4 m: ?

  63. ; k$ q( r' |$ b. C: r& B3 J( u
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 O1 q$ N% C- ~# q2 T
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 d* q- J: J; p8 G
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( }" k8 ~5 z- B  q) Q
  67. 8 H% S3 f) C. L% Z7 b: s
  68. dma_addr_t dmaphyssrc1 = 0;
    - s: T4 c4 T6 y4 Z
  69. dma_addr_t dmaphyssrc2 = 0;* {1 s) Z3 Y$ b! e: Z
  70. dma_addr_t dmaphysdest1 = 0;
    ! e2 y( {6 s. g) }
  71. dma_addr_t dmaphysdest2 = 0;
    , S: S8 u3 V8 d5 D; A
  72. 0 A, G# m+ H% }
  73. char *dmabufsrc1 = NULL;; K8 n7 [  L" p& N- ~1 a3 K
  74. char *dmabufsrc2 = NULL;
    % F+ ]9 o0 X. j3 T7 f! ~. X
  75. char *dmabufdest1 = NULL;
    : {# g2 w5 i- E5 v
  76. char *dmabufdest2 = NULL;  i$ u6 s4 H3 X) p% G6 q& N

  77. " }4 B2 L! x; |+ L# `
  78. static int acnt = 512;
    - a! F1 I2 U3 k; e2 c, \5 }) B% e1 }7 ~4 F
  79. static int bcnt = 8;9 V; z( ^3 E1 ]* @" Y9 \9 c$ I- z% O
  80. static int ccnt = 8;6 _0 b/ N6 U1 U5 u

  81. 5 H- @% L2 V* l& I% N
  82. module_param(acnt, int, S_IRUGO);# h* ^" H6 Q3 x) c. j. H' g
  83. module_param(bcnt, int, S_IRUGO);' v8 o. R  L# ~% W* [" T
  84. module_param(ccnt, int, S_IRUGO);
复制代码
" @) T1 z* M6 N
, r( E/ p" }; y2 l1 V( M/ l* a8 k/ t
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 ^9 B- q' x! S' r5 warm-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, ?; N" V. s4 n7 a) g
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) a; a; |8 d; x( l. _- e3 n/ J1 r: {9 T2 p& P

* f6 Q1 l& y; q# v' ]  C1 P
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-18 00:49 , Processed in 0.039480 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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