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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + [1 ]! u5 x* a5 x% g6 l; r  n5 p5 G
  1. [code]EDMA sample test application
    ( v4 E5 N0 Q) q/ x+ X% r
  2. /*! ?& u. ]: f  X
  3. * edma_test.c" W, J& Z0 B* s" q$ ?. X" `% B% `1 D& N
  4. *
    0 q: g* ]& p3 s) w
  5. * brief  EDMA3 Test Application3 s, O  q4 ?* K9 h
  6. *
    & c: D6 g" n. @, P! [
  7. *   This file contains EDMA3 Test code.! d  L7 C+ X( @) H
  8. *6 R- C/ I, \4 W7 o1 ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" r: L$ ]0 k# k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) Z  f& {2 Z5 b$ f
  11. *         TO CHANGE.$ V- t' |9 L' t$ z! |( O
  12. *
      C6 x9 [, F7 M' o- J1 d. h
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 e" b0 t4 F& b$ U+ F6 z3 {& P
  14. *
    5 E1 V& \, v# k* W
  15. * This program is free software; you can redistribute it and/or
    ' y  W9 ~, G3 q- k1 S* N
  16. * modify it under the terms of the GNU General Public License as
    ' m9 i3 d0 e) a) c! Z
  17. * published by the Free Software Foundation version 2.
    + g* A0 Z* F8 Z7 h: y" A" q9 q' M8 o8 ]
  18. *
    . H: o7 k1 d& r% l
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    + [  H8 }, o: Z  V; l. S" K3 p
  20. * kind, whether express or implied; without even the implied warranty: d2 z; F6 f3 V
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the0 |6 l% z. h% M& _* V
  22. * GNU General Public License for more details.% m2 L( C: x; I3 D8 |6 a/ F
  23. */1 B* p6 T/ G7 J! q9 }
  24. 9 ]# \8 c0 D( W8 H4 e* O
  25. #include <linux/module.h>
    $ d' e2 D% E6 h/ W6 k6 r. n
  26. #include <linux/init.h>" V* I4 p% R9 f6 U+ S/ ?8 X2 s
  27. #include <linux/errno.h>
    & P0 t) O9 u4 Y) n# L5 }6 G
  28. #include <linux/types.h>
    * U* O! a$ `. |" w  M
  29. #include <linux/interrupt.h>  r& R0 [- d$ |/ `* s! s
  30. #include <asm/io.h>
    & Q1 d, U# L) O* _8 X1 T2 w
  31. #include <linux/moduleparam.h>; B( w$ j7 \, I3 p
  32. #include <linux/sysctl.h>
    ' X/ j1 L; x% w1 P: S
  33. #include <linux/mm.h>
    5 R( C$ I2 j- ~6 ~4 W- Y
  34. #include <linux/dma-mapping.h>) U" B( I" @+ ]2 o7 ?

  35. * L9 y) R$ L- d/ [$ U; l
  36. #include <mach/memory.h>
    8 Q4 A+ q: F4 p5 Y
  37. #include <mach/hardware.h>" l: t  |0 s( L8 ^: F
  38. #include <mach/irqs.h>, F' d5 }. C, |7 \; w$ Q$ I5 k$ N" i
  39. #include <asm/hardware/edma.h>0 H" m( E9 e# h( U% z) a
  40. 1 I  u! i! ?( J! z0 K
  41. #undef EDMA3_DEBUG
    ' o( n- L2 }% P; t0 r; z* _
  42. /*#define EDMA3_DEBUG*/
    # D( s# u* G3 h. |
  43. 7 `* W; l8 j8 W3 s/ u. }  K
  44. #ifdef EDMA3_DEBUG( }( E% k; s& p' k1 D
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! F  U" O0 B1 A$ d7 L4 g' S/ j  W
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    4 h9 R7 Y8 q: k9 u
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# k5 g$ B. c$ K. j
  48. #else& d; h4 }$ ]. Z( O5 v6 W9 U+ Y
  49. #define DMA_PRINTK( x... )* ?% }' P$ }2 A. `3 _
  50. #define DMA_FN_IN; g! O. ~: Z3 B6 h
  51. #define DMA_FN_OUT
    # V0 R3 F) q. `6 h
  52. #endif3 f8 w' U# E# I
  53. 7 D3 t% b7 t/ N& Q8 o! n- ^6 X
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 Z- c$ }- k0 h& e
  55. #define STATIC_SHIFT                3
    " e" L) t$ f1 C
  56. #define TCINTEN_SHIFT               20
    0 j2 ]: \. b) u4 J; ^
  57. #define ITCINTEN_SHIFT              21/ {) u6 `2 _; F& B3 R
  58. #define TCCHEN_SHIFT                22
    4 W% m0 r  G" K/ z& b( I
  59. #define ITCCHEN_SHIFT               238 ~% d) c9 H# r; o6 E

  60. 9 _$ f9 g! D/ k+ K
  61. static volatile int irqraised1 = 0;7 ?8 q+ R' q+ v$ c1 }; M2 [
  62. static volatile int irqraised2 = 0;  p# r# }4 l  l" w/ m9 z: M9 j
  63. 6 A9 }8 m- Q& s$ C
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + o6 N. w1 s6 E9 g) ~$ V
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ ^/ k! Y7 `7 D
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 d7 N/ I1 A' X" z% P: z5 U' W# J# I

  67. ' s% h% q* x1 k/ C0 C2 i/ \  Y
  68. dma_addr_t dmaphyssrc1 = 0;( [1 @8 x9 U& P
  69. dma_addr_t dmaphyssrc2 = 0;
    # N, W9 y; ~: I2 @1 i
  70. dma_addr_t dmaphysdest1 = 0;7 L0 p. i8 G5 {- c! D: \. w
  71. dma_addr_t dmaphysdest2 = 0;* T1 _9 G4 n5 t" }. E
  72. $ D+ h8 h  R5 V2 G
  73. char *dmabufsrc1 = NULL;' Q! ^- A/ \0 A3 q% `
  74. char *dmabufsrc2 = NULL;0 l0 ~+ S4 q# @9 {
  75. char *dmabufdest1 = NULL;
    ' g7 N. N: G& T
  76. char *dmabufdest2 = NULL;. E% F" I  {6 k% F

  77. 2 K2 x3 M" P1 t) E- h* A
  78. static int acnt = 512;
    * V& X% z$ l& k; ?2 j
  79. static int bcnt = 8;
    " j" B3 k& E3 P! ?* p
  80. static int ccnt = 8;
    2 p4 V+ d1 |! M6 `; P7 G8 H
  81. 5 ?5 B% A, r% P$ b! I# I
  82. module_param(acnt, int, S_IRUGO);1 |: k  y6 Q8 a7 g! m1 V
  83. module_param(bcnt, int, S_IRUGO);0 H/ X4 a! h1 M, K) b  `+ \
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 b. n2 z( P7 e9 B" i
( U- G- \% g% B' L( ~2 h9 ?/ y      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 Z& n, S1 \/ }4 Y" Y7 {
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 H, o, H9 t$ X: r2 `! U2 k
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: _& G( U. a) n% [4 R! ^' N$ `, u; U! y# j, S

' W3 x( s% _4 ]9 E- I. ^3 A
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-3 23:01 , Processed in 0.042238 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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