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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 D7 H6 z, s7 I8 `% ^
  1. [code]EDMA sample test application/ A3 {% s' r# P1 M9 j
  2. /*. y3 b2 w8 ?" u: N) k
  3. * edma_test.c. S4 }. G& e5 y: O8 R) q
  4. *
    * g4 W$ W" W6 Z* I9 Z9 Y+ i* J: s
  5. * brief  EDMA3 Test Application. X; G- q: j0 M- o4 w
  6. *0 M. h% u/ r9 L7 ]
  7. *   This file contains EDMA3 Test code.4 N  p7 E7 X! D
  8. *
    2 z. c* c! D7 S  }6 v9 ]& ~/ ?
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ _$ ?. Y* O4 `
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    8 l* k8 v# }/ ?. l! T8 D( _5 s& a
  11. *         TO CHANGE.2 z; c; w5 }0 Y
  12. *5 x! q7 H3 \! |# N
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " ]# [1 ?9 T( n
  14. *
    5 N6 ^3 C' a# Q% w
  15. * This program is free software; you can redistribute it and/or
    . A: ]6 e# j" z7 G0 a3 L( }- z  Q
  16. * modify it under the terms of the GNU General Public License as
    ; |2 w  U7 I" O$ m( f- [
  17. * published by the Free Software Foundation version 2.2 E8 W: \/ B! z/ L  ^9 D% l5 @
  18. *2 i2 Z) i% ^; t
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ; W% D- Y3 J* M- E3 I! P
  20. * kind, whether express or implied; without even the implied warranty
    6 L' Y2 S' [, t% `& t! H% b, Q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % M* ?6 q  e5 `4 _8 z
  22. * GNU General Public License for more details.
    . k9 b$ ?* @) K/ h
  23. */
    0 S. ]# n% e% B1 R9 M! @
  24. ; S" |# f- v! h6 f: n  H7 t) \  \
  25. #include <linux/module.h>
    , |* p' Y$ B; U# f# c) W5 G
  26. #include <linux/init.h>
    0 Z3 i! @1 [! l7 O; h2 C% \, |
  27. #include <linux/errno.h>5 M% b! n# B* ^# B# K4 _, r
  28. #include <linux/types.h>* R, k. [+ b4 U' u
  29. #include <linux/interrupt.h>
    , G4 m+ E' D# V+ T* h( O
  30. #include <asm/io.h>
    ! S0 q" u% r" {2 M" \
  31. #include <linux/moduleparam.h>6 a+ o" J) q1 y( `: G7 x9 k
  32. #include <linux/sysctl.h>* O$ c: D7 x3 `
  33. #include <linux/mm.h>
    % V0 s6 e7 j0 P* x( B, }1 c
  34. #include <linux/dma-mapping.h>
    . Q  l) C# S$ r9 l- i

  35. 0 ^) A9 H0 Q8 ^) _2 d( I( ]& U
  36. #include <mach/memory.h>+ ?7 S, I3 M. H: t# f
  37. #include <mach/hardware.h>
    + d) D6 ]8 [; P+ O/ K
  38. #include <mach/irqs.h>
    7 U; x% ~9 _2 m$ [' m: D
  39. #include <asm/hardware/edma.h>( n; y8 j( b6 D5 c
  40. ; U+ J0 q% T- N/ F3 M
  41. #undef EDMA3_DEBUG0 }, z! Z/ r1 x* q! }
  42. /*#define EDMA3_DEBUG*/( X- K% d2 [; R4 V) E" m

  43. % u: S0 i* v5 B8 A- E) R8 G
  44. #ifdef EDMA3_DEBUG
    ' ^2 J% _: }4 L8 D  c' e+ f7 a( _
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' M, B5 L! E4 k9 q, {2 f* A: }
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 `% Q7 m2 z; [* B7 F$ E+ T
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)  }0 P% g; H# n( r( j/ P: R
  48. #else
    & i3 }* P: _2 c
  49. #define DMA_PRINTK( x... )8 C4 [/ ~5 X( A
  50. #define DMA_FN_IN
    ) _) a! n5 h+ M$ b8 F6 I2 R
  51. #define DMA_FN_OUT
    ) z8 |9 e9 y9 a6 J" J
  52. #endif
    9 e8 `! e+ [8 u& I. m! b

  53. 3 B4 i# N- V3 r1 r* R9 F) N( ^$ q/ G
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 ?2 Z, Z" e; j- f2 K
  55. #define STATIC_SHIFT                3
    - P8 l6 T4 [: j
  56. #define TCINTEN_SHIFT               20/ A4 r3 A- k4 R* a5 H8 e
  57. #define ITCINTEN_SHIFT              215 s& b* ?0 Z$ Z- \0 l9 z' k) e
  58. #define TCCHEN_SHIFT                22# q( l, t" }( d+ t; M! _
  59. #define ITCCHEN_SHIFT               23
      E# }  }( R; u

  60. 1 U! N1 B4 }5 ~$ W
  61. static volatile int irqraised1 = 0;3 M+ [. E4 a! `* G
  62. static volatile int irqraised2 = 0;& }! Y5 F( n8 N/ M) P
  63. 1 X7 b% x3 S* u! U2 w  l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- `2 V! U; Z4 |, P( L
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) ]5 e+ ^+ }" a3 |0 O. v% d3 B
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, Y+ @& P  m' ]+ u* m

  67. ! Q8 y2 y2 R( K1 s8 j
  68. dma_addr_t dmaphyssrc1 = 0;
    / \3 t/ J4 I5 \$ k$ H$ Q
  69. dma_addr_t dmaphyssrc2 = 0;
    " v6 s5 Y0 e" M4 ~$ q
  70. dma_addr_t dmaphysdest1 = 0;0 _3 p. f3 Y; Y# h5 ^  v0 I
  71. dma_addr_t dmaphysdest2 = 0;+ X$ Y8 }( y4 ~3 J4 J

  72. 7 w! Q0 _, m, S% ?* X" B4 ?1 X
  73. char *dmabufsrc1 = NULL;
    . E* s/ _6 o4 P4 v1 c( X+ _
  74. char *dmabufsrc2 = NULL;
    ' {" f9 x2 ^# E% Y3 d  e
  75. char *dmabufdest1 = NULL;
    3 e2 Y9 {7 \( t6 e/ ]( E/ o# ]
  76. char *dmabufdest2 = NULL;
    0 j5 q; {) w" m

  77. 1 P9 L2 n+ E, O; Y( F+ f* t
  78. static int acnt = 512;
    6 o1 [; z7 n4 I9 \, ]$ s
  79. static int bcnt = 8;
    ! H; }7 C  W( h) ~
  80. static int ccnt = 8;
    ! G9 P$ ]. {5 {0 W; n
  81. 0 y( i& e' X: u- w
  82. module_param(acnt, int, S_IRUGO);( \+ t2 Y& d0 c
  83. module_param(bcnt, int, S_IRUGO);. T5 w2 M1 J0 d, M6 J! A" U
  84. module_param(ccnt, int, S_IRUGO);
复制代码

/ z6 c) \: W! u0 R% f1 N* D0 N4 n. A( s" A- F2 N0 Z
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ O5 m0 D3 u$ @
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, S1 _% F# p: i% C% N     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; ]* M' o' g: d/ \# p$ [% J  S  t

" H! r! q7 _& Z+ U( o  }
6 ?' ?5 H9 Q, m7 F9 ]8 D- U7 Z9 \  N" x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-3 05:13 , Processed in 0.046166 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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