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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 N. e+ j  s( L) z/ c# c1 A0 X
  1. [code]EDMA sample test application# N) U  d1 R0 Y* o5 E3 N
  2. /*- }% M+ h" ^3 s1 A, {8 J. ?$ H# Z
  3. * edma_test.c
    % c# Q) }7 V5 l& D; `/ ]+ R. U" g$ s
  4. *1 E, [* r6 F& X. S3 e+ }* J+ g! ^4 z
  5. * brief  EDMA3 Test Application
    ) R# k# t4 v! [4 e
  6. *9 ^& q+ }4 ~8 \7 W
  7. *   This file contains EDMA3 Test code.
    * e+ T- |$ x7 J. l
  8. *& e" b/ H, @5 R$ B9 P. Q! g6 E
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 o: Y8 b6 O' H# ?# o( d
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( b, \. ~* ~" a4 `. S
  11. *         TO CHANGE.
    * k2 @; H' w1 i) t* S+ ~
  12. *7 \; {& s5 S' S
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 }+ |% [0 f4 z1 M* N. C3 T( A$ ^$ R
  14. *3 {& a9 H5 z4 H
  15. * This program is free software; you can redistribute it and/or9 d- L# e' n7 Q
  16. * modify it under the terms of the GNU General Public License as4 s* w' t3 o& C! J- o6 Z
  17. * published by the Free Software Foundation version 2., e! a( A/ y( A" ~9 O7 Z
  18. *- v% b7 T/ {, t! ^: C" m& f; m! _
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 z2 D/ ~) y6 z
  20. * kind, whether express or implied; without even the implied warranty
    4 ?9 P, q! k/ d- p( _5 {
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    9 p' s: |7 r5 u% W
  22. * GNU General Public License for more details.$ Z8 j" a. Y% p* K- p+ h
  23. */; [# S- A1 O2 q6 r* A' j8 J

  24. 2 c9 P" ]9 x$ e- v5 Q# P* L  ^. w
  25. #include <linux/module.h>9 K7 D, H! W9 R! m/ Y+ |& P
  26. #include <linux/init.h>
    ' C5 J6 S* F) A. f/ ^! P1 @
  27. #include <linux/errno.h>1 L/ c" N6 r- `
  28. #include <linux/types.h>  `4 m  r  s( P! x$ w9 a1 l
  29. #include <linux/interrupt.h>
    + L4 Z# d( r9 u
  30. #include <asm/io.h>
    + Y7 v4 L7 ~. u" w  E
  31. #include <linux/moduleparam.h>
    # F4 r0 d$ I- w( e5 T) H$ o
  32. #include <linux/sysctl.h>
    ! b3 x% _- j0 Z& \$ j0 b0 e
  33. #include <linux/mm.h>7 S* e3 `% X, i, C. P: o7 R$ r
  34. #include <linux/dma-mapping.h>/ a; ?$ G/ U8 Z1 `+ X

  35. % f  s' a( c/ K
  36. #include <mach/memory.h>7 c3 u# S: ~" M4 h! G
  37. #include <mach/hardware.h>4 Z5 `( M" a/ ^& }- i
  38. #include <mach/irqs.h>
    : m  |% b& T  O% }# k0 T
  39. #include <asm/hardware/edma.h>
    - u( W  X6 l. n) V1 q

  40. . f( u. ~9 V7 ?4 L4 u  q
  41. #undef EDMA3_DEBUG+ V9 ?" E& b8 I2 m. s! [4 g7 c
  42. /*#define EDMA3_DEBUG*/) c4 V4 |5 g* S! P5 O
  43. 3 g  n. H4 d2 O
  44. #ifdef EDMA3_DEBUG
      P) W, y$ t5 v- A1 L2 X
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 p! T/ R7 l, Y+ F4 p" h: X
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 \9 Y) A# L& s+ T
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    & S$ O" a- S/ ?  y9 K6 Y- P  s
  48. #else, [+ V, j4 o; I1 f. l' j7 z
  49. #define DMA_PRINTK( x... )+ M0 k+ w% O7 [+ l8 G8 s
  50. #define DMA_FN_IN
    2 ?7 s9 Q6 }* d6 [
  51. #define DMA_FN_OUT
    6 J4 J# u! ~. v* s  s) {) g
  52. #endif
    1 i- {5 h( v+ Q" n" u/ ?( `/ F

  53. $ f0 X; K+ n' |" c: N/ K4 D
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    9 z' I0 J5 K9 }7 U% [
  55. #define STATIC_SHIFT                3) @; D2 Z8 k2 b
  56. #define TCINTEN_SHIFT               20
    9 [9 E: J$ m4 d" c$ D# @
  57. #define ITCINTEN_SHIFT              21& w9 S' |/ _# l& b$ L
  58. #define TCCHEN_SHIFT                22: Y7 L7 x2 I' E4 i2 s& p  m' D
  59. #define ITCCHEN_SHIFT               23. W8 A4 h6 C* B; D' x
  60. 2 `! t% \! D; ?  R- w
  61. static volatile int irqraised1 = 0;
    # C( O0 P' D, x$ M1 A# T; L3 x
  62. static volatile int irqraised2 = 0;
    1 B' u; e8 J+ l) f; f* c* r
  63. ! j8 p! @3 W; t
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 m1 K) r' H1 t  C4 g6 X
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / [: W2 x% P: S& w- u
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( k7 Z/ w' @- `2 s. m: i0 v

  67. 6 A. m, A' I3 x8 E& ?9 r! D
  68. dma_addr_t dmaphyssrc1 = 0;
    4 B2 `* |1 v) K3 H' d2 F% u- @7 Y
  69. dma_addr_t dmaphyssrc2 = 0;$ m0 U8 I" `, ]* R) B7 ]0 a
  70. dma_addr_t dmaphysdest1 = 0;& G- f; I# T  ~- h+ ^1 e
  71. dma_addr_t dmaphysdest2 = 0;6 }1 C+ U! w' ~, V# D

  72. 8 Q8 N/ _. V+ r
  73. char *dmabufsrc1 = NULL;% i7 e" i, h4 x3 Z, `2 J) J
  74. char *dmabufsrc2 = NULL;
    2 I( P( L' p/ s0 ~
  75. char *dmabufdest1 = NULL;
    $ {# I3 L. d' G' `  V( z
  76. char *dmabufdest2 = NULL;
    0 c3 w! j) q3 j$ F. E( r- e
  77. ; T; D* D$ N' C/ B' D* O4 B
  78. static int acnt = 512;: w: Z  G- v+ S' F+ U. i
  79. static int bcnt = 8;& K. g3 ?' B1 {- L
  80. static int ccnt = 8;
    7 c+ s& D" ], P8 f- |, N- {
  81. : Z  N# W. ~: F6 [  y/ U/ s
  82. module_param(acnt, int, S_IRUGO);
    7 C* L9 R( i4 V9 d& ^
  83. module_param(bcnt, int, S_IRUGO);" w1 h3 u# d. h" f# ^
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 ~% \6 {- k) y9 t0 ]8 a; e7 g9 Y' L0 j" T8 X2 z$ U% z5 V
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 P9 i- B5 E! g0 O: w$ K/ R9 _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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( v3 e3 S1 d8 e: m2 T     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; H- L' m3 w, V7 p/ \. a$ h
* t( m1 b$ M5 Q& K
9 c0 g5 \: ^6 v
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-2 20:26 , Processed in 0.036735 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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