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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' p7 D7 b' W: l5 u, S7 W8 V
  1. [code]EDMA sample test application. l" t  k" a/ w/ i6 ^
  2. /*
    % h: Y" ]3 ^# r6 q
  3. * edma_test.c: B' i$ K/ a6 E
  4. *1 \7 ~- K7 a# t9 |- {- o
  5. * brief  EDMA3 Test Application
    $ k. a/ q# C7 j4 E' ~1 i$ ~
  6. *, O( O8 e# s7 I  N4 h1 ~/ e. M- I
  7. *   This file contains EDMA3 Test code.4 @! Q  P3 A; v( H3 Q& m( G0 q
  8. *
    % m. f4 u. A- |5 t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    . X% u2 V2 K% v$ I! W. U1 u+ v4 ^
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    % n- h- R( O8 p. d* F
  11. *         TO CHANGE., A+ w! ]4 E& K4 [
  12. *
    0 z+ B/ f7 E, O* q# W! F9 V
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  L8 N' X& ?" j0 d: m
  14. *8 n4 z, K9 k7 O; C& ]* h: `1 R. y
  15. * This program is free software; you can redistribute it and/or( t  V2 v6 c7 Z( p! B+ b
  16. * modify it under the terms of the GNU General Public License as
    9 g( `# b' Y( |8 b5 G* l
  17. * published by the Free Software Foundation version 2.
    : w. h2 }* M, {% V  m' f" n9 K
  18. *
    9 x: ^  [& N& E; B$ k& E
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 J1 B  y& j  ]
  20. * kind, whether express or implied; without even the implied warranty
    , J% x6 p& h: T  ^
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the2 h# t; J5 |7 I  x6 `' Q
  22. * GNU General Public License for more details.
    6 q; f$ \/ E( l6 a
  23. */6 B# M8 b. ~1 _. P* U& u1 ~/ }0 Z
  24. 8 p  K8 |1 J- c& x
  25. #include <linux/module.h>* u  A2 S5 @& T- i
  26. #include <linux/init.h>
    1 v% U2 u  g5 X) I* \; g
  27. #include <linux/errno.h>) V' y4 k3 O* L! |7 c0 s+ T6 T1 b
  28. #include <linux/types.h>
    4 X" L9 u* i% {, t6 @1 C$ @( d3 f
  29. #include <linux/interrupt.h>
    $ L" f" O/ i& x9 \# ~- g
  30. #include <asm/io.h>
    % }* c0 Z, l( N& \) i
  31. #include <linux/moduleparam.h>
    ( \( x+ R) s" ?5 t( N/ J' t; ?
  32. #include <linux/sysctl.h>  G, _' M+ L& F; B
  33. #include <linux/mm.h>2 j* i! U# g8 z% g* `8 l: `2 R
  34. #include <linux/dma-mapping.h>
    " D6 p6 E; ]3 p

  35. : F* C" [! F1 I- I- |- z( |$ g
  36. #include <mach/memory.h>" {5 l  G. c3 n. ^; ?, L# Q
  37. #include <mach/hardware.h>& H& y9 }% m7 {1 v2 F: L
  38. #include <mach/irqs.h>
    ( [8 C8 W% f* d- N2 t# {
  39. #include <asm/hardware/edma.h>5 B. F+ o- Q& U8 f+ [: H8 V

  40. 2 ?4 i3 s  ?9 e  @1 t
  41. #undef EDMA3_DEBUG. M  K1 ^3 S% h4 c' ^5 ~  B3 _( v
  42. /*#define EDMA3_DEBUG*/
    / |- i, a  j0 ?

  43. ! \8 a1 s  E! Y7 {+ z- E
  44. #ifdef EDMA3_DEBUG: B/ B2 U2 l9 o4 Y+ W7 s/ v  \
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    3 w7 e$ B8 f, r- {+ t5 _# h
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ ?0 x, x- d9 {- X6 J
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* }/ F9 T( _/ E7 e! J8 {# t
  48. #else7 \7 \9 Y9 \; o5 i! G; }* Z
  49. #define DMA_PRINTK( x... )1 n! @+ j- ^7 ~4 H( a& s+ m
  50. #define DMA_FN_IN/ ^; ^# K; {1 r* j( W" T$ y% Q! w
  51. #define DMA_FN_OUT
    4 @. ]( S: X4 E
  52. #endif
    & v# a1 `1 g, T# N
  53. 5 e9 e2 c1 I5 E3 L; ^7 m
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    0 E5 I( B3 i/ C) M6 P9 Y
  55. #define STATIC_SHIFT                3; x- X  y; ^1 H* U! i* i( z: m! g% F
  56. #define TCINTEN_SHIFT               20  b. L- ~9 Z, s4 i
  57. #define ITCINTEN_SHIFT              21
    7 E0 }9 Q3 r) C  U
  58. #define TCCHEN_SHIFT                22
    + F% h/ |1 x- E; N- p
  59. #define ITCCHEN_SHIFT               23, Z3 Q6 t: `* Z' D

  60. % {- I5 j9 T# P2 [+ Y
  61. static volatile int irqraised1 = 0;) c; I7 T; @. P# i- P
  62. static volatile int irqraised2 = 0;
    , P' w+ W8 I. n  _

  63. 0 x. G7 T0 q( h) N$ @$ ^  r
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; U, r- f9 g! l  ]
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) o& z4 R% K/ T* \- o; Z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' w* s6 t- t  S- A1 V+ k
  67. & g/ ~) d. \' p3 b. i/ @9 S
  68. dma_addr_t dmaphyssrc1 = 0;8 z: i) j# U; x- B4 z
  69. dma_addr_t dmaphyssrc2 = 0;
    8 C' ?: {  R9 F+ Z& F- R
  70. dma_addr_t dmaphysdest1 = 0;
    ) H% ]# V6 {$ y/ I' R7 _
  71. dma_addr_t dmaphysdest2 = 0;0 B1 [! e0 U4 C' b! I

  72.   F) v7 s; m6 R# s5 u7 Q4 |
  73. char *dmabufsrc1 = NULL;2 m2 {2 ^' F1 k, n+ D- w
  74. char *dmabufsrc2 = NULL;; n) P7 B, ?( C$ \: H9 \0 B( ^9 |1 O0 P
  75. char *dmabufdest1 = NULL;
    * Q1 j/ f' C0 H4 D4 {& k  n
  76. char *dmabufdest2 = NULL;
    ( d- D) t% _" K( r

  77. + x, K6 Z  m( B, \6 h) T9 A
  78. static int acnt = 512;
    6 y5 I4 V+ l% e& ^. f( R; R
  79. static int bcnt = 8;
    $ s9 x% m1 U2 U* h
  80. static int ccnt = 8;9 Z  }7 T. ]' ^- ~

  81. : ]8 x: q: x- @. ]' E) \% E. ~
  82. module_param(acnt, int, S_IRUGO);0 [. I* J" y% ~, T6 \
  83. module_param(bcnt, int, S_IRUGO);
    ) v- j! `: E" F& E
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( ]  @: _3 t2 m* ~( V! P  M$ r
( c5 v5 L; @- A2 L$ z& E) _9 {% _, S      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% ]9 C' P3 ~; C) ~- \4 j1 m* o
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' ^# i* K/ U2 t* j1 a     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! k  a2 Z+ L. Z4 ^  U* s/ X- y

$ u5 x' y- G6 q! R/ J8 o: q  r# c* Q" v& f2 K
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-25 22:09 , Processed in 0.044213 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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