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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) C1 l- N7 m5 r6 r' L
  1. [code]EDMA sample test application
    : ^1 k. k5 z7 A
  2. /*
    3 L0 t9 s& O% f( h/ I
  3. * edma_test.c
    " \4 O7 P! L/ d9 I; M- \! `
  4. *- w7 F3 ]6 J0 e% R& P
  5. * brief  EDMA3 Test Application
    ' [: [0 I' i5 H$ i# i5 w1 a
  6. *
    7 a' G* q  r1 G1 l( C& y0 Q
  7. *   This file contains EDMA3 Test code.
    ) j8 P% Q4 _! ?3 O$ m. T0 I
  8. *
    . R1 J! c- [% i
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( x7 p" g2 ~9 X' h, j6 h
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 D5 r, t0 F* f# D  p5 F
  11. *         TO CHANGE.6 I; |  R7 B5 {8 J  A& l% N
  12. *
    ' q! `% ]; b% D$ z2 q, O1 l) g8 b4 W8 A
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    9 p0 y5 J/ f: v
  14. *
    1 I+ r8 Q; M, `( y$ {3 q3 i
  15. * This program is free software; you can redistribute it and/or
    - e* q3 A' a; {5 L& k1 l
  16. * modify it under the terms of the GNU General Public License as: q1 j( z) j6 }3 X0 r' l* o
  17. * published by the Free Software Foundation version 2.- u2 R" M2 g1 y4 Q+ y8 Z" ?
  18. *, F7 F% o8 A, Q1 E" q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 D- d, o9 g5 t9 r3 H  _
  20. * kind, whether express or implied; without even the implied warranty( r& A: H; s* O3 j# o
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 H9 k  g5 N/ s1 X# X* z
  22. * GNU General Public License for more details.: N9 |& \1 \* _& \/ }8 Z# M7 a
  23. */
    . I" Z, |' ]+ @/ Q. d! Y
  24. ! ?) Y3 t# a2 A+ g# A8 L4 F, a
  25. #include <linux/module.h>6 g9 b, q4 T4 X# M5 m. }
  26. #include <linux/init.h>  k8 r# U7 z8 v- f1 n
  27. #include <linux/errno.h>2 A# |$ Z6 u. w; u$ c( J
  28. #include <linux/types.h>+ f$ r$ v6 Q/ @# B0 ?( d
  29. #include <linux/interrupt.h>
    5 q; C3 W' D5 ]) V8 W
  30. #include <asm/io.h>2 [! {5 H. m2 m4 j
  31. #include <linux/moduleparam.h>
    * A- O3 ^" u7 ^- I, X, g
  32. #include <linux/sysctl.h>/ e/ U# y% Q( a: f" C* J* _2 Z/ K- |
  33. #include <linux/mm.h>; p$ J2 V* a% ^, q: V
  34. #include <linux/dma-mapping.h>
    / |+ Q4 l+ v2 t8 m) j9 O
  35. 0 K% C+ k) A$ s2 I9 `& Q% x
  36. #include <mach/memory.h>
    ; W+ S: b" j1 \, a" H
  37. #include <mach/hardware.h>! C% a3 Z0 Z5 U
  38. #include <mach/irqs.h>
    ! n0 ]- M' W4 l* m8 y
  39. #include <asm/hardware/edma.h>2 r% o. C* m/ E. ^8 P; @; E- E4 b6 }
  40. ; K* T( Q6 v0 ?1 y8 d* Y9 Q" c
  41. #undef EDMA3_DEBUG9 t9 [" k2 ?  X% B5 b
  42. /*#define EDMA3_DEBUG*/  L9 @: L, |% U9 U
  43. 8 B. j0 j! K; {: F) U; ?
  44. #ifdef EDMA3_DEBUG
    - [; |/ ^9 K- B
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( ]# z$ ^7 D8 k7 K( j4 n- o2 f
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 A2 P0 d3 s" D3 F* y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    1 L; Z! @; W+ A) I* b1 w, [& d8 g
  48. #else4 U9 A2 c2 D, o, m  t
  49. #define DMA_PRINTK( x... ), m# |" _8 R' k9 H+ c
  50. #define DMA_FN_IN
    2 p( r4 j3 }. \4 F  l4 h
  51. #define DMA_FN_OUT
    4 P$ _; O# K( Y  F6 T7 ]
  52. #endif9 j8 V* R& l, l* ]
  53. " \& p0 E/ t* E1 d( }, N( ?
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 ]% u" f/ H% u: d
  55. #define STATIC_SHIFT                3
    % J# w$ T" C4 l' z: E
  56. #define TCINTEN_SHIFT               20& S7 n+ r1 ]+ g9 p1 B0 O6 s' q
  57. #define ITCINTEN_SHIFT              21
    % g( I: V4 p) T2 W4 k
  58. #define TCCHEN_SHIFT                22
    # k  [: m: x' f6 K! Y  ^$ `
  59. #define ITCCHEN_SHIFT               23- Z2 j* z  K) i$ K- {; p
  60. : ^/ l* B% S0 z; w6 Y* G/ [$ m
  61. static volatile int irqraised1 = 0;
    8 B5 U& ~* W2 _& n. U# v
  62. static volatile int irqraised2 = 0;
    , _5 a( Q* m5 i; Z) a
  63. & I1 C1 f; s" h6 l5 k$ L
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. X0 b7 A. E# W$ X) q" [8 \
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      f! S3 Z  q7 G' P
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" M! ?# q- A4 f1 L' H6 O

  67. + ~/ ~) D, d3 X
  68. dma_addr_t dmaphyssrc1 = 0;
    ) X+ a' [6 e1 S4 J
  69. dma_addr_t dmaphyssrc2 = 0;( K/ Q2 f6 L; o
  70. dma_addr_t dmaphysdest1 = 0;
    0 |6 e) [& J/ q3 w0 g, G
  71. dma_addr_t dmaphysdest2 = 0;- E. }2 C& {  R9 g+ t1 ?
  72. ) S! J! l4 G/ M% Y+ _- Y
  73. char *dmabufsrc1 = NULL;
    $ i  V1 t/ h: f
  74. char *dmabufsrc2 = NULL;- H+ g* e  S( N- g; w1 O! V
  75. char *dmabufdest1 = NULL;
    ! O! C- O0 Z, p9 c/ I. m
  76. char *dmabufdest2 = NULL;! [( G+ Y. M; _" m

  77. / |" J4 ^- i4 \, x- U+ Q
  78. static int acnt = 512;( H8 Y$ l: \/ v) p) ^
  79. static int bcnt = 8;
      k7 x* t2 r; F9 e
  80. static int ccnt = 8;, p. R& [5 Q, u
  81. ! ~, @. [4 D; J8 ?8 `1 _
  82. module_param(acnt, int, S_IRUGO);& N& {$ L  g) F6 m, \( w" ^0 g, j
  83. module_param(bcnt, int, S_IRUGO);
    7 e% A1 `% a. c& b
  84. module_param(ccnt, int, S_IRUGO);
复制代码
# S2 a) u5 b6 d9 E+ `  F
/ m) i, W0 r* O0 i% {  p" w
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, O% H7 d' K/ `  D% ~8 barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 Q' @; k' T9 x; b. h     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& ^; {- ~5 ]6 P5 C$ ]. Y3 ^9 u$ i6 N% N1 {2 ]* w
1 e9 ]5 C2 \9 ~; O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-17 04:38 , Processed in 0.045835 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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