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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; h; R5 C# G$ V" }1 Z2 x" s. I$ I
  1. [code]EDMA sample test application$ l. O6 R0 W3 g8 P  m
  2. /*8 }6 F  {. m, p& t
  3. * edma_test.c
    ! `+ }$ o2 Q2 `
  4. *
    6 I' f  }* [& c% _+ G
  5. * brief  EDMA3 Test Application
    ) r8 l% f: g! d, ~0 o3 \
  6. *. h* @/ c7 }* @! r3 `; X; }
  7. *   This file contains EDMA3 Test code.7 g; |  Q; p# k$ L
  8. *
    $ {$ V. _0 ^8 p, y9 }7 A3 f# `
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 x5 Y- l6 j: \- t% c* ~
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. n2 d; m, X. p( A" R
  11. *         TO CHANGE.
    ) d: I/ G, k0 E# L! T
  12. *; ], c5 i7 }5 X$ Y+ S9 z) S# u5 r
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 d; Z$ u% c! m1 g( g7 I
  14. *% S* N" V$ x( g) s  ?! V1 q+ e
  15. * This program is free software; you can redistribute it and/or' F1 H0 D# `* P' `; r/ Y* w
  16. * modify it under the terms of the GNU General Public License as
    9 R) K( R0 C" ~- Z5 D
  17. * published by the Free Software Foundation version 2.! l. J$ z6 i; U5 ?/ T7 F- m* Q
  18. *8 K8 A! g' ?/ o) r" Q! K+ E
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any" C! C" _* h7 I
  20. * kind, whether express or implied; without even the implied warranty* S+ D! W' ~) o0 B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    8 u  E  e& O' J5 u3 z# I( y2 P
  22. * GNU General Public License for more details.: b  Q8 }+ N- }- K' o$ F: l0 T
  23. */
    3 w6 j# Y/ P6 k9 q( O, N+ V2 v/ T( `
  24. 5 s6 @' t# _& w9 x7 A1 E# w
  25. #include <linux/module.h>
    1 z1 r2 i! \# l1 N3 w4 ]) P
  26. #include <linux/init.h>
    ! e6 [8 i- G" u
  27. #include <linux/errno.h>
    6 J- k) H5 a* x% |& n
  28. #include <linux/types.h>, n+ P  ^) |! l: D+ b
  29. #include <linux/interrupt.h>
    ; D5 x& v0 \' J: T
  30. #include <asm/io.h>, Q+ T3 p! |/ G+ N
  31. #include <linux/moduleparam.h>4 _, V& u/ J+ V  o" x7 {
  32. #include <linux/sysctl.h>
    - F; f( v, T8 M. Q2 C
  33. #include <linux/mm.h>
    7 c4 `) u" z  }3 q* i; o
  34. #include <linux/dma-mapping.h>5 j: E9 x1 j& }* L

  35. 6 W0 g8 V" j1 _* @" D
  36. #include <mach/memory.h>
    ! y8 }/ S% U+ V  Q
  37. #include <mach/hardware.h>
    ! X7 [% O; @+ ~- Q2 Q
  38. #include <mach/irqs.h>
    5 E3 W4 |8 O6 s/ k7 l' |+ j
  39. #include <asm/hardware/edma.h>
    : C9 [& ]0 W0 P8 W) f

  40. * E" N. g" e4 ?& |
  41. #undef EDMA3_DEBUG
    ; V% a: P. \/ a6 @3 n- F
  42. /*#define EDMA3_DEBUG*/
    7 }  v1 t8 K. ?. s6 R3 ^9 ~$ x

  43. # J3 {5 d4 P+ G8 ?8 d
  44. #ifdef EDMA3_DEBUG, Z' s% z. @6 f% |
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    / \" ^7 y# h* I3 a( B  K3 B
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      z, {& p- V- I  J  {, y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), n6 d& F, n$ }& E5 f' a
  48. #else1 _8 R4 F6 o% d, q  n2 i
  49. #define DMA_PRINTK( x... )
    2 N/ ~# U0 l7 Q0 X9 O! l; f  N
  50. #define DMA_FN_IN
    : F* t' a( _% t- j$ i9 A9 g# X- l
  51. #define DMA_FN_OUT
    + b  H4 w. p: N$ d. h; {
  52. #endif
    - ?" O  n* z- S% l
  53. $ `2 S7 j7 g: s8 n
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    4 |: Y& M( ^- k: E: A* j# H
  55. #define STATIC_SHIFT                3' }! j3 v; L8 z8 {; c
  56. #define TCINTEN_SHIFT               20
    " X% z- G# |9 f/ ^4 L6 M
  57. #define ITCINTEN_SHIFT              21
    2 X7 g( X3 H. l" h
  58. #define TCCHEN_SHIFT                22
    5 v1 }; G) T8 T7 s) {' w' X
  59. #define ITCCHEN_SHIFT               23. Y5 l+ a- F1 Y) [9 X4 J1 V
  60. " e& S* y" u& }* v% C
  61. static volatile int irqraised1 = 0;
    % X, {7 u3 P1 J1 F0 p" }* S9 w! k
  62. static volatile int irqraised2 = 0;) O# F: R( F4 m

  63. 4 v. _  d& k+ q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, p8 ?) ^7 s* }5 H6 \. b- w+ l
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- k" s; S; B/ i& J2 d9 f# F, W
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 c. B. I: y9 P: R" K+ A5 s

  67. 4 }% _6 B% |: R7 ]. J" T, R
  68. dma_addr_t dmaphyssrc1 = 0;
    7 i+ J0 _' T9 A! G' S
  69. dma_addr_t dmaphyssrc2 = 0;
    % v8 X2 r6 i* `) U$ l
  70. dma_addr_t dmaphysdest1 = 0;2 ?, p9 v6 @2 S' u4 h% V# ?# J
  71. dma_addr_t dmaphysdest2 = 0;0 a. G- h3 P! ^  J/ A
  72. * H/ g1 g% ?  e: A
  73. char *dmabufsrc1 = NULL;
    : b  H7 d; P8 j6 m+ K* S0 Y
  74. char *dmabufsrc2 = NULL;
    : q0 r) `% m9 `- [: }$ E" o
  75. char *dmabufdest1 = NULL;3 ]2 t2 s) p, E+ }# v7 d: m
  76. char *dmabufdest2 = NULL;, g" Y% E9 O' W1 X- ?+ [8 p

  77. 6 F; R+ M: B& a% i- ]1 k
  78. static int acnt = 512;
      R6 T$ w% l5 s
  79. static int bcnt = 8;
    0 T$ h. Z3 q" n  ^. c
  80. static int ccnt = 8;4 \* ^/ X* f3 e% f

  81. ( `# \' @1 L  G' T# V
  82. module_param(acnt, int, S_IRUGO);3 c0 S2 Q9 y# {7 T6 n0 N
  83. module_param(bcnt, int, S_IRUGO);6 O3 y+ y: [7 Z
  84. module_param(ccnt, int, S_IRUGO);
复制代码
" P# w$ W; G' u
% o. ]  N; L/ a% W+ _
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 ]3 j# Z6 i8 u, ?( T2 x5 Z$ U
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( I1 V1 k7 N% O
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# P+ n) F  \; V0 x1 I

( V% R3 Q" l% }' k* H0 _8 h0 ~2 v# f. a+ l  Z* C5 h! \
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-10-16 10:17 , Processed in 0.042692 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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