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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! B9 ]1 `' v2 d
  1. [code]EDMA sample test application3 g5 _: ^% v2 L3 |# ~( S& e
  2. /*5 u" O% [$ B6 g- i
  3. * edma_test.c' t& @+ S3 W1 N, n" O. v
  4. *" n4 D: ?) i$ l8 z, X! B
  5. * brief  EDMA3 Test Application' O3 j* N# b3 p8 R$ n
  6. *" X2 h1 ]+ ]# _, a" W5 M* F
  7. *   This file contains EDMA3 Test code.
    " F' ^8 J6 l( b9 h. _7 Z" j' X
  8. *
    7 s4 ?/ P/ I3 }3 m$ Y5 g3 E
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' `3 c  u% k, w, c$ L
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. p* O2 u3 o' R7 e: B5 N5 e$ |
  11. *         TO CHANGE.
    ! D! b1 V- d, p$ L+ K0 P0 e% `
  12. *
    % X0 ^! Z8 c( z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    : F4 U+ y$ |. x* V" E
  14. *: S3 W+ q4 o* W0 [% c
  15. * This program is free software; you can redistribute it and/or
    8 y8 P0 k% e5 ~2 Z
  16. * modify it under the terms of the GNU General Public License as
    8 ?. R5 d0 J( z+ y
  17. * published by the Free Software Foundation version 2., @1 n0 _7 m  I' C, h2 v9 u- _: [
  18. *
    8 s0 t: @: x4 {0 g% {( _  }
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ z9 k' }) I1 D" u- R
  20. * kind, whether express or implied; without even the implied warranty
    + _9 w3 ^' o7 p0 }
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the1 P% U$ u+ ^8 ]4 }
  22. * GNU General Public License for more details.
    * z+ q6 k+ f7 e( j# U0 M
  23. */- A3 P7 Q6 ^6 l' |* A) v& b8 ]& _

  24. ' L* H% p+ o' E& O* i+ ~
  25. #include <linux/module.h>
    1 y9 j' V' ^# |- l: a4 D
  26. #include <linux/init.h>
    1 A0 `9 ?- H7 |0 ]( e6 O
  27. #include <linux/errno.h>$ i9 y) {- U. Z; H! U
  28. #include <linux/types.h>
    : E  D# J; R4 P& W
  29. #include <linux/interrupt.h>* y$ R1 L0 U' M& y
  30. #include <asm/io.h>
    $ y7 S1 r. x- v7 k. Z2 Z
  31. #include <linux/moduleparam.h>) q- Q" J8 |& {
  32. #include <linux/sysctl.h>( c( ^9 C; I3 q  ]% f5 u' b
  33. #include <linux/mm.h>
    2 X& y9 V2 }; n
  34. #include <linux/dma-mapping.h>
    % s  D  b/ e# A

  35. * C' S' p$ |/ Y5 Y
  36. #include <mach/memory.h>
    9 @& j; v- J& V( `
  37. #include <mach/hardware.h>
    ' z4 j$ Z: t" j" s
  38. #include <mach/irqs.h>
    , R  Q% K) f: O' Y- _
  39. #include <asm/hardware/edma.h>
    ; o/ U. }, y; h! f5 G0 K
  40. 4 q  v# ]5 R  |4 y# r0 F
  41. #undef EDMA3_DEBUG! p2 Q" P$ Q# v/ b# d0 e
  42. /*#define EDMA3_DEBUG*/
    : G; p5 h$ V0 i( {" T# P! Y, l
  43. 4 E7 M4 m# U/ i0 \& ]+ e
  44. #ifdef EDMA3_DEBUG; x+ O# U8 N. S  e# m
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    3 t, I9 W: c1 d' f# ?
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): Y" r# [6 H5 B' @9 o, S8 r
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 X: N8 W0 B  C! g' S( x
  48. #else& r$ ?& y1 X' j5 @
  49. #define DMA_PRINTK( x... )+ A, a8 ?7 t/ ~+ r7 y6 R; p! F' C3 n
  50. #define DMA_FN_IN
    8 t6 F/ S4 @4 K0 B
  51. #define DMA_FN_OUT
    / U% b/ j5 C2 c
  52. #endif
    ( E% r8 d% Q6 y# L

  53. : {4 i# i7 q# c' G. ]7 }% t2 o
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 p6 |: H4 F6 H0 g  w0 C9 @
  55. #define STATIC_SHIFT                3
    : a; E2 y# [( b# F$ f% S
  56. #define TCINTEN_SHIFT               20# f% c5 d/ }" E1 s3 Q
  57. #define ITCINTEN_SHIFT              215 N) [, b5 `/ K+ O
  58. #define TCCHEN_SHIFT                22
    ! \8 n( T9 d+ M* R
  59. #define ITCCHEN_SHIFT               231 S. ]) h; {- [9 f8 @  N3 L

  60. ! A) `1 b8 |: H0 s. z
  61. static volatile int irqraised1 = 0;- j' j! |6 h4 H/ [* o7 p0 P! O
  62. static volatile int irqraised2 = 0;
    7 K: M2 j! m+ ~0 r

  63. 4 I' n: [& r- M! X' b
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% K9 y, Y% \( P7 Q; D
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . Y/ c8 G8 D- U. a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      Y( p) H: I) c2 r. _3 L+ O; d

  67.   z' q) U/ m! ^" e) t  @
  68. dma_addr_t dmaphyssrc1 = 0;
    ! p0 ]7 S& P9 Y& ~/ M8 I. `
  69. dma_addr_t dmaphyssrc2 = 0;; F5 P5 _# l, }. h+ v9 d
  70. dma_addr_t dmaphysdest1 = 0;" m% j" v0 Y( ^4 k+ E( D  R# g3 I: I
  71. dma_addr_t dmaphysdest2 = 0;$ r+ c" p: l6 m# u8 O. i

  72. " ^- L2 m. W- k; I' p5 X/ c' j
  73. char *dmabufsrc1 = NULL;
    0 X2 m/ P  W0 V$ h* j5 S; W+ B
  74. char *dmabufsrc2 = NULL;, E5 C# r* e  D8 M0 j
  75. char *dmabufdest1 = NULL;8 |5 k' i+ \6 T+ B- B8 L2 a2 w
  76. char *dmabufdest2 = NULL;. |8 Q( a1 \; a" i& `

  77. % f+ x3 }! ?; l* Q( l
  78. static int acnt = 512;
      N3 e9 j6 e$ A$ q0 E
  79. static int bcnt = 8;
    3 z, Q& |: R) N, w& E
  80. static int ccnt = 8;
    0 R! d% J+ c- P; ?; S1 t4 }& ~

  81. ( x' w4 m8 U2 ?) E3 S1 @, O- T
  82. module_param(acnt, int, S_IRUGO);
    % W$ J6 q2 h+ z: M3 o( ?
  83. module_param(bcnt, int, S_IRUGO);
    + u0 x8 F/ W3 e3 s; J" |
  84. module_param(ccnt, int, S_IRUGO);
复制代码
( x' H) Q; L* m6 C6 o
( F) L+ W) j) c6 c/ G4 |
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 }: L$ k8 m* u5 l9 H: l: parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) k$ o; @$ M% k7 ?; J
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 U# L$ ^+ q3 M7 u) I6 T
0 p7 G2 d( z& i4 ]4 i0 |- _' ]: i+ x& P' j
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-2 15:40 , Processed in 0.038575 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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