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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + ^8 i2 @: j! _( p9 M
  1. [code]EDMA sample test application9 x* x- _) F6 S1 x) B; ]
  2. /*
    5 [' ~% G( p" t
  3. * edma_test.c, I, s1 v7 X/ z1 m" e
  4. *: w( u' E5 j1 F  f" R0 e
  5. * brief  EDMA3 Test Application: m; A" S% c: ~9 `: q
  6. *! l1 l' r7 `* [- C4 r
  7. *   This file contains EDMA3 Test code.
    ) v. v3 Z% q) [+ z/ w. x7 ?& A
  8. *  d5 |. k# {$ C
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ b0 r1 e4 ?3 W( |/ p0 Z7 ]9 o
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
      Z) ~3 a! ~% p3 s& f/ f
  11. *         TO CHANGE.# s* [3 I4 D3 f4 }7 K
  12. *
    ( n! C  y( \+ p% O) C  u* q' D7 A
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % j- L' ]: j) v) s* o
  14. *8 M: k  \% _  L! [7 c: U8 Z* I6 C9 I
  15. * This program is free software; you can redistribute it and/or% p. l' X) Z3 {/ a
  16. * modify it under the terms of the GNU General Public License as$ W2 u. u( @' E7 _8 _& W# y
  17. * published by the Free Software Foundation version 2.
    # Y. `, S0 J$ `) {" t. B2 h
  18. *2 M0 l" K1 H' e5 E! p' x  O1 {
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 V" Q9 X) z  v- j8 R8 g! G
  20. * kind, whether express or implied; without even the implied warranty
    & k& Z! A# J( N! |
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 U* \  O9 u, B( e1 f
  22. * GNU General Public License for more details.2 H2 h% b- a- t) w( n- q
  23. */. U; v9 Y/ k$ x$ S7 c* H

  24. 1 @6 M+ z% z# z8 P' Y9 O3 q) }; q
  25. #include <linux/module.h>
    % s! q+ `& X! H
  26. #include <linux/init.h>2 h% Z7 {9 k' ~9 w! |9 `
  27. #include <linux/errno.h>' B/ o7 |% }! Q% ^, X* x! V
  28. #include <linux/types.h>3 a" t% ~/ q3 d% ~" I
  29. #include <linux/interrupt.h>8 i+ ~/ N" D: B6 }; w1 J; y( B
  30. #include <asm/io.h>
    1 Q, V; G2 G0 d# T/ r% T
  31. #include <linux/moduleparam.h>. V7 J# ]* V( R3 u. F
  32. #include <linux/sysctl.h>: M! _! V/ T2 T! V' k
  33. #include <linux/mm.h>
    8 n8 E& S, t, h+ D+ x
  34. #include <linux/dma-mapping.h>! s5 m3 x. S1 l; w

  35. 8 O: K2 L* K. t# a$ P, D
  36. #include <mach/memory.h>% u4 B* s8 {2 X0 @
  37. #include <mach/hardware.h>$ r( l' F( U3 b& O/ x
  38. #include <mach/irqs.h>& N$ |3 |* N1 V' u
  39. #include <asm/hardware/edma.h>
    ! J: W) F- T) \& c0 ]

  40. 5 v. m8 H1 `  W# s( @$ [0 {
  41. #undef EDMA3_DEBUG* _9 D1 D1 q7 P; J) R
  42. /*#define EDMA3_DEBUG*/# `) y6 t; \& F1 p! Q1 X. L( K* M; @
  43. 1 |( N8 z1 T' P2 g9 C. G
  44. #ifdef EDMA3_DEBUG
    + q( q3 s0 |  i% l" x4 D) K
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): k8 ^  F5 [/ G9 R2 \+ \5 {5 P
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 @# k6 v' `) F7 ~
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 G2 f8 z& q1 b
  48. #else- ~4 s. ~$ o: ~
  49. #define DMA_PRINTK( x... )
    % G+ K' d2 ]' ~
  50. #define DMA_FN_IN
    $ d) N3 Z  e- ?2 c1 I2 B
  51. #define DMA_FN_OUT( u2 p% Q: N. H
  52. #endif1 l- D, p& o% k* d8 @, b7 _

  53.   Z; O' P6 D' Q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). x* B, x( ^: \# ~! `
  55. #define STATIC_SHIFT                3; a$ q! p5 H6 P0 ^* N
  56. #define TCINTEN_SHIFT               20
    5 x! q; E9 x& O' w& {. b% R- h
  57. #define ITCINTEN_SHIFT              218 e$ E+ S( v' F5 h6 S
  58. #define TCCHEN_SHIFT                22
    . }4 a8 g0 U; K$ J" x- d- ]
  59. #define ITCCHEN_SHIFT               23
    % S. }+ f% t! Q5 w9 d/ [5 l' {( z

  60. : a& ]9 Y  Y) n* w9 z# l) l  c( m0 _
  61. static volatile int irqraised1 = 0;
    % G# Z# G4 L! K7 b  v( e
  62. static volatile int irqraised2 = 0;5 H9 z- T6 f% E

  63. . N6 }: [' [% c; T  V0 M
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * t) z4 w- x0 o  \! f. t8 j
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 r, r8 i0 K- B
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; M3 q  O8 S* o# D& F/ W! D' {( F; c

  67. 8 x3 g# m* E9 p/ f7 e" L% S
  68. dma_addr_t dmaphyssrc1 = 0;
    ) [4 P7 ~) \2 ~2 ?- J' Z, T
  69. dma_addr_t dmaphyssrc2 = 0;" X; Q( Z: S$ |' l1 K' z
  70. dma_addr_t dmaphysdest1 = 0;- G4 E5 v8 p7 ], L8 }! c6 [
  71. dma_addr_t dmaphysdest2 = 0;2 O* m0 E4 a" R! r" w; @+ U9 h
  72. ' d) V( t7 ]0 G5 n( }' {( i. ?! w
  73. char *dmabufsrc1 = NULL;% X. R4 X& ^+ \
  74. char *dmabufsrc2 = NULL;
    + s! b4 C* ~, l% i. n2 F
  75. char *dmabufdest1 = NULL;
    % P7 A: m3 M4 s( V$ G
  76. char *dmabufdest2 = NULL;
    % {, A, D; w& f: i

  77. ( i6 T* X0 b5 a: H/ h# d
  78. static int acnt = 512;; w8 ^3 N7 Y0 v' o1 R5 O  \- B
  79. static int bcnt = 8;
    6 ?/ z: @9 a3 ?: K/ n
  80. static int ccnt = 8;; U% I; `$ E  @0 m% G/ n

  81. ( O9 T  Q7 ~6 B! K
  82. module_param(acnt, int, S_IRUGO);
    6 v* l1 H- ~) A* i+ c- O- E5 k6 x& G
  83. module_param(bcnt, int, S_IRUGO);9 _" ]# i* M; v
  84. module_param(ccnt, int, S_IRUGO);
复制代码

9 z5 T0 `# I  Y5 d( n: R: G8 C" T9 w) G4 I# J5 e
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ U# P% h6 q8 ~% r# 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 q8 B% ^9 Y1 N* q3 c
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) ]6 O8 I) g& j6 ]4 F/ M$ M2 E
* d* s1 j" u+ s: y* T3 X0 F4 |
# j! P( r* y# g" r9 ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-26 17:19 , Processed in 0.035874 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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