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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 M7 I% S7 P8 g( j$ \
  1. [code]EDMA sample test application1 F4 A" A* R& \3 H, W
  2. /*4 o; F! F& J9 }! A. r  k' t  z
  3. * edma_test.c" t: H" o9 J* `: S- f2 z! a' y& q( ?
  4. *
    # N$ V7 y& m' ^. ]0 @
  5. * brief  EDMA3 Test Application
    ) ]: ?5 O9 Z+ ?, L' u4 E
  6. *
    7 K: \9 ]  C1 J$ A, A& P3 \! b
  7. *   This file contains EDMA3 Test code.2 L  n9 i" u1 s
  8. *
    - v; [  y( e$ Y3 G) R: \, s5 k
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    & N/ h: i0 m# h1 s+ o* S
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 b! P9 I/ \+ v+ ~6 M2 M; p
  11. *         TO CHANGE.( \; T5 A! Q. Q: t) |- H7 k
  12. *7 p4 p1 ]$ P& Z! E% J  V1 G
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    . P. j' `0 w, ~. f9 U4 v& i; O
  14. *
    * W6 Z: {3 Y% J) O
  15. * This program is free software; you can redistribute it and/or  B# g  O6 ^! _; p% z
  16. * modify it under the terms of the GNU General Public License as2 |& M$ L& W1 Q! h- T
  17. * published by the Free Software Foundation version 2.
    ! H4 w7 U" G  G3 C
  18. *
    3 E" A! @3 w; U  {: n
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    & k& I. H+ o: |0 h; o: Y- G: Y
  20. * kind, whether express or implied; without even the implied warranty
    " c9 p1 ]8 M' `$ ~; f( R$ {* S/ X1 Q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & s5 f. c+ q0 i
  22. * GNU General Public License for more details.+ @; p+ [$ t. l; Y) ^* y- A/ B8 C
  23. */# W! q- k2 T5 q; d

  24. 4 \% A- l. s5 U7 B! ]% l3 y2 R+ a
  25. #include <linux/module.h>
      O% n) ?+ I4 ~7 r
  26. #include <linux/init.h>& h( u$ N: g. _5 a) P& b, }
  27. #include <linux/errno.h>
    + t1 V2 ~0 J( U# U6 `6 {
  28. #include <linux/types.h>% Z/ I" P0 \0 U4 \
  29. #include <linux/interrupt.h>
    ( C# B4 H- v$ [4 t/ V# o* P
  30. #include <asm/io.h>
    " `, ~4 a* d# H
  31. #include <linux/moduleparam.h>3 t3 z9 e" m& `7 U' b) x# H0 S
  32. #include <linux/sysctl.h>+ T" B0 l' {7 u6 K% Q
  33. #include <linux/mm.h>. D9 ^- W' U0 @" I6 P7 {
  34. #include <linux/dma-mapping.h>
    ; H3 P* X) f6 b/ l' i

  35. % {  t/ ~- R* w8 z& o, p
  36. #include <mach/memory.h>- j7 s' ~& Y& n- U1 L: N# p- a$ @
  37. #include <mach/hardware.h>
    : W/ t2 q5 T: s- {9 v  V# a
  38. #include <mach/irqs.h>% O/ G8 Q) e4 T% F' G1 H- O8 M2 I
  39. #include <asm/hardware/edma.h>* X7 C! s* D( s/ [+ G
  40. 4 r! ^. ~) l+ @3 X' q  V/ |* t
  41. #undef EDMA3_DEBUG
      W5 g9 a3 h0 [( X( |% |' I2 a
  42. /*#define EDMA3_DEBUG*/
    * A, ~5 V" ^* B' ^1 `5 R" ~' l

  43. , D6 G, p! a  O, S( T1 d
  44. #ifdef EDMA3_DEBUG
    ! Z% D( `8 j7 F- c1 D) L+ Q3 H. l: V
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 n2 v( G3 P! c" Q( Q" A7 J3 o
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 r* R; O& y- H' A$ ^" {: I
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( ?- x5 ]2 T4 R0 ^  x' P
  48. #else0 p! p9 }0 ?% g6 m1 u) q
  49. #define DMA_PRINTK( x... )3 D0 y" U4 O2 _0 a2 [) M
  50. #define DMA_FN_IN
    $ t5 ~; B8 B( Q5 p2 H3 R9 B
  51. #define DMA_FN_OUT! T0 h2 Z8 ?5 W  }- H! r8 k
  52. #endif
    8 ^5 G+ O8 N6 G( Y( d; ~7 J

  53. 6 j8 G' `$ F7 v( d! M8 C# H) t  a) C
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)" a1 @3 m5 a' t  |  r' h1 B
  55. #define STATIC_SHIFT                3
    # j& ^' S: D7 s, o' B
  56. #define TCINTEN_SHIFT               208 Q; H- P" c# }. S4 x0 S6 @; h
  57. #define ITCINTEN_SHIFT              21- i+ [' J5 I( ^% |% c/ _
  58. #define TCCHEN_SHIFT                22
    6 t0 t' x6 t$ A+ e, s5 G
  59. #define ITCCHEN_SHIFT               23
    0 D: {6 B8 p3 s
  60. & }. b& x9 c" E; [" Y! W8 ]
  61. static volatile int irqraised1 = 0;8 U4 U* Y! t( @( \4 w% ?: y
  62. static volatile int irqraised2 = 0;. L0 A( Z. o- b- [% o
  63. : q8 ?& S0 c! X) Q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 W3 A$ K: a& y) c
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. |4 F3 B: g+ ]0 k* E( G0 [
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% o4 Z, V+ R6 J$ I4 w  H
  67. % n! n3 g+ i+ G8 Z/ `6 Z+ n
  68. dma_addr_t dmaphyssrc1 = 0;
    - A4 n; L9 q- p. J# C% w$ t
  69. dma_addr_t dmaphyssrc2 = 0;
    6 Z7 |# F2 D' r: k/ H, ~& p
  70. dma_addr_t dmaphysdest1 = 0;
    8 c6 Z4 E; n) w" V7 @4 H
  71. dma_addr_t dmaphysdest2 = 0;
    1 I7 d( x4 }& }

  72. & A( `0 \6 c4 r* O0 I8 c5 p& t
  73. char *dmabufsrc1 = NULL;0 O- }8 \2 e! m  W) t3 x
  74. char *dmabufsrc2 = NULL;5 d" U& x) Y* C
  75. char *dmabufdest1 = NULL;: h) D+ J& m5 Y$ l/ M/ T
  76. char *dmabufdest2 = NULL;
    ! m+ {" }/ C7 J* f: g2 y

  77. ; w& W# h: Z9 \8 ^
  78. static int acnt = 512;
    1 ^: W+ ?( J% u( @# _! U* V
  79. static int bcnt = 8;
    . P$ R. o  V+ V( h9 Q/ K
  80. static int ccnt = 8;8 g, A9 b, h* ^1 y
  81.   D# N+ e5 d8 u
  82. module_param(acnt, int, S_IRUGO);/ y( g: Z' P4 y2 l
  83. module_param(bcnt, int, S_IRUGO);
    ) L( Z0 g- n, g! o- x7 h5 F
  84. module_param(ccnt, int, S_IRUGO);
复制代码
! I6 m9 J; A5 Q# j0 K3 J

0 ]+ q6 r" Y( d0 l5 Q- z3 l      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* ], C, B6 f" @7 u2 {
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: \9 Y# c  N; `1 v; D. h: A
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# D0 k% i0 r5 i" i) P
. A; p8 d/ a# ^5 b+ Z

6 A' _3 U6 s+ T- L% K7 F
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-14 18:39 , Processed in 0.045667 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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