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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : X' S/ E0 ]- k! w4 }1 ?$ b
  1. [code]EDMA sample test application
    ! _7 t3 Z( v: {- ?4 e% ?
  2. /*( O) g$ T6 a" A  i( V- D
  3. * edma_test.c
    " s2 b" X2 s# e1 t" p: d7 C9 n
  4. *
    ' n, x  L( X2 ^
  5. * brief  EDMA3 Test Application
    & c7 D! p. P: ]8 [, Y2 u# z! k# N, `
  6. *
    ' n4 \" _: ~* o! g
  7. *   This file contains EDMA3 Test code.9 B7 x+ J5 p8 T7 ?! ?- q
  8. *2 ?$ r7 j$ G4 o
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * G% n- Q1 G/ M/ K! W/ Z! c  c
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 I6 c- y5 x9 m1 |& X* ~7 S8 K
  11. *         TO CHANGE.
    ) @, [  F4 U! n" ^) N
  12. *) l, ]: `5 [# v; R  \8 t8 M2 H
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 w7 |$ B( x  `: s+ H6 _- a
  14. *
    + ]9 C1 m1 K) r" c7 x
  15. * This program is free software; you can redistribute it and/or
    6 V0 k' F' _) M" c! n$ {
  16. * modify it under the terms of the GNU General Public License as
    " `' h4 L+ ]0 n2 w5 _
  17. * published by the Free Software Foundation version 2.
      R$ m2 Q! C% R6 I, J4 W! s
  18. *
    $ ^5 d& t, F. t3 Q- w. a
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    , }/ S+ `" N$ t- ?5 k0 `! }: A- T
  20. * kind, whether express or implied; without even the implied warranty
    + l' P* m# L! e- P# u, o! Q/ A% F
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the9 r" O# G3 }1 h( N. |4 J
  22. * GNU General Public License for more details.
    * L7 |) a, g7 \2 X% Z/ N
  23. */
    : p; Z7 G1 E& b; z$ |5 s  z
  24. + Y5 n, N$ G. d; K
  25. #include <linux/module.h>
    ( e4 T; N2 w# {5 V* e* M- ~
  26. #include <linux/init.h>
    . s9 {" s, G5 F5 H( Q0 k  `5 k
  27. #include <linux/errno.h>
    8 G! g  X$ i9 c: U. E. D+ o/ F2 y
  28. #include <linux/types.h>4 ^3 U9 b) f+ y
  29. #include <linux/interrupt.h>
    ; I* a# |& F. A; L" h
  30. #include <asm/io.h>
    1 u3 g7 m7 U+ y% J1 [5 K* t7 Z7 N
  31. #include <linux/moduleparam.h>
    & @# g8 z# ?2 w" M& Y- I, K) T  j' x
  32. #include <linux/sysctl.h>7 M0 u. z5 y3 ~" i, I. Z0 q$ t
  33. #include <linux/mm.h>+ H$ Z# g: A: o
  34. #include <linux/dma-mapping.h>: _6 g" l5 A  H' b

  35. - z5 h- d+ l+ c) ^, o% u( i
  36. #include <mach/memory.h>5 \1 c0 Z& }- w1 d) q% V. g
  37. #include <mach/hardware.h>
    $ ?. N0 \- P( M/ n
  38. #include <mach/irqs.h>" T# A6 V# i# X% T1 ^0 O/ {
  39. #include <asm/hardware/edma.h>
    - p( Y) }. f! ]# D

  40. / G6 D( t* m- J6 }; [+ R! y
  41. #undef EDMA3_DEBUG1 Q- {( P$ D, A& c7 {; N. B+ J9 G
  42. /*#define EDMA3_DEBUG*/1 k: \" I8 V" b

  43. 7 ]' n" {2 {- t
  44. #ifdef EDMA3_DEBUG
    2 G  j2 s! w0 f$ Y9 j
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( B) p5 P3 K8 `7 R( F( t( P- `
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ o5 K( a$ o/ p+ l; m- o
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 B& q. y: |2 O- u1 Z6 Q" a
  48. #else
    ' _/ u* G8 e0 Y  B  G
  49. #define DMA_PRINTK( x... )
    * ]1 W; l& F* Y
  50. #define DMA_FN_IN5 H9 m; C5 X8 E! z. [+ m# V
  51. #define DMA_FN_OUT
    8 O- K& k$ Y) p1 o4 u7 x* w
  52. #endif
    ; |0 E/ g: e' ?; [7 y* ~

  53. ; Y. w5 Z7 G& s+ R/ a& o8 f4 j
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)3 E7 ?9 V) q( j# R  Z
  55. #define STATIC_SHIFT                3
    , j* z! Z% v2 z* ~: D
  56. #define TCINTEN_SHIFT               20
    7 y; ~; r3 ^# Y/ n6 Z% I6 X9 D9 ^
  57. #define ITCINTEN_SHIFT              21
    2 U8 e' y3 S& Z1 M, Z
  58. #define TCCHEN_SHIFT                22, L. f2 d1 x0 t/ a- _: J" q
  59. #define ITCCHEN_SHIFT               23
    3 _1 O$ v6 O  [

  60. " e4 g; J1 L0 _3 t. W
  61. static volatile int irqraised1 = 0;
    ' Y% V! @+ g% x$ i' P/ B
  62. static volatile int irqraised2 = 0;0 G8 A( O9 B9 f1 v% q( `
  63. 4 g% f& J- g# ^4 L, D
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , O, l- E6 ]+ ]* q" M9 ^
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 i- C1 @. a) g8 s
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- ^. J  e4 J) v' q( P
  67. & b( r7 g$ G' Y5 ]. d0 [! R' a
  68. dma_addr_t dmaphyssrc1 = 0;" e! U' t4 d: F- K$ e+ E
  69. dma_addr_t dmaphyssrc2 = 0;! ?  ?  }3 E$ V( F. i4 L  `
  70. dma_addr_t dmaphysdest1 = 0;0 j9 |% v$ h9 N  [9 k
  71. dma_addr_t dmaphysdest2 = 0;  E% w7 y# s. M7 p5 B) f

  72. $ f8 K. X+ O2 v& C
  73. char *dmabufsrc1 = NULL;
    % E! h! e9 r2 H3 c7 J0 ]. I; L
  74. char *dmabufsrc2 = NULL;, m; B+ _  C) L: K  ^6 z5 M
  75. char *dmabufdest1 = NULL;
    & e+ x$ G8 W6 x
  76. char *dmabufdest2 = NULL;
    + _1 i, g! @, E0 q) N4 P1 M8 w

  77. 7 C# x5 a8 Y  L' d2 s3 `* A: r
  78. static int acnt = 512;
    $ L6 w6 O  I0 A+ \
  79. static int bcnt = 8;
    2 C9 R% ]+ ^2 f2 X! v" ^
  80. static int ccnt = 8;  l" A" I1 _; j/ d! J, t5 l0 X8 v" t) L
  81. : C# d6 m' p0 E& h9 y" V6 E
  82. module_param(acnt, int, S_IRUGO);  e6 k: H1 V  [( R$ m/ D' e
  83. module_param(bcnt, int, S_IRUGO);: @. m. P* T) s% N. l- T
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 J; M  x' g8 I% P1 x( X1 K$ f4 c) K6 r6 O7 _
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; z% q" S) p' c/ u* W( sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' f8 s0 |/ r& F7 q2 L) p
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* F; V0 D: ]9 Q0 M' L& q" \& a3 e4 [0 a0 ]- x5 q
) q+ f/ Q5 T' Z; ^6 S0 h- ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-4 06:32 , Processed in 0.035261 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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