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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- }8 d4 r* o, Z3 R8 S
  1. [code]EDMA sample test application" g0 {' J' L* Q' t+ \) S" W2 W
  2. /*
      d+ E( m: N1 Q# F: W
  3. * edma_test.c, M' r- _2 E+ b) B- F
  4. *
    ! k: S  z# D- y! k
  5. * brief  EDMA3 Test Application
    8 _- m2 _6 \# f) Q7 _- S) i
  6. *
    0 C5 c3 n$ X$ ^0 P4 W
  7. *   This file contains EDMA3 Test code.
    ' U# S2 k  r; e
  8. *
    0 f# @9 G6 V! V) e3 O% a' p
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 r& L1 o. P/ q- v+ \$ v
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    8 f3 `6 @0 n, b
  11. *         TO CHANGE.2 [# w" X6 S  j8 `
  12. *
    . x/ L0 p, u: Q4 v
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    $ }" d( {$ V% R3 K1 Q$ Q
  14. *
    ) H. w! ?, t: M/ @; m. ]0 P$ b
  15. * This program is free software; you can redistribute it and/or; X0 A! t* m6 r- q9 P! G
  16. * modify it under the terms of the GNU General Public License as0 a+ g7 d* g4 S$ O6 n
  17. * published by the Free Software Foundation version 2.% T) b, P3 ]8 a% I
  18. *" n. {7 g/ F- C( Y0 J0 Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ; J$ [+ K+ v" X* z! R5 [+ T/ n1 X
  20. * kind, whether express or implied; without even the implied warranty
    2 c  c( d6 T8 Q) I: d
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) _0 I8 f+ s7 o& N0 x$ h
  22. * GNU General Public License for more details.
    ) a' j/ P* x$ T/ i* B1 P' Q' F
  23. */
    - H/ j8 v% J% [

  24. 7 U, G, L+ i& ^
  25. #include <linux/module.h>$ ~" B" N% e1 w9 K% E
  26. #include <linux/init.h>0 u5 O+ m) h* E; M4 \* _8 F* N
  27. #include <linux/errno.h>8 h, @4 _4 x" X9 Y  R+ J
  28. #include <linux/types.h>$ U8 E% f" |+ J% L, [/ ?
  29. #include <linux/interrupt.h>2 @: k( p9 K; M' H1 n& {1 v% ]
  30. #include <asm/io.h>
    5 D& ]% [" M9 W* ?" a
  31. #include <linux/moduleparam.h>) ?; v( f$ L3 @# m2 ]
  32. #include <linux/sysctl.h>
    1 P2 s+ q3 u% _% A% N4 X
  33. #include <linux/mm.h>
    ! w( ?0 l2 r) J! r% L, W' E0 t% f
  34. #include <linux/dma-mapping.h>
    4 m/ {8 Z+ t; A8 g+ R6 [. A
  35. * ?* q9 u$ ^2 j
  36. #include <mach/memory.h>8 y( ^' u" M$ e
  37. #include <mach/hardware.h>4 J( j1 d. \& R2 J& Z
  38. #include <mach/irqs.h>' |. F. n* X0 }& `: J6 x# @
  39. #include <asm/hardware/edma.h>! Q2 G$ z# O8 G/ S4 Z: g2 B& R

  40. 0 A0 `# ~& ?0 c8 v. y0 ]
  41. #undef EDMA3_DEBUG
    : u; \3 D8 U. T0 n# {" S, \
  42. /*#define EDMA3_DEBUG*/
    ; Z3 o' R/ F1 b7 ^3 {& {; N& [. W/ `
  43. 9 E5 O0 ^! p! b9 P4 V) R' J
  44. #ifdef EDMA3_DEBUG
    9 Q7 _! l+ k! m4 A9 r2 P
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 n5 W/ d* H# [9 e0 i0 j% w0 K/ Z9 ]
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ S. F0 G" E, U! a* ]5 D
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    : G1 X5 `: O$ _. n" h+ e" L' y
  48. #else
    2 f! u% {% Q9 }2 w  F, ~" z
  49. #define DMA_PRINTK( x... )3 w& a" P* @% w& B( w$ @# E2 u
  50. #define DMA_FN_IN
    2 n$ p4 P2 X. q) J& l; x; A4 y
  51. #define DMA_FN_OUT& ]0 p- p. {' O- Y1 a% s
  52. #endif: T: m+ a6 E0 U$ h1 c

  53. + @7 w3 ~% K. t) t, v& x5 w' j
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ' }& T9 b2 A* i% e2 L' M
  55. #define STATIC_SHIFT                3
    # G& u. Z# ?" E5 q  ^; t: Q
  56. #define TCINTEN_SHIFT               20) A$ c4 _" c( ?5 o. e( {
  57. #define ITCINTEN_SHIFT              21
    . H4 Y' J9 P; N
  58. #define TCCHEN_SHIFT                22
    % T, N4 B3 F3 N$ A6 K
  59. #define ITCCHEN_SHIFT               23, A! O* f+ m! S0 q# R2 u, A

  60. ! d/ @- j4 j6 e6 {4 [9 I
  61. static volatile int irqraised1 = 0;
    ) `* d. o( {. V6 D
  62. static volatile int irqraised2 = 0;( D  U" t2 H. k# r9 [. g  n
  63. , K8 }4 K* ?  m/ ]: r) A
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & O/ n4 k! q" q5 O
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      v# x6 V: N+ m; k! ?
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' s0 x. |1 ^. q, ^: F6 C2 v# y
  67. 7 w' R+ i2 F, @% f0 n! B
  68. dma_addr_t dmaphyssrc1 = 0;
    % \5 t+ ]( P* [1 d! u4 J  @4 H
  69. dma_addr_t dmaphyssrc2 = 0;( q) b" n; {: J: L
  70. dma_addr_t dmaphysdest1 = 0;
    ; Z- t7 Y5 [4 V% v" V
  71. dma_addr_t dmaphysdest2 = 0;# w- t4 S9 X( v

  72. % x, h9 M. ]; K9 X# Y
  73. char *dmabufsrc1 = NULL;' b9 `! @3 K; K3 C, k5 A8 ^
  74. char *dmabufsrc2 = NULL;
    4 B- K2 z* r  U% w' }
  75. char *dmabufdest1 = NULL;
    , \3 w6 p" ?, S& s
  76. char *dmabufdest2 = NULL;
    5 q/ \/ j7 m6 x3 e6 u

  77. ; U) L- b& d' ^
  78. static int acnt = 512;
    " v( d2 O& V3 V8 Q4 H4 T0 N/ Q
  79. static int bcnt = 8;- s3 N8 U+ c# P% k6 d  x9 E
  80. static int ccnt = 8;4 ~4 @; i: T# a8 X7 M# ~, k
  81. * m6 _+ k, [( L/ e; s9 U
  82. module_param(acnt, int, S_IRUGO);* {( ^: L2 Z1 t9 y$ i; N
  83. module_param(bcnt, int, S_IRUGO);4 y$ u& b1 B$ z, F
  84. module_param(ccnt, int, S_IRUGO);
复制代码
- i7 Y0 K: d8 t, F% J
. \" s3 |& j  G+ Q6 f( S/ s" V9 m
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
  b6 M3 a% @' B6 p2 ]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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# I+ \' H& k& o9 s
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. b: ~/ {* g  Z& `) K1 W, O' j4 h) u$ S' x7 K2 T
6 U+ C7 F" Z& A7 w3 U
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-22 12:13 , Processed in 0.046042 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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