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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! ?" c! b7 T/ d; x
  1. [code]EDMA sample test application) z- x: v! S+ P% g+ {! u5 q8 g( A
  2. /*
    0 d: _2 [2 B. {
  3. * edma_test.c
    ( j4 J( C* r* o7 @
  4. *
    7 q! ?* e' M* Q8 i
  5. * brief  EDMA3 Test Application
    3 M4 O8 c0 c% I7 D) ^9 S
  6. *
    8 Q* d: y, Y* J5 S! \7 B
  7. *   This file contains EDMA3 Test code.
    0 S# A- H& V6 O- o1 u0 S
  8. *
    ( |/ F% ^% Y/ Y6 l
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + g9 G* K7 {% B' v
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 ?1 j( f/ H5 `- j  U6 P
  11. *         TO CHANGE.
    9 |2 L% D" K4 T+ I
  12. *
    / i5 L: X4 J" @5 G  i
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    , B; e4 G& L9 o$ ?1 q  F7 |
  14. *
      P7 c# p8 X) P) u
  15. * This program is free software; you can redistribute it and/or
    4 F$ Y8 {: f3 [
  16. * modify it under the terms of the GNU General Public License as
    $ a7 o4 j* u* L8 y" [# m3 x" e/ V4 @
  17. * published by the Free Software Foundation version 2., A: y, z" f/ ]# @% I# T! a" h6 b
  18. *& ?0 b+ L2 R: }- a# q" v7 x
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    & E! e# {0 B  Q, H- y' a
  20. * kind, whether express or implied; without even the implied warranty
    ' ]7 m1 O' C# I% n! j5 G; Q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . q0 D9 I& Z) d/ A* O
  22. * GNU General Public License for more details.  Q! X2 ^" `% E( H
  23. */
    7 ]) y. o3 j) m! M1 i" o

  24. ( e) P5 I; E% g
  25. #include <linux/module.h>: @" K+ v- r7 R" `4 c
  26. #include <linux/init.h>
    5 i# A* R! Y0 B& i7 k' O; V
  27. #include <linux/errno.h>
    - w% b' l9 m; o9 ^9 R! S8 a
  28. #include <linux/types.h>1 d' G$ Z. s# }7 b
  29. #include <linux/interrupt.h>
    ) Z- s6 i8 K! E1 G' f9 h7 G/ x
  30. #include <asm/io.h>: S* M  u" `- F2 N5 _6 E# J+ A
  31. #include <linux/moduleparam.h>0 m  o, O: y) i6 M2 v' A* ]
  32. #include <linux/sysctl.h>1 B- R: F' u' \, \( y  G
  33. #include <linux/mm.h>
    - X5 j0 J. ]% T7 w  _5 Z: J9 V: W
  34. #include <linux/dma-mapping.h>. {) D; r) b. h) e( @1 B
  35. 5 [  _3 S- d3 L' e0 w3 k
  36. #include <mach/memory.h>
    , F$ \6 K# }$ {5 Z% L4 N
  37. #include <mach/hardware.h>
    + R9 o+ P* z% r* I4 e. `
  38. #include <mach/irqs.h>
    & q" ?: T# R( o
  39. #include <asm/hardware/edma.h>
    / T- F- J! }. B: W
  40. # I" r% l0 z7 O
  41. #undef EDMA3_DEBUG
    : M+ l" p0 g! f6 V( |
  42. /*#define EDMA3_DEBUG*/
    # L: Y9 W" q. e8 W. M

  43. $ ^7 K. Y- p# G% p$ T
  44. #ifdef EDMA3_DEBUG
    - ^& A( G! _. n5 f( K! y. x% Z1 X& \
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* e* y; ~6 W0 G: a& r" t0 v# |
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    : W/ B, u$ t+ @- G
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! g9 B+ Y# z  m9 W6 ]! @
  48. #else8 l- N  C3 j4 s1 Y! q
  49. #define DMA_PRINTK( x... )* |1 ?5 k4 ^4 Z2 U5 I; d4 u
  50. #define DMA_FN_IN
    , {8 R- p& S" r7 Q9 \' c$ K
  51. #define DMA_FN_OUT
    & }8 Y: \3 P" B! v% a0 A
  52. #endif9 i! \+ o3 v1 g0 U  E

  53. # h, n+ s6 Z2 V6 \% p
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    & b2 r' g# F4 d6 k$ Q' o
  55. #define STATIC_SHIFT                3# ]) b7 S9 Q' ]: M' l" ^
  56. #define TCINTEN_SHIFT               20; i% }$ M0 b3 ^7 m3 ?: A
  57. #define ITCINTEN_SHIFT              21( m. g% @8 j1 c' j
  58. #define TCCHEN_SHIFT                229 V2 Q. f0 a  f8 I. H6 s; w4 z
  59. #define ITCCHEN_SHIFT               23
    0 B/ s6 N/ z8 a5 P- U$ I: [3 k; q

  60. 5 B5 p; f8 h9 D" o
  61. static volatile int irqraised1 = 0;
    5 K5 V* g) t* l: x
  62. static volatile int irqraised2 = 0;
      _" z& ?6 A9 ]! G

  63. 9 m- P) b5 b$ Z, [  G; z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 S# ?- z/ K, z( Y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* b2 G0 u" ?4 z% h# |+ k
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( I! [9 r4 P/ _- }) w6 s  F

  67. * E1 H% L- o3 ~* O4 i- e
  68. dma_addr_t dmaphyssrc1 = 0;
    : O$ O; d4 h5 _* d
  69. dma_addr_t dmaphyssrc2 = 0;( R9 x  Z! T4 Y+ Q+ i: J
  70. dma_addr_t dmaphysdest1 = 0;( Z4 K' d( A. n0 ~/ N$ x( z4 t
  71. dma_addr_t dmaphysdest2 = 0;
    " M/ c, {# }/ X" S5 ]

  72. ' I0 E2 F5 s  p+ P3 w  E$ W6 [6 |
  73. char *dmabufsrc1 = NULL;6 h. t. q- O% C& m
  74. char *dmabufsrc2 = NULL;: H5 K0 M; N5 ]4 l1 T" g
  75. char *dmabufdest1 = NULL;
    7 l4 C3 i0 F+ N1 G7 v6 O! ~$ ^# _
  76. char *dmabufdest2 = NULL;6 h7 r9 M% g* ^% p  Q& U* s
  77. 3 ]& H; i5 l/ \
  78. static int acnt = 512;/ L" r1 u0 w" W
  79. static int bcnt = 8;
    % l" M' @9 a3 X8 V0 N
  80. static int ccnt = 8;
    6 d# r/ R' y" u, |6 t) }
  81. ! ~8 s+ D2 D4 W5 S% \* ~4 A4 Q
  82. module_param(acnt, int, S_IRUGO);
    9 |) `/ r) f% j2 M
  83. module_param(bcnt, int, S_IRUGO);
    : _' L' j7 s2 y) O7 |, J% |" y
  84. module_param(ccnt, int, S_IRUGO);
复制代码
$ p! n4 Z) a  Y9 b( Y8 q

, w; J6 V" b$ v! r      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; r: V  n/ y4 K7 Q! jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& V1 n3 C. \3 K% N4 z( y
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; R# ~0 ?. R8 i0 E2 b2 J
$ m* y; ]; c* `  P' E) z; ?) s
* B! q1 `7 r) |1 c, A% w- w$ O* P5 M
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-19 07:42 , Processed in 0.037461 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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