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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 S4 O1 q+ C) O/ i0 ^
  1. [code]EDMA sample test application. G4 W* L  X' y# [
  2. /*
    5 d" y* M- [- w8 ~3 Z7 i
  3. * edma_test.c
    2 a7 o; C& ?1 }
  4. *
      ^0 ~+ S4 k7 w% ^7 Y
  5. * brief  EDMA3 Test Application
    ! T1 V) K- X9 a0 \  e, d- W
  6. *4 |/ d: J- N6 y) m# q. k
  7. *   This file contains EDMA3 Test code.
    7 _: z# o0 |( l6 v3 ?
  8. *
      L+ E: D( E7 C5 C" k, q: o
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ [' q5 @- b& Y& `2 c0 T( M' n1 [( `
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    % J! ~, |" I5 r3 m1 a' Y1 J( [; b6 S
  11. *         TO CHANGE.8 L) [' G, O% P5 F+ R( `6 e$ ?, V
  12. *
    . Z0 N6 X! X' l6 I4 t: |6 N! ~
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' C( d" E' |" L! e4 X+ ]# }0 Q, `
  14. *
    + [5 K7 n: V. a6 g
  15. * This program is free software; you can redistribute it and/or: Q; ]* C4 W* e- i8 `
  16. * modify it under the terms of the GNU General Public License as; w& k% g6 T: G9 _7 O* b
  17. * published by the Free Software Foundation version 2./ T9 }7 A$ W3 M$ x& U
  18. *
    ) N4 Q% n) h! \
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / J5 N/ l! L1 L% j. f
  20. * kind, whether express or implied; without even the implied warranty
    7 ^' @* u9 w7 N& Y; `  Y' f+ A# j  s
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* o- `; Y' S/ ]( v/ l0 R; s, {
  22. * GNU General Public License for more details.
    7 s2 |3 S0 g- a* I
  23. */
    2 ^' W3 P) v- n# ^2 u

  24. & h  ]# r4 Y' W3 `6 U! B
  25. #include <linux/module.h>( ^" |1 Z5 ]  ^: l
  26. #include <linux/init.h>8 ^$ R3 s4 X4 \- \- ], r0 V
  27. #include <linux/errno.h>
    - {4 Y. i$ {( E- U& q; b
  28. #include <linux/types.h>
    ) U  q  P& |/ X3 h% }
  29. #include <linux/interrupt.h>
    . H- O3 F  L- |+ Y* M* |
  30. #include <asm/io.h>
      y. u0 Z  v. b- k) G$ n% u
  31. #include <linux/moduleparam.h>) \- \7 r/ P- Q: _4 R7 M
  32. #include <linux/sysctl.h>" T- R2 t* ]* ~0 H6 ^5 N& n
  33. #include <linux/mm.h>; g+ m2 L4 N/ \; q! H
  34. #include <linux/dma-mapping.h>
    6 {. w* D4 h' @% T/ o; \6 D8 e4 @, M6 l
  35. # ~2 H8 Q1 w1 c+ D" G8 v
  36. #include <mach/memory.h>2 }3 p6 C  _/ [7 F8 i
  37. #include <mach/hardware.h>
    ) A% K) b& v! I
  38. #include <mach/irqs.h>
    ) |; P' D: k, x! M2 D+ U
  39. #include <asm/hardware/edma.h>% e1 p. k- Z7 b
  40. 0 O& s8 \4 M1 S, a
  41. #undef EDMA3_DEBUG# y# V! R. ~  @# Z0 G
  42. /*#define EDMA3_DEBUG*/  n. s6 J  J: M
  43. 5 I# O4 y8 _2 _! X: q$ D3 l3 ~
  44. #ifdef EDMA3_DEBUG  a. a( Z$ |; e9 C6 B' A( ?
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - V: n, w8 j( P6 `
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( d! _9 {3 S2 [4 K7 t; Q# Q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# ^! S; Y- ^7 J' ]" j
  48. #else
    4 ^* C8 S6 C7 i
  49. #define DMA_PRINTK( x... )
    : l- T! N+ T! t% i4 c, ^; }6 d8 O
  50. #define DMA_FN_IN. [6 A. M- Y7 ^2 d7 m) E" e
  51. #define DMA_FN_OUT( a; u# I6 }! p4 h
  52. #endif* \  U* @6 r# D! w- |

  53. 7 C+ c' @. Y- n- S3 P
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)& ]' I' e) j& n( F& U
  55. #define STATIC_SHIFT                35 O6 D2 u8 J1 i- k: f
  56. #define TCINTEN_SHIFT               207 W( t1 k$ [  \  q* Q, M- j4 X, w  y
  57. #define ITCINTEN_SHIFT              21
    : H3 l# v( u7 F5 }9 A: [
  58. #define TCCHEN_SHIFT                22
    6 H+ S% Y2 t( s( r0 ]) Q; U
  59. #define ITCCHEN_SHIFT               23' N/ w2 b9 h/ _3 v* i. e

  60. ; {8 P. k& ^  }; h* v
  61. static volatile int irqraised1 = 0;
    # x6 r! a, m' ?/ Z7 G8 w
  62. static volatile int irqraised2 = 0;
    % h9 G4 b( I6 X* i

  63. ! i+ x' h; `" e/ Z2 M+ ]
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! Z* ^% v2 M- R9 J9 Q; P$ x, I! S, p
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 Y, L& r* c& @
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; m0 y' f& T  C. U  p

  67. 2 P3 z6 T4 b- w! k2 M
  68. dma_addr_t dmaphyssrc1 = 0;
    1 Y# R) A* ^* F. S, s
  69. dma_addr_t dmaphyssrc2 = 0;
    6 Y) d) C; P" A  E0 d
  70. dma_addr_t dmaphysdest1 = 0;
    % O) K* q8 i( h5 H1 G% _9 {& u
  71. dma_addr_t dmaphysdest2 = 0;3 c% ~# [# A6 [) W, P# e6 H: m
  72. / o: c- c4 [4 Z2 @- [+ b
  73. char *dmabufsrc1 = NULL;
    & ?, k* {3 ?" z* k3 U
  74. char *dmabufsrc2 = NULL;
      j! ]6 x8 b4 @) z! W9 [5 \+ j
  75. char *dmabufdest1 = NULL;
    # t3 [% C8 H3 R. v+ {
  76. char *dmabufdest2 = NULL;
    2 P& }; D+ O! p3 m

  77. 4 q0 b. s' F9 C' i$ Z
  78. static int acnt = 512;6 B/ Y' y* t0 t0 C/ @" I7 M/ }
  79. static int bcnt = 8;
    9 b7 u0 {. s9 G
  80. static int ccnt = 8;/ v6 @  {7 J8 u

  81. , X! \& T5 p/ i7 d1 f( U
  82. module_param(acnt, int, S_IRUGO);5 ~5 m4 z- F# D2 c5 k- L, [
  83. module_param(bcnt, int, S_IRUGO);! k8 U- {; L5 Z! \! ~3 j
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: C$ q" \& H! H# ?; l2 z
2 x% h' R. P7 v      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 X& ?/ \8 D1 H) E$ L8 c) X1 |& Z0 B
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 M  M+ {+ q0 u" U+ Y     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. P  Q/ U! j( b6 j5 n4 k5 k
* Z" g+ F4 i1 x* f7 p5 D- C; p
4 x5 `7 u2 ^! F" V$ _* c2 f/ T8 d# y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-7 09:18 , Processed in 0.039555 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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