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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 n/ N3 a" E+ y: q2 p
  1. [code]EDMA sample test application. |% j7 D. @, N( e# ]( H
  2. /*
    1 N; h. u) A) G
  3. * edma_test.c) @# T2 T! X( W" a! C
  4. *! s& R8 v' }' U1 o! x0 I, U
  5. * brief  EDMA3 Test Application! q7 N7 _) Q9 d% f4 {2 U7 p
  6. *4 a1 E5 ^1 k) d5 S# F
  7. *   This file contains EDMA3 Test code.
    - L( f: P+ O! p! a! w; L$ ]
  8. */ f. _2 e4 g; i$ |* r! \( Q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 }/ v$ k2 q5 w
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! K7 s2 `4 Q3 y7 e- j2 `) W0 |
  11. *         TO CHANGE.
    6 B9 \7 {& I' J# c$ a
  12. *
    $ }& |, R) N$ }  ^
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    , ?5 v4 b0 J# f. u# ~  @8 [
  14. *
    6 s1 J/ N$ ]6 K. i
  15. * This program is free software; you can redistribute it and/or
    0 G7 f* O+ P1 [; _- [. Q+ o
  16. * modify it under the terms of the GNU General Public License as
    ( ?! x) A7 J, U
  17. * published by the Free Software Foundation version 2.* l* d& @% |* G( [# Z5 _; |, q' y( G
  18. *: |, m( `- C# y: i5 I
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
      s& H- N5 k/ v" C
  20. * kind, whether express or implied; without even the implied warranty) ]" t1 P6 O- ~+ H) [
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 C6 |: i9 H* s  Y9 A/ A; l, l1 z
  22. * GNU General Public License for more details.  b1 T$ u+ B; r0 m2 Y+ h  n, i
  23. */
    + U; f9 ~, ^; p9 L" Z

  24. # ^" ~7 r8 f  X- r  ^8 W8 O  K+ S
  25. #include <linux/module.h>! d) y: L5 M, e" C5 |1 ~
  26. #include <linux/init.h>0 B6 H0 |% c4 |) D3 O
  27. #include <linux/errno.h>% m; ]' ]3 [, A
  28. #include <linux/types.h>0 a/ ~6 z& D  ?' q7 Y
  29. #include <linux/interrupt.h>0 f. x! T0 v8 Y2 h. A, T7 B2 i
  30. #include <asm/io.h>
    1 B' D& S7 T) X/ s7 q" A4 S
  31. #include <linux/moduleparam.h>3 R" n& @0 L5 g. u
  32. #include <linux/sysctl.h>& R* ]3 z3 n/ A! L- h$ x9 l9 R
  33. #include <linux/mm.h>. L* H4 Q5 J# f5 g/ W$ [
  34. #include <linux/dma-mapping.h>
    # j0 |/ q+ ~& N% z: X

  35. ; m+ P! }# X( D
  36. #include <mach/memory.h>
    9 @$ L7 D" [1 F- A% a
  37. #include <mach/hardware.h>; O4 k: ]- x* G6 ?2 _1 Y
  38. #include <mach/irqs.h>
    ! y" i" @! z1 T! z& d
  39. #include <asm/hardware/edma.h>
    + H. e2 Y$ w# n$ [* Q, ?

  40. , p2 _9 I4 w; r$ r
  41. #undef EDMA3_DEBUG
    # \6 E) h+ N5 P2 G" Y; H
  42. /*#define EDMA3_DEBUG*/
    / x0 Q" n& g, G! A3 M

  43. ' a9 a7 N# a6 A; a
  44. #ifdef EDMA3_DEBUG# H: Q9 q: a6 ~6 L
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    & B! i- w, W8 T/ K/ h4 j* y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% j" A/ P9 w! [' A  v
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    # c$ ~5 a% [2 V$ \1 e
  48. #else& t4 ~. z' {+ p, @. Z- v: l
  49. #define DMA_PRINTK( x... )
    ) @0 y3 n( E3 T; @/ L) s
  50. #define DMA_FN_IN
    . O, G  w: [. X' g
  51. #define DMA_FN_OUT0 S5 X! i6 R+ c. L9 |! U/ j" S
  52. #endif
    - d7 n5 t  U% h  t
  53. 9 w4 q& g! U3 c  \  m
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : A/ }9 |2 D# [" o) ^% ?5 _
  55. #define STATIC_SHIFT                3
    ( m  w3 n, V0 |! @- g" a
  56. #define TCINTEN_SHIFT               20% Y6 b# J% H+ K* A5 H% H; d; k* n- D
  57. #define ITCINTEN_SHIFT              21
    + j4 a& F+ A% ]; _7 U  h
  58. #define TCCHEN_SHIFT                22- i9 S6 f: q' s, v  J
  59. #define ITCCHEN_SHIFT               23
    * g% u4 v- J) U& b  |2 G5 ?* y2 |

  60. 4 s, G2 G0 N8 B0 L
  61. static volatile int irqraised1 = 0;
    * |, V8 ?2 m% V
  62. static volatile int irqraised2 = 0;, w; M7 x  C+ z$ D8 D% h% x8 |& _

  63. 9 L" A; ?/ O; _  u0 x8 {
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* |2 U* I, }4 r# ~
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( Z  K7 X5 \# S0 c
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% s% b' D" E! r) ^8 |: w

  67. 9 i- G1 M, g, ^% z4 u
  68. dma_addr_t dmaphyssrc1 = 0;( u: P7 ]( |& M, o; i/ ]( `
  69. dma_addr_t dmaphyssrc2 = 0;
    ( N0 F6 p2 S+ E1 _
  70. dma_addr_t dmaphysdest1 = 0;( s7 S: _, E/ y9 j& E$ }5 b. V
  71. dma_addr_t dmaphysdest2 = 0;
    7 a) V" u7 q8 ]; U+ `
  72. 8 e( ]: R# X- P" |  N% b
  73. char *dmabufsrc1 = NULL;
    ( n& D9 _) z) ]+ l/ i. Q/ E
  74. char *dmabufsrc2 = NULL;
    ' r9 b' D3 I5 d. ^$ x/ A
  75. char *dmabufdest1 = NULL;
    , n3 ~+ n1 |) O; }5 ?
  76. char *dmabufdest2 = NULL;& t% ?6 o4 c3 I( V1 i% h

  77. : A# [/ B. D) p) q/ v8 ~9 X' ?
  78. static int acnt = 512;
    ( {& g6 l0 C, u. b" v
  79. static int bcnt = 8;
    7 N5 b2 @: ^% D8 Q
  80. static int ccnt = 8;
    ( ^, \3 m2 k% Z+ K

  81. $ W( [  c8 P9 y, U/ n
  82. module_param(acnt, int, S_IRUGO);0 f2 N! {+ P  _# z" O
  83. module_param(bcnt, int, S_IRUGO);
    6 L9 R0 |3 m  Z, v
  84. module_param(ccnt, int, S_IRUGO);
复制代码
/ I& v# J8 c3 |; ^5 j

1 Z" d( C" @! F1 ]% k- u      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% x8 e$ K* v) R- N' marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! X; |3 ]: |& ~
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, W6 n  K1 x! Z, U, d; \$ v

4 e7 L8 {* y9 C* L0 [7 c* A) }3 S/ u' B3 e. {9 {
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-10 01:46 , Processed in 0.039681 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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