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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 d: ~1 [* A6 c2 N! {2 q
  1. [code]EDMA sample test application- @; ^$ V- z$ u. @
  2. /*
    6 \5 l! s- ^- c# q) {
  3. * edma_test.c9 g( k  n: s" P) x! p: o1 h9 ^! @0 J3 h
  4. *
    3 L2 n" Z; g# x& T
  5. * brief  EDMA3 Test Application
    $ Y9 T/ l% F8 j  n- q1 S
  6. *
    / W* I) k. J* O4 f9 L
  7. *   This file contains EDMA3 Test code.
    / c1 \4 t+ k9 W5 z3 {$ t- |5 Z! M5 L
  8. *
    ! L, D1 m" N! C5 n4 k, G
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 t. ?/ N  d/ [7 n/ L
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 b! f5 S: a7 o% m( p9 H2 Y7 R
  11. *         TO CHANGE.
    $ w( L9 O$ V4 v& a; [
  12. *
    2 N! e( C0 l0 \  d: j7 h
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ' q0 _+ i: e, ?
  14. *& v3 ]% b' }. V, [
  15. * This program is free software; you can redistribute it and/or2 h1 D3 _& M( Y3 ]& c
  16. * modify it under the terms of the GNU General Public License as9 H4 R; ^+ q  c& z! Y) ^/ f$ T
  17. * published by the Free Software Foundation version 2.
    ) ^* t4 r, _8 x
  18. */ F7 x+ A; }* S" W% b5 W4 g% k
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 {+ c. }+ Y) x- B
  20. * kind, whether express or implied; without even the implied warranty
    2 ~$ L) w+ _0 T/ P
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    " S! {% z- L* R: S' }9 i
  22. * GNU General Public License for more details.5 c- p. @# R" {
  23. */8 F+ H( h/ X4 I1 F& j

  24. 2 `! d7 ]" }8 @- O% L
  25. #include <linux/module.h>
    8 P- _3 U) p% O( z+ O3 T+ U
  26. #include <linux/init.h>* M$ b' E7 r  _/ _$ S  D9 H' `
  27. #include <linux/errno.h>
    4 [4 U6 g% ]8 o; E
  28. #include <linux/types.h>
    ) g% ~0 {) a/ _1 e
  29. #include <linux/interrupt.h>$ J$ s! e( M$ @, l; m8 R
  30. #include <asm/io.h>
    & S( ], c7 }3 S+ L8 P; V
  31. #include <linux/moduleparam.h>
    : h( Z* u  H8 s+ p5 z# o
  32. #include <linux/sysctl.h>. S3 d3 u& [% K2 \( _
  33. #include <linux/mm.h>
    : K- g" z. l6 ]+ D' o# t
  34. #include <linux/dma-mapping.h>
    3 E3 O1 e' Z. Y$ r: W- J$ q

  35. 7 H$ H7 h6 f+ F: l/ I3 ~8 T9 k+ l! J
  36. #include <mach/memory.h>
    ) `% _. Y/ _& A$ K2 G, f
  37. #include <mach/hardware.h>2 H6 W! ^% B% I6 G2 B
  38. #include <mach/irqs.h>0 K1 m9 l9 }: Z* o$ ]- s
  39. #include <asm/hardware/edma.h>
    0 y  b' U/ q  s% l3 y5 ]' F; s
  40. ; p; C0 i3 `( b/ P- s. v
  41. #undef EDMA3_DEBUG
    0 o) d3 \3 y5 M) C
  42. /*#define EDMA3_DEBUG*/
    7 a5 [2 X9 G7 P# i# F1 `! L
  43. 2 ]3 e2 W  F4 \$ S& i4 j
  44. #ifdef EDMA3_DEBUG/ |% M6 o2 t6 x& h
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 }% K$ T; L/ M" K
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 m2 S9 O% j- @: M, c9 y7 o
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    2 }3 `& H+ M. Z6 L' P
  48. #else
    0 d# ]! w- [9 j
  49. #define DMA_PRINTK( x... )
    ; N4 C& |. V- F2 R" @
  50. #define DMA_FN_IN! b& \4 h3 h5 n* f4 M
  51. #define DMA_FN_OUT
    6 k, H% h! h/ G: @" V
  52. #endif
    4 l. h% v# n/ I8 i( |: o

  53. ; u( K# O6 o- o9 J" k
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)! N+ C9 l! T& A+ D( C! X0 ?
  55. #define STATIC_SHIFT                37 ]* }7 G* G. ]8 U* o: z1 |9 m1 |
  56. #define TCINTEN_SHIFT               200 P1 K- o- o: u
  57. #define ITCINTEN_SHIFT              21! n9 |$ e. V; q, A) j  x! d  D
  58. #define TCCHEN_SHIFT                22% c1 h% }' N% N3 M' u$ I
  59. #define ITCCHEN_SHIFT               23) o0 g& f+ r# ?2 w7 q0 X/ T

  60. 6 I4 O. a, B9 ~" b* [5 ?
  61. static volatile int irqraised1 = 0;
    ( R) e; k, \: K+ O0 U" k
  62. static volatile int irqraised2 = 0;  s) D) R2 i2 `% Q4 }1 M4 n
  63. 2 W7 u9 W4 ^# ~# z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( G$ T; I8 d! F$ ?/ c
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 b, J5 C% L4 N) Z, ~1 g
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 U9 Z% d9 f2 C3 p  N

  67. , a2 z, z8 O  Q7 ~, v
  68. dma_addr_t dmaphyssrc1 = 0;
    ! e$ J0 I& A7 A) A
  69. dma_addr_t dmaphyssrc2 = 0;* F/ u+ W  L$ a( r
  70. dma_addr_t dmaphysdest1 = 0;
    8 i. {/ b- |% w: U7 F! \0 o
  71. dma_addr_t dmaphysdest2 = 0;: [+ o: U3 p" i- S2 f; g' S

  72. ( l( R9 \/ f3 h+ P! g$ }) g
  73. char *dmabufsrc1 = NULL;
    $ k9 j6 B( G: ~+ l
  74. char *dmabufsrc2 = NULL;
    0 b' {, |1 e& Z) M( q
  75. char *dmabufdest1 = NULL;
    2 y) x9 ^) T3 o  @7 X  O
  76. char *dmabufdest2 = NULL;7 U4 J% Z. \2 u0 p. u

  77. 5 c9 `  h* n8 N, {3 U
  78. static int acnt = 512;
    8 K* o: {8 s+ `: n$ Z: f1 U
  79. static int bcnt = 8;, p- g! q& y4 G# X9 E
  80. static int ccnt = 8;
    ! z. y6 A, }. L, y; E+ P) c

  81. 2 P! D; t& e6 T; v. M* O) F! c2 i: |
  82. module_param(acnt, int, S_IRUGO);% }6 `: J2 g+ H! d
  83. module_param(bcnt, int, S_IRUGO);
    / K7 f& Y4 _# ?/ p3 t
  84. module_param(ccnt, int, S_IRUGO);
复制代码
+ X8 ]1 @. N  z
0 d8 g$ C" a7 D
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; \" B; o' ~! x7 |* y3 r
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 B( H& }' @% H. b) x
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ k+ y8 m- t' @3 P/ [
- F+ Q/ a7 a* H* s. h' j  f' x0 [; _, g* i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-9 12:13 , Processed in 0.037790 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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