OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , W1 @: m/ W+ G% U( v- v, `
  1. [code]EDMA sample test application
    : w* ]; ^! b7 r
  2. /*' @/ d2 b- r) G
  3. * edma_test.c
    " T0 J" O$ a# y9 R. l. S
  4. *
    ) [5 V& ?. \4 ~+ f
  5. * brief  EDMA3 Test Application7 l5 Y  }+ x- a% |# O) ~1 R( K
  6. *
    ; a( n" x7 ~0 L& S/ N: V
  7. *   This file contains EDMA3 Test code.
    ) y& T3 c- o! b0 }9 y
  8. *
    . X2 b1 i* v: k9 Q0 i
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " c( h+ Z# d; ~& H
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( B9 n$ l' j  F# J3 B
  11. *         TO CHANGE.8 s! k( a) m. a3 k. }: V/ K
  12. *0 }- O% f1 T: D1 r, W& A+ X
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    9 f7 M+ j0 f! V2 w. u
  14. *7 V* w$ W6 H0 @& S& |- t# i1 Y! }
  15. * This program is free software; you can redistribute it and/or5 H+ y4 t3 J: q
  16. * modify it under the terms of the GNU General Public License as  k8 ~4 i( f. s" \2 d0 Z
  17. * published by the Free Software Foundation version 2.
    ' o- i2 x. u. k( t1 c; W
  18. *8 ?) @& @5 q; ^/ _" _0 e
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 }7 [2 ?( b% J$ ^
  20. * kind, whether express or implied; without even the implied warranty" z* R2 e' e3 |8 @6 N
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) z  [3 O) ?+ ~/ H* E3 e+ I- Z( k9 ~
  22. * GNU General Public License for more details.
    8 U8 ?+ i. u$ F6 @
  23. */
    : l6 ~* B+ ?/ p/ Q$ i; k! T

  24. 3 l0 a# D1 b5 l: O" d+ ]: h9 }1 ~
  25. #include <linux/module.h>
    - W  ^. n8 n# x+ e5 [
  26. #include <linux/init.h>3 C- H7 B1 X1 L, P$ Q+ B" G7 q
  27. #include <linux/errno.h>
    " [4 p6 U# V4 ?4 @
  28. #include <linux/types.h>! z& K" H  \( A# h6 G0 r. Q
  29. #include <linux/interrupt.h>
    " ~1 Q: G- `; \6 r- A% c
  30. #include <asm/io.h>1 ]+ x. {- C- B# g) z3 ^
  31. #include <linux/moduleparam.h>
    6 Z. \; y2 F' `5 X7 d1 ?0 i6 n
  32. #include <linux/sysctl.h>: d  c+ o7 e2 }6 A4 B* |2 m# ^1 M
  33. #include <linux/mm.h>
    % N5 O: ~1 C" Q9 q1 m# @" H
  34. #include <linux/dma-mapping.h>: T2 ~2 K% Z6 V0 Q
  35. % E- k4 j3 A" g# g
  36. #include <mach/memory.h>
    ! }, D- m; h' _! B3 P
  37. #include <mach/hardware.h>
    - \2 u7 C3 L3 F
  38. #include <mach/irqs.h>% o9 d8 l! S( N6 m+ d8 L0 _
  39. #include <asm/hardware/edma.h>
    ) u& }- U7 s9 m; L8 W

  40. ; A3 w. q, u, v" p1 r- E
  41. #undef EDMA3_DEBUG
    & z0 y5 d* _" x; v& M; m
  42. /*#define EDMA3_DEBUG*/
    $ a0 Q& x  L8 y# T

  43. # |+ X5 n5 I3 O) I8 s- X! ]" r9 @
  44. #ifdef EDMA3_DEBUG, J' y5 d5 k3 j! I
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 T, S* C0 W; g# Q! @; t: C
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( [! _* h) h0 p2 R* S! j# A+ N
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- R5 L! d& E( Y7 r
  48. #else
    ) S% s4 g0 F' j) g9 z7 t+ W# d
  49. #define DMA_PRINTK( x... )! [1 `8 Z+ X+ L/ }+ }) U
  50. #define DMA_FN_IN
    ! j. f+ i9 p2 M. R  }
  51. #define DMA_FN_OUT
    5 J# F$ i; Y& f) K3 m) e% A& y
  52. #endif
    : q3 F& E: h4 k, }
  53. # v0 u9 D( b* \4 r- |  z( y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; V0 Y% S1 ~6 v
  55. #define STATIC_SHIFT                3
    9 y/ O& }, ~% ?: N& a
  56. #define TCINTEN_SHIFT               20
    ; U& M/ V5 Y8 \
  57. #define ITCINTEN_SHIFT              21
    8 ?6 |( K% f" ~$ N  g  m
  58. #define TCCHEN_SHIFT                228 p  e- m# e1 f: U9 B- S
  59. #define ITCCHEN_SHIFT               23! Z4 Z, _% q: O& _
  60. % q. w0 H% F- u( T6 V7 @
  61. static volatile int irqraised1 = 0;7 p  x% w) j* u: G1 V) f
  62. static volatile int irqraised2 = 0;
    4 B# }9 Z# I% K( a9 ?3 t% {( K$ H' q
  63. 9 }( Z9 |' v+ D# [* Z6 h/ O
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% F( Q& R9 g% {
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 @- [: B: `% V; c& P! Y7 v' V
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( |. J+ E( n3 Z1 w5 D
  67. 3 p; R$ P& z0 a
  68. dma_addr_t dmaphyssrc1 = 0;
    ; ]- O  Q" J! q; V! q
  69. dma_addr_t dmaphyssrc2 = 0;
    $ b" E" P! f3 ^0 q' }# z
  70. dma_addr_t dmaphysdest1 = 0;5 \# G3 k( Q( v6 n, K
  71. dma_addr_t dmaphysdest2 = 0;
    ! J, k" g4 K$ s8 c8 ]1 Q0 Y
  72. 7 f2 W; l5 i: g; N4 |7 n# W, T3 ?; @% C
  73. char *dmabufsrc1 = NULL;* F9 p) q7 }2 Z' y  z
  74. char *dmabufsrc2 = NULL;
    0 F1 b* e! P) Q, h4 ?5 n3 K
  75. char *dmabufdest1 = NULL;6 T5 ~( ]' ^0 U) y) S) A8 G
  76. char *dmabufdest2 = NULL;
    0 }* L3 x$ A% T
  77. : H" c7 X7 I  s& t1 ~4 u  k+ K
  78. static int acnt = 512;6 Y% t8 W) b7 G! @; J, _
  79. static int bcnt = 8;
    9 G) f* m. s* X, f1 K+ `/ U
  80. static int ccnt = 8;2 H4 E& U0 M: D
  81. , _* F% D  @) m6 K4 S2 r4 N
  82. module_param(acnt, int, S_IRUGO);
    7 l1 `# M$ _0 B# D3 P; d
  83. module_param(bcnt, int, S_IRUGO);3 b. F, b3 G+ D! I- I; ?
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 b. E2 u" m& {% P% ^7 G

! P( q: s0 A: M- ^# T- G: @& s      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' z/ o8 b# Z% j  o& q$ ~! t4 Qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 a+ _  U" s0 W$ d
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; O( F4 B& c% S  w+ {

6 x! ]! y1 ^7 `! ~
% i4 I3 F0 D( s) R7 g/ e
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-21 20:59 , Processed in 0.037494 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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