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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* `' e& I( u  m. N- T# i
  1. [code]EDMA sample test application
    : |( g: D1 L5 i! y! K& t: C
  2. /*
    % P- o8 \' [) {# q
  3. * edma_test.c% E1 z- [% }4 ~$ d
  4. *
    1 u9 d# a/ ^/ I( v
  5. * brief  EDMA3 Test Application, o7 L  M1 Y: ]5 R& ]0 b# j
  6. *
    . e( F# Y9 ?. W  h8 E7 `
  7. *   This file contains EDMA3 Test code.
    2 l0 e; x  C- C. O: \, h
  8. *4 g( N: K  }9 v+ H9 `
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 _* D. n, n& V5 v2 u
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( }2 t* ^& i, F, f1 r) O: e
  11. *         TO CHANGE.+ |6 K  v' W- E% g; y- S
  12. *
    $ I! C4 F! M3 Y  x
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 e6 C2 g9 E( B/ Y& h: T! G" K
  14. *
    / O' Q" m" H" w5 e  w& a
  15. * This program is free software; you can redistribute it and/or( {. \( O1 _/ T" L0 j5 C
  16. * modify it under the terms of the GNU General Public License as
    + v3 R- s- n4 z2 p" j
  17. * published by the Free Software Foundation version 2.
    $ j5 r% A& e& S$ R5 |7 ^
  18. *
    # f" P! g& b5 L8 D
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ }1 Z2 A, q( d$ A0 i4 L* ^9 U
  20. * kind, whether express or implied; without even the implied warranty; y8 b/ G% C3 H: B& l; B3 t
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & f* u$ v( A8 }  M/ s9 S
  22. * GNU General Public License for more details.
      k- D" x- H& {4 C1 V
  23. */
      l* f- i4 \" A7 m
  24. 7 C( G! V* N9 N( x8 t0 }, s
  25. #include <linux/module.h>5 e. K" l8 v2 S" P
  26. #include <linux/init.h>
    # q* D4 f& Y- n  t/ m* P
  27. #include <linux/errno.h>) `5 M- }+ M5 h" H% W: P
  28. #include <linux/types.h>
    4 T9 F/ G% e" d) I2 \5 D( a
  29. #include <linux/interrupt.h>, T% V# \2 H5 S6 J8 p( ^
  30. #include <asm/io.h>
    0 Y+ a1 ~& `3 i) ~7 w, S
  31. #include <linux/moduleparam.h>* w2 U: F. I: _, w* N+ w& o/ ~* M  O
  32. #include <linux/sysctl.h>
    ) I' Q3 Q( l5 ~. Z. o. u1 u
  33. #include <linux/mm.h>
    7 l7 E; u) B( H9 W/ h
  34. #include <linux/dma-mapping.h>6 y% r6 A8 O) j$ [9 F: T3 D

  35. + _1 }# u/ T6 h/ m+ l0 D4 `1 C
  36. #include <mach/memory.h>3 Y2 Y. T: j( ~* b) K
  37. #include <mach/hardware.h>
    - q# [4 N0 n9 q& \+ g5 ^: ?/ x
  38. #include <mach/irqs.h>* J4 E  r1 d& @* D1 n7 F
  39. #include <asm/hardware/edma.h>
      }; R1 k+ U( L
  40. + D4 i/ b) ~0 x, x4 w: {
  41. #undef EDMA3_DEBUG+ |. {* w8 ^4 ]0 R/ u( D
  42. /*#define EDMA3_DEBUG*/
    $ H# U* Y- ~+ s! Q2 s9 \
  43. ! P3 g& k. |2 B0 B
  44. #ifdef EDMA3_DEBUG
    0 l/ g) f. b; X# n
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    # e" e$ k2 b' [& e
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* x! t5 i; j. ^5 Y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( T/ G  F( k4 |  ~. ^& T
  48. #else. {' a$ ~/ i( S0 N( z
  49. #define DMA_PRINTK( x... )
    2 }+ O4 J+ v3 V0 s+ ?4 I
  50. #define DMA_FN_IN
      @) |/ q- D1 @3 i! G0 `# e
  51. #define DMA_FN_OUT& [+ _+ c6 `/ S( Q0 h# g6 N2 o
  52. #endif5 m0 e2 |2 }; `+ c: X, g2 t$ t  z

  53. : s. `; Y3 f3 b
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    1 O5 |( \+ {, [3 @
  55. #define STATIC_SHIFT                3
    ; K( Y) v5 |. G0 p# r
  56. #define TCINTEN_SHIFT               20
    ; m, D' n  ]% T3 b/ E0 E- Z* \1 I0 t
  57. #define ITCINTEN_SHIFT              21& P1 j/ Y  H" \( Y- g, j
  58. #define TCCHEN_SHIFT                22) \  _: `- ~( @( t2 e+ \6 @1 H1 Q
  59. #define ITCCHEN_SHIFT               23* z7 o# y" Q/ O* K
  60. 4 z# ]8 @0 y, x8 e. R/ `4 D0 d; v* a+ k5 Q
  61. static volatile int irqraised1 = 0;
    8 {: V, t# k2 p8 \% G; C' c
  62. static volatile int irqraised2 = 0;
    9 |0 S* L2 {% ~1 i% k
  63. . }2 t. Q: U3 q. i- Q2 d& i/ }
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , h# \. Q  ^" n/ g* i
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 i: K! f6 V2 M4 w7 y. F$ U
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) K; ]& ~5 \  W

  67. : w4 H+ X: ~8 j
  68. dma_addr_t dmaphyssrc1 = 0;
    # o( U# t* N- b
  69. dma_addr_t dmaphyssrc2 = 0;
    5 e; [; F3 e# v- Q5 y( l! P1 o5 K
  70. dma_addr_t dmaphysdest1 = 0;
    . ^8 `/ N! Q% g( R* d: }5 d
  71. dma_addr_t dmaphysdest2 = 0;  p/ a" F1 l+ o/ _
  72. . b: @$ i& H7 N4 ^3 v. q
  73. char *dmabufsrc1 = NULL;2 c. z) \6 b7 |# H3 {* {
  74. char *dmabufsrc2 = NULL;$ `7 x+ F/ M" F# g" B9 M
  75. char *dmabufdest1 = NULL;, R+ h" }- }% r, o( H
  76. char *dmabufdest2 = NULL;
    " ?. ^9 n7 R- h* y2 D

  77. - e( N. F; Q; r" U& k
  78. static int acnt = 512;4 c( }! d# ^# J2 t7 e; ]; k
  79. static int bcnt = 8;
    ) \! Y# O% N( [4 f% C* T9 z
  80. static int ccnt = 8;8 R8 ?  M! H! P* O  M, H# _4 o
  81. $ d) \; G% t% a2 J- Q
  82. module_param(acnt, int, S_IRUGO);
    ' E, n) O. O. V3 v0 ]
  83. module_param(bcnt, int, S_IRUGO);
    ) I2 \2 a2 ?6 A
  84. module_param(ccnt, int, S_IRUGO);
复制代码
7 r+ }; ~8 N" X6 E; h6 K! p( k
' B8 B$ y+ H; Z8 |; [
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 B5 s4 G# n2 P2 a8 _# x$ c+ parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' S; J4 \. I( R/ e7 {$ q, ~  |
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ a1 g; p+ \* \: T! R* U% ?1 m
9 D5 d2 g" C8 ^( F- [
; h; S) n1 _; A9 ]  M7 {3 Q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-2 04:21 , Processed in 0.049983 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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