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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , @! G. u+ Y8 H
  1. [code]EDMA sample test application7 g1 E5 h  u/ `* l5 v' j3 G
  2. /*" _% O& |& R* P* i# \2 u
  3. * edma_test.c3 k* ^. L1 l6 F9 T' B/ Q
  4. *
    1 D; ^/ B' B- q* s0 ~/ n5 U7 G
  5. * brief  EDMA3 Test Application
    7 b- K/ n8 G, }2 Q' n9 {$ m$ e0 k3 v
  6. *
    0 m7 h/ H2 [3 V( A- a
  7. *   This file contains EDMA3 Test code.* p4 {( ?) W1 r. H& k& X
  8. *. y) n% y9 P5 ^( U
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " T% ^  x1 q' T" p& g# V) Z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 x/ `! q/ P, l, E1 C
  11. *         TO CHANGE.4 l( m* e  g* j$ E2 e" N$ x/ A
  12. *( u: L& _4 n" A' J+ V* E! I
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# C, u4 M! j! a9 h
  14. *' B/ P' c4 ^. |8 ]' W4 u
  15. * This program is free software; you can redistribute it and/or
    ! C+ h% Y- L0 x: m8 g
  16. * modify it under the terms of the GNU General Public License as
    2 _$ ]5 x) j1 J/ B
  17. * published by the Free Software Foundation version 2.
    & c- \7 |6 P5 O
  18. *
    / N( w" R# V3 |: W
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any' G- I* I- P. e+ S/ Z
  20. * kind, whether express or implied; without even the implied warranty2 ^# Q1 D  K1 }9 V
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the5 o. K3 y; W! A: t+ X5 O' [+ |
  22. * GNU General Public License for more details.; a. A% J# B5 T7 [, h! H. o
  23. */$ q  }: U' m' r7 t6 b4 z( {
  24. * ?$ H" C2 L, }( j. d
  25. #include <linux/module.h>
    % {5 r) j; b. n' d" P1 q, Q
  26. #include <linux/init.h>& o4 A/ t, G( l9 e$ @. {, w3 e
  27. #include <linux/errno.h>
    2 Q6 ?6 E! e# p0 [
  28. #include <linux/types.h>
    5 }6 U$ s% z2 }+ r% ?* b! \
  29. #include <linux/interrupt.h>/ t0 A% X) U4 z. A; e3 v) Y; w2 X
  30. #include <asm/io.h>; \( F* g0 y1 E
  31. #include <linux/moduleparam.h>; w6 q6 l; L  ~" b
  32. #include <linux/sysctl.h>- ~: s+ R) H) a4 U7 a3 [) {
  33. #include <linux/mm.h>% S8 o" d" M1 N3 e
  34. #include <linux/dma-mapping.h>
    2 [( Q1 U* J& ?- L
  35. 6 P1 i: E; Z3 h3 n" x( S6 F& [
  36. #include <mach/memory.h>2 z8 v! q2 X4 Y/ x8 e
  37. #include <mach/hardware.h>
    + t" W% B$ j% }" S$ v/ u
  38. #include <mach/irqs.h>
    $ d" _1 \6 p( d* m+ ~- B/ C
  39. #include <asm/hardware/edma.h>
    7 b5 o) P) a3 F
  40. # N+ X- o. X* {) S4 h, {1 O
  41. #undef EDMA3_DEBUG7 X# h& ^  h# R9 f8 f, S9 t
  42. /*#define EDMA3_DEBUG*/* d/ X2 `* \' i& j, B6 K0 i2 k
  43. ) |3 i+ w  Y* }2 r, ~/ I0 z9 P  \
  44. #ifdef EDMA3_DEBUG( ^% a$ ?4 g. U
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    5 H2 @6 u. C3 Y5 q' _& l
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 \5 e0 i3 f1 s6 B/ y4 J
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    0 Q% S7 C- v% D! d; E; {: S
  48. #else3 ?- j/ M7 h6 }" ]
  49. #define DMA_PRINTK( x... )" ~* o% R1 {3 u# |0 G3 j
  50. #define DMA_FN_IN
    $ F) @6 t# {  m; P; G: v6 c, T
  51. #define DMA_FN_OUT
    0 v8 Y. y2 F2 v7 U% c
  52. #endif% A; }) v+ P; \, P5 \, g4 \& W) |( H
  53. 5 I1 o# ^! y- I4 ^4 f2 S3 {3 Q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( i* W- Q* u1 Z# ?$ ~- t# V& U3 ^
  55. #define STATIC_SHIFT                3
    ( t% A: k/ c1 ]; `% y/ B
  56. #define TCINTEN_SHIFT               20
    5 l2 R7 _4 `/ x. d( f8 z( ]4 w
  57. #define ITCINTEN_SHIFT              21, T3 w" j1 b4 q( v4 Y
  58. #define TCCHEN_SHIFT                22
    ( ?1 D5 `8 s% @
  59. #define ITCCHEN_SHIFT               23" _: X, L$ {1 i1 ?% D" s' x. E
  60. ( g# g+ p: K  n/ k2 b! \" l9 i3 H7 y
  61. static volatile int irqraised1 = 0;
      x$ }+ x$ M) q4 _
  62. static volatile int irqraised2 = 0;/ @$ _4 |. C- I% T9 p1 s) y

  63. / `. ?) b6 }6 C3 d
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 p# F) x$ z* x# L
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 |; M" ~1 ~( B: I" d
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , f0 X5 F$ D5 {* n

  67. : F0 A: P3 s/ V' v" t
  68. dma_addr_t dmaphyssrc1 = 0;
    7 f! Q0 b! S% u2 D8 @* @. z6 v
  69. dma_addr_t dmaphyssrc2 = 0;
    3 F; e1 q, I' o: h/ Q) R& w
  70. dma_addr_t dmaphysdest1 = 0;9 {4 A/ R; G: x+ D+ h% Y
  71. dma_addr_t dmaphysdest2 = 0;/ M, ^. Q6 ]5 Y: n* |
  72. 6 E9 j* O+ Z' q& F7 N& k
  73. char *dmabufsrc1 = NULL;
    2 g$ w8 N9 T9 k$ I8 \  y" o) D
  74. char *dmabufsrc2 = NULL;7 s/ }1 C9 }' U- `
  75. char *dmabufdest1 = NULL;- Q+ o  H/ O. M  ]; x8 r0 V
  76. char *dmabufdest2 = NULL;* e$ ~# Z! v" V5 o

  77. ; M; a9 C) R, W8 L. H
  78. static int acnt = 512;. N# Q' n: R7 q
  79. static int bcnt = 8;7 Z/ k2 D1 Z5 O& A1 F1 T: Y
  80. static int ccnt = 8;
    . _; X3 f; ?, W" k5 m( h: V& p

  81. % i4 R9 t6 v( _  c7 S
  82. module_param(acnt, int, S_IRUGO);
    4 `) w( U/ q" r* M
  83. module_param(bcnt, int, S_IRUGO);
    ' p4 y/ y5 S& x+ z; w! @( B
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, n7 H, p3 @8 h0 x& C  X* X. Y
4 i/ V; w" s0 ~0 c5 Z0 K# X$ ?
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ o$ d1 N. }3 g3 _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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% o4 j1 Q! A7 V! V2 j0 q2 p: A2 w
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" j- z/ U: A/ \- F7 u7 [) |
# D# ^" `8 e: S( t
5 ]2 ^9 U5 V( y1 S
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-20 10:40 , Processed in 0.037158 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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