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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + |9 Q  O% A& l; L- T6 f3 Q& n6 N
  1. [code]EDMA sample test application
    1 c/ [' i: R4 ~$ V+ Y) q
  2. /*7 ?4 T. w/ a- O9 f2 X- ^
  3. * edma_test.c
    ; s. e% K6 C/ D. |
  4. *
    $ s6 P; n% h' t2 R
  5. * brief  EDMA3 Test Application# O  i  k4 O: H* X
  6. *5 n: }& D- G( s+ O
  7. *   This file contains EDMA3 Test code.: `: c$ F0 U! W8 }
  8. ** F# q) E7 Y% `
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ w  u9 N) X# e6 E( Y* |8 t
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & E2 D: V, t6 |1 y7 c" N6 j# I
  11. *         TO CHANGE.' E0 R  ~2 `$ P+ g4 E$ e6 c: j
  12. *
    0 x" F1 y. P2 F% T! A
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ' l' |7 a2 m( C6 n7 K0 z
  14. *
    ) Y$ i0 u& ^$ ?* k
  15. * This program is free software; you can redistribute it and/or
    5 _5 S" D5 @3 R2 T
  16. * modify it under the terms of the GNU General Public License as
    ! \) ]5 ~2 K& j4 f1 Z- i
  17. * published by the Free Software Foundation version 2.7 `, y4 L  ~' c1 G3 ?# i
  18. *9 k" ~1 e7 B6 k' j+ ^; y( y! _. G
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any" _  b* o2 _  N
  20. * kind, whether express or implied; without even the implied warranty9 Z/ n3 E: c/ M' q, }
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 E7 u* \* V8 y7 D6 s+ i2 I: }
  22. * GNU General Public License for more details.
    9 w; J7 l0 Z9 @1 a0 s
  23. */
    , n1 L3 x# a5 @0 P$ Y3 \5 w, Q0 c8 `4 X
  24.   g7 O4 q2 P; ~+ Z( `* V
  25. #include <linux/module.h>
    1 Q! S/ G$ T$ L2 D9 L' t* ^
  26. #include <linux/init.h>3 g9 |$ k" ?+ n7 F/ l
  27. #include <linux/errno.h>
    ; k0 A$ q( Z' h' {9 m3 R8 K8 x
  28. #include <linux/types.h>
    3 m0 Y- a+ ?2 j) i
  29. #include <linux/interrupt.h>2 K, i- j# c( Y5 a; C- |: d& {0 u" L: f
  30. #include <asm/io.h>
    - Y2 E4 r+ l  x- ]0 M
  31. #include <linux/moduleparam.h>, Q1 d' x0 V! n" z9 ?" C
  32. #include <linux/sysctl.h>
    5 E8 ^1 H8 J0 Q' Y! n! H
  33. #include <linux/mm.h>! u$ J: C- y! V, Y3 T* P
  34. #include <linux/dma-mapping.h>5 ~' ^( n5 U0 d% o3 L

  35. * r9 A8 g" ]- [( }
  36. #include <mach/memory.h>
    $ v5 a6 H( i5 l
  37. #include <mach/hardware.h>" N, `9 q- s* a5 M9 F  B- \) |5 I
  38. #include <mach/irqs.h>
    - Y$ ~  u2 k2 F3 `# e3 i0 Q/ y
  39. #include <asm/hardware/edma.h>
    # Y1 \. @# g; C& ~$ I3 c9 k
  40. " l. K- z% Y' W# B
  41. #undef EDMA3_DEBUG
    3 {" N5 T4 L4 ~
  42. /*#define EDMA3_DEBUG*/1 i6 E- `/ Y, g1 f  C! W

  43. ; f+ D/ q: d; S1 a
  44. #ifdef EDMA3_DEBUG& i( K( [+ F3 E% T6 e! N0 m; t+ T
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ; X% L" q& h% G, ~  e+ }" S
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); m: P: o2 d/ H' u1 G% u8 i7 ~7 Q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ {# [. @) v( }2 j4 r1 V( R8 ~4 `
  48. #else! z$ n( F' I' `* ~9 y) _6 y" c
  49. #define DMA_PRINTK( x... )
    4 _0 J% X" C9 e) e1 f
  50. #define DMA_FN_IN8 N2 f* y4 u; T1 I. @; m# M
  51. #define DMA_FN_OUT# E( Z1 [  f) J+ J
  52. #endif! T3 r- }1 B* m  u2 d% u1 Q
  53. : u0 m2 F% U5 Q; l5 R4 {$ Y% T
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)# k' m) s+ d+ O0 ^/ i4 `' C
  55. #define STATIC_SHIFT                3
    7 P( J! |; p# m( h8 t0 E# n
  56. #define TCINTEN_SHIFT               20
    % Y: x+ G* _1 b% @
  57. #define ITCINTEN_SHIFT              21
    : W* p" l* b+ f1 W( F' L
  58. #define TCCHEN_SHIFT                22# ]# Z& W, a) }$ }  H6 A* b1 d
  59. #define ITCCHEN_SHIFT               23
    * l7 q  m8 R. h1 c+ h

  60. ' ]4 k' Z$ E7 L+ `% Y  N
  61. static volatile int irqraised1 = 0;
    5 K& V% P: w4 V# c! g( i' {
  62. static volatile int irqraised2 = 0;1 E1 p2 `$ r' P" L

  63. % j3 W0 j/ `/ I- t! `7 h3 ~' L0 E4 z2 T- Z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( I: Q) S$ e$ G9 E
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( D9 G' C. w: y( y: I3 P4 l- w
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' t4 }2 p' F0 d' h

  67. - Z5 I: J- _, P* i. I  B7 q& ]1 D( v/ w' v
  68. dma_addr_t dmaphyssrc1 = 0;
    / k& ^  ]: ]. M' ^- |) I
  69. dma_addr_t dmaphyssrc2 = 0;3 ?6 |+ U( o9 z3 B3 i
  70. dma_addr_t dmaphysdest1 = 0;
    / _+ c4 h0 [, {9 y3 _$ q7 e4 b
  71. dma_addr_t dmaphysdest2 = 0;
    5 F1 Q4 r1 _0 \) {6 }$ K
  72. ( t$ \8 g0 b. |' `/ u9 Z6 T
  73. char *dmabufsrc1 = NULL;1 l" k  I' I+ k' y  \# X& V; p5 h
  74. char *dmabufsrc2 = NULL;
    6 c* n2 {2 t& Y, ^! T; N
  75. char *dmabufdest1 = NULL;
    : d+ j, Z- G" o
  76. char *dmabufdest2 = NULL;: A) j1 ]" T+ T- Y

  77. ' Z+ i# C1 V9 }' O0 h# [
  78. static int acnt = 512;
    , n. C2 x$ u, x# I, P* A
  79. static int bcnt = 8;7 [4 B* ?( S. R
  80. static int ccnt = 8;
    " `( R& P7 T( c% T' ]. v; U* w
  81. : `; J% n2 B+ p# W8 K% r
  82. module_param(acnt, int, S_IRUGO);0 @$ _+ D9 ^6 Y5 [* P( h
  83. module_param(bcnt, int, S_IRUGO);! g+ @5 ]' }$ M) q. F
  84. module_param(ccnt, int, S_IRUGO);
复制代码

# g- }/ T. J$ ^1 p, r& ]
0 L9 J) z$ X0 y7 m( L      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 G! V. g! B8 [# G7 P
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: B2 ]- p7 z& V/ X& q
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 w$ H2 J# n- a
) b- @9 y! w* D; T( b7 P1 d" d  x

/ h2 X% R/ V+ Q( [/ J
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-28 09:19 , Processed in 0.039267 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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