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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% m0 Q/ D# ?) H) F5 X- p5 ]
  1. [code]EDMA sample test application  Y8 C8 g& f/ l) x5 `
  2. /*5 u5 w& n) V4 R/ |+ F, D: V. a$ {
  3. * edma_test.c
    2 P) d' Q# H+ C( P: ^  c6 ]7 Q+ l; B% H
  4. *
    & A; t8 A+ \- q5 b5 U8 }2 A
  5. * brief  EDMA3 Test Application
    4 }3 Q8 Y8 d# y& g1 S
  6. *+ }) i5 Z% G7 v  U
  7. *   This file contains EDMA3 Test code.* m2 S  E! E+ O8 r
  8. *
    & i  u9 n5 }1 _
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    , {1 p5 ~# A4 G4 @
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    " n* w8 f  I, `
  11. *         TO CHANGE.+ u) i8 t) B4 x  Q
  12. *
    : Q3 p, w5 ~: X9 u1 C/ X! a) N! ~
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( M" h& d4 v3 Q) O1 U* G1 @0 M
  14. *8 c9 K$ j8 E4 Z: r' w
  15. * This program is free software; you can redistribute it and/or
    + J' z( f7 r% x3 h
  16. * modify it under the terms of the GNU General Public License as( N6 U8 B/ p( U( {& |- N7 T/ i
  17. * published by the Free Software Foundation version 2.
    1 a9 L+ x% d7 ~
  18. *& g. ~! U% U0 S4 l' w9 X
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 w9 c' K7 `% F- X/ i
  20. * kind, whether express or implied; without even the implied warranty
    ' O# P  A0 n& T: j5 L5 V( k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 Y- s% u( O. B7 A# g/ ~# s
  22. * GNU General Public License for more details.
    2 i& z* a# I& A7 h+ l6 q( U2 s
  23. */4 m8 k  P4 L4 L

  24.   B# p% u: o& F
  25. #include <linux/module.h>
    ; X" X. y2 `0 U0 h- N+ t* y: H
  26. #include <linux/init.h>% T$ }: n( k3 E5 a/ _
  27. #include <linux/errno.h>
    ! R$ N; u' E4 p0 y6 f. m5 H
  28. #include <linux/types.h>8 w) c$ s' ?; E- [) N
  29. #include <linux/interrupt.h>
    1 i  T" Q0 w5 x) B/ @0 M
  30. #include <asm/io.h>
    ' {0 a4 }) p8 O# U) @
  31. #include <linux/moduleparam.h>
    : T8 c  J! F# Y( D- d' ?
  32. #include <linux/sysctl.h>
    0 L' g$ R& ?* E( k2 @  O5 l( @
  33. #include <linux/mm.h>
    ; p9 ~) x/ o5 c+ u& g
  34. #include <linux/dma-mapping.h>' A- o1 z; Z2 S) _& U6 z

  35. " a3 o9 l/ l1 j6 w3 ^: S; H
  36. #include <mach/memory.h>4 l: e" }* j% ]: {
  37. #include <mach/hardware.h>2 S( b% q0 j; |/ h! \* N! {" Y
  38. #include <mach/irqs.h>
    7 @4 ~. ]9 r5 K6 }1 W$ Q) c
  39. #include <asm/hardware/edma.h>; M0 V0 E& W; C) O& @/ x
  40. & u, Z7 P8 t3 S2 `8 K$ z: K
  41. #undef EDMA3_DEBUG
    7 A1 c1 O- }' `# [
  42. /*#define EDMA3_DEBUG*/- M6 v% o$ Y  h7 U9 g
  43. 7 Y6 [2 R) g. Y* b# o+ {; f
  44. #ifdef EDMA3_DEBUG1 K9 _  M7 ~8 H7 v$ n/ S! U1 \! L
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    / T3 v: u8 Y5 n: i4 N! ]- [
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); r% d/ Q3 g) j: w! l0 y6 @7 `4 i" g  V
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), \% c" w( x9 _& j% y3 ]
  48. #else
    $ G* q6 Q9 s+ z- c! b
  49. #define DMA_PRINTK( x... )
    ! r7 H2 d0 b% ^2 N! p4 x7 C6 j
  50. #define DMA_FN_IN
    ' O! G" M% Y1 i6 G/ Y
  51. #define DMA_FN_OUT% _- S* H( }3 F; J* W" i
  52. #endif3 w- K  \" x; `7 W- K
  53. - e4 H8 l" B& ^* E; V
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), z8 x3 ^- M$ a  ], v4 b5 n
  55. #define STATIC_SHIFT                3
    # _; T! g& E( l  L9 `: g% g3 ~
  56. #define TCINTEN_SHIFT               208 ^/ F% r* \; i$ v
  57. #define ITCINTEN_SHIFT              21
    1 i9 J7 A% Y+ W6 p
  58. #define TCCHEN_SHIFT                22
    " t3 U. J  Q+ k9 p# k( a3 ?6 K5 f
  59. #define ITCCHEN_SHIFT               234 q# L4 y0 {1 i
  60. 8 [6 k& w( a8 d/ N: U+ q. z
  61. static volatile int irqraised1 = 0;+ {8 l" E, s# M3 u# q( k8 }
  62. static volatile int irqraised2 = 0;
    8 o' l& O- D; q0 s: I8 s% b
  63. 0 l7 o. v" x6 R
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + a" G, Z, z5 Q- G7 K  v4 x- T
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " K+ C6 t  I" X9 R$ p
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 p$ n( j9 t6 n% _5 G5 T! t
  67. 7 _/ |& P1 j9 T: T: g
  68. dma_addr_t dmaphyssrc1 = 0;
      I9 L4 h( x" }* `" q
  69. dma_addr_t dmaphyssrc2 = 0;
      [* S4 m7 U7 f5 K: s2 }1 \
  70. dma_addr_t dmaphysdest1 = 0;7 w; x0 p& L6 F6 u: V
  71. dma_addr_t dmaphysdest2 = 0;
    4 O) j- M  ]( Y0 e
  72. - {0 }% b" u  @; S* ]
  73. char *dmabufsrc1 = NULL;/ R& G5 l" x1 E  y* P
  74. char *dmabufsrc2 = NULL;+ x, j& M* V/ F6 N
  75. char *dmabufdest1 = NULL;( K4 _  X5 D$ X$ d
  76. char *dmabufdest2 = NULL;# K9 H; O' Z* `3 h1 u
  77. * R' j. x  d" K9 e- [/ m
  78. static int acnt = 512;
    0 ~; `, l* e; F2 r% Q) J9 ^
  79. static int bcnt = 8;
    2 k. f. K; u; |4 t/ ]5 [( r
  80. static int ccnt = 8;
    $ T5 P0 K7 e9 B

  81. ) P- q: Y4 T; s# f3 [
  82. module_param(acnt, int, S_IRUGO);
    ' a1 |' |0 }2 i# t* P
  83. module_param(bcnt, int, S_IRUGO);
    ! v$ @( V6 E1 u/ }7 O4 V6 z
  84. module_param(ccnt, int, S_IRUGO);
复制代码
( p3 W/ J! `) T# M/ [

5 B# t& r; j* l' G      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
  |, A- i9 r9 j0 c8 X$ garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 k' B- b& w+ y; n' Z
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ H9 r, j0 C+ W

9 X! ^9 g6 |  m( r9 M7 \) l  G# {  B+ |, A  |0 B" z6 W
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-8 03:04 , Processed in 0.046786 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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