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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ h" P! T) r6 s5 a! l0 v
  1. [code]EDMA sample test application
    8 K8 X5 P/ I; m. u7 S: W
  2. /*
    # N5 t: {2 Z0 e/ W- M
  3. * edma_test.c. W1 h) h' W2 i# u2 ]2 n
  4. *4 q" w$ X/ v, v4 M3 _' G) v
  5. * brief  EDMA3 Test Application+ p% ^" O& ^2 _; K# L
  6. *( j" p8 u; e* p! p
  7. *   This file contains EDMA3 Test code.
    5 f* N2 y- v1 I$ H+ y/ n( x5 j& F
  8. *$ W; P9 J4 m/ L. j9 `' @
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. L) B: i8 p  x& j6 m" H
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 g9 z2 }8 Q) x1 M. G6 e$ e
  11. *         TO CHANGE.
    & S  Q# U6 L% }9 z
  12. *3 Q$ Y& m( J% f5 a  a# P
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 @* f8 ^; s( T% |2 I4 M/ U
  14. *
    : R' \3 ^1 W/ o8 d9 Q( K9 h6 {
  15. * This program is free software; you can redistribute it and/or) H; X. q& {: p- s: D$ O
  16. * modify it under the terms of the GNU General Public License as* n. S9 v& r3 q) u: w: ^
  17. * published by the Free Software Foundation version 2.
    0 E0 m# e: I( \" S9 u
  18. *
    : }6 R. s' b% Y" c0 }$ A" P4 E
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any* W5 s! G7 O" d) ~2 P
  20. * kind, whether express or implied; without even the implied warranty5 v: \9 {+ N5 Z% K8 o6 ^
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % k0 ?' ~) e1 l" y( U& P
  22. * GNU General Public License for more details.% V' G, t; x$ R* T+ \2 u
  23. */
    9 `- B  b' W# L( f( _/ \* r+ v

  24.   H* c+ i' D0 v7 C! P8 h8 K* h9 n) s
  25. #include <linux/module.h># S6 J/ b3 }+ r; k9 b# h5 V+ `
  26. #include <linux/init.h>
    ! C8 P5 Q% b( l& M& Q
  27. #include <linux/errno.h>
    ) [! ^3 H; x% w& C5 Q
  28. #include <linux/types.h>
    , Q1 n1 Z6 z- H1 f# ]: b
  29. #include <linux/interrupt.h>1 T6 S# e5 |2 W3 q
  30. #include <asm/io.h>, j4 ~2 O% j$ \0 U" r# F7 ~$ }3 B
  31. #include <linux/moduleparam.h>' V3 _# }- V- l, p2 E/ N
  32. #include <linux/sysctl.h>
    2 k' b+ u/ U. h9 ], k3 V! a
  33. #include <linux/mm.h>
    4 [( y! C' X* w! D% G0 C
  34. #include <linux/dma-mapping.h>
    ) B! E, ?/ Q6 S" B3 C# r

  35. - b5 u+ `/ k& S+ M
  36. #include <mach/memory.h>
    0 I! a* L- z  w9 L% _: Y* B! `$ A
  37. #include <mach/hardware.h>& J- [$ ^1 Q. W, C1 l  B
  38. #include <mach/irqs.h>0 Y* X9 y0 d" Q2 r( E9 @+ z/ N
  39. #include <asm/hardware/edma.h>
    0 f% z* n( I, |  x0 X; k6 ^

  40.   T1 \9 W0 c8 S5 h/ k% p
  41. #undef EDMA3_DEBUG4 m+ W0 A0 w7 x$ i
  42. /*#define EDMA3_DEBUG*/
    % ^/ c1 a5 }5 Y" r% G, @4 C
  43. ( w2 ^: q) n: M# J* U5 S6 c" t# W
  44. #ifdef EDMA3_DEBUG  E0 \1 a5 e) K% L8 L
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! K" M, L/ p( s- l+ P* z' u
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 |; X+ b- K) |' t  P0 T
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    & T6 ^% t5 H0 n2 v
  48. #else
      a& g/ g4 Y& ?  u
  49. #define DMA_PRINTK( x... )) O4 ~9 q0 V" Z5 w, T& f5 A$ l+ z
  50. #define DMA_FN_IN
    0 z+ t* a  H$ I2 q. ~5 }
  51. #define DMA_FN_OUT8 F. ?' h9 T4 c7 E, n! f( r+ `
  52. #endif7 S: s4 u. H( Z" R% }! M
  53. ) t+ K* _# C6 [2 ^9 a; k0 y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). l2 ?' K4 b. w; m+ H9 ]" ?# J
  55. #define STATIC_SHIFT                3
    7 f* X* @+ @. f+ L& \6 U8 X) C
  56. #define TCINTEN_SHIFT               204 j: \6 X9 l5 [* _& O9 N
  57. #define ITCINTEN_SHIFT              21. x/ v2 T0 z6 t
  58. #define TCCHEN_SHIFT                226 z' {( g5 b3 l$ G, q1 g
  59. #define ITCCHEN_SHIFT               23
    : F$ L) J4 l/ S3 I' N
  60. ! i) m, K; s& X' Q4 J
  61. static volatile int irqraised1 = 0;' n6 t0 E( A% U
  62. static volatile int irqraised2 = 0;
    " ~& S5 X: |/ Z( j

  63. $ s! Z, f7 _' q& O3 P
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 ^/ G2 q; W- z/ m  H( U
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 f( x+ B/ M; w' i; Y& k7 T
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " C- K* w/ b: S5 W! I; U: t( J
  67. 1 i+ h( N! S' {& l% b# v
  68. dma_addr_t dmaphyssrc1 = 0;
    % O0 S, e( _* R, ^( \2 X; r
  69. dma_addr_t dmaphyssrc2 = 0;8 n+ O4 V& x1 u
  70. dma_addr_t dmaphysdest1 = 0;
    9 x7 L9 e) N- m, T, x; z8 X
  71. dma_addr_t dmaphysdest2 = 0;# |6 x0 I4 I& p* j. d+ g

  72. 3 Z+ y0 L9 l: M
  73. char *dmabufsrc1 = NULL;
    0 Q) r9 Y; f, a+ \$ m
  74. char *dmabufsrc2 = NULL;
    6 n, a2 q9 G. _0 F: l( f
  75. char *dmabufdest1 = NULL;
    0 F0 V4 o* t- T: g9 [- s& E
  76. char *dmabufdest2 = NULL;" _# u, Q- u: x
  77. ; N( E0 e) b0 d( a, O
  78. static int acnt = 512;
    # L8 Q% B0 \/ F$ G
  79. static int bcnt = 8;# Y  A. d% z% S, c$ k8 Z8 O  C
  80. static int ccnt = 8;8 Q4 W  x' `6 O

  81. 3 ?! p7 b/ ~. M3 @3 K/ h
  82. module_param(acnt, int, S_IRUGO);
    ' k. E5 f1 ~# X% M3 |6 E
  83. module_param(bcnt, int, S_IRUGO);! c: s! `$ o$ B' V4 o9 O
  84. module_param(ccnt, int, S_IRUGO);
复制代码

# t" f# Z4 W9 \5 T# Q. [" c! k
+ e% f1 D  U* G4 s      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) }- _) W+ x# u5 J
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 {3 |2 p: A; l2 ^+ s2 O     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 U$ ?5 f, T# Z( K- ?9 j/ l+ B; Q* C2 c- `. T7 f0 ^1 H

# k) Y- V, G( t* N) Q5 \) R
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-27 18:16 , Processed in 0.062009 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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