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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 n* u- u% t1 F, A6 b; ^7 m
  1. [code]EDMA sample test application
    5 f: [+ a+ W. g6 k
  2. /*5 T4 p: C( s' ?$ \) i
  3. * edma_test.c
    $ [8 `3 m# c# K8 J+ }% n( @1 C
  4. *
    . p6 Z4 M; ]3 X
  5. * brief  EDMA3 Test Application
    8 z: ]2 b9 Q* R
  6. *
    # [/ S1 E  X3 f+ ~- C1 b+ ?
  7. *   This file contains EDMA3 Test code.) d/ Z/ \! L& B, A/ k+ b
  8. *
    . d/ k! e$ H( `) o" `. \) c
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 N2 J" E" |* }, }
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! Z7 V& g$ d; G  @7 v+ ^# F
  11. *         TO CHANGE.) m8 F& v* R: s  g, s
  12. *
    6 A% d% \) a2 L: N& J
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' b; Q' z1 Y5 ^4 @$ H
  14. *
    6 U/ F# V- x4 t' K
  15. * This program is free software; you can redistribute it and/or
    3 r0 ~6 N" D8 w: ]9 @
  16. * modify it under the terms of the GNU General Public License as: M' H: P. @/ W, [  M9 l
  17. * published by the Free Software Foundation version 2.5 u3 f$ h% Y/ q$ h
  18. *
    " R. B+ [5 j: @) Y, ^& ^* a' s
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    $ T/ |; I4 I* H- J7 p
  20. * kind, whether express or implied; without even the implied warranty
    ! X0 M) T: c& B- J, }0 d" l  Q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the2 |! G: g3 i4 U& z
  22. * GNU General Public License for more details.! Q; c$ L+ ^0 Z6 @
  23. */
    ; |9 C# F& y3 x8 m9 F/ k2 _% J! `

  24. 4 q9 W2 H8 @2 D% H" P; z
  25. #include <linux/module.h>
    7 j  @# y, b. p2 h5 P
  26. #include <linux/init.h>
    0 }" o7 o# M- E2 `4 e/ f
  27. #include <linux/errno.h>
    ! P9 i* C$ m; G7 e4 O
  28. #include <linux/types.h>6 u: j* k* U( ?# \  y/ a
  29. #include <linux/interrupt.h>; J  z* v& v. |5 v5 m7 x) b& G; }3 S
  30. #include <asm/io.h>
    ( R, y- m( M$ ~( u) I2 [' B1 F$ o- W
  31. #include <linux/moduleparam.h># b- i+ @+ w7 [4 ?( S7 G; a
  32. #include <linux/sysctl.h>
    ; `8 l8 y  F0 u' W, B
  33. #include <linux/mm.h>
    5 u/ |7 z. Q. |* L
  34. #include <linux/dma-mapping.h>, n$ a$ h- B% J0 k; o: V
  35. " V8 p% G$ k7 C( B" U" ~0 ], x" J
  36. #include <mach/memory.h>
    " n- k. K7 V. p+ c4 s
  37. #include <mach/hardware.h>
    3 D  B3 S  n- Q: L
  38. #include <mach/irqs.h>
    ( C% F8 H& @0 q& V0 w7 T, g" \* b3 X
  39. #include <asm/hardware/edma.h>
    1 T; V$ f- k# C3 [+ C; J
  40.   `7 d- P; o0 x' `5 Y7 u
  41. #undef EDMA3_DEBUG* i7 c# Z  p9 f" N6 H
  42. /*#define EDMA3_DEBUG*/
    ! j( n! @4 E: i

  43. 4 R+ _4 E* T. [, C
  44. #ifdef EDMA3_DEBUG
    % A* M0 c  F4 T
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# W; w) x$ [7 d2 G: W: `9 R7 y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). r- `2 {6 b6 }& t0 G" h
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); X) h) F& s, N, Y% U1 ]* b
  48. #else
    ( d! r% i+ N* H
  49. #define DMA_PRINTK( x... )
    3 k( M+ B, Z1 h4 f. k8 u
  50. #define DMA_FN_IN
    # c+ ^; `2 R& F/ G. a
  51. #define DMA_FN_OUT
    0 t8 n, }1 C% G4 F
  52. #endif
    ! I3 k8 ]  _: X) G
  53. 8 ]8 o* J; s& L6 o
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    3 [  `3 N/ P9 ^$ h+ g# Q9 D- r
  55. #define STATIC_SHIFT                3! J* W5 n- d  V. p2 m
  56. #define TCINTEN_SHIFT               20
    ! e& M* h& U# U  i' \2 [5 Z6 e
  57. #define ITCINTEN_SHIFT              218 }$ C$ h- U: H* ?: x, x$ K# m; N
  58. #define TCCHEN_SHIFT                22
    ( Q/ m* `5 F5 q: C  ~5 x
  59. #define ITCCHEN_SHIFT               238 ]- }) D& T6 Y- b
  60. ; ~/ y1 H; a& z: [/ \" r5 a& v
  61. static volatile int irqraised1 = 0;
    ! O3 h/ }  c! U9 j7 L  z+ U* n
  62. static volatile int irqraised2 = 0;, l  b+ ~7 J0 A+ D! N
  63. 0 X0 t' ], C2 g+ }  A# N" j8 b3 ~
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 o; O7 n& c* X( h( g" |' f
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 k+ |" p1 Z* d1 l
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& G3 m4 W# _0 e; t, W' b2 I
  67. 1 g3 A1 r" p1 Y3 v) G. f$ O! U
  68. dma_addr_t dmaphyssrc1 = 0;! Y, S2 g5 G2 j5 ?& \( t, \( K& k7 J
  69. dma_addr_t dmaphyssrc2 = 0;) B; x2 X8 a" E1 ?6 t
  70. dma_addr_t dmaphysdest1 = 0;# v7 w* b; L. i$ [
  71. dma_addr_t dmaphysdest2 = 0;/ M2 r, Q" l! P. z; M2 ]

  72. + @- T: _9 w- Y  j% w% I7 ]
  73. char *dmabufsrc1 = NULL;
    & d; u* A  h8 a) ^3 S5 K
  74. char *dmabufsrc2 = NULL;  s2 z0 g( t& u- j
  75. char *dmabufdest1 = NULL;
    3 B6 A# p  {6 |0 z( K7 Q% t
  76. char *dmabufdest2 = NULL;
    - y! f6 ~% K" t( p
  77. 2 ]7 Y/ @# Z8 C2 A3 k2 L; m" R
  78. static int acnt = 512;
    6 D: R# f) Q4 S9 ]: l
  79. static int bcnt = 8;
    9 T8 }: C1 q, ^- {! p" g) ]$ ^
  80. static int ccnt = 8;: Y4 O( @7 B) K2 w
  81. # C' ?& l; ]( L8 s! E4 h9 S2 N) Z
  82. module_param(acnt, int, S_IRUGO);
    " G( e; O" v4 r' v/ w
  83. module_param(bcnt, int, S_IRUGO);
    ! k* L: D) J/ W8 F0 `3 {
  84. module_param(ccnt, int, S_IRUGO);
复制代码
. W' k4 ~! n- @% H
: ?1 }& J* s- S: y
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 I5 z# o: b) {- B. k
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* X5 g+ B* _6 P$ O7 ~4 T% Q6 u5 z     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* o$ o6 A& ^5 ~$ J; g& f; B1 C0 g
3 E4 q( p. N1 T$ Q3 T$ x& A3 R8 c" R; o

- e# F0 l  V6 n! W, Q$ D- l
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-7 22:50 , Processed in 0.036981 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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