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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . `8 [8 o4 r+ [* U# x( \! J2 H
  1. [code]EDMA sample test application& z5 O% x1 q. w: a
  2. /*. c! T+ e6 ^4 n# {2 b/ E' r4 w
  3. * edma_test.c6 Z6 E7 y  `) w) M1 s, O
  4. *& B7 v/ m) w+ i
  5. * brief  EDMA3 Test Application& ^% b! R# R1 F
  6. *
    1 l& M" c7 S& s, G5 c, |0 T) Y' G
  7. *   This file contains EDMA3 Test code.
    " g* I/ h* R  _1 e3 F
  8. *
    & y% m2 j" a0 ]9 z. ~, O
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 `* j/ p# E& j& O3 _6 g
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    * Y) G- e: I& h
  11. *         TO CHANGE.
    - g( s& b7 R* v( Y, ~3 x
  12. *8 n, J' O4 v% K6 G) t2 W
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ l9 p; c/ J3 t' @# ~% [
  14. *4 K3 y/ z. M0 }. K- Y, b& Q9 L
  15. * This program is free software; you can redistribute it and/or
    ( x/ O0 F- d/ Y! A) `) R0 F, t. W
  16. * modify it under the terms of the GNU General Public License as
    : M  z! Q8 V$ U, [
  17. * published by the Free Software Foundation version 2.
    - A6 R! L/ T) Y1 Y
  18. *' ?! ^  d& x% D% E" x! L- G
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 E; E3 v  P" @8 ^
  20. * kind, whether express or implied; without even the implied warranty
    3 C  [, I) E' [% ?
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the: H3 s1 Q) J) ^9 l: V
  22. * GNU General Public License for more details.
    . u1 m4 M, E) b1 E2 {7 s0 n
  23. */
    $ w3 b; V- e6 Q

  24. - b* B1 p& b+ y( g: S* q9 e. W. b
  25. #include <linux/module.h>* h- w  h( `, D# ?
  26. #include <linux/init.h>: z5 [# b) U7 f' P
  27. #include <linux/errno.h>
    & J; j& U: D* i+ t, K( d7 h! B
  28. #include <linux/types.h>
    5 v! `$ o( f2 l+ x& v  j
  29. #include <linux/interrupt.h>6 b* |5 h  O; x9 t9 G
  30. #include <asm/io.h>
    - D  h, J3 a8 ]; H
  31. #include <linux/moduleparam.h>; U1 I& q3 N$ Y0 O
  32. #include <linux/sysctl.h>
    8 u+ Q9 D/ {2 V- w5 S# x' T
  33. #include <linux/mm.h>
      }) k; Q8 U! G2 A' Q$ E
  34. #include <linux/dma-mapping.h>
    2 l. D8 P5 o0 T; s
  35. 1 k- p8 S2 U: X9 ~, T( }9 V& Y& i9 L
  36. #include <mach/memory.h>3 |: U0 l$ ?0 c' g9 c
  37. #include <mach/hardware.h>$ R: k( E4 r2 k& j
  38. #include <mach/irqs.h>" y8 I4 t& @! @
  39. #include <asm/hardware/edma.h>3 ]6 o1 p8 P2 x$ m4 Q. b0 n. v5 l' u
  40. % h6 X/ C# v9 Y4 |8 q! u- P3 j$ u
  41. #undef EDMA3_DEBUG0 A% l4 I" t! a2 t
  42. /*#define EDMA3_DEBUG*/% n4 Z9 ]% u; w: v" L* s

  43. . m9 m' e# _9 Z0 `$ d8 T
  44. #ifdef EDMA3_DEBUG4 F' P$ [0 p9 w$ H
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 S+ {. L5 f7 G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    % l7 l. S: A3 B5 _5 E  M" n# E8 S
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    8 |6 v6 w7 n8 ~/ f
  48. #else
    4 X/ W8 O7 ^6 O* [" F2 f5 b$ L( M
  49. #define DMA_PRINTK( x... )
    - w/ T9 S$ m# C0 T  [$ M4 M$ Q- @; C
  50. #define DMA_FN_IN; o' Q* F, m% u1 `3 ?/ b
  51. #define DMA_FN_OUT7 m5 W0 c/ A  z$ k
  52. #endif
    0 s+ Q# @! N/ y2 _

  53. 2 |8 c& {, y. F, n+ t
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
      T! c% l+ Z, _! B# U. `+ o
  55. #define STATIC_SHIFT                3/ ?! h: |1 k. i# D! G
  56. #define TCINTEN_SHIFT               20
    1 V6 ?) Y; A6 `- o3 V' v8 [
  57. #define ITCINTEN_SHIFT              21
    , _* d! D5 u; _' k& v4 ?
  58. #define TCCHEN_SHIFT                22
    0 v$ {4 e( l. Z; a- |
  59. #define ITCCHEN_SHIFT               23
    . K8 K* V  T9 T
  60. / j  I. |% ^5 s! d$ Q4 }
  61. static volatile int irqraised1 = 0;$ E* ]1 S0 x* k+ }* p& I9 d% k6 o
  62. static volatile int irqraised2 = 0;
    5 a6 h0 N2 o# A$ ]. l9 p* M

  63. 0 L) |1 @; b2 u* k* y  F
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; Q! r% _7 u& S& u+ P) v& n! g. n
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 \6 L& q( ]2 m9 T; v$ J- [+ M- H
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ ~4 `4 Q9 O( J# z- M. |1 c

  67. + v' u: ^% E" S1 d" {1 ~
  68. dma_addr_t dmaphyssrc1 = 0;' k; T+ }9 ?: P
  69. dma_addr_t dmaphyssrc2 = 0;5 d. q7 w3 N0 ]
  70. dma_addr_t dmaphysdest1 = 0;
    7 o0 b  \, p& T  f. h" Y
  71. dma_addr_t dmaphysdest2 = 0;+ i& o; c- j/ M% l: `/ [8 c. p2 E
  72. ! E- n4 y9 Y- X
  73. char *dmabufsrc1 = NULL;
    8 L: H! {  d" V! Q
  74. char *dmabufsrc2 = NULL;
    6 k; A  s- B3 c2 J6 y# u6 r4 w
  75. char *dmabufdest1 = NULL;
    2 g8 a9 F7 R3 x( d4 i! H
  76. char *dmabufdest2 = NULL;5 d  X& n; E. P

  77. % g: l. T! m  Z
  78. static int acnt = 512;
    3 [; y& g' O* x/ ~6 W
  79. static int bcnt = 8;. G% D/ \  p8 ]8 }2 x& H; |8 x+ q" E
  80. static int ccnt = 8;
    8 a& n/ S4 V7 r: |$ d: ?& ^( G
  81. 9 G* m7 l$ [5 N- {; k' T2 W
  82. module_param(acnt, int, S_IRUGO);
    ; z, n; @- g# R) E
  83. module_param(bcnt, int, S_IRUGO);
    : m  k+ a$ Q$ n/ \) v
  84. module_param(ccnt, int, S_IRUGO);
复制代码

2 ^+ y- c% Y! j* e( E
. h" y: Y7 W) g* L% x2 u# W( K% V% r      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; J* |6 y9 m$ A( J0 _, b
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 y% D+ Q$ m$ m" N/ Y1 H
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 y: N. ~1 m) F) j# A  _- x
+ {5 G9 K! x+ ^' Y( U1 g; @; p( F# Q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-22 12:36 , Processed in 0.037126 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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