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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , ^. z6 X' E$ x
  1. [code]EDMA sample test application( [+ y/ p+ e, d; M
  2. /*; D0 H4 a- O3 Q, v" b
  3. * edma_test.c" s9 d, T( N9 S$ R& E0 }
  4. *7 M2 q& J$ J6 a" q) t( r$ ?+ P
  5. * brief  EDMA3 Test Application
    $ b: ]4 n. V( v4 B$ u% ~2 f
  6. *
    4 |/ X9 U& j9 {+ S
  7. *   This file contains EDMA3 Test code.
    ; ~( ?' a- C7 \' f+ b! t* w; G
  8. *
    4 |% b9 r1 G3 r) f* [
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ W6 ]8 m; e! A
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# Z2 ]% f4 J" ^
  11. *         TO CHANGE.
    * f. O4 O* D9 E* D  I' s' J* h
  12. *  i- h4 Z. h2 _: e% S6 n
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    7 ~. V+ J4 g5 u3 v% B5 S7 M0 D' h
  14. *
    + V& p) a/ ]" ~: [4 a+ q" c
  15. * This program is free software; you can redistribute it and/or
    # y& |7 @3 `* y4 E2 I
  16. * modify it under the terms of the GNU General Public License as6 f( N: n" i+ D/ S) M
  17. * published by the Free Software Foundation version 2., x! T" d: _( T+ x/ E! }1 V: \
  18. *
    ( e" o' Z& N& h' P$ [
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 c* r6 |1 [1 W: h5 T8 j) T# `, e
  20. * kind, whether express or implied; without even the implied warranty
    ) `" p4 N. I% G1 t
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  F0 e0 Q6 r4 x( b
  22. * GNU General Public License for more details.
    ! h1 v% G- t7 Z) g* X
  23. */* u  W( [$ k# b3 ^. E

  24. # t1 E. Y, V; r8 U2 n
  25. #include <linux/module.h>" @# W, V& s- j0 @. X0 t  @! |# y
  26. #include <linux/init.h>7 J' y6 H2 F2 T' G
  27. #include <linux/errno.h>
    : }: U( E) f8 Z8 t$ e2 Y5 l
  28. #include <linux/types.h>
    5 p2 N7 A9 @% A0 C9 R7 E
  29. #include <linux/interrupt.h>; v( [/ K8 P9 u& S) d* |2 G5 y
  30. #include <asm/io.h>5 |9 F: T% M: V  |2 ~
  31. #include <linux/moduleparam.h>
    , L- d8 i6 ?' O) S1 h& Z/ t
  32. #include <linux/sysctl.h>; F% h6 w) b) d4 {& r( J. x  ]
  33. #include <linux/mm.h>* J1 U! r* `' O: ?
  34. #include <linux/dma-mapping.h>& ?: H; t  I  \$ m& H2 w

  35. ; T  G* ]7 @. r- D) N
  36. #include <mach/memory.h>
    6 ]9 o! M. z0 ]( t: g
  37. #include <mach/hardware.h>
    1 E9 `, b8 G+ _7 i
  38. #include <mach/irqs.h>. R# ]% c( Z, _; c5 j7 C2 V6 o
  39. #include <asm/hardware/edma.h>! z& f, Z# ~( k
  40. . H; i- s4 t9 h+ i
  41. #undef EDMA3_DEBUG" H. {% a( d. Q# E# R: \
  42. /*#define EDMA3_DEBUG*/6 e& G9 d" |8 O9 y

  43. 9 i5 ~  W8 \( a7 j! f
  44. #ifdef EDMA3_DEBUG
    ; D; u$ T8 L" T9 r; I; v. y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 `% n; J8 O$ @' ^) Y# {2 ~# B* o
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 H6 [/ G& T7 d! _4 g$ r: O
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' e0 ]- |, @, a3 K. O3 t" H
  48. #else
    8 \) @9 K! q2 k) m6 o, J
  49. #define DMA_PRINTK( x... )/ L5 j$ M2 R' H/ e3 S9 Y# ?
  50. #define DMA_FN_IN
    - v7 _" U$ @/ C# }1 ~# X/ S
  51. #define DMA_FN_OUT7 {4 x0 l4 T6 Z& l9 c
  52. #endif/ n7 ~  }( X5 W& `

  53. 1 P7 ~/ w4 [1 G. Y& A0 E2 n. x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): F4 \' Q: ^; Y
  55. #define STATIC_SHIFT                33 }6 q2 m: x2 Z0 y5 U+ `+ B
  56. #define TCINTEN_SHIFT               20
    % b- d' T$ c/ f' {
  57. #define ITCINTEN_SHIFT              21/ a6 t2 W! L6 a1 \' J3 @
  58. #define TCCHEN_SHIFT                22
    & L- r# y5 T0 h1 x% g, n
  59. #define ITCCHEN_SHIFT               230 Z% N& K0 t- v- J& i3 M' W3 N* K

  60.   o5 K/ v+ Y3 P5 ^, m0 C
  61. static volatile int irqraised1 = 0;
    * e) O/ Z0 X0 c4 s
  62. static volatile int irqraised2 = 0;( h1 o% g; }6 F1 q7 \. A  ^7 v8 H
  63. 3 k1 E, W5 }; v0 @  K
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 G, a$ C# Y( ^7 w+ C
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 ^, l0 L/ F. ?7 w7 ?, I. v. r# ]
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 m8 @- y+ V" a1 l& k: h1 F3 g
  67. 9 g* x$ _% f3 _9 p( {
  68. dma_addr_t dmaphyssrc1 = 0;
    6 H9 E4 _$ Y) T( Q
  69. dma_addr_t dmaphyssrc2 = 0;
    # y0 `/ X( ^/ q# a( b2 D# t
  70. dma_addr_t dmaphysdest1 = 0;6 y* G8 [3 c  }, j' H
  71. dma_addr_t dmaphysdest2 = 0;5 ^+ Z4 k& P! p9 q6 t$ Z: Z  V

  72. ! G0 ~( D, G/ t7 q/ ]8 K$ \+ ~7 T( X
  73. char *dmabufsrc1 = NULL;- e3 a0 u; q5 |2 t2 n
  74. char *dmabufsrc2 = NULL;
    ( {0 I, r4 d# f: x* m
  75. char *dmabufdest1 = NULL;
    4 B$ K! L9 W- Y7 p4 h7 i; b
  76. char *dmabufdest2 = NULL;! g8 g6 S5 q, Z7 w# d

  77. 6 A4 b, g# z2 t5 Q4 x: U
  78. static int acnt = 512;
      f# x8 w* O6 W
  79. static int bcnt = 8;
    4 h9 a3 {9 a/ d8 [. o& F" j
  80. static int ccnt = 8;
    1 j3 y- L, @2 H2 u; w
  81. 0 A7 i! L& Z3 }+ e2 p8 h& c
  82. module_param(acnt, int, S_IRUGO);8 \! T; _2 i; w: g- n8 E# N
  83. module_param(bcnt, int, S_IRUGO);' S% e; @7 v* R4 O5 Q
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ _3 `$ a, J) o0 `
5 ^% [/ W6 I/ x, e7 M      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! ?0 v5 j7 }- |* ]
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( j! i$ Q3 c+ U9 @* v
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 G1 ~+ q: S' U9 L! j- Y$ p2 o( [

- d  a! q% c! J, }" u0 E' D# d  S  q; h% i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-9 00:43 , Processed in 0.038440 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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