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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 F5 y. g" v0 C! X' x
  1. [code]EDMA sample test application" P( J7 K. w! s1 h
  2. /*
    / Q; F: i% |3 V7 s, k0 Q0 _. ~
  3. * edma_test.c
    " s3 p& B( T0 S
  4. *
    ; G1 F- d0 u1 |
  5. * brief  EDMA3 Test Application. B/ j! y0 O) V
  6. *5 E9 R! k" z* }9 O% E& I; e& R
  7. *   This file contains EDMA3 Test code.
    5 B, O+ e2 |) H* S. O
  8. *: V7 @% o" ]; |* F- _' k2 p: X
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 u! c  U0 T8 }4 U1 y9 W
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& p' h& t: ~! C
  11. *         TO CHANGE.8 ]: y  S4 `7 U+ l
  12. *- |2 H; j! G* j) h: ^1 k# S
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      a# w. r, A& [; Q# t
  14. *
    + ^8 p$ l+ A) B2 `, r
  15. * This program is free software; you can redistribute it and/or! W7 `- ?1 Y! O. \- o- u, X/ B
  16. * modify it under the terms of the GNU General Public License as
    & ^5 \9 Z% `& |" h- y
  17. * published by the Free Software Foundation version 2.5 P& H6 s7 O& k+ D- H
  18. *! b- W/ r% Z" S( a6 X4 X* X
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ l8 v2 I7 s! I  G6 `. _/ U
  20. * kind, whether express or implied; without even the implied warranty- O2 x5 L" g$ U3 O  s7 Y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the2 M, X' a/ f4 J- P# E3 H7 d1 {. x
  22. * GNU General Public License for more details.
    " W; D- c4 P; r6 m4 ~
  23. */
    7 W+ H  b1 C; ~. a
  24. % Y0 F+ j1 S( g8 ]* \3 Y6 H
  25. #include <linux/module.h>+ f) n1 ^1 d8 b1 @; K# H
  26. #include <linux/init.h>
    & s3 z% R$ R& k- ?3 j1 h) s# n8 m
  27. #include <linux/errno.h>
    ! g# H7 @" I6 h
  28. #include <linux/types.h>
    # K& ]2 N0 H+ e/ {1 e. c
  29. #include <linux/interrupt.h>
    : B# g0 w, \! |( R0 ]
  30. #include <asm/io.h>7 K1 x  x( p# M1 Q- K# A4 y
  31. #include <linux/moduleparam.h>
    2 `# b5 O9 i6 {0 v: y" X; H) d
  32. #include <linux/sysctl.h>* s* K5 I, x3 J/ g8 {9 X& u
  33. #include <linux/mm.h>
    8 E, \7 Y, y: Y8 `$ Q
  34. #include <linux/dma-mapping.h>' o* I0 s: h; \* ]; m, l0 |
  35. % A" i) I4 X, n
  36. #include <mach/memory.h>" N0 H3 k1 E& L  |0 g5 K
  37. #include <mach/hardware.h>$ O$ w  h, M8 K1 n; b9 U, [, k
  38. #include <mach/irqs.h>* \- s% ^, V- O3 b6 d
  39. #include <asm/hardware/edma.h>
    1 I  N# V7 S8 P& j5 M% G/ B* h. d  q

  40. ' S# N1 n* o7 m# S1 w% G
  41. #undef EDMA3_DEBUG8 R1 G7 M) Z$ V+ J, V" D
  42. /*#define EDMA3_DEBUG*/! Y8 I: l9 m. t$ I& [6 r, L4 l& J

  43. # {( t  S6 b% L9 U! V
  44. #ifdef EDMA3_DEBUG
    2 s! B/ p- n8 G, ~8 X) j
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    4 U: _( C- {4 P  g. G! j: x2 B
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); P( Q0 b. C: g/ F  X
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* O6 n8 G" G3 K- g( R# \
  48. #else
    9 C) g( L" R" C: A. ~. E" {. _& ]7 y
  49. #define DMA_PRINTK( x... )
    ' F- [0 K  V# S  F2 m4 G
  50. #define DMA_FN_IN4 J# K6 I9 `+ W' v0 r
  51. #define DMA_FN_OUT
      C/ v8 V. [% G2 G6 ~
  52. #endif
    / S1 ~3 g( {& z* Q% F

  53. 7 O& o# X- J, B4 ]
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ) V3 h7 I. P- m0 P
  55. #define STATIC_SHIFT                3- k1 o# ^% _. F& p/ U. l
  56. #define TCINTEN_SHIFT               202 e7 @" X! D* ?5 t* ?
  57. #define ITCINTEN_SHIFT              21& H1 T: Q& t+ U7 K3 ]$ j
  58. #define TCCHEN_SHIFT                22
    . Y8 i( r/ u* x7 m  c
  59. #define ITCCHEN_SHIFT               23
    - [; D0 q: y5 y( w0 l
  60. / x1 d6 \4 m' y5 L9 W4 B) v* n
  61. static volatile int irqraised1 = 0;
    3 j0 y0 G9 i) h& \' f
  62. static volatile int irqraised2 = 0;2 M- F) D5 W2 A. t( Y( N/ e5 h

  63. - d' ]; S8 U* v. z1 u. p2 p  i
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" O7 C! t" w. D# [/ ?$ {" n) f
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& b( d- y8 C" Z9 R
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , W/ v, }; O, [% h, l0 R. b. X
  67. , [- _3 o! E' \- s, O/ t
  68. dma_addr_t dmaphyssrc1 = 0;
    $ w' e; W! C9 _
  69. dma_addr_t dmaphyssrc2 = 0;
    1 Q' D) T/ u& k4 J1 ^
  70. dma_addr_t dmaphysdest1 = 0;
    3 x/ A, t6 V# a) p7 v+ }6 G
  71. dma_addr_t dmaphysdest2 = 0;
    # N3 u# g* M2 v3 h

  72. 9 s" X- l0 C9 B& }( `6 H  d6 E( A4 f
  73. char *dmabufsrc1 = NULL;$ R- _6 k1 u9 _( N4 O8 x$ f
  74. char *dmabufsrc2 = NULL;
    0 e8 |( _8 f/ g
  75. char *dmabufdest1 = NULL;
    , z3 \7 g, ^  x  G) ]
  76. char *dmabufdest2 = NULL;; v: P5 }2 ?9 D2 a3 d& {

  77. 9 y# |3 E1 R% u9 p( w& N6 ^6 m1 M" f
  78. static int acnt = 512;
    * F2 x, [. U- s
  79. static int bcnt = 8;
    ' i$ N  z5 ]7 j- m% X1 d
  80. static int ccnt = 8;
    # A1 }+ m: D  t7 g. o# g4 A% T
  81. % X( C( ~! r/ z; t6 o1 L' _. O
  82. module_param(acnt, int, S_IRUGO);! w* I% O7 k, z3 F- z, }9 B
  83. module_param(bcnt, int, S_IRUGO);
    6 i: j+ U' U: N/ |6 r) B/ |
  84. module_param(ccnt, int, S_IRUGO);
复制代码
# s6 \* p! ]3 [! R5 q: s
( j9 z4 D) f/ E& A5 J& V
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ r( a0 X; {3 ^5 c3 q" Y) Q+ ?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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ i" ^+ p; v' g: w3 q' Z" V; D4 h
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" T6 `" U( v2 g( a
# Q$ x% f. n: n5 }4 R% ^2 h/ T
& z6 w# {! n# t# w, i* Y- p
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-4 15:19 , Processed in 0.046157 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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