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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' @0 z* s. ]5 v9 Y" K% W
  1. [code]EDMA sample test application
    3 q& t) M: F; }; S4 d- {) @% [! p
  2. /*. L* J" A! e6 Y' X, X
  3. * edma_test.c
    ; t4 ^2 s) n# ^
  4. *
    ' P4 l; ^$ ?' m" C0 A& k
  5. * brief  EDMA3 Test Application3 N% @, q* A" n5 A& c3 P
  6. */ ]( [' Q% O" Y- }
  7. *   This file contains EDMA3 Test code.+ h# h+ p0 P, {/ Y$ }
  8. *
    ) ^' Y$ {  c/ ]& A6 F) ^) \0 G
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      g% y0 P0 j5 _3 W* r
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    # T# {& \( X! ^$ y, w
  11. *         TO CHANGE.
    " Z8 p$ n' B- E: P, v
  12. *1 Z' {: @/ E, Y' A" O' R. N
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ) H& e$ D3 v6 K9 n- d
  14. *8 h: ?6 x) D! ?, n* p7 x
  15. * This program is free software; you can redistribute it and/or
    4 A/ w8 t+ _1 K$ g3 h
  16. * modify it under the terms of the GNU General Public License as  k' o, k6 w5 u) g
  17. * published by the Free Software Foundation version 2.
      I5 h- z) x# i/ {
  18. *
    ) ^- R9 B* U) C6 j* g# K
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 C/ J4 h8 N4 A" `5 ^8 @6 ]
  20. * kind, whether express or implied; without even the implied warranty# [$ G$ d! Z% Q( f; Q$ `
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the, C" u+ L. D, \: t- Y% C8 `
  22. * GNU General Public License for more details.# e* J. z+ t1 Q/ K( R' K: D
  23. */% |* X6 t) V% z
  24. ! J$ ?5 M" p3 K, \4 N' P
  25. #include <linux/module.h>. U0 g+ J. u/ e; j& ^2 R
  26. #include <linux/init.h>
    $ u3 ^# T; S3 `
  27. #include <linux/errno.h>% f# q; Z. J0 I6 W# G
  28. #include <linux/types.h>6 \1 @1 Q' L$ O# K# F& \
  29. #include <linux/interrupt.h>
    6 I7 l$ D, J7 j, e, E! z- [: ^
  30. #include <asm/io.h>
    * }9 C/ Q! ?/ V( X, N4 n+ A# M
  31. #include <linux/moduleparam.h>' P& L6 W( @- ~- j2 L7 ^
  32. #include <linux/sysctl.h>' C1 c+ B: L* i' U" r3 V- m
  33. #include <linux/mm.h>$ n$ O) _0 q6 ?
  34. #include <linux/dma-mapping.h>8 h2 Y& Y7 G( E

  35. $ y( J3 y/ j4 R2 Q1 S: X8 }
  36. #include <mach/memory.h>3 g4 Q: |2 q  w
  37. #include <mach/hardware.h>, W4 m# [$ K9 }; c- n
  38. #include <mach/irqs.h>
    / N5 q* W+ ^$ I- r9 P' b0 A
  39. #include <asm/hardware/edma.h>% r6 T0 D  @! o+ X
  40. 1 y7 o7 h9 x' K8 W
  41. #undef EDMA3_DEBUG
    2 W+ f+ j) C- d9 j" M
  42. /*#define EDMA3_DEBUG*/7 Y# O+ \* A( C4 T: A

  43. & |: e( r1 J3 m5 h1 ~
  44. #ifdef EDMA3_DEBUG0 o6 |5 M5 r/ r
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 n+ G" H* o- i) ^" J8 C! O
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 V7 x& t1 g  P
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! h2 x# b; @* K4 `4 u
  48. #else
    ; r# B9 `8 f& `6 Y$ ]& [
  49. #define DMA_PRINTK( x... )
    ' t- p* U( F( ?$ r' M: ]) z2 y
  50. #define DMA_FN_IN
    ! L4 U! P6 B" t2 L7 o
  51. #define DMA_FN_OUT
    8 o) Y2 \; P. v% p9 A6 B$ L3 y
  52. #endif" K3 n1 G+ `7 r$ A2 M

  53. ; @* {" d6 j2 ?
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)3 B5 D) j; Y$ u1 c
  55. #define STATIC_SHIFT                3
    " G8 d8 V( `4 \7 d% H! h+ I/ U* w2 r
  56. #define TCINTEN_SHIFT               208 _4 p  @! f! T( n
  57. #define ITCINTEN_SHIFT              21! P5 f# c& H% p3 x% C0 q8 @1 F6 F' Z
  58. #define TCCHEN_SHIFT                222 B/ M2 R. V) r% W
  59. #define ITCCHEN_SHIFT               23! X- a2 w4 T, E
  60. / i+ }2 L* s# q  j% y2 k# l$ s
  61. static volatile int irqraised1 = 0;
    0 e3 S* p  i; ?) W1 g8 P1 e8 K
  62. static volatile int irqraised2 = 0;. G: ?; B! A$ p$ }6 n

  63.   v. W* a, D* ~* c. m" @1 \
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : Q$ X) K/ d8 w- z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 v( H( B! e% e" a5 G# \
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 O' s/ m8 R: M  p

  67. 5 N; W6 Y2 O5 Z% Y# P$ ?
  68. dma_addr_t dmaphyssrc1 = 0;$ x( N, `" K) z9 ?. z$ j
  69. dma_addr_t dmaphyssrc2 = 0;
    $ z7 r  s' m- O! L# Z* g
  70. dma_addr_t dmaphysdest1 = 0;
    2 S" M" G, B% _& t9 X6 O
  71. dma_addr_t dmaphysdest2 = 0;$ ]5 ~7 y. Y  Y8 ]8 W' g9 |! C0 c

  72. 2 ~9 S' r6 A" p* n& Z3 C
  73. char *dmabufsrc1 = NULL;
    ! c' X9 M! I4 E! ?2 a% Y
  74. char *dmabufsrc2 = NULL;
    - o  r. A. ~7 k( |$ a7 l
  75. char *dmabufdest1 = NULL;
    - ~: a( e" I6 c7 c  L" S+ \) h
  76. char *dmabufdest2 = NULL;. k. o/ G  U: [8 }
  77. + ?$ ^# _* x5 j$ P+ F* m$ r
  78. static int acnt = 512;/ l! k# z2 x) L0 k: X" h
  79. static int bcnt = 8;! W9 o: X5 T# P7 Z  X9 n
  80. static int ccnt = 8;
    . N' x/ l0 }8 j2 W4 B
  81. 1 [/ S! ?' |% Q9 n; Z+ V
  82. module_param(acnt, int, S_IRUGO);' U1 X7 A7 _3 n' X- _
  83. module_param(bcnt, int, S_IRUGO);
    ' Y9 o3 d8 c6 W; ?$ T
  84. module_param(ccnt, int, S_IRUGO);
复制代码
# d0 y: @8 c- B4 J* v6 R
9 H0 i% g- F8 `
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 r. [; i' X5 @" h0 |
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: ^2 c7 v# P8 _5 ~% t     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 F5 w6 Z" i  S; U" r1 p
! F& e5 M0 [3 y: Y( E* M$ ?
4 ]' r2 ^) Z) ]2 D
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-9 17:27 , Processed in 0.038291 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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