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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * B  N8 G# s; }2 q& R7 Q+ ^" @
  1. [code]EDMA sample test application5 {6 M6 x# V/ _+ b2 h, U% q) V4 D3 v5 g
  2. /*
    * B% @4 E+ o, t% k
  3. * edma_test.c  }7 D* C4 G/ l9 W
  4. *3 W5 x: U- h6 ~* o/ w
  5. * brief  EDMA3 Test Application( q# f+ B# @! B( k6 K7 }& m( _
  6. *& V  D- v8 o; z
  7. *   This file contains EDMA3 Test code.
    / q  p2 n+ q( ^
  8. *
    , G+ n4 m3 s3 _# j7 r
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      `: Z; F2 r9 Z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) X8 V' a1 q2 w) Y+ w7 M4 U
  11. *         TO CHANGE.3 Q7 v7 R6 T" Y7 z- D) V
  12. *
    % @$ }. g9 K9 ^9 e+ E$ g( Z; K
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " h( ]& ~) v$ V7 Q4 z( I
  14. *
    2 ?. ?+ u. m- N1 X+ d1 ^; \
  15. * This program is free software; you can redistribute it and/or
    0 h& V8 v& i6 O# Z- C. ]# {
  16. * modify it under the terms of the GNU General Public License as
    + ?) Q( j/ R* }8 y/ I7 V3 V0 A
  17. * published by the Free Software Foundation version 2.: V( |  a7 T/ j2 j/ G2 S
  18. *
    ' ?* |" A0 T( {' J( j& u
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 z/ S1 V8 l. o8 M# d) _
  20. * kind, whether express or implied; without even the implied warranty
      w8 k; B8 {6 _1 y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- Y9 C( Z6 ~6 h& K1 r9 f
  22. * GNU General Public License for more details.- C3 w: O: t0 M  }  A1 m3 ]
  23. */# t& e5 w3 D7 T& |+ v& R7 e) c. T
  24. - y/ `6 s$ h  r! f
  25. #include <linux/module.h>
    9 w5 m- Q7 S6 F9 A0 X' Y
  26. #include <linux/init.h>% D. ]4 r" J( u; }  y
  27. #include <linux/errno.h>! }9 ?, E0 s  C! _
  28. #include <linux/types.h>
    , e1 R, r1 X) ~
  29. #include <linux/interrupt.h>
    - c( R8 [$ S4 V1 G" I- r
  30. #include <asm/io.h>
    3 V3 s; B2 q. b& ^4 R5 Y- S* V. _: I
  31. #include <linux/moduleparam.h>5 _' Y& g' E& ?+ p, y5 Z: j4 k
  32. #include <linux/sysctl.h>
    4 l3 g/ l3 V$ w  Z( l2 J' J
  33. #include <linux/mm.h>( q9 R1 F1 ^( L; t$ ]
  34. #include <linux/dma-mapping.h>8 n# v+ ~# _& g1 [8 r, |, g) w

  35. : G6 E4 a, _8 I
  36. #include <mach/memory.h>
    + C% `& k( v8 L% L4 u# G: W
  37. #include <mach/hardware.h>
    4 f3 V0 _8 K- C- W$ I9 Z
  38. #include <mach/irqs.h>
    . @/ U- Q- t2 L3 v  V
  39. #include <asm/hardware/edma.h>3 c+ y. ?; V4 y) e7 N

  40. % k" U" c$ i9 [2 \' t; E  h
  41. #undef EDMA3_DEBUG8 F2 O& a) @4 w6 Q$ w% H5 K
  42. /*#define EDMA3_DEBUG*/
    6 h, K5 w2 A2 Q. R

  43. # ~1 c5 W% |) x) S0 g/ I
  44. #ifdef EDMA3_DEBUG2 x- D" D# ]* k3 B  D1 R" r
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& Z9 o* O! h7 M* D& j& S
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ) a+ J+ P$ l. A1 [
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    4 J8 {6 \1 ~  [7 B$ o
  48. #else
    5 F! t2 V/ M( s# D) M# E
  49. #define DMA_PRINTK( x... )
    4 Y' }$ ^2 }! z+ j/ F4 ^# r6 V! B' B
  50. #define DMA_FN_IN3 ~3 B% u" t8 J0 o+ ~) s
  51. #define DMA_FN_OUT/ h: e2 Q' L/ u9 p" ]
  52. #endif
    9 f" F3 i( N  K6 N* v
  53. - H4 J; J% t  Q+ B
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): u$ [; F$ L5 m; Q: C
  55. #define STATIC_SHIFT                3( Y$ O3 g/ Q4 c, b" t2 ^
  56. #define TCINTEN_SHIFT               20
    1 P  R2 \/ T& M9 X2 g
  57. #define ITCINTEN_SHIFT              21
    " t7 t) M5 q# r5 @+ e! |: y; w
  58. #define TCCHEN_SHIFT                22" }) w& S+ x6 |* o
  59. #define ITCCHEN_SHIFT               23
    5 j8 H9 k" B3 G1 Z8 S; e2 E' h
  60. % z- n+ h' h* U) F
  61. static volatile int irqraised1 = 0;
    9 m! O! Y2 k# O2 v) q
  62. static volatile int irqraised2 = 0;2 \) S8 w8 I; U, @

  63. ' W' ~) x6 A. w9 \4 c" w& n6 S
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 v2 g8 b: l: p
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ r- Z' ]& B+ J
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" [; U' B) r# p, m: {% M& U
  67. 0 H" S3 L# G' D/ E
  68. dma_addr_t dmaphyssrc1 = 0;  y2 M  [$ X# l& J
  69. dma_addr_t dmaphyssrc2 = 0;
    ; m6 V( q; C: y* y% A) Y9 j6 V
  70. dma_addr_t dmaphysdest1 = 0;
    1 j' `& |0 ]! g+ t* I
  71. dma_addr_t dmaphysdest2 = 0;& b' s* i# z8 w* r% r
  72. & g6 s$ F, o8 D# M! V4 a% N
  73. char *dmabufsrc1 = NULL;
    $ |; T" q' e+ `2 {" D! W+ C
  74. char *dmabufsrc2 = NULL;+ @0 ?0 N$ Z4 b
  75. char *dmabufdest1 = NULL;$ s- |! m( L: \! B
  76. char *dmabufdest2 = NULL;
    2 L( z/ V/ J0 y0 K( @
  77. 0 E0 q2 I# G/ Q/ b& d/ g
  78. static int acnt = 512;% D0 q9 N* R5 h# O
  79. static int bcnt = 8;! }5 C0 C  d5 ~; g1 c
  80. static int ccnt = 8;; L# S" w- W' f& T; {
  81. 9 S$ E# o$ W* k+ @9 ^
  82. module_param(acnt, int, S_IRUGO);
    . Y1 |8 K$ h( C/ ~
  83. module_param(bcnt, int, S_IRUGO);7 z! T0 q) G" s' x& y9 J6 h
  84. module_param(ccnt, int, S_IRUGO);
复制代码

+ f% p8 ~0 f0 v) T  y) [6 B) h+ O& @
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' l6 n+ P; L! D  karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# \7 H2 ^. [7 c     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( F7 V2 B0 I9 V. g. L+ Q7 f! v- [
& w$ {* u; f$ j0 D9 {  D
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-27 21:15 , Processed in 0.040313 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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