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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; ]% W0 K# }* c2 @+ |' Z0 w
  1. [code]EDMA sample test application
    9 ?( N0 h& I5 |' l- n3 H6 v
  2. /*
    : W$ |9 h1 U7 [. d5 D  D& j+ O; T
  3. * edma_test.c# E  d- x& M' ^
  4. *
    + _, a. V( G8 V2 @2 k
  5. * brief  EDMA3 Test Application$ D* x: N( ?5 l
  6. *
    5 q" O) P( o6 Y- |7 |
  7. *   This file contains EDMA3 Test code.2 m5 {2 v. T/ K. I8 L0 @
  8. *1 F7 c* w# V0 y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    . |* S4 X2 D& `# Y+ a
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    % }% w: t: A. Y9 G1 L
  11. *         TO CHANGE." J# @9 O: a  A2 |3 a
  12. *+ V0 d/ w5 G7 Y" W2 X+ ]
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    0 x% J, g- \+ S+ w! o* Z! k) J0 m* [
  14. *
    - _& T$ m. I3 O* }6 b% }& V8 v
  15. * This program is free software; you can redistribute it and/or9 l, Q& d' I/ W) b- M# E
  16. * modify it under the terms of the GNU General Public License as
    + B: c) S) c- ~8 Q! q( m: w
  17. * published by the Free Software Foundation version 2.6 D4 D7 F  `3 a! J) R
  18. *8 U# e0 [: n" H
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any! Y4 L3 }3 Y7 Y; {9 P
  20. * kind, whether express or implied; without even the implied warranty# o; p- Z) ]; o
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & I  J7 \( T4 i5 E* v" `
  22. * GNU General Public License for more details.
    & Y1 C/ f  u( @. J; p( b
  23. */
    5 u" ^& V) m: R
  24. 0 r8 R, I  @$ j1 x
  25. #include <linux/module.h>
    ) x/ L9 L* s! ^: ^( u4 a  G4 Y
  26. #include <linux/init.h># y, z5 D) O# W( I: a+ |& x, D
  27. #include <linux/errno.h>
    ( |) f5 [  K( R# z' P$ b& O
  28. #include <linux/types.h>7 `7 c1 z  E) P- T* ?
  29. #include <linux/interrupt.h>9 M4 C( ~) {9 m! O: n
  30. #include <asm/io.h>- U6 z! V* ]. ^- ^0 ^" C
  31. #include <linux/moduleparam.h>
    & N" g) b6 F! m8 K
  32. #include <linux/sysctl.h>
    : r: V& @, k0 J' s) ]% l
  33. #include <linux/mm.h>
    # ?) }& V* x" h3 w# d' h
  34. #include <linux/dma-mapping.h>( @& ]/ z' Y4 n; ^6 z3 Q

  35. 5 l/ [2 D5 e6 l# P
  36. #include <mach/memory.h>
    " i/ b( ]  e6 m) S5 ]
  37. #include <mach/hardware.h>2 Q$ O7 Z( |" o* h. `
  38. #include <mach/irqs.h>
    - R% Y0 f! I1 Y3 k
  39. #include <asm/hardware/edma.h>
    / f, @% `* @/ T! [$ h: Y

  40. 2 l1 u9 [- K: u
  41. #undef EDMA3_DEBUG
    : D- r+ u6 t* a) N& O7 n
  42. /*#define EDMA3_DEBUG*/
      k5 O' O1 L* j) b8 r' W( e

  43. 3 T) l5 [& y. o/ K% v/ r% I" h
  44. #ifdef EDMA3_DEBUG
    + N' y& f9 O% K
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): @' @; L7 r, `$ Y, q6 B. N& V* H
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 H1 J9 m2 {! G
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    1 V3 m& b' g% s; Z
  48. #else
    # P& N4 L2 n9 J
  49. #define DMA_PRINTK( x... )* z9 X( S' I& t5 S6 U# s
  50. #define DMA_FN_IN* [5 O& J0 N+ y$ U/ m0 s. G
  51. #define DMA_FN_OUT) G: |8 C, t( N$ p
  52. #endif
    8 e8 P+ [9 P7 X6 k

  53. ; K7 ~3 \. {2 p2 k) b
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)% H7 z! F3 K; v2 N- z
  55. #define STATIC_SHIFT                3% S9 T8 m5 _$ i
  56. #define TCINTEN_SHIFT               20" q* s# U8 L5 r" h4 b3 X, g6 k
  57. #define ITCINTEN_SHIFT              21
    2 H! R0 s  _% g  B/ q: t8 F' B, H+ ?
  58. #define TCCHEN_SHIFT                229 f1 y0 T! f4 _6 D3 l
  59. #define ITCCHEN_SHIFT               23( s4 D. H- v4 b% Y
  60. 7 h0 p: Z* p/ C! C) S2 O: n  |+ C6 q
  61. static volatile int irqraised1 = 0;/ Q3 N# }' \$ o/ F3 f
  62. static volatile int irqraised2 = 0;& g& l1 ^$ z' X  C% _3 ^7 ^

  63. 7 s! T6 X2 Q# o9 F4 K
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 Z& H0 Y1 [3 q8 E7 a/ o
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- W* e" ^8 F4 E4 e7 d$ W( {! s
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( H, ^* x* G/ D8 @+ H, a
  67. * f3 T( J' E: s! |/ F2 c/ f
  68. dma_addr_t dmaphyssrc1 = 0;7 i& f& z  {$ J- a+ f: R: ?" T
  69. dma_addr_t dmaphyssrc2 = 0;
    6 v- \8 o1 z9 y
  70. dma_addr_t dmaphysdest1 = 0;+ e3 x7 {" c  O$ S0 X1 ]: @# X! m
  71. dma_addr_t dmaphysdest2 = 0;3 k' P* \7 @! ?1 Y# D5 U/ Z3 W1 R

  72. % n+ Q- @( F& u- M4 k" D5 A% C+ D8 ~
  73. char *dmabufsrc1 = NULL;+ M3 S- n+ X& C! o
  74. char *dmabufsrc2 = NULL;
    7 `( e+ a& c3 u/ R# G1 ^
  75. char *dmabufdest1 = NULL;
    ( U! k9 @3 n  B. P
  76. char *dmabufdest2 = NULL;4 W. s$ d) ]; ]; Z0 a8 S  _
  77. 5 ?6 V5 m" c! I# p. l
  78. static int acnt = 512;- p! u) [7 B% x
  79. static int bcnt = 8;* D+ F# M& [" ]9 d* {8 a& K4 t
  80. static int ccnt = 8;5 n- R( Z  a* C' s0 {

  81. - H$ T& M# F% s" n5 J- T
  82. module_param(acnt, int, S_IRUGO);
    7 t% d! i8 j* D2 N" s
  83. module_param(bcnt, int, S_IRUGO);$ |$ C9 ?+ s& p0 U" ]9 _
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% `( I$ m) m) Y' x$ s1 `, h9 U$ Y* V. f# g
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) L) U7 ^+ \% D+ W+ W- 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 G- z6 \- c& \
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% y7 w. E) c4 {8 ~- C
+ q: B5 [# h) w0 c
7 C! q3 X) [  ~" w
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-15 07:52 , Processed in 0.041907 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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