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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑   e8 f6 a* E1 o! n' ~- b
  1. [code]EDMA sample test application- O8 F: e( T7 a) U
  2. /*
    ) ]/ P/ v1 J% I6 m) z( y
  3. * edma_test.c2 `5 {' ^8 S; j9 c; M
  4. *
    : v" X+ z$ a9 W" k
  5. * brief  EDMA3 Test Application
    1 j" Z  d, b" H. X4 A% |: W
  6. *4 E" N) Z; x- f
  7. *   This file contains EDMA3 Test code.
    + [0 }3 E, i6 J
  8. *
    . N3 k8 A* t8 M1 g# g
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# C2 i$ m3 M  b" S" K) L
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# v+ f' y* V( x
  11. *         TO CHANGE.
    ! C' P( T2 ]2 n& Y! i' {# `& V
  12. ** N# u0 ~* `* a& P
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. P& }6 |* V% [6 U8 b8 h
  14. *1 c3 m8 }- e3 ?7 I7 H; |
  15. * This program is free software; you can redistribute it and/or
      [! @$ |2 F) u  v) X
  16. * modify it under the terms of the GNU General Public License as
    0 o& i& }* m" T. _' s
  17. * published by the Free Software Foundation version 2.$ A7 T" [, _+ `& u! J8 X+ ~1 P0 C6 [$ K
  18. *1 A. K( q+ G% R- O! i$ w
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any' q, t, F4 O4 L2 ?; I( F' g
  20. * kind, whether express or implied; without even the implied warranty
    : f! B: r( R: p
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . h* o1 j' }& B( Z3 _- Y) i( Y
  22. * GNU General Public License for more details.- `% I. w5 e2 D( j
  23. */
    ) i# _* C( J4 X+ w

  24. 0 h/ ?  m+ q. G  q9 Z/ c; h
  25. #include <linux/module.h>
    7 [9 K+ }3 L& X; P6 d3 r
  26. #include <linux/init.h>
    5 J+ m8 _- A' b* P! b! e
  27. #include <linux/errno.h>4 r0 w( O* k/ i
  28. #include <linux/types.h>" z, }0 N; C* A/ r8 F
  29. #include <linux/interrupt.h>/ p9 S1 [: x! G7 J. l
  30. #include <asm/io.h>
    2 I) ~0 n$ h' T. A
  31. #include <linux/moduleparam.h>8 Y) |1 ]" `  Y* x2 \9 e
  32. #include <linux/sysctl.h>
    ! A* d" `4 j# j- v/ X8 c4 \. t
  33. #include <linux/mm.h>% l% s- w* I$ _6 ~, q& l% }
  34. #include <linux/dma-mapping.h>
    $ H# n! B0 h* E+ h) h8 P

  35. , k& r7 H' O& ^* O- Y6 s% I! u+ g$ ?
  36. #include <mach/memory.h>
    4 n4 G' A/ b) S" E& c
  37. #include <mach/hardware.h>3 V) m: w) c/ W; l8 S+ }
  38. #include <mach/irqs.h>
    - Z0 N6 M, v/ _
  39. #include <asm/hardware/edma.h>0 k7 z+ e' r/ k7 R4 M
  40. ' `( P7 M5 y% I' X
  41. #undef EDMA3_DEBUG6 u% y0 x  l% u  |+ K" C
  42. /*#define EDMA3_DEBUG*/# |5 E, m6 A" e0 u; w" u9 i& T

  43. " z) z$ [3 G) L! O' A9 P/ [
  44. #ifdef EDMA3_DEBUG
    0 O8 G/ w8 V% ^7 k3 B0 J
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    " g! T* K, {5 X8 u
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 J: E4 o" j/ V2 h( z! t
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 v7 l/ I+ h% A% Z
  48. #else4 N6 o" h7 q+ f# l% n& |
  49. #define DMA_PRINTK( x... )( V9 B. S( _5 N) V6 M1 J( L
  50. #define DMA_FN_IN
    8 }; z2 K  @& E1 \
  51. #define DMA_FN_OUT
    3 Y% ?$ k- D& {1 p" {: k& `
  52. #endif% B+ h4 x$ d. E- N

  53. & w. Q9 b& ?* M6 Z0 I1 h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)# Y. b- d/ y: @" C& I  ^, ~
  55. #define STATIC_SHIFT                3
    ' M' V# h6 a0 i: a
  56. #define TCINTEN_SHIFT               207 Q0 {* Y- @$ M4 v6 b) E2 L. T' ?
  57. #define ITCINTEN_SHIFT              215 x8 }$ u* O5 m6 f# n9 c& d
  58. #define TCCHEN_SHIFT                224 o* _, u0 G; L& b" `# c
  59. #define ITCCHEN_SHIFT               23/ V7 D2 b: l& L
  60. : L, ]& C- \- _  M- y+ u
  61. static volatile int irqraised1 = 0;( d" D$ M8 k8 Q
  62. static volatile int irqraised2 = 0;
    ' s- n2 J; l( Y- ^  q! I

  63. * S* B+ }; m. S! t! Y! q* p
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& q) |" N5 [$ ~/ K
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & {0 x: t, [5 E3 p2 N% y+ d
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& d9 |% m5 V: O9 H* Y! H, W/ @

  67. # l/ C( F" q3 w( H* w, m
  68. dma_addr_t dmaphyssrc1 = 0;6 h7 ]/ n6 Y& e! G1 s% c1 N& J" h
  69. dma_addr_t dmaphyssrc2 = 0;
    ' {5 [( D8 {" u6 L9 h9 s
  70. dma_addr_t dmaphysdest1 = 0;9 t8 A1 ^# S1 K8 Y4 U9 W" d
  71. dma_addr_t dmaphysdest2 = 0;5 `6 B* O5 U0 I3 {2 P

  72. 0 P2 p! P  P4 O% e
  73. char *dmabufsrc1 = NULL;: x! L- s& F/ D4 G- R
  74. char *dmabufsrc2 = NULL;8 h- O0 g; d8 Q% b" S# z% j& N
  75. char *dmabufdest1 = NULL;
    ; D! J7 Y+ n: G6 _
  76. char *dmabufdest2 = NULL;
    $ ?% E; h0 n8 U1 @( m! [0 t( h

  77. / E0 {0 u3 I, c: I
  78. static int acnt = 512;
    0 b% e$ |! p1 n8 |, d6 X  x
  79. static int bcnt = 8;
    + T/ M- L& Z. ^& V7 H
  80. static int ccnt = 8;0 Y" i) r6 x4 J& D8 ?: a

  81. 0 d2 A9 \6 U* C* c
  82. module_param(acnt, int, S_IRUGO);
    ! ?, H+ {9 C0 @/ d- S& N6 W
  83. module_param(bcnt, int, S_IRUGO);
    9 B. b6 H& |! i7 C  ]+ O; t/ A
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 Y; l5 B: u. A3 z5 H- [
# ^4 S5 u; P5 i- ]
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 G! L# K5 I$ a0 s8 U7 e+ W6 t/ A
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 S: X/ e: n: @. n
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: \. L  p& A1 ~/ t# v$ w* n4 d+ _7 i! Y

* {& L4 b& ~; U( a& r- y7 ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-17 00:29 , Processed in 0.041206 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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