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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 g3 N# ~! F* L. W; W1 E" r
  1. [code]EDMA sample test application
    ! H  c' M( B( o0 L$ ~3 y! x
  2. /*
    ) o# p9 {$ s$ s8 f6 S1 }, Y0 T2 `
  3. * edma_test.c
    % P( u& V2 b0 Z) J
  4. *
    " b4 }  q$ K. C/ l
  5. * brief  EDMA3 Test Application
    ! `$ P9 }% P; s  }/ Q" [
  6. *0 s. Q( F" N: H) _
  7. *   This file contains EDMA3 Test code.: @% s8 S9 p6 I0 F4 D
  8. *
    1 j* Q. m- f! r( g; F0 u+ A3 E! A
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' S) Y+ b8 S/ h5 k2 C* u
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ' y+ J. H+ I1 n/ ]9 `1 @: b
  11. *         TO CHANGE.- x0 G0 R; n  H' J& u
  12. *
    ; Z2 g9 F# ^* O, y0 C6 }. t
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    0 I, t/ \9 g( i# w( ]
  14. *& v3 ~3 A3 S' Q0 c6 f  L6 _
  15. * This program is free software; you can redistribute it and/or7 z% w) G+ H! T$ b8 W
  16. * modify it under the terms of the GNU General Public License as2 J! D* q7 S4 U% ^# l
  17. * published by the Free Software Foundation version 2.* a$ z/ S5 H" n* `
  18. *; Y6 p( E/ t$ P: p  ]
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    + N- R) g( ]# v, D, a9 L
  20. * kind, whether express or implied; without even the implied warranty$ {# V. c$ ]9 X/ U
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* C& I5 Y" }  o+ W  A( j4 |0 Y
  22. * GNU General Public License for more details.: Z  z' V- _" v5 }2 [; g
  23. */
      l3 H8 U3 J8 i9 ~* i
  24. ! `7 E: H0 D$ m; k7 s% D
  25. #include <linux/module.h>0 Z  U1 a/ V4 I- I5 p
  26. #include <linux/init.h>
    2 {: r2 M1 G& r) g$ K% a
  27. #include <linux/errno.h>/ }. o2 U9 V! C  d
  28. #include <linux/types.h>
    & e6 `$ m: I* J! o% |1 u* Q
  29. #include <linux/interrupt.h>
    5 U0 _2 P0 R5 H
  30. #include <asm/io.h>/ N! J+ i7 N; ^8 G) {
  31. #include <linux/moduleparam.h>
    ( R5 }! E' e) n" ?/ p' U+ P
  32. #include <linux/sysctl.h>
    . h, n4 q$ k7 x8 Q$ _: S$ o
  33. #include <linux/mm.h>+ [8 S+ E& X9 V5 h. d- @- j9 P
  34. #include <linux/dma-mapping.h>
      t% {# r6 ]) K$ F5 Z
  35. 2 ?( T- o8 {  ]! J% g# m3 i
  36. #include <mach/memory.h>+ ?- e& M0 m7 o2 _- j& T% u) C
  37. #include <mach/hardware.h>
    . q8 H1 g3 e' k9 Y$ y; p
  38. #include <mach/irqs.h>
    ) i4 ?) K) U  a5 Y: q
  39. #include <asm/hardware/edma.h>/ h/ d2 t0 G& e3 a- e# |6 u

  40. 8 j, [3 U3 N/ ?% K
  41. #undef EDMA3_DEBUG% l# s) V; O; m, N. ^9 h
  42. /*#define EDMA3_DEBUG*/
    . U/ l7 B0 e8 b. G* V3 i9 `

  43. ' P* j2 k0 @- q6 n
  44. #ifdef EDMA3_DEBUG6 W1 w2 J3 A. {* U# q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    4 u! ]2 U: C( k: W' L% i3 ?# ?
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 d& X) d9 D% O+ `6 A; `8 u
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). ^' b& R+ r3 ]
  48. #else
    0 Y$ J$ J7 _! o
  49. #define DMA_PRINTK( x... )
    8 N4 @; l; [& d7 R' J
  50. #define DMA_FN_IN
    , p1 c! _% W& |. x( i2 A" _" {* B7 d
  51. #define DMA_FN_OUT$ x4 p* f( _" t) ~1 t& d# T: X
  52. #endif
    # F* W, u8 d+ C9 }" V
  53. ; {( e9 i" b7 t
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( q3 b3 K+ C) t% C  J* D
  55. #define STATIC_SHIFT                3
    # F& w$ ^5 u# k
  56. #define TCINTEN_SHIFT               208 K& ^3 C+ E7 u9 z, \+ [# y
  57. #define ITCINTEN_SHIFT              21
    % N, }6 U' `- g
  58. #define TCCHEN_SHIFT                22
    - c- F0 H0 {4 n) j3 G8 n+ _
  59. #define ITCCHEN_SHIFT               23
    ! Z6 a7 N% k- Q) p

  60. 9 n- x* U; \2 {: R' Q8 P( W& `/ m% b  e
  61. static volatile int irqraised1 = 0;; y& h1 b, {+ p
  62. static volatile int irqraised2 = 0;
    2 T1 |0 s1 Q  Q- S
  63. 7 I/ a2 L& F' j$ Y. ?# r
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : W" ~7 t8 x% g+ p4 J
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" |7 p( S" M' I: c( Q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % E5 M) H9 ?+ t+ w
  67. + a0 f! U- z* g1 \5 Z* u: s- J
  68. dma_addr_t dmaphyssrc1 = 0;' N2 ?7 p: A7 A
  69. dma_addr_t dmaphyssrc2 = 0;
    7 r% J8 W( Q& W' w) t; w
  70. dma_addr_t dmaphysdest1 = 0;
    , X3 s3 Z7 K: X7 m& g1 H3 _
  71. dma_addr_t dmaphysdest2 = 0;, z! o% i; N) M" f3 p* M
  72. # h: Z$ Z7 O3 l; g/ ?  l3 G1 H
  73. char *dmabufsrc1 = NULL;. \9 D1 e# b% A+ T
  74. char *dmabufsrc2 = NULL;; S- f9 Q# j% x8 {* K
  75. char *dmabufdest1 = NULL;9 R/ }# t4 F. W! d
  76. char *dmabufdest2 = NULL;
    ! u: X9 P* T: d4 n% S) [
  77. 6 @7 }5 Y- u6 v6 k& q3 C5 A2 X
  78. static int acnt = 512;
    / q' l* u2 t4 P  Y
  79. static int bcnt = 8;' Y2 \! o& w; k( C! J6 Q  a
  80. static int ccnt = 8;' z3 x& g( ^& o# o0 p, }

  81. % y5 B+ Z# n* p1 r# O. `
  82. module_param(acnt, int, S_IRUGO);1 [* C+ O' x" ]8 w
  83. module_param(bcnt, int, S_IRUGO);
    9 Z3 {1 L  i: T+ ^. P4 \, S3 l
  84. module_param(ccnt, int, S_IRUGO);
复制代码
! C6 _6 y* y  p; k$ B" I# Z4 z( T8 G

* P* r; G8 c+ ~. @( l      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 q* u+ c% \6 b8 B0 a* }
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ C) M) W" R' T* F+ k% K" f
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ T: M/ z; L9 @$ _6 e5 K# f
4 x& J$ ^. N6 x$ ?. a) ?  P

) R  j: A/ O' R5 T7 {! \) h- _( g
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-24 23:53 , Processed in 0.036522 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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