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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 i& u" H8 c# z' x8 Y: X
  1. [code]EDMA sample test application9 {/ x2 A, M' B0 T! x" e8 W( }. R
  2. /*
    4 t4 I! @. n8 W' d# M/ D6 _
  3. * edma_test.c
    - X  r- V; U0 f- f/ D! N, h
  4. *
    : [* M# T3 l$ D0 L$ u
  5. * brief  EDMA3 Test Application2 o, I% [% v$ d8 i) H
  6. *' ]: E0 e( g7 p6 z  C, z% ^  n
  7. *   This file contains EDMA3 Test code.* G1 f2 h/ S& c4 Y7 X& ]: x
  8. *' j3 Y& b2 A( s1 k2 t. J
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * y! n7 v; X7 ~0 {% n, X. Z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    9 k; r7 x0 \. f$ O) |$ B- p8 I
  11. *         TO CHANGE.6 B5 ?# \1 c0 D) }
  12. *! x' x1 U, v. `* P/ ]
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 l/ b5 t$ d9 g) X
  14. *
    6 R( I5 Q2 c+ {/ J9 x; z8 R
  15. * This program is free software; you can redistribute it and/or) i8 `1 P3 G8 n
  16. * modify it under the terms of the GNU General Public License as1 X( k" D, K) T, M5 Z3 w
  17. * published by the Free Software Foundation version 2.) J  G! \5 x9 \- x/ A; y) D
  18. *
    & {# T9 n& I/ c4 @9 P+ Q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    " ]! w; M$ S; Y4 N3 c0 x! K+ ]
  20. * kind, whether express or implied; without even the implied warranty5 U! W4 T' v9 i2 F( {* E
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    : @. V$ b( c) |" ]8 e) q
  22. * GNU General Public License for more details.
      O! J: [" E* N- H1 k
  23. */  \" H: A8 D* O1 |6 [
  24. " \1 U! _3 u2 k1 t# H$ H
  25. #include <linux/module.h>( x% ^( Z8 a! ~* z% P, _( k; P
  26. #include <linux/init.h>% c; m( @4 M2 W3 ^5 e. d
  27. #include <linux/errno.h>
    , A5 \, u7 v4 z" x) m: `" s
  28. #include <linux/types.h>) d+ A6 e% \7 z0 \
  29. #include <linux/interrupt.h>
    * p* U+ |, Z7 F4 q
  30. #include <asm/io.h>5 Z3 Y' q- H9 ^% W& U
  31. #include <linux/moduleparam.h>
    6 o& G# s9 {6 R8 X6 p) K
  32. #include <linux/sysctl.h>: ~- o2 U' M( l
  33. #include <linux/mm.h>4 c8 L4 M$ n9 y. t9 h* y# d" f
  34. #include <linux/dma-mapping.h>' u$ b# V3 r" f2 h
  35. 1 ~* u* s1 f( \8 v
  36. #include <mach/memory.h>( i- B& {: L7 ]
  37. #include <mach/hardware.h>2 R! e" ^9 l2 B' m+ e. h2 }
  38. #include <mach/irqs.h>6 X. H% F/ J+ l5 w4 M" p
  39. #include <asm/hardware/edma.h>1 e' |( J9 h* n4 `

  40. * H. R$ C" X, J  w8 S
  41. #undef EDMA3_DEBUG( z- u% g  h: n* d8 \% C8 {
  42. /*#define EDMA3_DEBUG*/& L( Y. X, s) j7 [& S
  43. ; u0 a' X) H. R4 `
  44. #ifdef EDMA3_DEBUG
    - i8 l: D/ ]# A! c3 p' K+ w
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    + ]+ w( f* m% I1 S6 D1 V# q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), o6 @+ p; V8 t0 }, Q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% N% z0 I! L% y! `$ ]" p: i6 g
  48. #else7 k. e0 v6 i8 }( l; T
  49. #define DMA_PRINTK( x... )& O4 \( |3 G/ D
  50. #define DMA_FN_IN
    / k) k6 ~! L$ K+ W+ I
  51. #define DMA_FN_OUT
    & m2 C- e) r! w: X  @
  52. #endif# r& H. N* r5 @) H
  53. # ]5 L5 D. i6 X' a
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)# [& b& N( g6 N  n
  55. #define STATIC_SHIFT                3* H$ E( F6 G) I: D: G/ J: v
  56. #define TCINTEN_SHIFT               20+ M# {% e  a) O: D) R
  57. #define ITCINTEN_SHIFT              21  k0 m+ X8 }4 J& I
  58. #define TCCHEN_SHIFT                22/ e  c& }1 z  j' K1 y+ c7 b1 s
  59. #define ITCCHEN_SHIFT               234 U+ }' t/ @. q8 c

  60. # d; a; X: S$ _/ D# D9 C8 U4 N
  61. static volatile int irqraised1 = 0;; M1 ^4 h4 O/ S  D
  62. static volatile int irqraised2 = 0;
    # ]$ g( C9 B& t3 U

  63. % ?! m+ k3 `: x8 F) A4 q# ~; J6 H
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' B% m  C& ~" Z8 i1 w! c$ l
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ W+ m/ W' l! v& _! O4 y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / Q0 e, M) a% T8 d7 N
  67. ) C  g; w3 ]& a. z. y2 v: `5 j
  68. dma_addr_t dmaphyssrc1 = 0;
    8 g$ I0 d" h- q) H% s" ^
  69. dma_addr_t dmaphyssrc2 = 0;8 G; t. z7 M4 d+ k: H
  70. dma_addr_t dmaphysdest1 = 0;
    $ C' i7 Q4 G, n
  71. dma_addr_t dmaphysdest2 = 0;
    / I$ b& [$ j  x$ u
  72. - N; l1 ~5 ?0 R% e7 b" l+ P
  73. char *dmabufsrc1 = NULL;
    + {, l3 @5 k: @2 B. N1 k" O
  74. char *dmabufsrc2 = NULL;8 X" u3 K5 q6 T% e8 n
  75. char *dmabufdest1 = NULL;
    / W0 D3 z1 u% X: Z2 ]: X+ f+ N. B
  76. char *dmabufdest2 = NULL;! D  v7 w3 A( p" f( B1 B
  77.   I8 m0 n" _0 A8 L- M% O3 X& L
  78. static int acnt = 512;
    & Q. [/ C1 V% n
  79. static int bcnt = 8;! u/ e& o( U; [% I( R
  80. static int ccnt = 8;& w& S. H) W  T+ p  L/ D- T; Y& G
  81. $ U# H' _) z' E2 {
  82. module_param(acnt, int, S_IRUGO);6 H- h) H& N7 O" H: ]
  83. module_param(bcnt, int, S_IRUGO);
    3 B& X1 d+ h% @) C, u! w
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 a3 v7 S. |8 W0 a% F; {
% N0 Z# f! }( f: h
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 P( E3 _$ E0 \6 P) l& p8 j  f
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% |8 ^- r: h( Z! H
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ @# S7 n- y0 l8 n
/ `& L+ P& P# I6 A" E0 L. i" Q
1 [4 E3 {: T5 t! @
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-19 02:20 , Processed in 0.036390 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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