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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & d9 y  {8 g# ~/ f* p5 X% ~; y  C
  1. [code]EDMA sample test application: J* Z5 `+ k& N# e1 |! W" v
  2. /*
    9 {) `# P; R. K. b3 P
  3. * edma_test.c
    " C, G5 ?" {9 i' |! X* P. f
  4. *
    5 {8 Q& ~5 W$ p# D) p" T
  5. * brief  EDMA3 Test Application3 M" Z7 |* V& [& E( g
  6. *+ n6 }+ p3 B1 y2 M' \, P
  7. *   This file contains EDMA3 Test code.) n- ?4 U0 F# W) h* R
  8. *
    ( o2 U* x" A7 C7 ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& s6 T+ x# ?2 K: V& z8 [
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    1 b. W1 Q9 s- Z, `3 V  U( j
  11. *         TO CHANGE.
    ) ?5 g( F6 _7 V7 A) b( x
  12. *
    4 U9 K- E1 P1 ]' [4 ^9 a6 B5 Q% X
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, H& M% Y' b/ H: K3 i* v0 B; T7 K! y
  14. *5 K' @9 o- t+ Y9 d- F
  15. * This program is free software; you can redistribute it and/or
    0 l/ S1 e8 i# z
  16. * modify it under the terms of the GNU General Public License as
    + P9 Z; _1 t& X( U0 i% ]9 I$ Z: W! s
  17. * published by the Free Software Foundation version 2.; x* D& P8 f1 p
  18. *
    . }% @& P4 W- T" U9 d
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 [5 z. X; r' r- \' c; b" ^0 p
  20. * kind, whether express or implied; without even the implied warranty
      J, @$ U9 p) m' w, f, ^
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* M* w  ]( O0 T0 [) X- I
  22. * GNU General Public License for more details.
    * E7 c# r8 G. _* Y: W
  23. */- V+ Q$ F" F9 y. [: J& R- i2 h
  24. * ]" S) x8 t9 k8 D8 F4 b/ B% @5 P4 C
  25. #include <linux/module.h>
    4 h/ R0 [& ?5 Q! f" K9 f
  26. #include <linux/init.h>
    3 G2 x, K4 T! H8 P6 f, I
  27. #include <linux/errno.h>
    9 @' a5 d% J! Z
  28. #include <linux/types.h>/ l" E. |+ U5 D) _
  29. #include <linux/interrupt.h>
    0 ~" e& G. g- v7 `
  30. #include <asm/io.h>
    + j5 V; A# w) D8 [# i% \
  31. #include <linux/moduleparam.h>) m6 a! z$ E3 J2 E1 W
  32. #include <linux/sysctl.h>0 Y' s0 ]9 n1 b! |
  33. #include <linux/mm.h>
    & q2 M1 C, u. w& m1 Q( r, l
  34. #include <linux/dma-mapping.h>
    , }8 d+ O4 T/ z" x* R; p; L5 o
  35. % |' C8 X) h& L: L
  36. #include <mach/memory.h>, @" {: I: U. y# b3 ?7 H
  37. #include <mach/hardware.h>5 X/ s, z* H$ l3 Q  T: k) ^
  38. #include <mach/irqs.h>% l# W. x7 p% i6 d
  39. #include <asm/hardware/edma.h>
    2 ~# U5 f4 B5 u8 P  K% D) Z

  40. 1 q* ?3 {/ y4 J- V' u* H, `
  41. #undef EDMA3_DEBUG' H) M9 N! d8 y
  42. /*#define EDMA3_DEBUG*/& a. l, v+ ]1 E% W) t: P+ Y
  43. , K8 [. H7 v, m" i, U( v+ m
  44. #ifdef EDMA3_DEBUG
    % s- j/ U% S% x/ R6 n. o
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    6 O2 @( D; E) A* q3 n8 F
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( n9 v* v2 T& z0 k9 F- _
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% l1 _; k/ G; ~' T7 u" L
  48. #else  X/ p. e7 s  t) H3 d* \& \
  49. #define DMA_PRINTK( x... )
    # D0 a* _. b; `; B0 ~7 D# }# q: `
  50. #define DMA_FN_IN$ Y" U' i3 O5 c/ _% {, g1 e
  51. #define DMA_FN_OUT9 t$ J3 |/ s% E. w
  52. #endif
    , l% O+ L- N* d+ M8 K8 a7 Z9 a' o- S

  53. / C( X+ Z. |9 ?% y6 ^. t
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)6 T& v# b( @8 v4 V6 z
  55. #define STATIC_SHIFT                3  ]& Y' T8 m* B  S
  56. #define TCINTEN_SHIFT               20' `$ Z- W9 M- ], Q2 u4 n# W
  57. #define ITCINTEN_SHIFT              21
    * z7 w* l+ R. h0 w/ i( Z) q
  58. #define TCCHEN_SHIFT                22. u9 N. i7 g* X& G5 |' y- I
  59. #define ITCCHEN_SHIFT               23
    , P3 b  h. q& j
  60. : X0 I3 E5 v8 @$ w, t  c* d
  61. static volatile int irqraised1 = 0;  J, G2 n( f( o9 g$ @; m/ i
  62. static volatile int irqraised2 = 0;  y% f/ z* C6 U- L* L& A$ I0 R, F

  63. 8 \1 }) u9 G; G* n* k! Y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, s: h! S, E/ ^/ n2 B* b
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 i+ V5 g: l( x: z) Z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 Z2 K9 t* _, S" w! `- m3 ]
  67. 1 S1 E! [2 _/ K1 ~" r
  68. dma_addr_t dmaphyssrc1 = 0;+ }% n) q. C- N1 g" Q
  69. dma_addr_t dmaphyssrc2 = 0;8 P" x5 E4 B. [" M' l, z. q1 `* ?& G* I
  70. dma_addr_t dmaphysdest1 = 0;
    ; @9 {0 h; i. V6 W5 N  [) Q
  71. dma_addr_t dmaphysdest2 = 0;
    , M8 _+ d" f- l+ O% Q+ s
  72. 7 m/ ^, z" E$ b% R( G, T+ c4 r
  73. char *dmabufsrc1 = NULL;1 k8 Q% n+ ?/ m- o
  74. char *dmabufsrc2 = NULL;' a* b3 l$ U$ o' r  h
  75. char *dmabufdest1 = NULL;
    8 \" i  z8 V- w- s" K: z
  76. char *dmabufdest2 = NULL;
    * @) ]! K6 ?' s' m0 I

  77. " a3 c  \8 T: `
  78. static int acnt = 512;0 Z8 F# Z( n/ H6 e" v* B
  79. static int bcnt = 8;
    # k$ P0 J3 z: \
  80. static int ccnt = 8;$ |& j2 G# x- c: |/ |+ r6 r
  81. 3 m9 u* P: S! t) g" a6 i0 J
  82. module_param(acnt, int, S_IRUGO);8 b  _3 c3 Y  @9 t
  83. module_param(bcnt, int, S_IRUGO);
    ; S" v, _2 L, y, X: P! T
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 C( F& e( L% F, o8 j) t( d
) _4 F( c9 u1 p, S) Q
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: x# }) X! f& c6 n% M9 H* Y1 a; D: 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) C* d! X% m1 ?" s9 ^# s) z
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& W* w! a5 N% P& G$ r) b

; Q" m$ z. M% ]) ~
$ e* y; I& l6 @5 d9 n
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-17 20:36 , Processed in 0.037570 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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