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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " s% L% w5 Z; [8 V5 S' |- Y
  1. [code]EDMA sample test application
    8 y2 ]9 _& W2 r, t% c1 M8 K
  2. /*; @, L+ V* `: g
  3. * edma_test.c1 `7 f2 `4 d7 F- v& [
  4. *- b9 R+ d( d$ o9 X' G
  5. * brief  EDMA3 Test Application- T, J) D, [' D6 O1 ~2 U
  6. *" t$ Z" `% i! [; v9 L3 P! v  F+ C' E
  7. *   This file contains EDMA3 Test code.) c  o4 M5 m$ D' x
  8. *) z& j- [2 {: n) C
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ D5 q/ P/ S$ T; w/ \: |
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    * Y3 p! W) V& Z* I3 i
  11. *         TO CHANGE.4 j1 j8 H8 N& F! I6 X) @
  12. *5 W' |+ u1 e3 E6 A# z, J% l( @
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    * n8 q' r/ s5 w2 W2 }
  14. *
    . k. f; H4 z/ u/ |
  15. * This program is free software; you can redistribute it and/or5 ~- g" }) F6 _
  16. * modify it under the terms of the GNU General Public License as
    5 W4 a: b( F1 G2 a; ]+ y8 I3 ^6 j
  17. * published by the Free Software Foundation version 2.
    5 t8 t8 B5 `' K
  18. *4 \5 z6 t$ Y/ S% |
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    2 P0 S/ f! s. E0 o  `; ~$ Y1 g( M! K
  20. * kind, whether express or implied; without even the implied warranty
    " s+ K2 m/ C6 a8 U4 Y3 ?
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the1 K3 [( D" L# H5 t; t! W
  22. * GNU General Public License for more details.+ w6 c& }  \8 N
  23. */
    / [7 v7 }: j- R
  24. # ^1 a. K' L0 d$ P' G. ~3 x+ c
  25. #include <linux/module.h>
    ' ]9 h) e# O( O' |& Y  C; h
  26. #include <linux/init.h>& V! M4 Q, f! m% D3 U9 \1 S$ E/ b
  27. #include <linux/errno.h>
    ' w( G& d9 h" d- v$ r" G# G
  28. #include <linux/types.h>/ N' G  f1 X0 I
  29. #include <linux/interrupt.h>
    ) i) O- F, E9 j3 E' |
  30. #include <asm/io.h>1 V; P9 ]$ Y5 k0 h0 v( H; ]
  31. #include <linux/moduleparam.h>
    0 |2 f4 ~" k4 {9 ^
  32. #include <linux/sysctl.h>
    # o4 p9 j3 Q& U+ D% `, ^5 |
  33. #include <linux/mm.h>
    : A' S0 r# f( c# t3 i$ y3 E
  34. #include <linux/dma-mapping.h>
    1 p. n% `3 P! j
  35. 1 u. z& }6 e8 v/ y
  36. #include <mach/memory.h>
    , Q$ |3 z9 A  _. I; a% c9 M
  37. #include <mach/hardware.h>
    8 l- n5 a! c) a$ R& e8 k! ~
  38. #include <mach/irqs.h># a* }0 N( ^, |% `; H
  39. #include <asm/hardware/edma.h>
    + d8 Z! S) ~: k% R2 h5 h# S

  40. 7 o" J+ P/ A8 I( X" r# z9 z
  41. #undef EDMA3_DEBUG
    : H$ Z( c9 y; f/ u* W* V; u
  42. /*#define EDMA3_DEBUG*/6 k- j: o5 v% [+ t; R% N

  43. ' w( F2 B4 U! i7 B9 k8 A4 q( B
  44. #ifdef EDMA3_DEBUG
    ' R. |) f  G* L9 {) h- \
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 T; p6 i9 l' s1 s% C* n" x
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    1 H/ Q" u/ m- c8 U" T/ F' }
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    : ~8 Z: b: E2 D" V8 C& {
  48. #else5 R* f9 a* n: V: C: W" e. f' b: s
  49. #define DMA_PRINTK( x... )* g6 i* ?9 Q" x' @9 ?# o
  50. #define DMA_FN_IN' y0 C! s, f' E0 G9 y0 [
  51. #define DMA_FN_OUT
    + N9 f( U5 B, ?& j; j
  52. #endif
    9 m9 ^% r1 o7 ~) _

  53. 7 l* p) M& K$ w0 z* b6 p  o5 U: z6 e
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ) ?% w; K: S2 _# b: V
  55. #define STATIC_SHIFT                3
    0 ]- j* a0 B0 S/ `! \0 v. d
  56. #define TCINTEN_SHIFT               20
    9 t+ ^0 y* v2 A  ?4 O5 L
  57. #define ITCINTEN_SHIFT              21
    . G7 a% S  O) m
  58. #define TCCHEN_SHIFT                22
    ! S* s2 m/ b  H
  59. #define ITCCHEN_SHIFT               23& {2 Y" A- i7 m7 h

  60. ) P3 F( _1 @( i  x# K2 S
  61. static volatile int irqraised1 = 0;% m! y4 O) [/ h; ?4 O
  62. static volatile int irqraised2 = 0;% p$ h5 A* A. p# L" \+ i

  63. . d; ^. W7 H) e
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( a! `; [/ l, M* T
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, D8 \! u9 |9 [% c
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / S4 x8 F( x$ a0 Q9 ^
  67. % G! c# S7 _0 o6 O5 w. x
  68. dma_addr_t dmaphyssrc1 = 0;& Q' Z  t" a2 {. a+ l# a
  69. dma_addr_t dmaphyssrc2 = 0;' n5 c3 b4 y0 G- |' S
  70. dma_addr_t dmaphysdest1 = 0;
    2 h& H8 [# t3 i# t
  71. dma_addr_t dmaphysdest2 = 0;
    3 e% U1 J, o5 O1 [1 q( v0 O
  72. 3 K- `1 P# X: h8 b( W7 e5 P9 I$ p
  73. char *dmabufsrc1 = NULL;
    1 ^3 m8 t7 J2 X5 H9 B! t
  74. char *dmabufsrc2 = NULL;
    3 n* L- L' G  f$ ]2 c
  75. char *dmabufdest1 = NULL;
    - _# a9 H' J5 m& F& o  E0 \
  76. char *dmabufdest2 = NULL;
    + ~3 j; o( x6 O1 I

  77. $ u0 g; o  X+ Q- f
  78. static int acnt = 512;7 t1 @8 {6 d+ w9 k% B
  79. static int bcnt = 8;  w1 B( f6 ~; Y! o# C. w
  80. static int ccnt = 8;
    $ l. B; W  E% w( [

  81. - i8 J# X8 ~, G& H" Z$ v
  82. module_param(acnt, int, S_IRUGO);
    * a8 j% i& [) V5 L
  83. module_param(bcnt, int, S_IRUGO);
    . i) V4 a* N- G9 q2 y. P' ?
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 E% t9 R3 B8 I" }/ {+ G: [. h
) u/ P6 s/ Y" F) V
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ B- ~9 }+ K0 s0 s
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 G2 F; w! z. Z" u* O& t' q" ]     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 Y& ~2 W; m2 l9 Q. H/ ~
$ `% Y. R" {( c
* o, `. C9 v! H4 P- _' E5 n, [! {
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-7 13:35 , Processed in 0.038302 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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