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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- N- s3 _$ C) G( t3 Y
  1. [code]EDMA sample test application
    5 s; S$ U- w8 J/ R3 ?1 \
  2. /*  `7 s$ v! ^* d
  3. * edma_test.c
    2 ^# R4 }' T! |# c
  4. */ y, v9 n# j* y
  5. * brief  EDMA3 Test Application
      j) X8 v7 C8 P0 y. i. y! w
  6. *+ _8 `% U7 ]( _5 e) i9 N( l6 _0 Q, C
  7. *   This file contains EDMA3 Test code.
    . x+ C, u5 Y% R, r( R" Q& E
  8. *
    . J9 X2 B3 O  M7 r( ~! e( R; y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    0 Z2 C  H! ~7 h# o9 O1 [9 q. `6 t" L
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, k' g: x  M5 r7 u
  11. *         TO CHANGE.# v4 k6 p8 g' p# e  v) V) N
  12. *
    9 k; h; y" u& h1 c0 v& V1 N
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    1 v9 h! q% D2 z$ z
  14. *; E) G5 n3 N5 {1 D  D# b
  15. * This program is free software; you can redistribute it and/or
    9 }# J1 }. p. Y9 d6 R, A' Y
  16. * modify it under the terms of the GNU General Public License as; h: H, ^6 e. c& g' x( X8 t
  17. * published by the Free Software Foundation version 2.
    3 }; J- A# }* S, J1 Y
  18. *: r  L3 \8 p0 J# B+ h0 E2 U  I
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- s  s. i9 ~( M3 C! W
  20. * kind, whether express or implied; without even the implied warranty
    0 r8 Y, N. ]$ i. w3 [* A
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 I! B* q1 Z$ D2 e% X8 i% J5 R
  22. * GNU General Public License for more details.
    6 w2 Z4 L  Y( Y; o) w5 a8 B
  23. */
    3 ]& i& u, ~/ }  }4 }$ w

  24. 8 @2 |6 i' V* L. O( B# X' B. z
  25. #include <linux/module.h>5 Q: ~: }" [6 i: n
  26. #include <linux/init.h>0 S3 t9 D5 K! b9 H' \: q9 @
  27. #include <linux/errno.h>: G: x+ S- w# U4 z
  28. #include <linux/types.h>
    ' U. m4 E) y  t
  29. #include <linux/interrupt.h>
    / g% A" V3 l# V$ ]$ K$ U2 `) r; B
  30. #include <asm/io.h>
    + C6 L, @1 X0 ^+ Q5 U
  31. #include <linux/moduleparam.h>! c4 d2 h- M; y8 V( v% [- i: E
  32. #include <linux/sysctl.h>6 s  a1 u4 g5 |; j2 w7 Y+ g+ N. u
  33. #include <linux/mm.h>- `) n9 ?, c0 G9 F; k
  34. #include <linux/dma-mapping.h>
    % M4 m. L/ |6 A9 b0 ?7 L6 W
  35. / D* Q- V; y( W
  36. #include <mach/memory.h>% l6 \7 f. @! o; J5 T( m* [( j
  37. #include <mach/hardware.h>
    # U( {9 V) B) R/ a
  38. #include <mach/irqs.h>
    2 c+ {% m) i) W
  39. #include <asm/hardware/edma.h>
    5 c6 N. ]. H9 Z) I5 O! T/ a

  40. ) D' H: M# \9 X7 a" ^9 y
  41. #undef EDMA3_DEBUG; V, g; d9 L* W( e
  42. /*#define EDMA3_DEBUG*/
    5 N6 ^9 h! r8 T  ]5 r

  43. / ]6 O3 i) }7 S8 P0 n% K
  44. #ifdef EDMA3_DEBUG7 m# X3 k+ }1 Y) \2 m9 r
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ R$ ?  G+ _2 z0 m3 G0 z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    : A, i6 \- W) ?- e, P* ~3 k5 h' T
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). b8 B7 U( p: b& h) I2 u
  48. #else
    0 \6 H8 r- J/ H( g$ S5 m( m
  49. #define DMA_PRINTK( x... )
    5 v+ d' |5 g1 O
  50. #define DMA_FN_IN
    5 w* ?9 M3 l# Q6 k. l
  51. #define DMA_FN_OUT: Q4 {6 o! @9 z; f6 O
  52. #endif
    ! z3 b( N) d3 L

  53. 3 x& i* d/ E9 A) p
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
      Y3 O- o! O- p- X" }9 P
  55. #define STATIC_SHIFT                3
    8 e: C4 }' E: y0 _7 }
  56. #define TCINTEN_SHIFT               20
    $ q7 t; [; D8 @6 _6 U
  57. #define ITCINTEN_SHIFT              21
    & p; i) \/ j6 e# v* J8 a
  58. #define TCCHEN_SHIFT                224 u1 q. W  V9 x! A2 @) m
  59. #define ITCCHEN_SHIFT               23
    & J9 Z! G$ g; I' t! c

  60. 5 h- ~+ V" W$ @4 {" p
  61. static volatile int irqraised1 = 0;
    ) E0 A0 v# o% l! v6 q# J
  62. static volatile int irqraised2 = 0;' X( ?( F! @6 s- o! c

  63. 9 U% I; B( }6 e. r2 Q- a! s
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 z3 j: n9 l, o/ ?+ d
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ v6 ]/ i/ s+ d; q, K! W& d" O( b" d
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( d2 Z+ N7 U; E) ~. \

  67. ( K1 r0 w. G) z6 v
  68. dma_addr_t dmaphyssrc1 = 0;
    0 q% ^  o8 q8 u+ r+ a
  69. dma_addr_t dmaphyssrc2 = 0;4 L, r0 L1 j) J9 g& q/ W' ]
  70. dma_addr_t dmaphysdest1 = 0;
    / o% s" \6 n, z1 N' J4 p
  71. dma_addr_t dmaphysdest2 = 0;& c9 i# K$ T1 `! y% E

  72. ' d; S" s1 q) ?! ]3 C. d
  73. char *dmabufsrc1 = NULL;5 Q9 ~8 O  P1 o. l' ]: G: v/ ~
  74. char *dmabufsrc2 = NULL;
    . u+ R( |; U7 `. ]* G. z! U: g* V
  75. char *dmabufdest1 = NULL;  x2 F) u$ o8 W- }8 \3 d( r
  76. char *dmabufdest2 = NULL;
    8 Y& p7 B6 h0 ?; J$ D$ U, ], P- s
  77. 0 s/ [. t/ T; v+ p" _
  78. static int acnt = 512;
    ! v* F9 N! e) w$ w, o& a( n, E, G
  79. static int bcnt = 8;
    & @8 Y7 ]5 y) b" I) U2 V( D
  80. static int ccnt = 8;1 l# U* a, u" P
  81. & f" }+ q: p; J2 i/ f7 V
  82. module_param(acnt, int, S_IRUGO);
    7 u& L; [$ i& U/ ~2 y
  83. module_param(bcnt, int, S_IRUGO);
    6 [5 L2 R5 a% d
  84. module_param(ccnt, int, S_IRUGO);
复制代码
( C) b5 D0 B! q7 W$ Y/ w
) r0 L) o2 i3 f
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, P* X$ q2 R( Y: Z  i7 xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。  Y8 X) M% N8 U4 T: `/ C, H1 a) h
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
  `6 H% S& }1 t: e  g; O/ @& X5 ^9 }0 `4 U: K/ Z7 `
, d, h4 ]3 C# K) ]8 n2 l! S
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-12 11:52 , Processed in 0.037847 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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