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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# w' N) N5 J; I* I) V; M
  1. [code]EDMA sample test application
    $ f1 l! ?- U% [1 n/ g  Z. s
  2. /*4 b9 b# K% f# ^- W
  3. * edma_test.c8 r$ ~) P' r/ a9 y3 B; K) C% q
  4. *0 P" v& c% v( X7 r
  5. * brief  EDMA3 Test Application0 `- U+ p7 ?: G3 W  `
  6. *
    3 k1 u- ^9 h+ Q; K9 e( k
  7. *   This file contains EDMA3 Test code.
    3 y: z* S3 K  k" o
  8. *
    ) V. H3 O" n( n; M  q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( z' l7 F& C0 }0 k. n8 @/ o) F
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & F6 h. Q3 g9 \2 \
  11. *         TO CHANGE.
    " w5 B- y9 s- M
  12. *8 f; F# U: Q4 A( R& r
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% Y) Y: N6 k+ M6 z  X
  14. *7 ~% ?8 r) D$ S( L. c9 z6 K# ?
  15. * This program is free software; you can redistribute it and/or
    # R! S2 H& z4 t, M$ X( ~% f
  16. * modify it under the terms of the GNU General Public License as! a+ X7 m* h, L. Z3 S2 Y5 Q
  17. * published by the Free Software Foundation version 2.
    ( a5 }$ n, p, ~3 Y
  18. *& X; M6 t6 a: O/ E) d% Q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any% Q# [* _4 L8 M6 g7 q
  20. * kind, whether express or implied; without even the implied warranty: @" f: K" g1 Q- f3 `
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' y6 o, T  w! y
  22. * GNU General Public License for more details.
    8 a, v! \/ @- p3 @! j
  23. */
    7 u$ B* B; f% H! i
  24. . v1 H( o$ w; w5 A8 h' A* L$ K
  25. #include <linux/module.h>
    3 W1 p9 N) u: A+ w  z
  26. #include <linux/init.h>
    % s' s8 B! j) V$ T
  27. #include <linux/errno.h>
    ! F0 R3 g* p* m6 N1 v) e
  28. #include <linux/types.h>
    & k* J+ |8 @3 m0 T$ m4 |! }
  29. #include <linux/interrupt.h>
    9 c# S% L6 }, q% f. z: s8 S
  30. #include <asm/io.h>/ R# Q% I' g% |: d, K
  31. #include <linux/moduleparam.h>( `. D5 _( l/ t! [! ]3 I
  32. #include <linux/sysctl.h>  E  _3 m, E; c# O
  33. #include <linux/mm.h>" l% K: x8 c$ \3 U
  34. #include <linux/dma-mapping.h>* L# K; N2 t+ _# k0 `+ O
  35. * _+ @3 i8 }9 Z: {6 K: ?* ^+ N  h1 b7 T
  36. #include <mach/memory.h>7 c6 v8 @0 W5 R
  37. #include <mach/hardware.h>
    4 {3 H2 _( M6 A" w' y
  38. #include <mach/irqs.h>
    # E. Z3 }# U0 ^3 d% U
  39. #include <asm/hardware/edma.h>' F" T0 X% t: d9 v1 h% @$ X% ?

  40. 7 `) f# k; o& I; t9 y
  41. #undef EDMA3_DEBUG
    4 g5 p, ], p- i8 a$ w1 ?. P
  42. /*#define EDMA3_DEBUG*/3 x1 {  X/ o. T7 k

  43. ) g/ q0 A- u- B
  44. #ifdef EDMA3_DEBUG
    . ^  z) R5 ^' e3 r2 z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    : s! ~& z' R& ?0 l% [4 n7 r
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)  V+ U. [- R- [) f
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 T. T1 g2 ?/ S4 Z2 t+ F
  48. #else
    1 c3 z$ P& ^0 ?8 W/ M  s) z, h
  49. #define DMA_PRINTK( x... ): z" t, W) a/ w9 D
  50. #define DMA_FN_IN
    ) r. v- d/ L9 r' v
  51. #define DMA_FN_OUT
    3 r9 j; j% X) W! @  D) l
  52. #endif
    4 M, T% h) s! ~, R3 D; L7 [. B
  53. ) {" ~& C$ c. z3 v2 F; Y1 K
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    3 l$ S9 j) x! J) c: Q
  55. #define STATIC_SHIFT                3
    9 r2 g. h3 k  ]! g3 z4 ~3 a  z
  56. #define TCINTEN_SHIFT               20
      d3 b# U! [7 y- D( O  d% \- Q
  57. #define ITCINTEN_SHIFT              21" G2 A) V$ J9 `
  58. #define TCCHEN_SHIFT                22; j8 b8 x$ W7 h5 E& ?) _
  59. #define ITCCHEN_SHIFT               23
    , p- |8 G% N! i( Q( T" u8 }% x

  60. 9 y* L0 \, Y+ e& |- O
  61. static volatile int irqraised1 = 0;
    + O" P1 T  x( h
  62. static volatile int irqraised2 = 0;
    8 m* _3 {5 C: y1 k  v
  63. ) W& N4 \( r2 u, _7 ]8 I
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' d( s+ [, O  z7 n2 H
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# H0 N7 \% p8 `4 ?
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. ^7 f# |* v+ |5 x

  67. ( X% p5 _% {/ r: O' d
  68. dma_addr_t dmaphyssrc1 = 0;
    0 G2 J% b# o4 d
  69. dma_addr_t dmaphyssrc2 = 0;* E! R+ j' Y7 g$ i5 E
  70. dma_addr_t dmaphysdest1 = 0;
    & S. u+ g2 x) U3 {% y
  71. dma_addr_t dmaphysdest2 = 0;
    0 t+ s/ f6 v6 b8 l3 R" G/ w  U2 h

  72. 2 m/ Q) r% }6 m( V9 E! l
  73. char *dmabufsrc1 = NULL;* O1 h. K3 }: D4 j- B
  74. char *dmabufsrc2 = NULL;4 [1 }2 N) z  h" h) ^
  75. char *dmabufdest1 = NULL;
    6 f6 {) C" [4 O7 n
  76. char *dmabufdest2 = NULL;% R! ~7 W( ]7 m, D0 D

  77. / h# G/ |/ [/ i& p5 f
  78. static int acnt = 512;2 Q+ }6 b2 P9 G/ J+ G
  79. static int bcnt = 8;* b$ {6 a4 B$ ]" l: P9 W
  80. static int ccnt = 8;& C" [" x9 F9 ]% P! G+ }4 s# R
  81. 8 N! @/ M* O% j0 m
  82. module_param(acnt, int, S_IRUGO);- L# R: u; o& m1 ~; W
  83. module_param(bcnt, int, S_IRUGO);' d1 X1 n/ C* j5 f- i
  84. module_param(ccnt, int, S_IRUGO);
复制代码
) v& m4 Z7 J( N% K/ L7 p) D. Y

1 w& j3 y- B- f! z0 C) }; B      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& a1 e+ ]- L8 O: G% {( M9 s) f6 Uarm-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 X" T9 V, L$ W     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; \4 ?, M  \4 z8 R" p+ K4 W3 F  O1 l/ c$ B
0 g! L$ Y) x# K0 e$ O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-8 16:14 , Processed in 0.042209 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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