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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 K( z( o$ D& s0 j9 v4 C8 u! l
  1. [code]EDMA sample test application
    ( c' D+ |' r# G9 k) ^- u
  2. /*9 m5 [/ e1 b1 O% \- x% R( i8 e
  3. * edma_test.c
    + @  c9 p" m7 E5 _2 o5 p% {
  4. *
    % M* x* z+ u1 V4 E0 P7 E* J
  5. * brief  EDMA3 Test Application) Q3 n1 G" s0 u( Q* C: f* W: c& L4 T$ H
  6. *
    % \+ J3 u- R- w2 ~% |) t
  7. *   This file contains EDMA3 Test code.
    ; }7 S0 {5 w$ P  `' o  F4 Z  v
  8. *
    5 T& M% K  a  ^: m
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    9 D- _( Q8 i' C* C9 b: H
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    3 h& n8 v8 t7 e5 v3 z
  11. *         TO CHANGE.3 O: Y0 m# @5 H" T. A+ O
  12. *
    % x# `4 H0 ?9 n+ C+ K
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    & c3 F5 R7 ~+ t2 i4 y, k! d+ n
  14. *
      ~0 a" Y8 R& c" [0 {
  15. * This program is free software; you can redistribute it and/or$ H9 r* e) Y) K( e6 }- g! |
  16. * modify it under the terms of the GNU General Public License as
    9 t* L+ E3 d3 ^) r
  17. * published by the Free Software Foundation version 2.6 U& E! r  J' k& o- m; x
  18. *
    ! C0 U. V! M! P2 M1 V0 l0 C
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any. R! D, @0 g( ~* v3 E
  20. * kind, whether express or implied; without even the implied warranty
    ; {/ b, b6 C" C* K$ [
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 Z- S2 L7 A/ y  w# f+ f' D
  22. * GNU General Public License for more details.- C. X8 K" s- G& ]9 f
  23. */. b( p. R' ~) j; L7 A9 Z

  24. 2 K  u2 {1 P+ O% H, z3 E9 F4 |$ y
  25. #include <linux/module.h>0 o; Y  G/ x8 d1 M
  26. #include <linux/init.h>
    : h+ a4 O2 V& k3 h/ \4 k3 [+ E: p
  27. #include <linux/errno.h>
    7 `" r# b: E; x5 l" c" u0 C
  28. #include <linux/types.h>/ \% C% G, l% Y0 b. d
  29. #include <linux/interrupt.h>
    3 Z0 P! ~; m  _- x4 I3 m1 s+ E' O
  30. #include <asm/io.h>8 a& r1 @7 _* l- Z+ U( m/ X! y* u
  31. #include <linux/moduleparam.h>) ^5 O4 ], k- `+ U
  32. #include <linux/sysctl.h>
    # c+ x% j; ?: e9 k* f' x
  33. #include <linux/mm.h>
    - t& s+ y% W" y1 s7 m9 F
  34. #include <linux/dma-mapping.h>
    ( u' e6 P& W0 ^
  35. , ^; n- W. O" h- [
  36. #include <mach/memory.h>
    / T1 Y( P" }: Y  s& K. K- t
  37. #include <mach/hardware.h>
    8 w2 g$ V7 f  q+ a* E! V# e2 J
  38. #include <mach/irqs.h>1 S+ m, W$ x9 H
  39. #include <asm/hardware/edma.h>, i" R% c; R6 _+ c% ~
  40. : l/ K- M. G+ T4 j2 f4 A, H
  41. #undef EDMA3_DEBUG
    6 @0 W# e" }% N
  42. /*#define EDMA3_DEBUG*/
    4 X- J5 V% \8 E# p% j  V8 i- r

  43. % E, C; K+ e7 F( ?" L# w
  44. #ifdef EDMA3_DEBUG7 n7 z7 b% }7 H% d2 \$ l
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    : {3 [. L/ x: v
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' Q. O% W4 f" H+ F6 x: k
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); ~; c  Y- m4 m  ]4 ^* N/ r' N
  48. #else
    # l4 J! x' B5 }: L2 A# V
  49. #define DMA_PRINTK( x... )
    2 |. ]5 I7 j7 t% C& W8 O
  50. #define DMA_FN_IN) e1 ~" r, y$ F4 ]: l# }
  51. #define DMA_FN_OUT/ R$ N# {. B( I/ C
  52. #endif
    & l+ M2 K+ |* I" b. t5 E; i' I

  53. ; T0 A3 S$ ~" h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)) O) j. d' P7 X; B
  55. #define STATIC_SHIFT                3+ V/ `! b! S$ A8 s
  56. #define TCINTEN_SHIFT               20, _# n, g0 D2 R
  57. #define ITCINTEN_SHIFT              21! h; j- S2 p1 t2 |
  58. #define TCCHEN_SHIFT                22
    6 w% a5 B9 Y/ o3 R9 e
  59. #define ITCCHEN_SHIFT               23; I6 m  p/ t% E
  60.   N: x  o7 ^5 ?: P5 _
  61. static volatile int irqraised1 = 0;+ g0 y: r0 L& ?' D4 I7 e
  62. static volatile int irqraised2 = 0;
    % L. f6 k5 I7 f3 t2 g* c" g8 s- s

  63. ' W& l/ U6 }. ]& W
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 E; C4 m0 y3 V) Y/ j; Z+ f
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 V- d. j6 j7 r" C% W" Y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 \+ |8 j) v: k

  67. % b) D. M' x2 P3 h0 S9 m( z- q( n
  68. dma_addr_t dmaphyssrc1 = 0;
    7 G/ z9 P+ t& s, @: z5 V% |  T
  69. dma_addr_t dmaphyssrc2 = 0;+ S0 n) z0 ~8 G, c* n8 m/ ^/ B
  70. dma_addr_t dmaphysdest1 = 0;  |* j7 Z/ E- _8 K
  71. dma_addr_t dmaphysdest2 = 0;
    , l  u% L1 n3 w( P; S1 o* K. W

  72. : o# v$ f" l2 O% e
  73. char *dmabufsrc1 = NULL;
    3 W# u7 J2 g8 [; p' }
  74. char *dmabufsrc2 = NULL;
    6 g  s9 R. X0 [! f# E: d: B  E
  75. char *dmabufdest1 = NULL;
    4 z2 R9 J$ u( a8 f4 ~3 }* ?( P" f
  76. char *dmabufdest2 = NULL;+ d$ a8 }3 d% T

  77. & K- u& z  L" X+ \2 d8 Y" `
  78. static int acnt = 512;
    $ o" M, Y! s$ |
  79. static int bcnt = 8;) W/ e7 F! l9 Y6 {
  80. static int ccnt = 8;1 Q1 n' y2 N7 `. D
  81. / w+ N# l$ v9 J( e3 ^3 L3 o
  82. module_param(acnt, int, S_IRUGO);  W, N0 ]- F, `
  83. module_param(bcnt, int, S_IRUGO);
    6 |. j& Y2 k* U& c
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; {3 R- d/ H7 d
5 S! g+ D1 A* G% v3 U
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& \- t4 J) j* D" P0 x* h
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ V+ _4 o$ k# n; R+ o+ Y( t     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 l0 R% _$ f5 @

' {# T' P) a9 p3 }
! Z. }1 n, H2 `, @. j7 T. k
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-13 12:18 , Processed in 0.038645 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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