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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 \  _2 j' a7 E- X
  1. [code]EDMA sample test application
    / ~/ z: n4 x0 \" K
  2. /*6 x" v& C6 @! u/ }/ d  r- @; m" M2 R
  3. * edma_test.c+ r" d0 T, s3 C# F. i1 Q
  4. *7 b2 y( R4 p! m4 L. [% m5 j
  5. * brief  EDMA3 Test Application
    + J& h9 ~; X' Q
  6. *
    " P9 ^: [, Y" `% _
  7. *   This file contains EDMA3 Test code., N2 d+ B- {9 V' c
  8. *
    8 G; b" k/ ~# S2 c
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    : H3 v. [8 p0 L1 p
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    1 G# e8 W$ k0 T& [4 a$ G/ @# P9 N
  11. *         TO CHANGE.
    ' k5 y% [- [: Y; z/ {7 L6 Z
  12. *
    7 k& f9 D, Y9 D6 M" e) f
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ P' ^- g- ]# w' v
  14. *9 l+ e$ l% _/ S9 V2 i+ [1 g& ~7 J8 `5 w" ~
  15. * This program is free software; you can redistribute it and/or
    8 O% H: i- R, P
  16. * modify it under the terms of the GNU General Public License as5 o5 |$ a  b  ?- _5 b
  17. * published by the Free Software Foundation version 2.
    / g5 A! [/ u' k9 a3 k
  18. *5 Y0 g7 s/ |4 T% p, t; n3 L8 y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ) F; M/ j6 v/ z2 v0 k; }: Z& O/ u
  20. * kind, whether express or implied; without even the implied warranty# h( y( I; V5 v* j+ l
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 B7 b6 |# U/ r; W& W8 B$ F  a
  22. * GNU General Public License for more details.- p/ Q% S, E4 s; Z! F9 {" w- x
  23. */, D7 M* Y) ]2 N9 m* U- h! b- M/ h

  24. 3 d6 L! X% X( y- X
  25. #include <linux/module.h>$ e+ C6 M) O4 A' Y3 B% V8 S
  26. #include <linux/init.h>
    ! g) s, Y/ U1 z. L+ b
  27. #include <linux/errno.h>; M9 x0 f3 \1 \  b7 i" A8 a
  28. #include <linux/types.h>
    + C: {- M. U  `, p  w
  29. #include <linux/interrupt.h>. h$ U' ^2 b8 ]$ r: y0 a, J
  30. #include <asm/io.h>
    / n3 O! E' Y2 _* s1 c" C5 u" j# v* Y9 P
  31. #include <linux/moduleparam.h>
    * y! i( W% Y) L5 U1 ~6 M3 a
  32. #include <linux/sysctl.h>: F4 L' e' A0 Y; b0 b& {
  33. #include <linux/mm.h>& j. R- ^2 v" e4 H
  34. #include <linux/dma-mapping.h>+ T' C/ }! [: t0 o7 }

  35. 5 u1 v" u2 `! D4 Q
  36. #include <mach/memory.h>6 |8 H' o: Y$ m( e
  37. #include <mach/hardware.h>
    ! u; Y; R1 j  x- f5 S
  38. #include <mach/irqs.h>
    * A$ n# A6 ]: Y$ `
  39. #include <asm/hardware/edma.h>9 F9 `' V" g5 Z

  40. 1 _3 W5 C: `' t& C  t. I+ V
  41. #undef EDMA3_DEBUG$ w, }1 h; v# \* U! H( a9 @, g
  42. /*#define EDMA3_DEBUG*/
    1 c5 X, k+ D/ }5 l( v( B  x

  43. $ X3 i! H) m7 n+ W: A4 \
  44. #ifdef EDMA3_DEBUG
    $ x2 ^& r9 e; M, B6 S8 z7 `1 l' p7 Z# ^
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    9 ?0 F7 a5 Y4 S. |) h
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      O& Q4 [  Z1 j
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - @- W7 G/ a' r  U
  48. #else4 F: i9 }5 ]$ `+ e
  49. #define DMA_PRINTK( x... )
    + Z2 i3 i) G8 G$ }% p; F' k, G
  50. #define DMA_FN_IN
    & O) K' U1 I. ?! d: `
  51. #define DMA_FN_OUT
    ! {: [" S8 o1 v) t% N
  52. #endif) g$ k- U  W, y
  53. # L9 `1 R# W( p! U) n% z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)" D4 S* y( ?! V) E0 L' B3 }% D( k
  55. #define STATIC_SHIFT                3
    ' w" ]5 l* o  I3 r/ H
  56. #define TCINTEN_SHIFT               20
    . Y0 i: {! T8 r
  57. #define ITCINTEN_SHIFT              21$ J1 B( S# a$ a4 E. c
  58. #define TCCHEN_SHIFT                22
    : ~, g3 G" s' i4 A2 K3 b2 c
  59. #define ITCCHEN_SHIFT               23/ T' i1 E6 D5 a/ N# F, P, Z* x* \

  60. 6 K# [: B9 R0 F: u
  61. static volatile int irqraised1 = 0;
    $ B7 c+ q1 b; q9 m% W7 @! j2 |
  62. static volatile int irqraised2 = 0;
    & d" G" K: C; d" R  T

  63. 7 G0 r) Z2 r1 ?5 Z7 |$ U
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 j3 K. I2 _% ]/ T
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; G0 U8 v- F  k
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: _+ B. c5 M* g# K* v- l7 s

  67. . _+ ~5 l) l( h; i
  68. dma_addr_t dmaphyssrc1 = 0;& u6 A' C7 H/ a
  69. dma_addr_t dmaphyssrc2 = 0;
    3 p! w3 o& s6 P
  70. dma_addr_t dmaphysdest1 = 0;
    $ h$ k1 o2 Y- a( @$ B% x& z
  71. dma_addr_t dmaphysdest2 = 0;
    " ^$ G% a( S: _# n5 ~1 n  ?" b

  72. & w" c+ D( a& `2 X( x6 q+ q; |
  73. char *dmabufsrc1 = NULL;' ~, b3 A( D- M' i5 i/ L
  74. char *dmabufsrc2 = NULL;
    , Y  g: H- S# M4 G; _
  75. char *dmabufdest1 = NULL;
    9 f; j* ]/ y) R6 c
  76. char *dmabufdest2 = NULL;' Z$ A" Y" {, G7 \/ |+ n; e

  77. 6 x/ F- [4 B/ G0 Z" e" O% L
  78. static int acnt = 512;7 ?" d: \+ l& ^( P- {
  79. static int bcnt = 8;  Y7 G5 f" K2 q; h- A- W( N7 u8 `
  80. static int ccnt = 8;4 z3 h# [0 X/ l% P7 R- h
  81. % m0 n4 f. n* |, H' o. Z3 N) d2 q
  82. module_param(acnt, int, S_IRUGO);. M7 Y1 @* [6 _3 E# j7 O
  83. module_param(bcnt, int, S_IRUGO);
    # j. q% C% n* u1 ^+ s' {
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; M( W0 G9 L  p/ n4 _4 h$ a

! @# j/ |6 c0 |; L      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' n! \. d2 L* @' n3 L7 larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, c) _- u. b! j- C
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, j5 W4 U! `0 d+ k) B

4 N) m1 l: H4 F# Y9 T+ V; l; x' k4 J, L+ M7 r! F! r
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-14 03:29 , Processed in 0.040878 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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