OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - a, {% [2 n$ f! [2 j
  1. [code]EDMA sample test application
    , T! j! r! ?) t+ l" K& |
  2. /*6 O  ~8 A+ B, Z# n0 r7 S
  3. * edma_test.c( \+ H$ |, f+ K$ C3 c
  4. *
    % m# m0 u% H; J9 ]4 O' r
  5. * brief  EDMA3 Test Application
    ' O6 \. d- {2 ?. e3 ]/ u, j( {2 f+ r
  6. *
    7 g% q5 y6 B  a
  7. *   This file contains EDMA3 Test code.
    ! a5 u- ]& @1 G
  8. *
    , M  W5 }# b* [/ Q% j
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 H- P; F8 @# o% Q1 K. s3 F
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( i4 l4 S* O# T9 T) Y0 `
  11. *         TO CHANGE.
    ) F: [2 I  H8 y3 D
  12. *& D. a- G" a! D9 C" V' g% X( q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 C% ^) w  M* L4 |( s
  14. *
    + k# l% _+ {5 q7 Q. x. F3 O
  15. * This program is free software; you can redistribute it and/or
    & J) m8 e& ~; c8 Z4 e: L
  16. * modify it under the terms of the GNU General Public License as7 ^# \3 _3 f! B. F+ w1 ~
  17. * published by the Free Software Foundation version 2.
    5 [. `. V0 ]' ]) H) {1 Z6 R- g( p
  18. *$ z5 Q  K' x0 s- f$ W  y) y4 o) J
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ W. L  g& l7 O  f- Z4 |
  20. * kind, whether express or implied; without even the implied warranty- t4 D  @7 X3 z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      d/ x, _0 E4 A
  22. * GNU General Public License for more details.: G( D1 S6 r; {' j* s4 r) A
  23. */
    9 Q" w- f0 T/ [, K( D( S

  24. ) e7 y3 u6 ?2 u% f
  25. #include <linux/module.h>
    9 `7 m* A; z& w7 G5 X
  26. #include <linux/init.h>
    % u7 C0 W. |( @( i, i
  27. #include <linux/errno.h>
    % R% U0 ^" G4 ^$ H0 f
  28. #include <linux/types.h>
    & R" p0 h: h) O6 e, [% m) ?2 Z
  29. #include <linux/interrupt.h>
    & l) R( w/ `! O: U  d, s3 g
  30. #include <asm/io.h>
    0 ^$ q" J, P8 f; L* S1 p. ^3 [, R
  31. #include <linux/moduleparam.h>6 ^+ O8 p! T" H$ g( A; P
  32. #include <linux/sysctl.h>2 m" U8 J  m9 `, [" {& H
  33. #include <linux/mm.h>1 j% L0 S9 G8 K& M
  34. #include <linux/dma-mapping.h>
    6 U. ~8 [& H2 k3 x, |* E4 f' V4 v! l

  35.   J9 h3 l0 R) E/ u
  36. #include <mach/memory.h>
    % v5 d* X* U/ P7 t: c
  37. #include <mach/hardware.h>
    ; p5 w, n3 i7 |7 i% H
  38. #include <mach/irqs.h>$ q& ?! X/ z. q
  39. #include <asm/hardware/edma.h>
    ; ^6 U  [/ t7 O& |# d4 A( S0 Y/ @0 i

  40. 8 J+ R7 k  ^# a& s: Q) K
  41. #undef EDMA3_DEBUG
    $ F; N: W% q8 H1 m
  42. /*#define EDMA3_DEBUG*/
    ( l9 }  `. g3 X& u3 P9 Q. l# c
  43. * K. o! A3 E; [2 q( h7 F
  44. #ifdef EDMA3_DEBUG
    * z/ E, a. F7 Q% X+ y5 a& D
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    " r8 J  L+ l; q7 H
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( [6 }+ S! S6 t$ E# I6 e
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 N5 j4 c. i& {: L8 @9 k7 y
  48. #else
    6 t1 I0 G+ Y5 {2 b- q
  49. #define DMA_PRINTK( x... )
    3 C# G3 i  j2 H/ E, m
  50. #define DMA_FN_IN
    . q0 g" {" k3 r' m' E6 F
  51. #define DMA_FN_OUT' f8 E  b4 I1 t. j& f* s) x
  52. #endif4 {7 f% D3 g, p) M. @  S- w  X" N

  53. . I1 x, c; O1 w; n/ m
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)5 u! c8 c. o* |& ~
  55. #define STATIC_SHIFT                3: u* w/ {% \; U/ _# F2 ^: d
  56. #define TCINTEN_SHIFT               20" i# Y1 ^2 @  J& u
  57. #define ITCINTEN_SHIFT              21
    8 ?& O0 o" y1 c; @2 G) F2 f( h# t. ~
  58. #define TCCHEN_SHIFT                22
    + {5 k; N1 Z; T2 y2 X9 a
  59. #define ITCCHEN_SHIFT               23: J3 |& O+ S" j* e- c9 n' y

  60. 6 l+ v$ ^; Q& P3 s; m8 |
  61. static volatile int irqraised1 = 0;/ Y- F9 z" _8 m+ w
  62. static volatile int irqraised2 = 0;
    ( F% a" ~- g' n/ |/ r1 n/ d
  63. " o. r5 w5 v; i$ Z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # P2 v/ @' L' q3 [2 i6 k$ W8 v
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! t, V" U% Y+ l8 N( ~
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 h1 V9 D1 @% u; G5 u' r; m
  67. + _3 ^+ l( [* A. k4 Y5 Z+ l
  68. dma_addr_t dmaphyssrc1 = 0;
    , C. A$ Y$ Q* J( P, d% e6 T
  69. dma_addr_t dmaphyssrc2 = 0;7 l& O! P) u3 ?9 P. `/ x4 K
  70. dma_addr_t dmaphysdest1 = 0;
    % e/ d( I5 T4 ~0 T7 R2 }% j$ D( I
  71. dma_addr_t dmaphysdest2 = 0;
    + V* g. B( R' m$ x) C$ S, l
  72. ' y, v' X" g  b/ v9 R, L+ b
  73. char *dmabufsrc1 = NULL;8 N& R" ^2 G" ~$ h/ X& N
  74. char *dmabufsrc2 = NULL;1 }2 D  x4 `8 x" I* f, X( g  A
  75. char *dmabufdest1 = NULL;
    # W$ D' ~, _" D1 v( b6 ?  E
  76. char *dmabufdest2 = NULL;
    . ^* u- d2 I- a3 k
  77. ) Q" ?5 q/ q. K5 N" x* o& ?
  78. static int acnt = 512;. h% z0 q5 u  q; l
  79. static int bcnt = 8;
    ! f" `$ `) d  J9 d# [# g6 N  |+ F
  80. static int ccnt = 8;( w8 Q) [4 P# ]/ L+ r
  81. / p" t0 M3 j# R8 d# y7 r! Q2 Y
  82. module_param(acnt, int, S_IRUGO);& `# @/ s+ x- v6 [: @
  83. module_param(bcnt, int, S_IRUGO);
    / m2 b3 H% D! P7 I$ b; n! r/ z
  84. module_param(ccnt, int, S_IRUGO);
复制代码

- K  P% R. |* F# D9 B' J* j
. C. a/ h/ u( t5 f! M      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" Y! s7 e! ]2 A& u& L: darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ v+ e) B: R$ o% m0 S  _4 L
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# V6 R( A; P2 d" o

1 t! n- w( F' i
9 R* Q. N' a7 D% L9 W, y( R9 @1 t" w/ r
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

点击跳转“创龙科技服务通”

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

GMT+8, 2026-1-20 12:26 , Processed in 0.039157 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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