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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 G+ y# j8 @# b3 _. e: q
  1. [code]EDMA sample test application3 T& ~* \6 B. x* g
  2. /*
    ' H( C0 o& I" R5 P* |
  3. * edma_test.c" C+ D! z; _4 r. Q; W6 ~
  4. *
    4 o8 c3 q& b9 h! x0 I( J* W( Y0 Z
  5. * brief  EDMA3 Test Application
    " z9 r: O& R+ H$ {
  6. *1 \2 w$ |+ G3 w: U  F6 K8 V
  7. *   This file contains EDMA3 Test code.$ d8 t: e, ]7 k$ F$ C) X  T
  8. *. l: M3 C; b* K. s6 O
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    , i; x. a& A; v0 O: H6 [
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    - _, t' z* P+ L+ v5 G2 e  P
  11. *         TO CHANGE.& r$ ]5 I& c' g; h9 Y3 s% o3 ~
  12. *( T+ p0 D4 k" ^0 v1 P, v
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- E$ a+ L+ I! \6 n( N1 ^( n
  14. *2 `; H: P1 C) ]9 \
  15. * This program is free software; you can redistribute it and/or* W2 w) _0 W- D2 o6 b; `
  16. * modify it under the terms of the GNU General Public License as' T7 P! G- R  @1 N9 [- y
  17. * published by the Free Software Foundation version 2.3 n# \8 t( \  |$ a+ t8 o
  18. *( F" g. |& p0 t* S$ l& @; E) a
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ; I& [' \4 |1 Z7 W; i8 ^2 {
  20. * kind, whether express or implied; without even the implied warranty) W6 i3 _3 T/ I) A, u; C
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the" C/ B  X4 ~2 [( v2 ~* }
  22. * GNU General Public License for more details.
    * V6 ?- f0 m  w" g$ f
  23. */  U$ Z' B  f2 {5 K. D$ K, ?

  24. & I& I- p4 e, V8 h
  25. #include <linux/module.h>
    5 K5 T4 g4 H9 S; T; C& |
  26. #include <linux/init.h>
    % R( w2 @# V2 C* x+ n# N
  27. #include <linux/errno.h>$ \, u. ]1 T( C* v6 g+ G9 G3 m
  28. #include <linux/types.h>
    3 j* P, x; u, m: z  H' X
  29. #include <linux/interrupt.h>! G) @4 F* }. j2 N* P, ~
  30. #include <asm/io.h>
    ( ~: C* V+ ~$ A
  31. #include <linux/moduleparam.h>
    $ l2 H3 `, W$ x& F( e0 h9 ~
  32. #include <linux/sysctl.h>
    ) F% L( G% j* ?+ F2 f; `0 Y
  33. #include <linux/mm.h>
    + d" D) k* h3 F0 T8 G; F; P' d
  34. #include <linux/dma-mapping.h>
    4 i4 H. u8 S6 k7 X6 ~

  35. 7 Y/ @7 f0 M1 t% T9 F
  36. #include <mach/memory.h>
    ( k3 L0 C, r# T. C* p- ?1 a
  37. #include <mach/hardware.h>
    + [. F5 s* j. O. ^* l. W) X) v
  38. #include <mach/irqs.h>
    7 ^1 M* C9 \7 W! j  K
  39. #include <asm/hardware/edma.h>. l0 k2 Z' B; I7 W3 i, Q% ^7 w

  40. ! {+ T0 D: }7 D( L$ d
  41. #undef EDMA3_DEBUG& w! n1 o& c3 k  X3 c$ X
  42. /*#define EDMA3_DEBUG*/
    # S( x) N  m! e& X/ ]# M2 X" b# @

  43. ; K: t6 |& d$ p& d* L
  44. #ifdef EDMA3_DEBUG" f7 L; K' K0 f6 `. I
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    & K& P6 E5 F  {/ i) u
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- H; }. c- u' E& C. F" v
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 ?$ E' ?  N- C3 H
  48. #else
    " ?& d' I2 N5 C. {
  49. #define DMA_PRINTK( x... )
    4 v  Y" A" S5 p: N+ X
  50. #define DMA_FN_IN
    # C5 L4 B) U4 b& g( E" {- d& j
  51. #define DMA_FN_OUT
    , o& G. r( J( [
  52. #endif
    2 D* B3 w) c" M) l, v
  53. * Y  ^  l3 F8 U  p: m5 y. J
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)9 ]2 H  S% {5 \2 b8 \! S
  55. #define STATIC_SHIFT                3+ X8 K, f1 {* i
  56. #define TCINTEN_SHIFT               20
    6 e% B" ^- e! [8 F" n; g# Q# Z
  57. #define ITCINTEN_SHIFT              21
    " |$ q# ]* K2 ~" q9 l- U: W1 p  r
  58. #define TCCHEN_SHIFT                225 [$ ?0 G) W, v- m, i2 `" g1 I+ K
  59. #define ITCCHEN_SHIFT               23
    * q9 A* V5 \9 N/ O8 q' T: r

  60. 0 w, s  L3 |% @% e: ~# v8 e. i' V
  61. static volatile int irqraised1 = 0;
    . D9 i6 i0 _- A7 X! p* c9 ^
  62. static volatile int irqraised2 = 0;
    ; f9 j$ W4 f9 n. ]6 p2 {
  63. - x, z# i( l# C0 M
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 H8 e% X7 Q0 m5 L$ |& i) V8 Z4 V
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 t7 V% ?1 N( ~* U* L
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 l5 {1 ]6 e) H- }: @+ l2 h& x
  67. 4 J; i: \# G8 N* B8 s
  68. dma_addr_t dmaphyssrc1 = 0;
    ; k- `# e; B8 q6 }* |8 a8 e  |
  69. dma_addr_t dmaphyssrc2 = 0;6 F/ F" h" i% \
  70. dma_addr_t dmaphysdest1 = 0;
    , J& S; z8 w7 S2 t, U' K5 Y% J
  71. dma_addr_t dmaphysdest2 = 0;/ ~8 w; \5 G  c5 I3 O6 R1 r1 f3 K

  72. ; g" i" t2 ?& U3 H6 Q3 N+ F
  73. char *dmabufsrc1 = NULL;
    : z! q9 R3 U" g' t
  74. char *dmabufsrc2 = NULL;0 ~* N6 X2 \' k2 e7 K* p/ f) R/ @
  75. char *dmabufdest1 = NULL;
    % A( }+ ^( ]4 c6 S) i, H& X
  76. char *dmabufdest2 = NULL;. E" U4 E6 @3 c) ~, F3 ]
  77. 0 H7 W- O; \- H: Z% p. I
  78. static int acnt = 512;
    ) b0 i  l% n' _# K. V7 C* O5 z
  79. static int bcnt = 8;
    + O0 h2 x! O1 M5 H1 d" F+ t
  80. static int ccnt = 8;
    6 o2 c0 x' D) E6 ^) `5 e8 P
  81. 3 i! o8 W  d0 ~" F% k9 _0 O
  82. module_param(acnt, int, S_IRUGO);
    : \' h5 ^1 l) ]; f! g
  83. module_param(bcnt, int, S_IRUGO);0 J8 M9 m# t+ R* N7 ~7 O: M8 q
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% C9 N; d* I+ Y1 I; ^% H+ Q; [9 ?: y$ F" B
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& I: Q) F% k7 m- W! i3 `0 E
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( m3 \8 e. H  p* e" W7 a+ X* }7 d
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- f4 W8 j8 b% P' y( ^

! \1 I8 k2 z& [! K7 [0 |1 u' ]8 M  x* x" I1 t1 Z; v7 N% |
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-12 22:41 , Processed in 0.041669 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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