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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; C) Q3 [; E1 k) e6 L9 d; L
  1. [code]EDMA sample test application' j5 Z% K+ ~, J8 D" h
  2. /*
    0 C' v  e$ F& b3 q- i
  3. * edma_test.c" e. y6 h" h4 M3 v+ B( @. r+ c
  4. *. k4 }, x/ l7 }+ U* f; l
  5. * brief  EDMA3 Test Application
    * J$ @# i6 e( A( _/ n( H* t
  6. *
    / U& n% l. W0 @. x8 \0 D/ Q( X( Z
  7. *   This file contains EDMA3 Test code.
    ; e7 a( t% d& p  K4 o% U- u
  8. *
    5 F" P' ]) M; }0 w& D* Z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    # O9 a7 Z* p; D7 N( |3 j+ B
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    : v- x. Y5 @# t) M5 H# ^5 I
  11. *         TO CHANGE.
    . e0 ?5 g! w  Y4 e) _6 F0 u
  12. *2 S" G% u# E; u% n/ `6 S5 `+ P
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ |5 I) ?0 u0 V& c3 k' n) Z7 O4 T
  14. *
    $ ~, B- v* ]% U
  15. * This program is free software; you can redistribute it and/or
    / a* c. d" f# T2 M( O8 o9 H
  16. * modify it under the terms of the GNU General Public License as- e( x* E; e6 ], N, }
  17. * published by the Free Software Foundation version 2.7 ?: G; W7 U) {3 j0 X
  18. *. {$ e2 O! b4 b7 r/ }" e2 s
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; n! S- g5 ], h" Q* W
  20. * kind, whether express or implied; without even the implied warranty
    # S/ z  d5 m4 m( f6 T
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - n4 x6 v: \# z
  22. * GNU General Public License for more details.
    ! @0 k+ V; e# u* @3 j* Z5 q
  23. */
    / n- Z4 y+ C4 s  |4 n  Z6 p
  24. " r5 }* o9 e2 C' U
  25. #include <linux/module.h>
    $ `# q- m3 t  @2 L! f2 m) r
  26. #include <linux/init.h>6 T2 q' k7 N, _- z$ |
  27. #include <linux/errno.h>: O# L" G3 J8 w* g
  28. #include <linux/types.h>
    & X; L- U# A9 N
  29. #include <linux/interrupt.h>) _2 o) I$ m5 C# |( e3 B
  30. #include <asm/io.h>! R% t" A! C- |/ _4 c7 P3 a/ j
  31. #include <linux/moduleparam.h>: i* W; b* r4 t/ F) d4 R* U& u
  32. #include <linux/sysctl.h>
    % |- i6 p9 Z  a' _" h" w% O( b
  33. #include <linux/mm.h>1 j+ n2 j0 ~/ T
  34. #include <linux/dma-mapping.h>! a) D; Y3 e; _( k4 K5 k
  35. 0 G0 Z: r: n5 K
  36. #include <mach/memory.h>1 z; M) f0 q, I' k7 `9 E
  37. #include <mach/hardware.h>
    % P% w  D; |8 g( s8 J
  38. #include <mach/irqs.h>
    # y6 J2 _! s3 t* c( D# H( V
  39. #include <asm/hardware/edma.h>
    3 n, \3 x( ?7 x; W: X

  40.   P* m, v3 @* r7 o6 k
  41. #undef EDMA3_DEBUG, `$ N* T% H) O4 r' T
  42. /*#define EDMA3_DEBUG*/
    " B6 V9 @8 q* a- [

  43. 2 ]4 A% k9 b6 i9 B
  44. #ifdef EDMA3_DEBUG
    5 Z* m% b6 z" v) Y, ?& k
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& O7 I+ I; v4 ~2 r6 R) C& p! k
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); k( v' M! i: f1 E# |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 i3 T& c6 Q5 c
  48. #else" {7 o% M8 s/ R- a
  49. #define DMA_PRINTK( x... )
    + \# {8 _- i" m- H
  50. #define DMA_FN_IN* m* a4 l" x! d3 t0 `9 X! g( m& M$ O
  51. #define DMA_FN_OUT
    / I4 n2 W" P7 d6 `
  52. #endif
    9 n  j  X0 H' R& w- K

  53. + L  A' ?6 u. W' r- ]: r1 o
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : K# U7 `# m- T
  55. #define STATIC_SHIFT                3: W$ d7 h  l1 g  f
  56. #define TCINTEN_SHIFT               206 W  v# d) X. I) ~8 E3 M
  57. #define ITCINTEN_SHIFT              218 V, W1 h$ n9 i" l
  58. #define TCCHEN_SHIFT                22
    % y- L& q; P' c  r  I3 ]
  59. #define ITCCHEN_SHIFT               237 U$ T/ r/ B0 {$ c: [

  60. 9 }# c6 [) R5 j) @$ l
  61. static volatile int irqraised1 = 0;
    6 M* u: q, m# D& R; ?
  62. static volatile int irqraised2 = 0;% E1 y% P# r/ G7 I2 D

  63. # K6 h% `9 h3 K: Z5 }7 M: M8 J/ e5 l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- x! c# g& r: i4 H
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , ^% C# v' `' E8 l/ ?. T5 T2 I' t
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * m8 g- @6 J( E2 M' E/ q
  67. 7 S- {3 x5 A7 u: z& z
  68. dma_addr_t dmaphyssrc1 = 0;
    - h5 a6 Z7 T! p
  69. dma_addr_t dmaphyssrc2 = 0;
    5 F; o; |* |8 q- c$ F7 F
  70. dma_addr_t dmaphysdest1 = 0;1 s# Y% j& u' R4 w7 n% a* N$ c( D' S
  71. dma_addr_t dmaphysdest2 = 0;
    % x; |5 r* G+ D2 q2 [

  72. " ]: Z  t8 _& I0 n' v8 M2 N
  73. char *dmabufsrc1 = NULL;
    & W% f# j$ Q% Y' M7 _- Q
  74. char *dmabufsrc2 = NULL;% u/ x+ U& b) A5 [. c% d
  75. char *dmabufdest1 = NULL;
    # {8 Y! z% q5 e3 O1 W: l& ^
  76. char *dmabufdest2 = NULL;8 Q" j9 P8 t* a& `$ t! h

  77. ' B% @6 H  Z- i
  78. static int acnt = 512;
    + ]6 W! w0 D; [8 p3 h
  79. static int bcnt = 8;
    & X: o7 e) g/ g$ c( x
  80. static int ccnt = 8;. Z: n  y$ v9 O" h: Q

  81. 2 x: O1 z! Y# l5 r6 z2 g
  82. module_param(acnt, int, S_IRUGO);
    3 R/ c) D3 k% \  `& V( D
  83. module_param(bcnt, int, S_IRUGO);
    3 r# _* B" O! B7 b
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% R* b: g5 L7 E0 z- f
3 m$ f/ R8 W3 [* }3 F/ I      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, E/ o, S- [+ q9 C, n( a' w) Darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ }" F  O! @8 e# N+ n; p
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( Q* u! e0 T$ z+ M1 U2 e6 v
: e) I; W" R  i6 b2 E
3 B( f7 u+ {& P2 e4 I: |. ~
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-15 08:24 , Processed in 0.042261 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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