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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 g- u0 F# x" Q6 b% n+ q
  1. [code]EDMA sample test application
    3 x/ R  z7 f; D, k" \
  2. /*, h9 g9 ~2 D3 |, b5 F0 [0 J& O
  3. * edma_test.c
      b1 Y$ l( M9 R6 l9 U5 |+ _
  4. *6 t5 w9 T- E. P  `
  5. * brief  EDMA3 Test Application) M/ n- i! {6 p0 b1 I; y
  6. *
    * h/ ?' c: H+ `
  7. *   This file contains EDMA3 Test code.
    3 ^2 }' d9 t: W& t
  8. *2 L5 s, P7 h/ ~! `6 }7 j% x7 y  \
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: E9 N3 |3 y4 a& ?  w
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; E+ O) o; t0 p! F3 e# ?
  11. *         TO CHANGE.
    3 S( Y9 K9 Q6 v
  12. *0 @" c" a3 d2 x0 S& ?# U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) `: H" p' f2 ~/ ~$ r
  14. ** d5 @+ l  ^* i: F# i
  15. * This program is free software; you can redistribute it and/or- s6 I2 m1 E8 }5 s- K) A5 k
  16. * modify it under the terms of the GNU General Public License as
    5 V9 s/ U! `. g8 z. J+ M2 C! z5 K9 O
  17. * published by the Free Software Foundation version 2.! W6 G) [5 [8 k$ a8 _1 |
  18. *
    7 A  W" f/ n; `5 F
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 f, D5 O: x: A2 F  k
  20. * kind, whether express or implied; without even the implied warranty$ l2 \4 E% x- t2 x% U/ J
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / m9 y/ u2 }6 @6 _- e
  22. * GNU General Public License for more details.: A. [- w1 [6 ~
  23. */, |7 V( C/ V5 y' i- Z) n* ?: u

  24.   R- a9 U( Z" s
  25. #include <linux/module.h>
    3 {# q. r) Q  B
  26. #include <linux/init.h>
    # w3 l+ o# D4 Z) }& ?+ X, h6 g1 X
  27. #include <linux/errno.h>* j& g: ^7 E- ?' \: a7 F- F* G
  28. #include <linux/types.h>
    & z5 j, W* I* c( O0 V
  29. #include <linux/interrupt.h>
    & J( @2 K/ q- Y, I7 S' Z  @
  30. #include <asm/io.h>. X. w( J" A: h& b
  31. #include <linux/moduleparam.h># S9 i  x* l; ?5 m3 A
  32. #include <linux/sysctl.h>
    $ |! X; u; @/ `; C& [% C! T5 R3 W
  33. #include <linux/mm.h>, {/ h1 P/ h4 U, }/ N. L
  34. #include <linux/dma-mapping.h>$ M! U3 K, _' ]3 J& I

  35.   U: o3 C: r7 |$ a% v8 V1 o
  36. #include <mach/memory.h>
    ) ~( _  q# S2 _. B$ R8 @
  37. #include <mach/hardware.h>8 q; O/ F2 h; e- B6 H2 D
  38. #include <mach/irqs.h>
    * V4 E0 Q( o, D
  39. #include <asm/hardware/edma.h>( q+ F& C1 ?: h
  40. / i- z/ g9 ?+ ^8 Y+ [! }5 S: t8 T
  41. #undef EDMA3_DEBUG
    1 j. A& s+ h- I; F3 B& x' o3 a
  42. /*#define EDMA3_DEBUG*/2 t. G# g, N' K8 p* U& m

  43. $ T& Z) ?1 p, ]1 X/ x/ H
  44. #ifdef EDMA3_DEBUG
    6 L: d- G  S' A& O
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' @8 i  O) F1 V6 U2 z) H9 N  Y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    0 o- X; |  T0 z, [
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): w9 b8 P+ G  _& X* S2 O
  48. #else
    7 u9 I; |2 h+ b0 U1 c; N9 V% f* s
  49. #define DMA_PRINTK( x... )  F3 L# V! J5 s
  50. #define DMA_FN_IN# O1 b3 ?" P" A: `9 Y
  51. #define DMA_FN_OUT! J6 @! u2 N# K, C) ^3 N
  52. #endif
    3 D: M. c( E5 r

  53. - Q+ J6 v  z' \  _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " V- P$ r8 M( h3 P8 D7 K* ?
  55. #define STATIC_SHIFT                39 I: X, {1 e, K3 F8 m# ~  o1 ~  G
  56. #define TCINTEN_SHIFT               20" t* s/ `1 L5 D/ }* n" o
  57. #define ITCINTEN_SHIFT              213 u1 {: z; q- |- ^
  58. #define TCCHEN_SHIFT                22
    / c) x- T. M3 F% ]9 M
  59. #define ITCCHEN_SHIFT               23! N: p+ z, M- V1 Z, O. c8 q
  60. & ]; @# S4 G: r# t; C- v7 ^: ~+ m
  61. static volatile int irqraised1 = 0;
      B- G# r! T" I2 ~  H1 ]) W
  62. static volatile int irqraised2 = 0;
    . Q, z3 P! B- D3 d- o8 K+ G* S  z
  63. 9 E: G& i( M3 X! n0 v6 c
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* R) O/ I8 o& E) _$ |
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) h- e: B4 d% o- {
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( T6 w' H8 [1 B5 s; _9 C3 @
  67. & u. N# r$ k8 ]8 c. V- E
  68. dma_addr_t dmaphyssrc1 = 0;( q, c  ?! _4 N
  69. dma_addr_t dmaphyssrc2 = 0;
    ) g+ f4 O: c. X
  70. dma_addr_t dmaphysdest1 = 0;
    7 W; ^& z% q. ~* d
  71. dma_addr_t dmaphysdest2 = 0;# }- K! |& r: ^  }3 ]6 @

  72. 3 J7 V9 o0 I& h5 T! ?, u  m
  73. char *dmabufsrc1 = NULL;
    4 h8 H/ I* n$ M9 R& g6 C9 w
  74. char *dmabufsrc2 = NULL;0 v7 ?" T: g( q6 v" A3 w, ]& t
  75. char *dmabufdest1 = NULL;
    6 E; Q" a5 z3 y9 N
  76. char *dmabufdest2 = NULL;$ `4 s% Z5 e; P+ ?% D
  77. 9 p0 Z* V  G8 i  M
  78. static int acnt = 512;
    ' K& p+ r) J+ B! m9 d
  79. static int bcnt = 8;8 F4 |) B. n- S$ K' m# Y$ a
  80. static int ccnt = 8;
    & [9 g7 A& d- x3 W; t2 C# W$ F! |2 b  W

  81. + J+ n2 {- o* H4 x; x* K4 a
  82. module_param(acnt, int, S_IRUGO);
    8 W( c+ K: q3 R
  83. module_param(bcnt, int, S_IRUGO);, h" T, Z6 b0 Z) r3 w
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 O4 U$ ]9 b4 d' ?6 v; i
2 w" F9 Y1 q$ t: K' _; D3 d. W
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" Q( T0 [/ E2 v) 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ V( i9 l- W" X- t9 m+ d
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 J' `: {4 A2 k5 M1 T  [  C/ {$ h. P
, S9 ]$ ]1 `5 B; f9 k
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-20 10:02 , Processed in 0.040569 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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