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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 ~3 @% I$ v, f: D( A7 Z0 m
  1. [code]EDMA sample test application
    + D; o- E3 Y3 x3 m0 Y4 G2 S) q
  2. /*
    + ]+ r6 S6 [! U2 l7 f: `
  3. * edma_test.c4 l% c& [: T, D! y8 l: N. b7 S& f
  4. *
    2 z# g5 H& {% i& {3 t
  5. * brief  EDMA3 Test Application
    7 [, d/ i" F& ]
  6. *
    4 ~8 Q% a+ q. N, b3 r  c
  7. *   This file contains EDMA3 Test code.
    " I3 A% O6 Q  m
  8. *
    2 ~2 o7 _) p; X# r' E
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! V: R1 j1 R8 U8 {% }. b
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 x) ^9 x) Q5 I! t" F
  11. *         TO CHANGE.
    9 |0 ^  X, r- u$ O. W2 s6 \
  12. */ P7 C/ E  ~% A, r0 H* ~! b
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    - ?/ K. X" U+ k+ g* J* {
  14. *0 H0 S* F5 q3 C& t' j5 o& t7 W) Z3 d
  15. * This program is free software; you can redistribute it and/or
    6 J3 n0 Z+ I9 [# D3 H
  16. * modify it under the terms of the GNU General Public License as
    $ p; S( s0 y. {; I
  17. * published by the Free Software Foundation version 2.0 y9 V+ Z3 q8 Q
  18. *
    $ b6 I: e  u. R9 ^$ K' V
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 V2 n" ~) _  A% F
  20. * kind, whether express or implied; without even the implied warranty
    , Z# N  ?' o, N: F
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    9 s6 U7 L; P9 b2 J: m$ I' L# F
  22. * GNU General Public License for more details.+ v% g( T9 u" y) |$ V
  23. */
    # M) N: g4 ^  h0 T; T
  24. * M( A4 P  m1 X  \) O. W; ?# Y4 W
  25. #include <linux/module.h>
    5 j; C4 G8 O; a! ]8 d% M0 h
  26. #include <linux/init.h>
    : H8 u! H6 P0 ?& Z% G& J4 V! W
  27. #include <linux/errno.h>
    : ~5 j! m0 u9 k8 U. K/ H/ m
  28. #include <linux/types.h>3 d3 i6 w' g" Y) Y; i. I& i1 V* A
  29. #include <linux/interrupt.h>* Y0 ?4 k. C5 T0 I9 l
  30. #include <asm/io.h>
    # ^* l$ i9 p! F3 g$ _0 m
  31. #include <linux/moduleparam.h>
    / X& z# z' L9 L
  32. #include <linux/sysctl.h>+ c6 g/ F9 G- N; u& F' J4 {0 i  [8 T
  33. #include <linux/mm.h>
    4 q! y1 {5 W5 p( X2 m
  34. #include <linux/dma-mapping.h>
    / L% M4 G- L. D: u: j
  35. ; {; u2 J% [" \8 D- y
  36. #include <mach/memory.h>1 J0 n/ I3 G, S
  37. #include <mach/hardware.h>9 w8 t/ l5 w0 o( O
  38. #include <mach/irqs.h>
    ! n/ M9 b4 v  F6 N& `9 ?
  39. #include <asm/hardware/edma.h>
      f1 j1 t; v- w

  40. ' z6 T6 h) \3 W' d9 ^
  41. #undef EDMA3_DEBUG
      h  h# N: X- t" `) T0 a
  42. /*#define EDMA3_DEBUG*/9 y; \) }& U3 n& T

  43. % d- L4 U4 Q7 s; B9 M
  44. #ifdef EDMA3_DEBUG. t  L# g' }* ]6 i. B1 |1 g) N3 _
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    # w; \& }% q& \) N
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( |4 G' M3 g& r7 \; W4 ]0 X/ w& W
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    : [0 G! }  @( w8 O& [& W1 }% P! s
  48. #else! c9 W. v) Y1 Y' `9 o) L. `% P# k
  49. #define DMA_PRINTK( x... )0 V; Z/ D) N" g0 j( m4 T' }( n9 O, `
  50. #define DMA_FN_IN
      \* M3 g5 m. Z" {9 G2 X
  51. #define DMA_FN_OUT4 W+ i' W* E8 |5 C4 t
  52. #endif) _, F3 u) E: v
  53. 5 U1 H+ [7 {% [) U/ E7 ~, e" f. g# @
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); `& H+ p# P& N1 r
  55. #define STATIC_SHIFT                3% ]- p/ }" L1 ^: V3 V
  56. #define TCINTEN_SHIFT               20: [1 Q$ x; R( O& c
  57. #define ITCINTEN_SHIFT              21
    $ [  s" Y6 ]( u# ~, b& q/ Q! J( h
  58. #define TCCHEN_SHIFT                22
    ( |7 x- Z# U% ]' R9 e1 {$ w7 N
  59. #define ITCCHEN_SHIFT               23
    6 L1 X4 w2 `! o3 }- U
  60. / a2 t5 E- G9 a! l  `3 c) {
  61. static volatile int irqraised1 = 0;
    - J8 ~5 E/ X- P1 m5 h
  62. static volatile int irqraised2 = 0;
    ) Q: a3 Z+ G% A2 v6 N: B+ s% d

  63.   V  O) |) G8 [; F9 o# o
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 D9 L5 a/ B; T. i
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 i- x3 _6 v# Y6 }8 I4 y1 r
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 S# g9 f( z; I4 h3 p9 U, B' y

  67. ) e7 _) ?% F' D/ S4 v# q
  68. dma_addr_t dmaphyssrc1 = 0;
    # g7 Z4 [* f" K4 L
  69. dma_addr_t dmaphyssrc2 = 0;/ F# \% `& |+ }( c$ U0 `
  70. dma_addr_t dmaphysdest1 = 0;/ P3 B2 e' V# L; r- o/ D! E! X6 ?
  71. dma_addr_t dmaphysdest2 = 0;: X8 O: S1 w% k

  72. $ N. E9 O1 T) w7 ]- m3 j; C" b' N
  73. char *dmabufsrc1 = NULL;' K3 g3 ]7 @- X2 F& I$ d: v$ q) X7 l
  74. char *dmabufsrc2 = NULL;
    + G. n, d. g: ?" D  }& U! E
  75. char *dmabufdest1 = NULL;
    2 L2 b7 F$ G1 Q4 V3 [! o* y. J
  76. char *dmabufdest2 = NULL;
    * @% g) w9 S. U' v( U8 c" P4 _
  77. 3 y+ ]; P7 G+ J, j; v' X$ q
  78. static int acnt = 512;
    . r. H, g/ J% q3 T# c4 B
  79. static int bcnt = 8;( L3 C. t0 p  Q
  80. static int ccnt = 8;2 S) |6 W5 s- N5 X: k# r
  81. & T$ g- A  |+ D; ?8 r- }' Q
  82. module_param(acnt, int, S_IRUGO);) D3 \3 I3 D& x1 d4 i. C1 D1 g: H
  83. module_param(bcnt, int, S_IRUGO);/ J; {3 y9 ^2 |& ~  C; ~
  84. module_param(ccnt, int, S_IRUGO);
复制代码
$ T: F7 o" |/ ]) ^; k1 C
+ D- D  N8 K* ~; c1 J9 t' i
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! U/ T- q4 ^6 o6 m. Y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 h3 ^# M8 B# Y/ r; F6 T9 ~     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& [. c1 V# g6 G3 q: g  [! t
7 o/ v/ B+ [  Z' E+ X
9 v0 }3 D: A" L8 G/ T6 i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-5 18:31 , Processed in 0.038758 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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