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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; {* m/ a5 S- w/ n5 x( I1 M9 r
  1. [code]EDMA sample test application( K* _3 Y3 c! f& Y: {7 N! H+ S# g
  2. /*
    7 B& c1 ~  H6 d4 d
  3. * edma_test.c! P' {$ O2 _  f1 U. Y* g
  4. *1 w0 r; ?! I/ n+ v! {# {4 Q# B( L0 p8 x
  5. * brief  EDMA3 Test Application1 ~; \: K. I2 W  `9 O$ R
  6. *
    - M9 V+ X+ ^* q
  7. *   This file contains EDMA3 Test code.
    . g/ I. r; `6 U2 O
  8. */ J7 E6 L% |( W7 V' t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    6 c# `- f% V% F1 m  ?
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    - {2 D9 g- K" O4 m& t$ _/ n
  11. *         TO CHANGE.
    % [/ H* U$ N! ~# R# ~; N  C
  12. *
    & j' }  T/ o/ ]! k7 F/ @) F& C
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    / Y+ H8 P* v9 N1 I
  14. *& Y1 {% f- ?7 r3 c1 J. A( o- ^( ?
  15. * This program is free software; you can redistribute it and/or
    ' b5 m2 |- `2 U# _1 V7 [, H
  16. * modify it under the terms of the GNU General Public License as. `- o% N% _8 b7 r0 E: o" m2 C% |( Y
  17. * published by the Free Software Foundation version 2.
    7 G* l' \/ z- ^+ x
  18. */ s; w0 S1 D' x8 v! J5 u4 p: n2 \* _" G
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ j4 E/ T- N. B5 |
  20. * kind, whether express or implied; without even the implied warranty
    * O4 y1 n  ~- K/ c$ w8 C/ t
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - w3 B0 H5 r" S0 l
  22. * GNU General Public License for more details., Y& M' T* n" x" P0 C
  23. */! t2 i5 g* e" E. y  Q: o+ B& _) @
  24. $ y, k. q8 W0 s8 a: Q! V
  25. #include <linux/module.h>
    5 w; K+ J. p0 j) S9 |1 J
  26. #include <linux/init.h>
    ' {. {5 F/ L1 ^9 e
  27. #include <linux/errno.h>$ P( a  E: Y5 m( U5 T/ Y
  28. #include <linux/types.h>6 n: r' @0 c, o6 G0 C
  29. #include <linux/interrupt.h>
    3 L0 y- L& i, n+ r
  30. #include <asm/io.h>
    3 n" V) `, T+ b
  31. #include <linux/moduleparam.h>
    0 x$ R% l2 P: i2 L8 y' T
  32. #include <linux/sysctl.h>( l! w- U! }9 g3 S. E0 T; E
  33. #include <linux/mm.h>
    7 \  z6 M) `1 u; [' C- m
  34. #include <linux/dma-mapping.h>
    1 X1 w$ D: R# x% w/ m+ E

  35. , J; x3 H# F3 m+ N0 q) M
  36. #include <mach/memory.h>
    2 a$ }* ^! v% |' @! X: s
  37. #include <mach/hardware.h>; a7 p2 ~: M$ \. V& O- q! r
  38. #include <mach/irqs.h>9 u( z7 r) i! M: d) X( r
  39. #include <asm/hardware/edma.h>
    4 A7 T2 X' }+ g( ~& k

  40. 8 c2 q8 s; V8 [1 o9 b: U! g. k) r
  41. #undef EDMA3_DEBUG
    0 |- f) r, i4 d% t
  42. /*#define EDMA3_DEBUG*/
    1 @1 @8 i: I% Q

  43. + t: R3 G$ V9 m
  44. #ifdef EDMA3_DEBUG+ o# z, x" ^  q  H) Q2 P- a
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 ]( D5 H) w  I0 u: E8 ~; ?1 Q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* s* Y# v0 e' h
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* ~! d( x; L, D0 g' D: z  _
  48. #else
    5 P3 D9 X& u5 N9 W7 w
  49. #define DMA_PRINTK( x... )
    + i4 P1 X3 M* n# |
  50. #define DMA_FN_IN8 m; \9 J% a. A! u
  51. #define DMA_FN_OUT( D9 m) I$ _( Y) U
  52. #endif
    $ ^0 c+ s8 ~9 i
  53. + c5 k$ C9 `; o" V7 f4 j
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    - T/ m1 m& @1 B* G! q: Q  J1 M9 y
  55. #define STATIC_SHIFT                3( j9 @. o" @# [+ v+ C1 M3 l
  56. #define TCINTEN_SHIFT               20
      j( P6 h* |4 G+ U. ~$ ^+ [
  57. #define ITCINTEN_SHIFT              214 O3 R. b6 y# ~/ p
  58. #define TCCHEN_SHIFT                22
    9 V4 g% u) Y5 ?' X
  59. #define ITCCHEN_SHIFT               23' l7 [. Y& z) {; s, W
  60. " d# e& c" c3 x# a0 D2 j4 p3 Y& Y- C
  61. static volatile int irqraised1 = 0;
    $ j# v& h) y0 Y$ M- }( R" D
  62. static volatile int irqraised2 = 0;
    1 ^4 s6 c; @6 V$ Z5 s0 S
  63. ' _( e& j1 @1 u" a5 Y5 B4 n6 y5 D
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 m* f  O) R: r/ H  w
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 J; l& Q8 J" ]- L& E
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , ^+ a# ?) r- I( R1 n4 q& K
  67. ; [6 `- Y) K/ e
  68. dma_addr_t dmaphyssrc1 = 0;" D* l9 U: z2 i! ~% h
  69. dma_addr_t dmaphyssrc2 = 0;
    2 u/ J5 Q6 U# N# u
  70. dma_addr_t dmaphysdest1 = 0;+ n  u5 e6 s* B" Q
  71. dma_addr_t dmaphysdest2 = 0;
    $ ]6 Q- c/ @6 ]% W' z. S' l, B

  72. 7 K. k9 `& p5 l; D3 x
  73. char *dmabufsrc1 = NULL;+ w( c* g" r( E. W8 A
  74. char *dmabufsrc2 = NULL;
    " f% @7 A/ \9 S
  75. char *dmabufdest1 = NULL;
    # \5 E; ?; u4 {1 X
  76. char *dmabufdest2 = NULL;
    & A2 P% [* U2 u2 }: C

  77. / j4 R5 L' s" X1 ]% g
  78. static int acnt = 512;2 K1 U% ?3 \2 R" J* |  q
  79. static int bcnt = 8;/ l0 V" _4 n5 P* Q- r$ |
  80. static int ccnt = 8;" H' ?8 @5 [: L* [/ ~7 l! J9 J
  81. ! M# h  K8 h9 G5 {" x
  82. module_param(acnt, int, S_IRUGO);) y1 g, l/ e0 N9 H$ e
  83. module_param(bcnt, int, S_IRUGO);
    & V9 L4 J: H& Y+ n  }7 y
  84. module_param(ccnt, int, S_IRUGO);
复制代码

& r9 n2 P6 e2 |* h. U! s2 b
0 L' ]% M) c9 R; m, u: r& J' k; v      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, j: _& d$ e2 g* j; [' I
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 Z% F3 t- N+ F9 [4 h
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) x$ ]# X! y* t
& e6 k2 c! V2 E! [0 I) v2 r3 i$ H# f6 O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-10 15:21 , Processed in 0.037991 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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