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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 R1 W( R" T' U0 n7 T0 X  D
  1. [code]EDMA sample test application
    8 h  ~3 p3 ?0 ]4 W7 b4 u
  2. /*+ i! C$ J' G+ ^) ?' K
  3. * edma_test.c& Y  e5 k' Q0 R: t3 p1 ?! `
  4. *) z$ [, J8 `9 A; p6 [4 G7 J8 ?
  5. * brief  EDMA3 Test Application: }6 u& Y; ?! d) S7 s
  6. *3 A% a6 G' w/ |( j0 r
  7. *   This file contains EDMA3 Test code." ]" O: `! N) p; B1 W- p
  8. *) i0 i- O5 ]* E* g8 ^6 T+ X
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 D/ r" u3 D7 K: O
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; h' v+ U( N& y6 R- }
  11. *         TO CHANGE.3 U8 M4 [2 `! S
  12. *
    6 s# [/ W' z8 P: E8 b
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 L( w' S( f1 K  Q+ T( j1 S* s
  14. *. z6 v# o( n7 o, L9 }4 {; Y
  15. * This program is free software; you can redistribute it and/or( j, B# Z. m  I7 U5 m1 _) ]
  16. * modify it under the terms of the GNU General Public License as
    7 _8 }/ j3 Y. \& r, f* C
  17. * published by the Free Software Foundation version 2.1 p: }$ j- Z% h( [; v* Y* h
  18. *, r/ y: A2 W+ Q  E: ]8 u/ l* h2 ]
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: l7 [/ G2 c  G
  20. * kind, whether express or implied; without even the implied warranty' [, o5 ~; c4 L, [
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0 M+ F3 t; |, H+ u3 c5 Z  z
  22. * GNU General Public License for more details.
    % X' h4 ~7 ]- d' B( Y( S4 G" \8 F3 O
  23. */
    . |0 b5 v; e$ _/ V/ K

  24. . T, |* h( ^8 Z* e+ a; V
  25. #include <linux/module.h>
    2 ]! s$ K3 ?' i( Q3 f
  26. #include <linux/init.h>
    8 x' F3 B0 O% r3 A
  27. #include <linux/errno.h>* R& s0 t  u1 P
  28. #include <linux/types.h>* v  g7 a* J- i& F$ s/ d8 G
  29. #include <linux/interrupt.h>6 D3 J' w& M, g) V( z6 ]" `: u
  30. #include <asm/io.h>$ V+ C  T- l( F, }  I5 f
  31. #include <linux/moduleparam.h>: @: c; h: d! c- i3 T: o; H" I
  32. #include <linux/sysctl.h>
    . W& j; \2 q: x/ ^: ?
  33. #include <linux/mm.h>
    # s( C) Y3 i! O
  34. #include <linux/dma-mapping.h>
    ( [. `9 v+ N6 T% k/ V  O7 t
  35. ) P/ ?- k: N/ `. B1 L! I
  36. #include <mach/memory.h>
    ( R  c) c; {: H
  37. #include <mach/hardware.h>
    7 g+ ]  C% A+ a4 ~  y
  38. #include <mach/irqs.h>
    " _% T. J% d! V7 T
  39. #include <asm/hardware/edma.h>9 u7 ]& X  e- P5 Y+ N0 ?8 S

  40. * x9 g7 }- J  h: x
  41. #undef EDMA3_DEBUG
    + n! A5 R9 P* ?
  42. /*#define EDMA3_DEBUG*/- K  ?5 ~! Y8 o$ b
  43. 0 a, H0 P$ i# M1 d: D# L
  44. #ifdef EDMA3_DEBUG
    $ b8 o- Q  \3 d9 P7 Y, T+ x# ^/ \$ K
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 ^6 Y; J" {+ F" C+ J- _- [. {! t" B
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # u( v: M( G! E0 m7 T4 T& {% s
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    & K' F3 U' q0 h
  48. #else
    2 R& ]) r7 G) l, U+ R( v" _* L
  49. #define DMA_PRINTK( x... )
    6 @3 W& n5 D4 d% I+ j1 S  o% y
  50. #define DMA_FN_IN
    8 |  _6 \3 k/ |( x* d0 ^, o
  51. #define DMA_FN_OUT- f. Q% ?0 z- l8 W8 f& Y3 l
  52. #endif0 x# y+ u& L& a4 n7 x3 N4 q
  53. 5 v' ~) |! i( S# P" U; a
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 y: E, F& L2 [
  55. #define STATIC_SHIFT                3
    * ~, d0 D2 t6 H4 y. B- @( ?
  56. #define TCINTEN_SHIFT               20
    4 H( \, x/ ^' x) w! b0 P8 d* K, R
  57. #define ITCINTEN_SHIFT              21( I  \, ?! k( p/ e0 ?, O
  58. #define TCCHEN_SHIFT                221 p, @/ q3 @2 Z, Q: s2 h
  59. #define ITCCHEN_SHIFT               23/ h6 Z1 y+ i% M6 d6 l
  60. 7 f* n8 ?5 U7 R9 E3 Z  H7 Y
  61. static volatile int irqraised1 = 0;5 ?( P! ?/ Z. k* _3 w; I
  62. static volatile int irqraised2 = 0;0 D' T$ s4 P9 Q" c5 P4 [$ f
  63. 9 s$ D6 [8 U7 I. }! U* T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( @0 ^0 Y5 `/ h: ]  P$ D
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : M2 E) ]/ B; V* K9 |4 Q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 y$ R( w4 b* F0 ?1 l# d

  67. 3 Y. F6 r: m. ?- [9 K9 Z
  68. dma_addr_t dmaphyssrc1 = 0;3 y3 i# e+ x+ T5 H
  69. dma_addr_t dmaphyssrc2 = 0;
      e9 n  w. t# I: e, V& {; f( `( r7 Z
  70. dma_addr_t dmaphysdest1 = 0;1 }; g% r. @5 c# C( M3 `3 T) P
  71. dma_addr_t dmaphysdest2 = 0;9 R; X' ~. J' f) |8 U6 s$ b
  72. * b9 _  P; J# l. G) D2 e
  73. char *dmabufsrc1 = NULL;
    * _& ~& t+ L' S2 f/ c0 |+ u
  74. char *dmabufsrc2 = NULL;& N# b# u! j6 v% w
  75. char *dmabufdest1 = NULL;) `6 j* @- ?/ R! k
  76. char *dmabufdest2 = NULL;" |; n9 ?$ P. T. \8 t
  77. : W- [1 \9 F% l" _5 |
  78. static int acnt = 512;$ X+ {) r+ A" a  z" ~% y
  79. static int bcnt = 8;2 x8 ?! N7 [; p: [4 P6 K
  80. static int ccnt = 8;. @% r/ I* N9 M

  81. 0 l9 w0 i8 n# L; o4 H
  82. module_param(acnt, int, S_IRUGO);
    ; G4 J; v4 |2 Y. f
  83. module_param(bcnt, int, S_IRUGO);
    % O! e% S  n' v  J
  84. module_param(ccnt, int, S_IRUGO);
复制代码

9 z; \0 P: y+ T: R: ~7 W1 Z# M+ n# h) C/ N
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# f) a* s6 g! @* n3 u6 v6 W: S) D$ }
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: L9 ~( p0 y7 {& q& _# W     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 \9 J5 e0 q) N5 w$ W2 m

$ T+ p' }) O( N/ c$ j) N, ~& d* w9 w/ d2 v: R4 m
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-14 22:00 , Processed in 0.038832 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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