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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 F. ?4 [7 F& L' z0 n7 f  V3 c! ~
  1. [code]EDMA sample test application
    - ]% i& N4 W5 B. K. E* [: C
  2. /*! F  k& J5 h) f, M
  3. * edma_test.c7 ?9 y) G9 M  O4 i, Z7 k9 s1 B) ~
  4. *
    & X9 M; h+ P% S
  5. * brief  EDMA3 Test Application: W4 j! I  {/ \9 ^
  6. *
    " R; D- n0 ^/ Z& r8 ~+ `
  7. *   This file contains EDMA3 Test code.) w, {+ I& y, A; U
  8. *
      I' U* s8 P( ^* U0 \
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 d% t4 y# x1 s( Z$ p! t; x* W6 N
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    # @3 v: P% T% e; W' u" |
  11. *         TO CHANGE.
    ( D6 a- f1 l& O, P$ a% u( x# u: x
  12. *
    9 R; r& X. W# ^9 p8 i) Q) o5 G
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 g# U* V8 Q5 y6 I5 l( B: L6 S
  14. *; D3 s1 L  V8 j3 y) U7 W
  15. * This program is free software; you can redistribute it and/or
    ( x3 {" P0 P+ h5 u2 l
  16. * modify it under the terms of the GNU General Public License as
    7 f; C' v9 Z* y, ?/ r1 w
  17. * published by the Free Software Foundation version 2.
    6 f4 h! ?9 j2 e" u
  18. *8 ?$ z$ y2 o: ?! K* }' f
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ G4 o+ W$ k' L% w3 o
  20. * kind, whether express or implied; without even the implied warranty
    7 L, z3 Y9 S6 j& i! l7 ]* [* f
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the& d6 R+ o/ I! ]) f
  22. * GNU General Public License for more details.4 t& I; l' W) |: t4 }
  23. */
    + o" i% R& L( F9 X! }

  24. ; |3 ^$ _; C% ~0 m/ F
  25. #include <linux/module.h>
    # M) S8 l! Z. N9 F5 J, D; O
  26. #include <linux/init.h># t# `) U$ m) v" X  X
  27. #include <linux/errno.h>
    4 K( f9 s- h" C7 r* O
  28. #include <linux/types.h>
    / W8 z" F5 w4 U$ v" e9 E( X, @  U
  29. #include <linux/interrupt.h>
    , u6 \- S# h/ U7 v* f* x+ D# H
  30. #include <asm/io.h>% }* O7 o$ S2 ~2 g
  31. #include <linux/moduleparam.h>5 o. d4 P( ]: i( J; H
  32. #include <linux/sysctl.h>
    - s. [5 Z5 T8 X) _
  33. #include <linux/mm.h>
    / K  r9 @9 ]1 w8 S2 I8 C/ C
  34. #include <linux/dma-mapping.h>
    $ f( R3 H: M4 X4 z( I; x" b
  35. - `' Q* E' Z, T1 w$ t
  36. #include <mach/memory.h>
    + P' D- a2 [/ H0 S7 |  ^' k3 s5 G: X
  37. #include <mach/hardware.h>3 x7 p6 R( O8 `& i8 o
  38. #include <mach/irqs.h>( |6 X  c8 `7 x( c4 S6 h! [
  39. #include <asm/hardware/edma.h>" P: [/ }9 U! l7 p0 O
  40. $ c5 Y3 ~" C/ U0 w% i9 ?: L7 K
  41. #undef EDMA3_DEBUG
    + ^2 p0 S1 m% _  b6 D& ^
  42. /*#define EDMA3_DEBUG*/! \& ?3 o$ s& k. G/ v% x

  43. 4 r4 S2 p( P& |9 o0 S+ o1 w
  44. #ifdef EDMA3_DEBUG
    # t1 _6 z& B* A. P2 Z- p! G+ X
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    $ M2 ~6 K/ a8 K+ ^( s, G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& N, M8 e3 X/ i* W, E) B$ n# s2 q1 d
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 ?7 k: \% v5 z) T
  48. #else! R! d$ p, s% t% d- w
  49. #define DMA_PRINTK( x... )
    8 u2 k; o$ S: u+ d7 r3 s  b+ g% v
  50. #define DMA_FN_IN
    * \3 L+ w& P* j' }: Q* P
  51. #define DMA_FN_OUT' u5 F3 k. Y, Y8 j
  52. #endif9 E! `/ E7 P" o; a

  53.   Z8 y" H1 ~" L7 A$ v/ w
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    5 O; P" [1 p8 E# `
  55. #define STATIC_SHIFT                3
    / M6 C0 w9 P" ?/ @- W  Z
  56. #define TCINTEN_SHIFT               20! R, r/ v& Z. G
  57. #define ITCINTEN_SHIFT              21
    8 B& w$ S2 L5 z( T
  58. #define TCCHEN_SHIFT                223 |# w) \  T5 d- q' B
  59. #define ITCCHEN_SHIFT               23
    ' R) }$ O8 J  |! e
  60. 1 l( ?; s' ]% @2 @+ a' H$ z/ \
  61. static volatile int irqraised1 = 0;$ z) c  N  I, w
  62. static volatile int irqraised2 = 0;0 n, R: R; O( S2 J7 p5 `: M& ^
  63. , J9 J/ }# Y! f% e& }& D6 g& B0 I
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" H! u8 {1 ?0 |- s8 A, H3 y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      g; A7 c/ W. m; {# M: Z4 @7 p
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. t) w" y) H( m1 |1 k# s) H

  67. ; I2 J* y- r- X( \3 }( u
  68. dma_addr_t dmaphyssrc1 = 0;
    6 M  F8 |; I; a4 w! A
  69. dma_addr_t dmaphyssrc2 = 0;4 m0 |0 C" w- m
  70. dma_addr_t dmaphysdest1 = 0;) M( _9 W9 `% r. X
  71. dma_addr_t dmaphysdest2 = 0;/ Z- D- ]1 f8 s6 Z

  72. 7 O& [  S+ T; W3 y3 ~
  73. char *dmabufsrc1 = NULL;
    - u7 C3 g8 T( H
  74. char *dmabufsrc2 = NULL;# _, z4 p9 `, w3 X4 L$ k
  75. char *dmabufdest1 = NULL;
    ! I0 v5 w, ^' Y' i9 }8 r' t
  76. char *dmabufdest2 = NULL;
    6 d; \+ B$ d# w* Y

  77. $ b+ y5 N) Z% Z. I) {' i$ T
  78. static int acnt = 512;7 {  y4 D4 ^, ^! O- h0 U0 w# m
  79. static int bcnt = 8;
    . @' v. b  K( ?: X- Y2 k
  80. static int ccnt = 8;9 G3 W4 D& X% x$ G" k  E
  81. - E9 H# n$ C- x5 [# U8 |
  82. module_param(acnt, int, S_IRUGO);4 P8 i9 y0 `) N
  83. module_param(bcnt, int, S_IRUGO);8 u; k/ v5 ~3 A0 }/ m
  84. module_param(ccnt, int, S_IRUGO);
复制代码

. e4 P$ I% ~8 {
$ n' o  G) p9 I; t      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 s9 _- j& H1 N  i7 i9 `8 L
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( `' O! _7 e3 ?  ^     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 h1 g/ O' ^' j; A& a9 H
% t: u. X1 W. z
- v& Q+ F, G6 F/ Q0 U
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-25 01:52 , Processed in 0.045508 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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