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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 e$ o2 k6 Q3 k' b1 ]1 p5 P
  1. [code]EDMA sample test application
    , q+ |3 t0 m! Y1 Z
  2. /*# U+ @$ K0 `$ R, Y9 f2 `1 w2 z
  3. * edma_test.c% O/ ^, t6 E! d. P, R& L. e
  4. *& C- i/ `8 ^& ?/ b; s
  5. * brief  EDMA3 Test Application' ?; Y( U* J" s2 ~/ D
  6. *
    6 \! r3 g. I7 V, w
  7. *   This file contains EDMA3 Test code.
    + ~3 m' y7 C$ m1 k% K
  8. *! h6 |3 V/ w* Z8 L! L
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ b4 k; V( K8 K  J% E
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 I& @' J- H/ N: {7 \7 Q" X
  11. *         TO CHANGE.
    % U3 i7 D- E' H/ \* }" `7 g
  12. *
    2 B: ?2 B# N, s  L4 T% G9 C# F
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ B4 o) m' G0 ?6 Z7 s* A  i
  14. *
    " y1 Q  K+ c  |; |$ s& q5 T% u" T
  15. * This program is free software; you can redistribute it and/or  t, v, N# x" y
  16. * modify it under the terms of the GNU General Public License as" s, S; C& ]: w; f$ O
  17. * published by the Free Software Foundation version 2.- h5 e) ~& s9 V2 P- m5 I
  18. *6 S: ^  q# b& G) r8 h% w
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: c& P5 T6 Z  k+ R& i" ?: ^5 I
  20. * kind, whether express or implied; without even the implied warranty
    $ V3 W/ m& Y5 E6 S( T4 a9 H
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the( z" ]: b5 R! O. _# u
  22. * GNU General Public License for more details.7 @, ^+ {4 N5 o8 c
  23. */
    9 m/ V4 F% H; s1 ^! o" L2 F
  24. - Q  W% Y# E& z! p9 f
  25. #include <linux/module.h>
    + C6 H8 v$ r* q' a# Z* O
  26. #include <linux/init.h>
    * w: G' c6 c/ d2 \# K+ ^
  27. #include <linux/errno.h>- z. \4 |/ F% g2 V5 I" e( @' U5 ?
  28. #include <linux/types.h>
    6 e" |9 d9 E5 U1 _5 g  i
  29. #include <linux/interrupt.h>, X- }& B, g7 I: u% |
  30. #include <asm/io.h>
    # f6 G7 i% ^3 ~& ]/ M; P. K% I5 W
  31. #include <linux/moduleparam.h>
    , b! U6 m6 k- ]0 `5 n5 s( I
  32. #include <linux/sysctl.h>
    5 d) j) f5 l9 F: `2 ]
  33. #include <linux/mm.h>
    ) {, W; ?& W$ L! T1 D4 u& e  w! L3 C/ h
  34. #include <linux/dma-mapping.h>; q" n1 ]# f3 y# H  Z+ s. w

  35. 1 n- L, g4 |! X; a3 U
  36. #include <mach/memory.h>1 g+ Y3 F7 c) x  m8 j6 c
  37. #include <mach/hardware.h>
    % a) ?; H$ I$ u- E
  38. #include <mach/irqs.h>
    4 D  I; S! L& s- V1 j/ z! Z
  39. #include <asm/hardware/edma.h>
    . {+ j  L& E6 G. p
  40. 0 q! h/ Y3 t7 x0 z$ O% G
  41. #undef EDMA3_DEBUG
    ) m5 v& A$ u$ }5 H0 y# o
  42. /*#define EDMA3_DEBUG*/+ c+ w7 e) G# P/ O2 S
  43.   s  Y6 Z+ L) X
  44. #ifdef EDMA3_DEBUG
    ! l* M$ F6 h* C/ c- E' Z! z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    & Y' q  O/ P, k! X3 J" S
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & U) ~- q, |; ~7 {
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    * \0 z, N' u  q0 B9 R9 y" @
  48. #else8 b/ n2 g, V, @6 N
  49. #define DMA_PRINTK( x... )
    , p, ~/ p9 A: i3 b7 Z% t
  50. #define DMA_FN_IN/ y" g& y: x2 o- d
  51. #define DMA_FN_OUT
    ' J: R* p& I# V" Y% ^6 ~1 L
  52. #endif  g- S2 z" `$ r( @. B6 f

  53. $ y5 [/ g% F$ m* M
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    4 B$ H3 ^9 T4 Z+ h) @
  55. #define STATIC_SHIFT                3
    ! i8 Q( X2 v8 n" m
  56. #define TCINTEN_SHIFT               204 b5 w2 D" d0 y' ]: B2 B
  57. #define ITCINTEN_SHIFT              21
    - g0 P2 u) M6 L' ]1 k% H, y& \, |& B
  58. #define TCCHEN_SHIFT                22! G* Q: K% w; a& z' d1 ^8 L" A
  59. #define ITCCHEN_SHIFT               23- a3 a% L+ F9 T* L" E' j$ X- g
  60. / B# M2 }# T: `" O3 q3 Q. g
  61. static volatile int irqraised1 = 0;# A1 V) E# }! I, D/ }8 Z. g
  62. static volatile int irqraised2 = 0;, ^" F& s6 `7 S) B$ \1 p. R7 p1 ?4 ^* \

  63. ) g1 ]: ?6 p  ]: b& l' T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' a$ D  |: y& w8 T- g
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : @/ J; w% I4 r  j+ S
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! C& ]) f8 L7 J. D  Y

  67. : X" U6 W/ l6 ^6 }
  68. dma_addr_t dmaphyssrc1 = 0;! ~% Z1 b$ i5 P& y# T0 t
  69. dma_addr_t dmaphyssrc2 = 0;
    0 M8 c/ q( a5 N+ Z, `
  70. dma_addr_t dmaphysdest1 = 0;4 ~* U+ f# c9 w, {6 w- G
  71. dma_addr_t dmaphysdest2 = 0;! K* f9 C1 y0 y

  72. " i  f0 U' ^: \8 t
  73. char *dmabufsrc1 = NULL;
      ?; R" u3 J; i! B1 }) A! R
  74. char *dmabufsrc2 = NULL;+ A& N( p3 J/ p) z& y0 V. [) N1 [$ ]
  75. char *dmabufdest1 = NULL;) \" o; x) O2 _% c& E
  76. char *dmabufdest2 = NULL;1 ?: S2 M! v# G% u3 [3 y# v

  77. ; s2 I) N  f4 I0 Z) R7 t
  78. static int acnt = 512;
    % w' ~1 R$ k3 \* ?8 C8 z
  79. static int bcnt = 8;
    6 L  f' L0 a' K# J' t, k7 ?) \8 w
  80. static int ccnt = 8;) C* J" |& v. K* U) S$ D9 V. K
  81. ; u( L. W" n% }( V. h) S# {
  82. module_param(acnt, int, S_IRUGO);
    / m$ c- O! L: o- ?
  83. module_param(bcnt, int, S_IRUGO);' U9 K8 O' c- I3 ~4 ]
  84. module_param(ccnt, int, S_IRUGO);
复制代码
! J, l$ ^3 g' o

9 F- Z9 p. Y7 ], E# ]      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ g) Q) p! P% A0 r9 m
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* ~' b( g# H2 }4 l* @) R& e
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 ?3 c& ~( M  ?$ _" Y$ _  Q; ^
) y6 N1 z- }, @1 }3 l! e# V; I

2 [: q, f1 c  D' K( l& g
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-5 15:21 , Processed in 0.044439 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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