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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) E/ ^! I( e5 ?% ~1 m
  1. [code]EDMA sample test application/ I0 ~. ~' L) ~: ~8 ?* H, A" \
  2. /*. c& F$ c' p) r  m; y. h
  3. * edma_test.c' i" O1 r) |" h
  4. *+ T/ `, r; m8 n# s  H
  5. * brief  EDMA3 Test Application
    * P6 o8 m4 |; F) m  X+ j
  6. *4 h9 v% H3 O& J6 I0 w* [
  7. *   This file contains EDMA3 Test code.4 T6 K  f) d- Y5 S
  8. *
    - c: a" r% r) m+ T/ [
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# P5 l  s: H: T' z9 `, t
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 t' b, n3 X" y2 C2 h
  11. *         TO CHANGE.5 j* ?/ P' s9 t. V
  12. *
    % P* ^5 K- R5 s% B( h3 b/ b% z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    1 ^4 K/ S' R4 F. f
  14. *8 R0 ^# w& K0 T/ i( @4 ]. v6 i% [* K
  15. * This program is free software; you can redistribute it and/or5 u& T2 r* _! p& C( \' ?/ y% N
  16. * modify it under the terms of the GNU General Public License as# u& z7 H# o( T$ _% e4 V; C2 P
  17. * published by the Free Software Foundation version 2.
      V% {  M$ h. u0 E* ^3 I  m
  18. *
    , j! \8 y, Y  b3 b0 H" B$ l
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& ~( B. _9 g: d! Y; u% F* V* j
  20. * kind, whether express or implied; without even the implied warranty" q3 `8 m1 T6 a' j0 s' J
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- W+ j1 F, \: q7 D" W( G6 l
  22. * GNU General Public License for more details.
    , A3 q9 H* _6 ^  h1 D: f
  23. */8 }0 R1 ]! B7 v! q4 m
  24. 9 N% V$ p% u; V: o, e7 ]" J
  25. #include <linux/module.h>. ^8 h/ D4 S( p6 m
  26. #include <linux/init.h>4 Q# z* g; N  `5 f' N7 d
  27. #include <linux/errno.h>
    9 [8 ?3 X4 ?# y9 v. i. a
  28. #include <linux/types.h>
    ! _7 _4 B+ Z/ S5 k7 m) ^
  29. #include <linux/interrupt.h>5 |+ L+ q: ^) _3 o
  30. #include <asm/io.h>  L1 M/ _1 g# r0 u
  31. #include <linux/moduleparam.h>( [8 T; J# ~: z. {% N. z: K
  32. #include <linux/sysctl.h>( I) {4 ?2 O; r
  33. #include <linux/mm.h>+ O. I9 l) y0 l# c. r  M; R
  34. #include <linux/dma-mapping.h>- P9 K; k  a3 F

  35. & L5 d9 u% w* v" f  A
  36. #include <mach/memory.h># t% ^1 O+ G; |2 R: Z( \
  37. #include <mach/hardware.h>
    + y: t% {+ R- x9 `: K8 b0 R
  38. #include <mach/irqs.h>
    % D# u2 G- C0 j  e8 j+ ^; e
  39. #include <asm/hardware/edma.h>+ Z8 L; i: v4 s

  40. $ {2 T( w' [( L5 S9 `4 \5 \
  41. #undef EDMA3_DEBUG6 \; V1 p& \8 V9 k! c- U' i
  42. /*#define EDMA3_DEBUG*/
    + s- i* a7 [' ~5 K
  43. ! s7 n( T& t3 m7 I3 L
  44. #ifdef EDMA3_DEBUG
    & U6 x( b/ |) e7 z; R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 D2 X  h5 _* M, d/ }
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    - q' S" a* Q- m: v4 `4 R. Q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" v( G* r+ f# B) X3 z. ]. S8 _' `
  48. #else
    9 }8 I$ m  W5 n* x3 O) e
  49. #define DMA_PRINTK( x... ). z3 ?' P" |- @- j8 @
  50. #define DMA_FN_IN9 ~, f1 t$ t; C, `* n5 v
  51. #define DMA_FN_OUT! m& Y; g. d# X6 L" D3 v% B+ O! W
  52. #endif  B! A' m9 d: k* m1 ?6 I( n* f! z
  53. - G0 _1 h1 Z* W: r9 s8 T
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); O" r9 V# {- ?
  55. #define STATIC_SHIFT                3
    / ]3 o7 e. k) a- [8 E
  56. #define TCINTEN_SHIFT               20) V2 @. j) e+ A$ x. p# `  U
  57. #define ITCINTEN_SHIFT              21
    2 Z* a: t! c8 O2 M
  58. #define TCCHEN_SHIFT                22
    5 f+ A9 P# C% Z) s( t1 x7 T
  59. #define ITCCHEN_SHIFT               23
    / C) x& c7 O, J+ T' P9 `
  60. ! X7 z+ l% a" l/ X+ _
  61. static volatile int irqraised1 = 0;
      Z& A; e% f, m- U+ |8 m' k
  62. static volatile int irqraised2 = 0;
    * S8 y  k) T2 {2 o  ?, w& Y

  63. 7 ^- ^$ x, M" W+ I& C. N6 R! S
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' }7 |0 |% i' Z& W7 ~; i7 J
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: K  o6 N5 f) l/ ^; r8 m; A
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) k0 @" H( a1 V% Z0 n4 ^( h
  67. 8 j3 n  d# u! h& N+ l. F5 m6 u4 I! _* j
  68. dma_addr_t dmaphyssrc1 = 0;
    5 t. k* R8 O' H- G$ r# l
  69. dma_addr_t dmaphyssrc2 = 0;. A. H4 f/ V( m& j6 G
  70. dma_addr_t dmaphysdest1 = 0;5 _) O: _5 }5 k; `& ~: J
  71. dma_addr_t dmaphysdest2 = 0;
    2 x3 p/ J! i0 P* ^& W1 w

  72. 3 v$ j1 m, ?8 L+ d2 k, ]
  73. char *dmabufsrc1 = NULL;
    - Q+ v) @& ?* Z/ E
  74. char *dmabufsrc2 = NULL;
    : `/ p) _2 p2 a" @, w. o$ M
  75. char *dmabufdest1 = NULL;
    0 a7 C4 A' F# y5 t7 Q+ ?4 n; }6 f
  76. char *dmabufdest2 = NULL;  X2 U3 P* Y5 g, w$ r+ O) t
  77. 8 |: A& ^1 p+ _" Z  b7 r  m4 a: ]
  78. static int acnt = 512;
    # E6 ^; ?! u9 S7 T
  79. static int bcnt = 8;
    0 N# q! V5 l3 R7 S6 q* a
  80. static int ccnt = 8;
    " g6 P/ W$ u9 c$ a
  81. * A( k8 O7 A- O6 a6 B* {4 F
  82. module_param(acnt, int, S_IRUGO);
    2 n, [2 C+ T, `* L  v9 H* b9 T
  83. module_param(bcnt, int, S_IRUGO);2 D% q& ?" ^" K& o
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% L- d. q' x  q) {( I3 R; O0 v: l# G* R6 K1 L5 x4 p4 v0 r
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 s8 x( F* I' }2 `  ?
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 w+ y9 p0 c6 A; p
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! t+ N, R; p+ }. K# p

, W2 Q! X% C# b. w; o
( H. }, F; a  O- S( E9 y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-24 18:29 , Processed in 0.039486 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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