OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 E' q' V; W8 ^. q3 a8 p. |: ]8 z
  1. [code]EDMA sample test application
    9 F) H1 r" U. G" E! z/ b1 H; O
  2. /*
    8 n. J4 `/ j" w
  3. * edma_test.c  O4 u( N2 E6 `# s/ Z3 ^
  4. *, J+ D8 A3 Q2 ~* J* @! L. V& b: F
  5. * brief  EDMA3 Test Application
    3 ~0 z$ q8 {0 y2 O. N" ^: f
  6. *7 b. [! H4 N& d1 }
  7. *   This file contains EDMA3 Test code.
    ) R; v. G, Z: Z+ I6 h! n4 y
  8. *
    ) y2 V: ~$ Y! L2 r: w8 X* S+ E
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 b; g" O& E0 {  J1 z2 z; P
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, n7 n* c4 S" o9 y& S: q
  11. *         TO CHANGE." A9 z  W: y0 c& B: @
  12. *
    & Q. L# H+ a8 x! a' r, Q+ |" [
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" F8 \% a! |" `. R3 V) D% i5 F
  14. *
    - }% `' G* k. \; g# w8 X
  15. * This program is free software; you can redistribute it and/or
    + T) }! O6 Z% w6 g+ i
  16. * modify it under the terms of the GNU General Public License as& A% c  k# f, W) {# `; ^
  17. * published by the Free Software Foundation version 2.
    2 K8 R9 u: V& _# b9 Z, x" Q8 r3 t
  18. *
    . \- x" n/ e; d4 v  k! q! u6 e
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 I0 Z! o/ U  Q" @5 x- ]: h
  20. * kind, whether express or implied; without even the implied warranty
    $ S" P9 x+ l& K3 U: F
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3 r& N& o0 @4 b6 {% |" V# j
  22. * GNU General Public License for more details.( x) y9 J  s' i& w6 T  p) J
  23. */2 x7 [/ i' D4 w4 c
  24. 5 |5 @( _+ W" |$ o: ^
  25. #include <linux/module.h>0 v. k/ w6 I+ Q' l. J3 f
  26. #include <linux/init.h>
    + Y! G) }% e! \. i6 L: ~- p
  27. #include <linux/errno.h>3 v6 V8 b  r. \" z! ?7 O2 P
  28. #include <linux/types.h>
    ' _# S" L# @# d% u& n  f( `8 {2 T9 l
  29. #include <linux/interrupt.h>5 w* W3 K: ]% ~4 {' ^6 W
  30. #include <asm/io.h>4 u6 r+ C) P8 r  A& |+ Y  }% E. m/ f
  31. #include <linux/moduleparam.h>
    " k( c# x" m* s0 l7 z  G) }
  32. #include <linux/sysctl.h>
    * g, U4 @" P1 A/ `2 @8 P
  33. #include <linux/mm.h>
    9 x+ ~7 T/ D5 `; D' v
  34. #include <linux/dma-mapping.h>
    ( }: r& ?  ]! U& g" x

  35. : A2 L7 K7 N  ]- l8 |# J( F
  36. #include <mach/memory.h>
    * ~0 u/ M1 x) b8 H
  37. #include <mach/hardware.h>; t, n6 g& E0 C; i, Q
  38. #include <mach/irqs.h>
    / M# b4 A. `% o" W: v; T* s6 E
  39. #include <asm/hardware/edma.h>$ N( l. k7 H& {4 |3 e
  40. 9 N* h) P$ f- w$ F
  41. #undef EDMA3_DEBUG/ i2 q! @5 S4 D% b0 z  q
  42. /*#define EDMA3_DEBUG*/
    " P! C" ?) ]5 J7 R6 G
  43. 6 ~" H" D& B& y, ^+ A9 }* z
  44. #ifdef EDMA3_DEBUG  p! J  K- m5 Z& }! T' y& s/ c
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    7 v+ F7 x+ ^* l4 D# h: l7 B
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! C. _( F$ _- Y8 l# O8 t0 F( L
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    : q, w7 R# b8 G) N7 O& y( i: U
  48. #else$ ?) x" g0 r4 _4 F9 k2 Y; c
  49. #define DMA_PRINTK( x... ). s: U' n1 n  j" c5 o, f
  50. #define DMA_FN_IN; n, `8 o! G  g% n) u
  51. #define DMA_FN_OUT
    . }% T4 K" m7 h  X* m
  52. #endif
    % k" N: W* `; Z
  53. ( N2 k" c* Z, p6 k
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : B/ D5 C! V- E5 j9 T
  55. #define STATIC_SHIFT                3% Y* f5 ]& `2 x6 V
  56. #define TCINTEN_SHIFT               20$ I, u# w2 J9 h4 |' w9 c2 o* ^  n; d
  57. #define ITCINTEN_SHIFT              215 h* F; k$ _+ }8 p" t9 z
  58. #define TCCHEN_SHIFT                22
    ! U  E0 g- a2 r1 y
  59. #define ITCCHEN_SHIFT               23
    8 }7 `9 t" ]6 p% \+ B
  60. 1 e) U) p) b6 p! d) \0 V: J
  61. static volatile int irqraised1 = 0;
    4 k9 {% J) G. x7 u
  62. static volatile int irqraised2 = 0;8 @( N9 q: |+ f  m# Z& A

  63. 1 M. g* J8 l8 ]
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % W  d9 w' l$ h2 T. F3 u
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( O2 E& E# v1 c, f0 j
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# o1 k; z+ u  f4 B/ Y
  67. $ b7 j* a. W: p* I/ d5 q
  68. dma_addr_t dmaphyssrc1 = 0;
    ( R# t4 d( H3 p' W* |4 a
  69. dma_addr_t dmaphyssrc2 = 0;
    5 C9 o$ Z8 U# A7 G3 m
  70. dma_addr_t dmaphysdest1 = 0;$ }2 m& R5 J; q" z
  71. dma_addr_t dmaphysdest2 = 0;
    5 G2 W/ `3 ^" v
  72. 4 [  _. n+ a( y/ P& {1 u( Z
  73. char *dmabufsrc1 = NULL;& P9 F: z$ a/ r% h. ?& ^
  74. char *dmabufsrc2 = NULL;
    + a& |- Z& O# y2 Y6 \
  75. char *dmabufdest1 = NULL;
    ) v- i) X: a, X* [5 y
  76. char *dmabufdest2 = NULL;, `' Z$ x8 O! W; W$ l5 K

  77. , d- L( f& u3 J7 |  p" o
  78. static int acnt = 512;
    8 e/ X1 a4 c) I; ]
  79. static int bcnt = 8;& I' \. _* t4 j% \. |$ x! g
  80. static int ccnt = 8;
    . E. }2 n" f0 R8 Y

  81. ; V' j6 k  X$ R. {' \# O4 |
  82. module_param(acnt, int, S_IRUGO);
    4 b  [6 f; r# _) Y/ W0 U: a9 {
  83. module_param(bcnt, int, S_IRUGO);7 c2 A% R1 F" j0 _3 a
  84. module_param(ccnt, int, S_IRUGO);
复制代码
$ ?8 G8 I  c: s0 ~, P! C0 u

) P1 Q8 _3 g& d% \1 N      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( R3 \7 D# g: 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" {8 Y/ i* S) U2 Q
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* i) ^6 n3 ?7 i. R

# I$ y) z8 P) i0 x( W1 d2 x9 k. {7 g" [; R# G' u
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

点击跳转“创龙科技服务通”

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

GMT+8, 2026-2-26 17:04 , Processed in 0.058473 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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