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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . ~3 e$ A1 ~+ e
  1. [code]EDMA sample test application
    ; w1 A4 U! _' m% _
  2. /*
    : \2 ]+ S$ C: O, Z# z
  3. * edma_test.c
    . Z% Y' I& C" T  ]* D8 C
  4. *
    2 _5 W0 R; D) s" p% _8 r# S* G9 p5 J
  5. * brief  EDMA3 Test Application3 V, K4 c% U6 @, @
  6. *, Z$ I3 G6 L5 A- o" P
  7. *   This file contains EDMA3 Test code.
    0 w3 p$ Q5 ~! `- m
  8. *
    5 c& Z. p: [2 N
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    % Q/ g* g- E4 Q2 b. \5 C. n8 t1 l) I
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- f6 z1 X! W9 Q, Q3 r- u6 h% l
  11. *         TO CHANGE.
    5 O: l4 K5 j4 m9 h* \* y$ j
  12. *
    - K: d* J6 L% B! j
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* g; q9 Y$ l, K8 S
  14. *5 j, J6 s- l8 U4 d4 B* K6 c( `
  15. * This program is free software; you can redistribute it and/or
    ! s3 J' P+ G) {+ Z/ Q. {
  16. * modify it under the terms of the GNU General Public License as
    & f* B; ~; L, ^* n
  17. * published by the Free Software Foundation version 2.0 G0 A$ e* r. C5 V
  18. *
    1 {, e, a6 a  ~: m) N  |
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 |" X4 U+ A2 Q: A" o4 k6 V9 X# E
  20. * kind, whether express or implied; without even the implied warranty  A, n2 A7 o* Z: m
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # J) d, v/ a5 E1 a+ `
  22. * GNU General Public License for more details.2 G9 _" K1 T3 y; i4 p4 _# O
  23. */
    0 o/ W( ]) {8 {' G
  24. 7 [+ ?$ L3 `* Z: M7 D9 p
  25. #include <linux/module.h>
    8 p; U4 n! i5 c8 v
  26. #include <linux/init.h>3 [* B$ k& H" j) C  J" T7 J! Z/ j
  27. #include <linux/errno.h>6 O  S6 D* a% x% i5 e" W
  28. #include <linux/types.h>
    5 S) ^6 u$ Z7 \4 s: O. K
  29. #include <linux/interrupt.h>
    7 i+ J) a; t! O! C: o6 \* N. C
  30. #include <asm/io.h>
    & ], l6 K% @/ P7 _8 w3 ~7 m# k3 z, L2 _
  31. #include <linux/moduleparam.h>
    3 ]3 M, S9 k3 ~6 x: x6 v" u
  32. #include <linux/sysctl.h>) F' a- p4 Z$ I6 A# K
  33. #include <linux/mm.h>
    " I* A) N: q- F0 P' i3 a  \" `
  34. #include <linux/dma-mapping.h>
    + z4 B4 A7 j, n+ G2 A7 ?
  35. 8 ~. v6 K4 ?5 j
  36. #include <mach/memory.h>
    % `3 E# r' ]6 }: U( [  q! x
  37. #include <mach/hardware.h>. R4 ?9 g  _, k
  38. #include <mach/irqs.h># ?! Q) F1 b0 c/ P' {% l
  39. #include <asm/hardware/edma.h># L. Z) O9 S9 C
  40. 9 m  K0 S5 a" M- Y) p
  41. #undef EDMA3_DEBUG
    ' r* Z( P) c! u$ Q2 R8 j& h
  42. /*#define EDMA3_DEBUG*/
    4 O' `" H- R7 I+ e$ q0 @
  43. 4 f" a# C0 m! ^" x# A( N5 h  q
  44. #ifdef EDMA3_DEBUG) K- n9 {! C2 ]6 P
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    9 u1 w' V0 B4 B& a
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 J" I- V& G- B) N; p' G
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 \# z& P- Q, s' j8 Z5 u
  48. #else
    7 b0 w& W$ z) D* l; s
  49. #define DMA_PRINTK( x... )
    " j1 |7 r# b1 z
  50. #define DMA_FN_IN
    ! {2 }( n- g& ^
  51. #define DMA_FN_OUT* u; z' X( }+ o7 y- K, P
  52. #endif
    6 B  k# f+ g2 p& U. P( R
  53.   P( P8 J4 H0 i* k0 O
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    $ ]. J/ G) X* l
  55. #define STATIC_SHIFT                3
    " J! G; E1 o* k& \
  56. #define TCINTEN_SHIFT               201 I; Q# f& `6 e; Q( \
  57. #define ITCINTEN_SHIFT              21. P* c3 D$ H% N" }% b
  58. #define TCCHEN_SHIFT                22
    2 r; B9 X6 Q; I+ B2 t' F& K5 u
  59. #define ITCCHEN_SHIFT               23
    . K. Y) `/ q5 w6 F. z  w( v

  60.   Y; y+ l% [5 P$ \
  61. static volatile int irqraised1 = 0;
    % j: T# R" f. A" t5 v# F% I6 y
  62. static volatile int irqraised2 = 0;9 E- @# K7 K! M' R* R0 s

  63. 4 a5 e9 ^3 K$ r5 E# z" v3 D4 {
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( R) z, X) C; l- q, i) @
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - i2 `& D1 m+ R" d# Q* w4 ^
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / S6 A, [  v3 x1 j/ G8 p' G/ n: g
  67. " @% Y) m2 |" K% E. |
  68. dma_addr_t dmaphyssrc1 = 0;, u! R! x% j( o0 j, ]% l) L' ?; W
  69. dma_addr_t dmaphyssrc2 = 0;0 K: c! h3 V% u: H0 y2 z1 W/ \
  70. dma_addr_t dmaphysdest1 = 0;) Q: Z' v' _6 E* |! [
  71. dma_addr_t dmaphysdest2 = 0;
    / s' x. j  H0 Y7 U
  72. " |) F9 g! a. o2 t) D! u6 c
  73. char *dmabufsrc1 = NULL;9 e+ c/ S; u: G3 O' r& B
  74. char *dmabufsrc2 = NULL;3 S. B( L0 M9 u. S7 R# U! g+ n
  75. char *dmabufdest1 = NULL;
    7 m3 |  Z# T& B, X
  76. char *dmabufdest2 = NULL;& G4 s' w( A8 O8 g7 D

  77. + f- W4 Z' n7 p! m7 `
  78. static int acnt = 512;3 B2 f3 }1 h. j$ ?
  79. static int bcnt = 8;8 ^1 {$ E! J: o# c/ U8 n
  80. static int ccnt = 8;
    2 m8 `. _! J' h2 q8 v5 ]6 s% N
  81. + d4 Q! x+ O: U7 }) B$ i
  82. module_param(acnt, int, S_IRUGO);, Q  Z2 Y0 a/ ^6 J& o9 `
  83. module_param(bcnt, int, S_IRUGO);5 w1 p- E# x9 q9 b1 g% {; C
  84. module_param(ccnt, int, S_IRUGO);
复制代码
" {2 X. J7 j  q0 @2 {' V

! ]& ~- U- G. V  Q1 K+ \6 }      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 \; D8 C& b+ X- B, s
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. b. I* l* }9 j! }0 ^2 H8 l4 b
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& J# E) Y* E7 ~# `7 C+ R0 K6 |) Z

1 _: L$ _, ^% ~. o! A& @, h" X
* o5 R" \0 v9 g( U2 V2 W" n
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-28 11:31 , Processed in 0.038865 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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