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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! W, e+ I( p% t
  1. [code]EDMA sample test application
    ' v- ?% [  \7 Q6 H( y* h
  2. /*7 v! S/ c' S6 M4 o4 [& o
  3. * edma_test.c7 q4 l% i' U6 y1 L3 F7 |- i! y
  4. *
    , S0 W# t. C0 I4 e
  5. * brief  EDMA3 Test Application
    . u6 H( ~' h, {! A1 I
  6. *
    1 s2 ?+ T/ O8 s5 p1 @* r+ }; `
  7. *   This file contains EDMA3 Test code.5 o1 T0 j4 _" u: V/ @: }/ p
  8. *
    7 w: O  t1 ~( l+ G/ u3 I$ ]! h- O
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    , U& d* y! V$ A0 [4 S$ t
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    $ F3 X; \7 G( C
  11. *         TO CHANGE.
    ; Z7 Q- `7 M  w4 Q
  12. *
    ( y3 z5 |: J) Z0 i, X5 J( x
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 X+ D9 o4 k8 d
  14. *# k4 x/ y6 q) M( h% e. B3 S
  15. * This program is free software; you can redistribute it and/or
    1 B3 q, B1 y5 h( K/ b# X
  16. * modify it under the terms of the GNU General Public License as
    ; O6 p  t+ S3 c- h& d- w( L
  17. * published by the Free Software Foundation version 2.
    / x3 n. z4 n9 p/ y6 O# U0 j7 k1 t% e
  18. *( X' L, L. Z, |2 ?4 E
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any( v/ y3 |' t6 l& r& `# m" H
  20. * kind, whether express or implied; without even the implied warranty
    ; M) B" q" }4 n
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7 ?/ j2 ]; c: S1 k% q; b) U  W$ Z
  22. * GNU General Public License for more details.1 p7 b$ z; E7 d8 D; j5 h3 D9 Y
  23. */
    4 M) f: ]6 T6 N
  24.   H8 A" V+ k, i5 U4 ]; H
  25. #include <linux/module.h>+ b3 [! @# w3 {
  26. #include <linux/init.h>- ]. J! K/ m2 q6 i  d3 S. G
  27. #include <linux/errno.h>. L1 O! C/ I4 r4 ?, g* b
  28. #include <linux/types.h>
    . Z2 q8 {. _5 p, U
  29. #include <linux/interrupt.h>+ I+ Y8 l# z/ G9 [6 I: X
  30. #include <asm/io.h>
    2 w% _- h. d- B6 a7 b. Z- X: ?3 r" Z
  31. #include <linux/moduleparam.h>
    - S( u! }9 a, s. E
  32. #include <linux/sysctl.h>
    # f* {5 h* y/ r  d0 w1 }
  33. #include <linux/mm.h>
    ! l' \5 J; w& X% Q' v
  34. #include <linux/dma-mapping.h>2 s2 M4 ~$ q3 t$ C+ K: l: l

  35. ! g( b- c1 g) v/ P% d4 i
  36. #include <mach/memory.h>- Z8 c6 M" A4 E' W: A
  37. #include <mach/hardware.h>
    6 g$ \& O% L8 X$ U
  38. #include <mach/irqs.h>
    ; B/ c, Q7 b+ ?7 L: k
  39. #include <asm/hardware/edma.h>
    . U- h3 v- g/ X& i7 X( ]: ^

  40. : j$ b' k' x' A$ t, l
  41. #undef EDMA3_DEBUG7 Z+ \9 v# I# x; V0 v$ @5 q, [
  42. /*#define EDMA3_DEBUG*/; |4 ?$ @2 e. o- M1 x
  43. 5 e0 _3 v- G0 }6 t$ O9 f% T6 R
  44. #ifdef EDMA3_DEBUG
    5 V+ p( f! R/ l6 d$ D
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)  {, A$ c. H4 Y! D
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    5 |: [2 a; K7 e( }4 r* Q0 S
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ M) c: z, X8 y
  48. #else1 J1 w1 h1 p! u
  49. #define DMA_PRINTK( x... )
    : W, x# s: |, ]# Q  @2 y1 v
  50. #define DMA_FN_IN9 |0 P; N! a! ~) B  `8 n, ^
  51. #define DMA_FN_OUT! g6 N6 @: f: q3 c$ ^# E3 `8 y
  52. #endif3 q7 \2 s0 C4 {* H

  53. & X; A( t' e  h6 G; r5 v
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)" h! a( b4 {0 y4 g5 u& M
  55. #define STATIC_SHIFT                3
    4 _+ u; {, P5 c3 r6 E9 K
  56. #define TCINTEN_SHIFT               20$ r! a2 u' P1 W' M3 m2 N) _, z, I
  57. #define ITCINTEN_SHIFT              21
    * _8 G" p1 l: N, E" J3 M
  58. #define TCCHEN_SHIFT                22' Y9 G; s% _+ i" i+ p/ t& G& M0 |. }
  59. #define ITCCHEN_SHIFT               23
    1 G3 }+ u0 ]* J3 N) w3 _
  60. $ }3 N/ a; B: {
  61. static volatile int irqraised1 = 0;
    , G* i( s: B, g' {* [6 ?3 J. I: [
  62. static volatile int irqraised2 = 0;
    ; E+ _. u" f3 g9 |, f+ G* S
  63. & E' R* O- b0 @% s1 e) i/ w
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) v5 I! M- I1 ^+ D. k
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) O8 i; ?5 V& N, A) U
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' n( b+ R6 w/ `
  67. & m! N' q7 ~. Y3 _6 p( ^
  68. dma_addr_t dmaphyssrc1 = 0;* Q, q& d* D. g* @- Q; r" N
  69. dma_addr_t dmaphyssrc2 = 0;
    3 F1 z- x% s7 ~4 u0 H
  70. dma_addr_t dmaphysdest1 = 0;+ o7 W$ c! u- n5 f/ _
  71. dma_addr_t dmaphysdest2 = 0;3 w# K" X' D5 ~. \. s: `
  72. 2 b9 x+ B+ f8 ?5 t0 _
  73. char *dmabufsrc1 = NULL;2 _5 V1 J7 }' q2 h; @/ y* ~
  74. char *dmabufsrc2 = NULL;
    & ?' m0 Q7 g6 P) i$ H
  75. char *dmabufdest1 = NULL;! T% m1 l5 U* y2 z2 p' Z
  76. char *dmabufdest2 = NULL;
    + a" ~0 t/ H# @/ z1 U

  77. . s6 F4 a  m" Q5 p- L, m
  78. static int acnt = 512;
    # t1 C- U* m, p' G/ u, W' B
  79. static int bcnt = 8;
    6 r7 E" g  h0 ?$ B7 b
  80. static int ccnt = 8;1 b, O4 o: L; `& o

  81. 3 I4 U+ H( |; L& F5 V5 v! W
  82. module_param(acnt, int, S_IRUGO);- s" I' p7 [3 @; h
  83. module_param(bcnt, int, S_IRUGO);
    8 K$ E# K: P+ I1 }5 }5 o) K
  84. module_param(ccnt, int, S_IRUGO);
复制代码

- L2 G. e( i7 x; a: B6 \$ J7 d5 H; {* x* H% N1 w# V
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- I- B, R+ k& u6 q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% u  E9 O- G% s0 }/ t' F     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 i* `/ f1 B8 s* G* r$ l' ]: l

; R, j" h3 C5 `9 V' \
4 ]" I* s) ]5 j  x) f6 A% R& C
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-10 23:14 , Processed in 0.037617 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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