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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( ]( ?. q$ q. w8 ?& s+ B1 c
  1. [code]EDMA sample test application
    $ |( B3 \$ O0 F, s' D
  2. /*
    6 p6 v* ^4 t7 w! v
  3. * edma_test.c
    0 r% T& w- @- w5 }# l
  4. *
    1 _$ z. m7 ?* R- D: a5 s& L8 t, C( ~
  5. * brief  EDMA3 Test Application
    ) g, B( n2 U. z9 c8 m7 A
  6. *
    $ M. U- F- F+ a: v$ U' q1 u1 q
  7. *   This file contains EDMA3 Test code.
    & z6 b$ O6 q; _$ }
  8. *
    3 X/ N, f' Q! w" l
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" R" P% F+ O6 P+ M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 }2 V6 \& q9 d2 O! P; M# z
  11. *         TO CHANGE.
    5 n! o- m7 |& X8 Y
  12. *- S3 z" e* P* i4 `* \# u2 G" w- R
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ a6 S1 |. [+ ?! r; Y
  14. *. U! M( L- R  M9 h
  15. * This program is free software; you can redistribute it and/or
    2 a+ Z  C" }  l- p* J& L
  16. * modify it under the terms of the GNU General Public License as
    4 h! ?1 s5 O7 T2 W
  17. * published by the Free Software Foundation version 2.  s7 j! q1 ?8 A' i9 b& t. n
  18. *5 m7 V# D' I5 {5 Z* P
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 n% ~0 N0 @" F6 d9 ?
  20. * kind, whether express or implied; without even the implied warranty; z4 v" S3 Q7 j1 }
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 y: G" h- H9 H9 h( Q: f
  22. * GNU General Public License for more details.0 h* Q) ~( l/ c! ]9 t, q. e
  23. *// H1 u' k! f6 w6 Z8 y

  24. 2 E3 s" ^: i3 ^+ b: M
  25. #include <linux/module.h>
    . q. x6 d4 A1 U: L/ }
  26. #include <linux/init.h>4 k- v3 s; _& ~2 W
  27. #include <linux/errno.h>+ |# W1 N" f& K+ u& C
  28. #include <linux/types.h>
    3 p) D! S: S0 i& j- R+ u4 c
  29. #include <linux/interrupt.h>
    / p- Z- ~0 G) n1 C2 J
  30. #include <asm/io.h>
    ( j' E1 Z8 y0 N  I; G
  31. #include <linux/moduleparam.h>' v. \, x, y  a3 k
  32. #include <linux/sysctl.h>5 k+ |$ Y* A4 M2 C& Y
  33. #include <linux/mm.h>
    5 w' P4 `% y9 S2 I2 A, B( w  p
  34. #include <linux/dma-mapping.h>
    7 }0 `% k- x2 X; h/ u
  35. 1 F# k" |, D1 p1 b( x
  36. #include <mach/memory.h>
    & {+ N: Q" j3 j! d
  37. #include <mach/hardware.h>
    8 ]& k/ R5 p/ D' @
  38. #include <mach/irqs.h>9 J/ h. N/ N- _8 O. M
  39. #include <asm/hardware/edma.h>
    3 E+ V/ A$ h1 j
  40. , E; [) m2 x: f: Y- x( k. A
  41. #undef EDMA3_DEBUG
      r1 L+ Q- U8 N* t2 |2 q
  42. /*#define EDMA3_DEBUG*/" p& |$ j+ N; {7 r

  43. ! ^4 s8 S' N# w: L
  44. #ifdef EDMA3_DEBUG' l9 n; X  }; T; c: Q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    + ]' a% N! i$ i8 A
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    4 s' n6 ]# G( D
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ q; X4 r/ ~9 q7 I
  48. #else/ V* ?5 T% r1 f
  49. #define DMA_PRINTK( x... )
    0 p, }4 A6 g% Q: `# _
  50. #define DMA_FN_IN+ v. ?; O; _, j
  51. #define DMA_FN_OUT
    / P8 \+ _0 M: i9 v) |, M6 F
  52. #endif
    8 Y; B4 `. N! z: [' c" w& ^

  53. ) f1 g! d' B7 X
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    3 A* m! U; w' x2 Q; P
  55. #define STATIC_SHIFT                38 N" C) r6 S' I/ M
  56. #define TCINTEN_SHIFT               20
    , h' F0 E& R4 k  |2 G
  57. #define ITCINTEN_SHIFT              21
    0 F2 Q' i$ |. f# {; K. l9 O
  58. #define TCCHEN_SHIFT                22
    $ O% J. g' p; x
  59. #define ITCCHEN_SHIFT               231 \/ c& k0 U* K# c# L% ~
  60. * W+ t0 ^' m6 Q* F: E
  61. static volatile int irqraised1 = 0;
    5 w, w9 J- J* o" q) g
  62. static volatile int irqraised2 = 0;
    3 [! g( k: [1 @' U! t8 K! ~% D/ u

  63. & ?  F  r' m4 K0 s8 l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : g- S( P& b9 {' p- Z5 ^% n, Y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  d- E4 N& u' f
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - _* t: u( P0 o  g3 ~9 }' E
  67. - ?5 a8 Q2 e. I6 w( s; @! |
  68. dma_addr_t dmaphyssrc1 = 0;
    0 K& l1 M: i% l' C
  69. dma_addr_t dmaphyssrc2 = 0;2 q0 k( e+ Z& {: ~0 b. F
  70. dma_addr_t dmaphysdest1 = 0;0 P( k4 m9 l+ O/ N; Y
  71. dma_addr_t dmaphysdest2 = 0;
    4 S! `  i. \8 A1 N- w

  72. ; O6 g4 Q1 w1 c: a) o! g9 g& y
  73. char *dmabufsrc1 = NULL;
    . {! a# D: B" N
  74. char *dmabufsrc2 = NULL;; J* I1 P2 ^% L$ |# ?0 F8 Z3 `
  75. char *dmabufdest1 = NULL;
    * A* l3 x" }7 T  K; p
  76. char *dmabufdest2 = NULL;
    . x2 w2 W7 v, l. A
  77. ; c: x& _- V& M- t/ F! o' z6 l
  78. static int acnt = 512;
    , r9 X9 L% j7 B' j# O2 b
  79. static int bcnt = 8;" m& s/ {) |2 Q- ^8 e5 Z5 v' Y1 O6 v' c
  80. static int ccnt = 8;
    8 o; S1 a  H( _- ]  o  g* ^8 S# ?
  81. 6 Y- z9 T& J/ e" d8 `  L
  82. module_param(acnt, int, S_IRUGO);
    2 d  _4 V8 D( g3 B' O
  83. module_param(bcnt, int, S_IRUGO);' R% b( x2 N, w( W. C$ }' O0 i3 o) [
  84. module_param(ccnt, int, S_IRUGO);
复制代码
$ b0 b" b" Z( X, ?1 q2 ]
3 z/ W5 ]6 i* d+ y" O5 O  W+ l
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' Y  m/ Z4 L2 R/ H4 \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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- T; }3 B1 d  C- W
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 I5 A7 r- p& b6 M/ `" m- a1 B% S
, b* c" x- Z5 x
: q& K/ Y5 M* n4 k; b& E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-22 18:58 , Processed in 0.033268 second(s), 23 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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