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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. l0 [  F# p% s' [  U- ~5 M5 r8 l
  1. [code]EDMA sample test application
    5 u- S1 A6 M% s( s- m8 J
  2. /*
    + H( O) E* b1 L' ~1 G0 f* d
  3. * edma_test.c
    6 V5 v' B8 P& E
  4. *
    ; f; }* ]) T6 B
  5. * brief  EDMA3 Test Application
    . S; F7 s( R/ y1 @
  6. *
    - m* i4 F, |5 X, v
  7. *   This file contains EDMA3 Test code.
    * R2 T' ^( `: l
  8. *. }) }9 i8 e6 O( Q3 ?  }
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    , e/ [/ }  I; D, w  g# f, S* }
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 V- p) X2 s: X7 F0 c
  11. *         TO CHANGE.
    6 H; }: w# W/ M& V! F
  12. *
    $ R8 }9 }: j3 Q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ) m0 @$ P( j. X! g* u
  14. *
    0 A" L+ q3 C" c9 B
  15. * This program is free software; you can redistribute it and/or. }! A1 k% v" h
  16. * modify it under the terms of the GNU General Public License as
    $ ?8 A8 o2 N1 k  _0 o
  17. * published by the Free Software Foundation version 2." y- d6 P$ ~$ y9 T/ }/ G7 F& l
  18. *
    $ x: ^; M: w& ]7 i: d
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 ?9 a  {$ z! r7 |6 _/ S
  20. * kind, whether express or implied; without even the implied warranty# b, B' P+ U% e3 D+ H& u# F8 @& R
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the& I. e2 B5 K. V4 x4 M1 h, o
  22. * GNU General Public License for more details.1 Q/ z4 h" W& U' W; c0 J
  23. */6 Z2 T+ j0 Y: g- O) _* s- M% {( t

  24. % k/ j0 [6 b/ o8 [+ g( c. F
  25. #include <linux/module.h>
    + x4 M% F6 U1 T. p
  26. #include <linux/init.h>
    - l+ z) E9 f& C9 e, |: z
  27. #include <linux/errno.h>
    : {  c. h/ ~( H
  28. #include <linux/types.h>0 W% C, d6 W* d1 K& L
  29. #include <linux/interrupt.h>
    0 B/ l: X% v! F* {
  30. #include <asm/io.h>+ d6 ~1 V( O6 M- j; W
  31. #include <linux/moduleparam.h>( E2 |4 Z$ w5 v
  32. #include <linux/sysctl.h>
    8 B' W# G: t1 e& Z
  33. #include <linux/mm.h>
    0 t3 h4 ^4 K$ U; g" K5 a
  34. #include <linux/dma-mapping.h>' X7 ^: d' Q& v  Z  L$ e

  35. 4 h5 ~; C* z- F% n- Q
  36. #include <mach/memory.h>
    9 S3 e; R1 a3 O) o/ R- K
  37. #include <mach/hardware.h>4 e! N7 `2 w$ S; \( w' I
  38. #include <mach/irqs.h>
    % @- ~9 o$ h3 j4 P* L4 K
  39. #include <asm/hardware/edma.h>
    3 ]9 V+ W( g6 M. ~) Y) i
  40. 3 Y, g. _( s) i. u3 P1 |; e2 y
  41. #undef EDMA3_DEBUG# }! S6 j6 k# ~  }9 f2 i) w4 P
  42. /*#define EDMA3_DEBUG*/
    2 h5 m/ c( i# k
  43. 6 p8 b4 p% }; H* {9 w' a1 \) X
  44. #ifdef EDMA3_DEBUG: T/ A2 E* C4 [7 x, W. W! g# C
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" n5 M4 n/ T9 k/ Q) u
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" h( F! [  J) o: r
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % ?6 d7 q1 ~# b- T+ L
  48. #else- i1 P) n6 e5 p
  49. #define DMA_PRINTK( x... )
    $ R: b( d4 q6 \3 v$ t
  50. #define DMA_FN_IN" y# c. N4 C: T3 y+ E
  51. #define DMA_FN_OUT
      f! ]5 N, O6 Z( o$ m9 G" _
  52. #endif6 n+ f& c5 U( `: Z) b6 Z/ R3 e4 T
  53. ( D# _6 o$ p* z1 h! R' f
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)! ^% a- K' Z  Z, V1 B1 n
  55. #define STATIC_SHIFT                34 m, N! E8 A% H9 G/ O
  56. #define TCINTEN_SHIFT               20
    # a* V: T; U, C
  57. #define ITCINTEN_SHIFT              21! J3 X1 [$ B1 |  o6 P6 `
  58. #define TCCHEN_SHIFT                22+ S8 @  Z. l- e1 F0 T  p, W) b
  59. #define ITCCHEN_SHIFT               23. V- m3 e" W6 a9 [  i( k; `
  60. " A7 U4 w6 n- ^, \7 Q* M
  61. static volatile int irqraised1 = 0;7 C& _# w  v# `3 ?/ ]( I
  62. static volatile int irqraised2 = 0;
    8 V! D- Q. x* Q" d' k- ?( B" G
  63. " m3 n# n" G9 i1 B
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- o+ I, T6 b7 J1 T9 G
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 O9 ^% D# S. Y2 D
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # K% x4 t* N: @9 X* g

  67. / J: ?: L4 C( e4 `- J: D
  68. dma_addr_t dmaphyssrc1 = 0;7 l9 ?2 J& x# D8 d
  69. dma_addr_t dmaphyssrc2 = 0;- T9 ~8 V. ?9 h) H# o  x( c
  70. dma_addr_t dmaphysdest1 = 0;5 l) C! L* }5 h( N
  71. dma_addr_t dmaphysdest2 = 0;' D) m$ |' H7 N' T) c& G9 ~5 J% z3 K

  72. , t: E8 Q; E! n$ p7 t
  73. char *dmabufsrc1 = NULL;; O5 R6 n" X7 g9 B# w( j
  74. char *dmabufsrc2 = NULL;* S4 H5 t' O9 n. g8 K
  75. char *dmabufdest1 = NULL;
    * i9 R" F; r( G8 y+ J( E" M
  76. char *dmabufdest2 = NULL;0 u2 [' k# _' _7 N* r
  77. . \( w, O9 o0 T2 ?7 v1 F
  78. static int acnt = 512;5 I+ M8 @% s' d
  79. static int bcnt = 8;9 x4 ~6 `+ m$ g, F
  80. static int ccnt = 8;
    # w( _: O: E$ H) X
  81. # C' r: Q8 d2 M1 f4 f+ h/ w& s! @& R
  82. module_param(acnt, int, S_IRUGO);
    2 k" f* n! C2 x- Z' F0 C3 T
  83. module_param(bcnt, int, S_IRUGO);- i3 H' ^% Y9 ?8 i
  84. module_param(ccnt, int, S_IRUGO);
复制代码
) f, r5 Z7 B7 p% R# @9 u7 V
$ N6 ^: k, |& v6 K0 F' u
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用  E3 P  Q4 S9 j# x% |
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 [& }, ~, a, e, }
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 }/ Y) i1 A. x( N7 M

1 w( k7 A" w2 [6 l: E
; a" J  p; [9 n/ h! d- G
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-5-9 11:19 , Processed in 0.039117 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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