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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ |$ p2 ~; p6 m
  1. [code]EDMA sample test application
    : s1 n" b. |0 ]2 v; C0 [
  2. /*3 X+ H2 x3 c6 i6 }+ I& ^" [9 I7 `
  3. * edma_test.c
    + s* _/ f/ ~2 ~/ l1 u" A
  4. *" O2 ?; p; j3 r" S" B% X, _
  5. * brief  EDMA3 Test Application
    # m8 V1 `8 z6 E
  6. *3 r( T) h/ C6 N5 Y# ~$ @# Q
  7. *   This file contains EDMA3 Test code.% M5 j" f8 ?1 q5 Z( a, z$ I
  8. *. [. a  y3 o6 r6 W  B6 M: e
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    : P; Q$ {. `) c! X
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    $ v/ K2 H% J1 c
  11. *         TO CHANGE.' U6 a1 H! w$ @* Z( L  a8 b
  12. *
    * p4 c; p! m; q5 j  U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" o# B3 Z  U4 g6 q  e# j$ J
  14. *+ r- m9 O+ [3 a
  15. * This program is free software; you can redistribute it and/or
    0 O% J5 k0 F( T! F. O
  16. * modify it under the terms of the GNU General Public License as2 U% [6 d7 z: a  u) _
  17. * published by the Free Software Foundation version 2.
    0 d& e: O5 _  V) X' P3 u
  18. *1 U5 Y3 A6 v, [& w* f- H
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 ?6 e/ z1 H" _; ^$ J6 M: _+ n: t
  20. * kind, whether express or implied; without even the implied warranty+ o2 S: v' @- ~3 A3 C
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - x" u2 {3 o! z9 e
  22. * GNU General Public License for more details.
    * X( B9 v( X; n. G/ D
  23. */
    + L1 n+ c' M  T( X! P9 w# |
  24. * k* m4 A, z1 w8 u: i: e  L% B( n
  25. #include <linux/module.h>
    1 n* n  T4 r8 O1 V+ X2 n
  26. #include <linux/init.h># d( T9 K: ^/ a: A; }& E
  27. #include <linux/errno.h>
    7 T  ?: ~& M; s8 y& A$ L
  28. #include <linux/types.h>9 M/ G: Z  K2 h' O/ c, x6 y$ t4 Q# F
  29. #include <linux/interrupt.h>' D6 e, }9 M) Y
  30. #include <asm/io.h>
    & Q: L/ U4 i- T2 \
  31. #include <linux/moduleparam.h>4 V2 n7 i, b  `! y# ~
  32. #include <linux/sysctl.h>. H8 _: ^, X. y8 \7 X  u
  33. #include <linux/mm.h>8 s, Z! i4 }9 b
  34. #include <linux/dma-mapping.h>
    ! N. A  E* z, [  x5 v8 h3 h8 U8 u

  35. ( P! X$ B$ k* y/ x# @, |
  36. #include <mach/memory.h>  v1 |& L. o. ?8 B5 R2 m
  37. #include <mach/hardware.h>
    ; k& I$ e, V3 x3 Q
  38. #include <mach/irqs.h>
    5 p, c: ]" s1 A
  39. #include <asm/hardware/edma.h>
    4 U* j0 u/ p* F% h! G# s9 |& f
  40. 0 o! @- |# L! a" _+ h1 I, V5 ]8 o9 Y
  41. #undef EDMA3_DEBUG
    ( o5 l  a# Z( m5 w, M. j/ t/ @
  42. /*#define EDMA3_DEBUG*/
    5 q1 R( D0 U5 J7 i4 Y- ]

  43. ; c% p4 t7 d% M1 M! n
  44. #ifdef EDMA3_DEBUG& l3 s6 N: {$ x6 a5 d, I- y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 h( W% z- D, ^/ ^/ M6 t) G! E
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( X! W. ^/ _$ x/ A7 u! y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 ?  L, f3 M& ^  k9 R- f
  48. #else
    6 [- P" {( j- y# ~8 T+ E
  49. #define DMA_PRINTK( x... )
    - t" C, [+ o4 U/ D
  50. #define DMA_FN_IN
    : L3 }# Q, V1 W7 a
  51. #define DMA_FN_OUT
    ) U5 a$ U  U  U6 U& s& T
  52. #endif
    7 m% d- E! w; ~  v+ }! P$ f
  53. 9 ?3 y  c$ c' x9 p0 G6 j+ q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( C5 r& p0 S4 z# J- o! H! s
  55. #define STATIC_SHIFT                3
    ) h! P# `% s0 a7 h) ?1 r! x' R
  56. #define TCINTEN_SHIFT               20
    , P: D9 A; p& u6 X
  57. #define ITCINTEN_SHIFT              21
    ) P' c. ^4 \* U
  58. #define TCCHEN_SHIFT                22
    5 u! s0 o- v: b( ]9 B( ]
  59. #define ITCCHEN_SHIFT               23
    5 U7 N5 o& A5 I9 ~/ k5 l* p

  60. 6 t: r$ t/ Z5 G7 V8 S
  61. static volatile int irqraised1 = 0;, C# B! @( z2 Y+ I; [
  62. static volatile int irqraised2 = 0;( f% z& W, x# D: [& b+ w, m5 V

  63. 3 h, [1 g$ g+ M- ~- `3 P
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: A! H. ~, |) z$ V5 e' t2 C1 v: M! C
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , w! d, v% [% @8 {' A, T, d
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% B4 l0 M5 n  \: \2 N: Z, p
  67. / [( r- [0 n  f* N, c8 o7 [
  68. dma_addr_t dmaphyssrc1 = 0;8 |7 R: Z, ^- E* X1 f
  69. dma_addr_t dmaphyssrc2 = 0;% U8 [; J/ J; E( O
  70. dma_addr_t dmaphysdest1 = 0;6 U: f8 E6 r8 [+ F8 D
  71. dma_addr_t dmaphysdest2 = 0;# h+ N3 y- h3 h) C- I2 R2 `0 g
  72. ( `/ L7 N  Q8 n, N3 W, T, Z( q+ z
  73. char *dmabufsrc1 = NULL;
    % B' A3 R; K  `3 J# u2 N# {
  74. char *dmabufsrc2 = NULL;/ L" b( U7 g/ c5 f, G4 L
  75. char *dmabufdest1 = NULL;+ H1 {& }0 ?# \
  76. char *dmabufdest2 = NULL;7 j" T* z- {% q, o% `+ c

  77. ' t+ C6 U* t- {. A: o- m6 b: L
  78. static int acnt = 512;0 ?! i  }% q$ Z  l/ L, @
  79. static int bcnt = 8;
    8 w; `, P$ y( o  e3 b! |' y
  80. static int ccnt = 8;7 g9 s- z4 F0 s& L
  81.   C2 @% g8 R  W0 O$ R
  82. module_param(acnt, int, S_IRUGO);1 j1 c9 X( D* x$ e8 g
  83. module_param(bcnt, int, S_IRUGO);
    % h1 W5 K/ i' F8 g
  84. module_param(ccnt, int, S_IRUGO);
复制代码
" u2 X  _/ c$ E

3 L* a' J4 L$ y& k1 i7 @9 p0 ~      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 |( i& ?8 @& ]1 T
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! v4 ?( T) q7 e8 E     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 D/ s+ [' l& {6 c6 r8 O; B, P

8 t, C/ B* |, ~, t: ^+ X3 Z3 ~2 k2 i' O4 b  b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-14 11:03 , Processed in 0.036773 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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