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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 Y3 G. l( Q/ T. I9 H, x0 {: [# \
  1. [code]EDMA sample test application4 F, {- x9 V% w' x0 q) g. P
  2. /*
    # P9 o; A2 j0 K$ b3 V% @
  3. * edma_test.c8 w# R) q- @: s$ D( d
  4. *7 b7 ?; w- Z- J$ X
  5. * brief  EDMA3 Test Application' Y2 Q! k; A6 B5 p
  6. *
    & K. Q# L4 A" f$ E: v8 n* t% r
  7. *   This file contains EDMA3 Test code.
    2 R( \1 u2 G, s1 r' ~& Q
  8. *
    9 T) m. I0 H8 f2 W
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 P0 [- B& P: G9 L% A9 a
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% z* g4 @% i3 k9 z9 b6 d
  11. *         TO CHANGE.
    - ?, p( s. r7 i( N
  12. *
    5 O' H( ^5 @1 n7 Y* L
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" ^& J+ F( u8 r6 Y% F; R1 t
  14. *% i) a: [' Y3 M' ~# i2 T
  15. * This program is free software; you can redistribute it and/or
    0 E9 b7 l3 H$ V( W. c4 Y4 Y1 w8 Y  U" N
  16. * modify it under the terms of the GNU General Public License as; N8 l) z, {  q' a+ T" J
  17. * published by the Free Software Foundation version 2.
    $ X2 V) Z4 t) ^( C% q4 d9 \
  18. *
    ) `7 H3 C- K" G& [) b7 h
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ! _7 h& S/ y5 e8 @
  20. * kind, whether express or implied; without even the implied warranty5 ^! H) d" d5 F) N" e0 d
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 I7 ~2 e7 b. b- q
  22. * GNU General Public License for more details.
    2 k) ?5 p6 y" f8 m. ?
  23. */6 `# k# I+ l) S

  24. % Q0 m3 p- Q" }6 w- V
  25. #include <linux/module.h>
    ( o, V% K4 k6 f. P( U; Z) J( `
  26. #include <linux/init.h>
    - |& L  p  t$ _  [$ f' F+ p# q" y1 r) X
  27. #include <linux/errno.h>
    ! n) g: v9 l, @+ B# S
  28. #include <linux/types.h>
    & }  p2 d9 z4 c/ t8 O4 s' }
  29. #include <linux/interrupt.h>! J- b9 M6 r1 z, h
  30. #include <asm/io.h>
    * s( C8 s2 F( y, |
  31. #include <linux/moduleparam.h>
    2 |9 X, _# m* ^! {6 P) X! n
  32. #include <linux/sysctl.h>
    $ X, N, S) l, P0 S. u9 E
  33. #include <linux/mm.h>
    ( J% ^/ m1 @, a
  34. #include <linux/dma-mapping.h>
    # s% S* p, |( u2 o2 G$ P  f
  35. ( s4 t  V  ^7 o- ]: z! U
  36. #include <mach/memory.h>
    ! |* K4 t: `( @/ j
  37. #include <mach/hardware.h>6 R5 n# M7 j" C$ O
  38. #include <mach/irqs.h>
    1 }- ]( e& M" k/ i* x$ T$ B
  39. #include <asm/hardware/edma.h>
    ! |1 B" O0 I  V# ^: K9 x

  40. % r! Q  f2 J6 j1 ^6 M
  41. #undef EDMA3_DEBUG" K6 r, x& b! d( Y0 ^3 Z0 \: F
  42. /*#define EDMA3_DEBUG*/
    - B) p3 I: _( R1 ~% K: R

  43. ! M) `" }) y, X8 y' F
  44. #ifdef EDMA3_DEBUG
    , s) ^4 m$ [3 Z5 O* ?
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    : Q0 r6 f8 ?, q& I6 |+ T2 l. f( i( }
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 e+ z. f8 X# o/ [
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    " K( d, e! @* `& r
  48. #else& L: M1 v. A, S2 @, x% J
  49. #define DMA_PRINTK( x... )
    & c5 a; {- V! [  h6 _: q
  50. #define DMA_FN_IN, A% o$ e' T1 l5 p
  51. #define DMA_FN_OUT: C, X0 ^. H7 V  Z1 b' Z1 x, R
  52. #endif
    ( G8 ]2 k" d% x% x
  53. $ Z* n! S3 B0 ]: F4 d
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ) r( a) S  m' N+ n* M( i+ W
  55. #define STATIC_SHIFT                3/ G: K6 }2 h. |
  56. #define TCINTEN_SHIFT               20
    : K( p) a2 B6 Q; R: a9 e
  57. #define ITCINTEN_SHIFT              21
    / h/ q% n: G, c3 y& N  p
  58. #define TCCHEN_SHIFT                22) x* `4 ^/ w0 B9 |2 |; p2 b
  59. #define ITCCHEN_SHIFT               23
    + ~; S) [9 _# w

  60. 3 d. T* e! Y7 Z4 W1 _& l
  61. static volatile int irqraised1 = 0;
    ! d, P! J: Y5 Z6 S
  62. static volatile int irqraised2 = 0;
      u4 z& o0 R& u3 h

  63. ' v% Q7 Y* R3 e
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 s0 }& B* a, ^+ P# D- f6 Q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( Z) Z* `: x. b: {# X
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. N7 P1 ^4 }) ^% c# Q

  67. 1 q0 t1 p, U3 w$ `. y
  68. dma_addr_t dmaphyssrc1 = 0;8 O( p! c2 o+ B3 D) e. k! t
  69. dma_addr_t dmaphyssrc2 = 0;7 g7 u2 N7 ], q$ |8 q( J0 t. {
  70. dma_addr_t dmaphysdest1 = 0;
    1 P. @7 y! I1 B5 m$ z
  71. dma_addr_t dmaphysdest2 = 0;; s! E2 c9 N6 L5 H  I7 m

  72. 5 _' ~+ g/ {/ b4 V# K2 D
  73. char *dmabufsrc1 = NULL;) S# [; C& Q/ C" v/ [
  74. char *dmabufsrc2 = NULL;
    ( i: h" I+ p$ N8 m+ M
  75. char *dmabufdest1 = NULL;
    8 f1 L( U2 ]$ W5 ^
  76. char *dmabufdest2 = NULL;; v9 k$ J) V# d8 n7 L

  77. % h( `7 h, s) ?* y  g
  78. static int acnt = 512;
    ) I% n; M2 N- F& v
  79. static int bcnt = 8;: K- t$ d( m3 `
  80. static int ccnt = 8;! u# t) W4 T) ?
  81. 3 m3 w  w: U) T( R+ N
  82. module_param(acnt, int, S_IRUGO);" j+ H' N/ {9 G0 d+ Z8 t" V/ `
  83. module_param(bcnt, int, S_IRUGO);
    $ P% n+ m6 B1 q, J+ n, L+ w9 f
  84. module_param(ccnt, int, S_IRUGO);
复制代码
: N0 x$ j1 @% B) u/ J3 B

. J" o. F8 r- U5 X' E/ ~      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 j: a6 G9 Z5 b" G, zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: l- y$ y/ e$ a: B! q0 n; F
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 L$ O+ ]+ }. X7 Q; g7 Y
0 }. q' H  a1 O2 {" K1 K, F
9 f7 X" ]0 Q3 e
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-2 04:43 , Processed in 0.037939 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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