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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 D* V, j  O  z  z3 y% U, z
  1. [code]EDMA sample test application& |* S& C) W/ \% R
  2. /*( e* g$ `3 i$ L4 ?, J  k
  3. * edma_test.c0 j3 x' O: c5 D0 V. F2 D
  4. */ J4 G# ?* z0 Y% D/ Y  U: d
  5. * brief  EDMA3 Test Application
    ( _$ D4 B/ [* I9 Z0 Y# p( T" u, l
  6. *
    $ T1 P6 @- H5 x& G' j) P# F
  7. *   This file contains EDMA3 Test code.2 s# Q/ S7 b4 C8 H; B
  8. *0 b8 J4 _5 L' O7 O+ D" b+ r
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ' i2 t) I1 w* a9 i; m
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    $ y2 b6 b% d" [; v1 G/ h' A5 i
  11. *         TO CHANGE.
    - l- c3 d/ U1 m' E& `
  12. *
    & d  a, [% R) c# s8 ]
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    9 x8 w" h( u5 F9 }- ?! a/ V7 h
  14. *1 d5 I" v# e% w( `
  15. * This program is free software; you can redistribute it and/or' n5 D8 ?9 j  C) i# z# |0 W
  16. * modify it under the terms of the GNU General Public License as+ O! x3 z/ z& A9 b& A. s! B; p
  17. * published by the Free Software Foundation version 2.- `& R/ B! j! s, O' b2 j4 l
  18. *. A' t, f/ l. d: ^  `9 l6 D( g
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    : v) m" f2 p( Y- ?4 i$ A
  20. * kind, whether express or implied; without even the implied warranty6 o9 [2 F  j8 Z; {( a9 d9 N1 E, w
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    , C: w1 z8 |4 i) B; K9 y
  22. * GNU General Public License for more details.
    4 F2 [. ^# e$ a; M% F; q4 N
  23. */
    ( g+ O! B  b, v5 `6 {5 W

  24. 9 e) \9 s/ J+ P3 M; V" l
  25. #include <linux/module.h>, n0 J: U" s5 H( t
  26. #include <linux/init.h>
    5 ?: ?) G8 k2 y& }  W
  27. #include <linux/errno.h>0 J# r7 J/ W5 l* Z
  28. #include <linux/types.h>
    ! j5 v) ^1 e% W! ~, e& g# F
  29. #include <linux/interrupt.h>
    ( p- v5 R. n  U+ W) S: x$ l  ?% X+ O! h
  30. #include <asm/io.h>
    / w9 z' m; \5 i# d) h$ m( M
  31. #include <linux/moduleparam.h>' J0 L4 e' D$ }9 d7 f) K+ v5 u. H
  32. #include <linux/sysctl.h>6 V9 R* z, A- `& o$ J+ W+ a
  33. #include <linux/mm.h>2 _/ O  q" e3 |# u; t" m
  34. #include <linux/dma-mapping.h>
    * x# e. o+ f  A
  35. 5 K7 ]( ~) Z4 r( {4 O
  36. #include <mach/memory.h>( ^2 u# g) I, H! E4 K( u
  37. #include <mach/hardware.h>, U- @1 |* l* M# W" h& n, w
  38. #include <mach/irqs.h>2 F2 K; m, D/ ?2 q% y
  39. #include <asm/hardware/edma.h>
    ! P' B8 i$ \2 P8 y& R1 ]

  40. ! O  b  W! f% `; |1 X' ^2 L5 m
  41. #undef EDMA3_DEBUG
    4 l/ s7 H; d7 B1 {* h2 @
  42. /*#define EDMA3_DEBUG*/0 p' P$ y2 F6 e* b: Y

  43. . H0 `6 U, ]& d1 d& u
  44. #ifdef EDMA3_DEBUG
    " I  W5 ?6 I& t( F% q: {
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    3 Q$ W) L" I; T
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    0 H, N6 `  n0 N0 L: W9 m
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" a# y) Q2 x  Y0 D5 x( Y
  48. #else
    " i# ~6 |5 c7 k% J6 a- Y4 P; g
  49. #define DMA_PRINTK( x... )% H9 h$ |. o! c/ H- h9 L
  50. #define DMA_FN_IN$ n5 |* e$ X. Z0 e4 b
  51. #define DMA_FN_OUT; _- K, ]0 J+ L  W2 o* O6 s
  52. #endif
    ; m5 K# C1 B/ y8 q: L. r, G
  53. ! J8 |- i8 N9 m0 Y( N: G; J- L
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    & M! D7 h$ b* T4 A7 ^6 k8 D8 \/ e# a
  55. #define STATIC_SHIFT                3
    . ^. e- F4 Q( M: D- q: x
  56. #define TCINTEN_SHIFT               200 E2 o, w8 z% f
  57. #define ITCINTEN_SHIFT              214 }; k0 Z7 }* F% H( y
  58. #define TCCHEN_SHIFT                22' N3 z7 H8 h8 E' L% @* U' N' u
  59. #define ITCCHEN_SHIFT               23
    ! r$ j7 |6 r; [8 {+ w" ^) n, _# [
  60. ) r8 M. _# Z7 D, D
  61. static volatile int irqraised1 = 0;- H4 z2 A: R2 l1 t
  62. static volatile int irqraised2 = 0;
    - Y1 T* d0 B. S( o% D

  63. / L' W0 n  r- v  h) M/ s. _7 o  }% Q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- t3 |+ u8 _/ u8 a% ~
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      X) d2 g8 `! x+ l! R1 {0 q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) q. m! M# y2 x4 ^8 K

  67. 0 c0 T& Z# Q- s  K
  68. dma_addr_t dmaphyssrc1 = 0;; E; B4 c' r. e' f- {% P
  69. dma_addr_t dmaphyssrc2 = 0;8 k! C/ S1 r4 ?, n" Z2 a. R
  70. dma_addr_t dmaphysdest1 = 0;
    4 V) [9 t) H0 j: p, y" M+ A
  71. dma_addr_t dmaphysdest2 = 0;
    $ p( T) m6 z& u3 k6 P
  72. 4 y3 V  E! E" W* e  y
  73. char *dmabufsrc1 = NULL;4 P7 m0 _$ c, D0 M/ Q" M. @2 A
  74. char *dmabufsrc2 = NULL;1 I; e, k& P: |7 R
  75. char *dmabufdest1 = NULL;
    . r1 x, E: t8 C$ r6 e
  76. char *dmabufdest2 = NULL;4 Q  }3 [6 m5 _2 i9 x6 |

  77. 7 i: t- |* ^3 w* Z
  78. static int acnt = 512;
    7 o" D' x4 h  `1 U
  79. static int bcnt = 8;
    3 h8 g' r* c4 Q. P
  80. static int ccnt = 8;
    8 W& h" A, U1 N5 s8 V# h7 h' `' F

  81. 8 A. A0 {; ^, T2 [. n
  82. module_param(acnt, int, S_IRUGO);
    ; r4 X( h' \% `5 H6 g
  83. module_param(bcnt, int, S_IRUGO);  V1 |9 ?- R( s% f* a- _2 Q7 k
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 E! l" E$ D, b9 V/ H/ I$ O# I
; n8 _& o: ]/ k' f* }, x
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 N# g) f/ ?+ H- J6 r: x9 R
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: s. O( q6 z; C& _" X
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( i( y" k: i" ]" z( C2 V% M. i' Y) q; Q9 W
% V3 k& u/ P  K9 O4 c

" U4 e& d: f) w8 @0 B# x$ }. G. ]' _
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-3 02:46 , Processed in 0.035333 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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