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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 p& q  Y; f4 `, p2 H
  1. [code]EDMA sample test application. J6 f! |; g" g) ^6 \- h6 N( y1 `
  2. /*5 p8 f: g1 I; |7 ^
  3. * edma_test.c3 K6 w  A5 ~  @0 {4 G6 }
  4. *. x" j2 x* Y/ P" ^& S" f% |
  5. * brief  EDMA3 Test Application
    4 A4 a  S) T: X8 O+ ~
  6. *! d7 q7 B" l& L  k! }' p) J
  7. *   This file contains EDMA3 Test code.
    3 u1 P, @0 x) S9 M+ h
  8. *
    ; d* z' X4 a$ {* D9 T3 x% e$ [
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    2 v) Q$ h5 B* R) B+ j8 P
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , d' c$ B' z5 O7 D/ s* z
  11. *         TO CHANGE.. B; G. Y0 X& t2 e( P; C2 @. u
  12. *+ S) F2 L7 D* G- n& n4 w# q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    . e" p. L1 f) g) j: R
  14. *
    / n0 u4 J7 }$ W  B4 h
  15. * This program is free software; you can redistribute it and/or* @0 J, l2 q. ~  H. b* Q( Q
  16. * modify it under the terms of the GNU General Public License as6 D, ~! r- L% o; ^
  17. * published by the Free Software Foundation version 2.
    ' W8 L( y" C. d+ R! c& _: ~0 E. R
  18. *
    3 j; ?7 p9 p6 M, C3 W
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; o/ k! B6 V- [4 q( U! X- n! u& g: J
  20. * kind, whether express or implied; without even the implied warranty/ b) J$ k3 V' Y' O) P5 ], x
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    , Y7 D1 S! ~$ L/ L8 u& W1 x
  22. * GNU General Public License for more details.8 V! D$ ~9 g' @" Q% I# h/ @$ t  `
  23. */! _3 C5 u2 k" ^# L# U3 H  k
  24. - {9 P: l- j; n5 }% S  D$ F4 h
  25. #include <linux/module.h>: I! A4 h2 K6 G- y4 a" p
  26. #include <linux/init.h>
    / {) A* s4 [: D# z* E9 \6 r
  27. #include <linux/errno.h>  j% ?6 v! }8 f- h4 p
  28. #include <linux/types.h>
    ! t" @8 k; s7 w0 q1 C3 C
  29. #include <linux/interrupt.h>8 v; s1 K) Q5 ~; t9 y
  30. #include <asm/io.h>! |+ T1 M+ i6 A6 e1 q! f+ \
  31. #include <linux/moduleparam.h>
    ) r  v8 u6 B; b% }1 y
  32. #include <linux/sysctl.h>
    . H' U! O$ i( T
  33. #include <linux/mm.h>
    : K: l2 q( i+ G0 M
  34. #include <linux/dma-mapping.h>/ f! k3 Q& p5 ^; g: [* I  m

  35. : C# l% j  J" u  ?
  36. #include <mach/memory.h>
    - |0 W6 A9 ?& F& a; i/ L; C( X# c" m
  37. #include <mach/hardware.h>
    4 E9 m% I! Y6 m
  38. #include <mach/irqs.h>
    6 m# A5 s' _* P0 P# N! P, t* s. ^
  39. #include <asm/hardware/edma.h>
    6 N4 J+ r$ O' u; w% E8 a$ s

  40. $ N* |2 A' n3 u1 y: K5 I, b) m
  41. #undef EDMA3_DEBUG
    4 A! X" X7 j+ X' d
  42. /*#define EDMA3_DEBUG*/
    ) E0 Z) v. A5 H+ W. N$ \
  43. . [0 k5 c) _/ V) [4 \
  44. #ifdef EDMA3_DEBUG
    ; ~# D6 g0 B$ j4 s* w" ~! a
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ c# {  W( H; n& g
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    1 q; M- D4 H: o! ?$ V  |2 y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% j( L0 o9 V& s9 ~+ K
  48. #else/ u% j9 g& q$ E
  49. #define DMA_PRINTK( x... )
    # F& A( D: O3 t  z
  50. #define DMA_FN_IN$ O6 o! X% d; t1 ?
  51. #define DMA_FN_OUT
    . w9 |5 b0 [# Q4 [" o/ v
  52. #endif% @7 X6 Z* e3 u

  53. 3 j' I6 H! ?7 U3 l
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)" A! B3 v% A% ^3 Y
  55. #define STATIC_SHIFT                35 D5 P  K: H: T8 I9 a8 x
  56. #define TCINTEN_SHIFT               20
    ' M& i* t% H: [
  57. #define ITCINTEN_SHIFT              21
    6 C+ t  C1 G* Q/ h3 `
  58. #define TCCHEN_SHIFT                22* _- L1 w! z- o, E; F" q% U5 R
  59. #define ITCCHEN_SHIFT               23. h& W9 T9 u3 k! }

  60. ) P, x% X/ d( Q+ `. z" G* F; p/ U
  61. static volatile int irqraised1 = 0;
    4 k8 H; P+ g& A) s  X8 y' y# q( ?% w
  62. static volatile int irqraised2 = 0;
    ' O" B9 R5 h3 a# ^" v

  63. 5 ~- ~; {: f+ w0 c- w$ y5 X
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      N: D3 n! G. _. @" u: Y7 C
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 |: h6 D4 ]2 A8 U
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; }* n. |2 V$ N0 s
  67. - f3 W. M  ]3 m: D
  68. dma_addr_t dmaphyssrc1 = 0;2 Q* k+ U. ^% W8 `8 J: e  P
  69. dma_addr_t dmaphyssrc2 = 0;
    % E7 ^# C. N# }
  70. dma_addr_t dmaphysdest1 = 0;( [- u5 s' c' L8 i; c
  71. dma_addr_t dmaphysdest2 = 0;
    - D) Y" z# X& F; y4 I

  72. 0 h) J- v" x+ F
  73. char *dmabufsrc1 = NULL;$ ]$ ^* C/ i6 J4 F3 g+ b7 d) k6 c5 I
  74. char *dmabufsrc2 = NULL;- l- r" e7 {1 r4 V7 a
  75. char *dmabufdest1 = NULL;
    * B% l9 ?/ u4 M1 v7 N4 x' r
  76. char *dmabufdest2 = NULL;* b/ ]4 `  T: n1 J$ X5 D4 ]

  77. 5 j. b) W& M' X& x, t$ E
  78. static int acnt = 512;% V6 h- G' L& g2 C
  79. static int bcnt = 8;* j  Z2 O' `& h
  80. static int ccnt = 8;; d9 V- t' e& A; `* ~. D$ Z
  81. 5 f+ L9 X# v/ w  T
  82. module_param(acnt, int, S_IRUGO);& v9 w( Q* n8 e, j0 T3 ~
  83. module_param(bcnt, int, S_IRUGO);% m4 l# u$ T4 M" r. W
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 E0 P0 L' t6 G  _$ A$ q+ C# G; B% y* |; @  ^! B& `# l3 g4 L3 ^
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ E" p0 R9 {) c) i% Tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, G/ q5 ~+ [' v" H+ W
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 B3 r/ o( N$ \1 t' C! R9 K
* U% j; K; y+ A( i
5 R, H7 ~+ r5 [& u- @! s" d: r
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-21 22:45 , Processed in 0.040204 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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