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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ y$ K9 d2 G1 ^. u5 C
  1. [code]EDMA sample test application# x. J' U8 @; L$ i
  2. /*
    , C5 W5 G* Y! g  @. K& D, K! E! J
  3. * edma_test.c! G, e0 e4 X/ g2 |1 n
  4. *
    " u1 i. W: w$ g  F6 B; H
  5. * brief  EDMA3 Test Application' S; P! Q: `* ]1 \/ }7 g3 q
  6. *
    4 S& A- n. g* ~  Q4 q% X$ N( T
  7. *   This file contains EDMA3 Test code.
    , O/ E" s$ ?& Y' \
  8. *$ A3 r+ o- i1 ], s$ |% o
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' t  Y3 j9 k6 c- o: N
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# W: p/ ?7 o  {, `) S
  11. *         TO CHANGE.5 ~  r; h  D9 c+ s% m! t2 U
  12. *
    3 C" T8 j3 I3 y8 [& `$ V4 ^
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( ?0 H1 j- }! Q: ~
  14. *7 g* [& w; i- }9 M! r4 U
  15. * This program is free software; you can redistribute it and/or
    / {" J$ P1 K+ O1 G- C# {: S
  16. * modify it under the terms of the GNU General Public License as" M$ O2 C/ W' U8 [
  17. * published by the Free Software Foundation version 2.4 J8 o3 X4 Y" t8 g& X* q
  18. *+ K( g% g& ?. M9 \0 b
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ' `) z4 }( J4 k0 Z' R, W$ E
  20. * kind, whether express or implied; without even the implied warranty6 O! ]0 x: e" v% s  q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the+ e- q3 A$ K2 d+ g6 C8 ]& k* q
  22. * GNU General Public License for more details.
    + X' B# N1 }. I+ g
  23. */+ f$ L0 j1 m3 s& `0 f
  24. , a% |. _2 ?; p4 q; Z
  25. #include <linux/module.h>
    % v% O, b$ w' b; d+ u- m
  26. #include <linux/init.h>
    ' E/ G& M. m3 u9 o- z/ u
  27. #include <linux/errno.h>
    - t4 t  q6 |7 ~2 ^5 }% K
  28. #include <linux/types.h>& K- x& V  }5 n; P: M
  29. #include <linux/interrupt.h>; ]" b1 \9 p. }  G
  30. #include <asm/io.h>
    1 Z' @7 k: n% `8 _% A
  31. #include <linux/moduleparam.h>6 h/ p4 l* Y5 E
  32. #include <linux/sysctl.h>1 V2 u' k7 ^2 r! n% }' _" f
  33. #include <linux/mm.h>8 z! }: |: L! \5 }- M1 Q
  34. #include <linux/dma-mapping.h># B& d6 f1 n  Q- U1 l* n# l- f

  35. % k) H2 w5 j1 |/ c6 M
  36. #include <mach/memory.h>5 W) _# v& Q4 w; Z# a
  37. #include <mach/hardware.h>
    + i% i1 F% Y5 h0 q
  38. #include <mach/irqs.h>
    ! L( E4 A4 o6 L. H0 G7 ~# _7 r
  39. #include <asm/hardware/edma.h># \3 ]! w  ^7 S  Q5 m1 L
  40. ( B- }$ Z4 L- f, ~  `: p- P; G4 P
  41. #undef EDMA3_DEBUG
    & c# r3 t) g$ B! Z
  42. /*#define EDMA3_DEBUG*/
    ) ?- _4 {4 n) Q# E' b; ?

  43. 4 T# Z! C$ P9 n# m
  44. #ifdef EDMA3_DEBUG  C' d1 C2 q8 v0 Y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 _! |; S9 k7 r! J! y1 |& T
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ' U$ c) Z1 _7 h6 w) v" y. z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 p3 t( m# e8 b1 {2 ~6 G
  48. #else
    % K8 e) J) G0 J/ U# P! y6 o
  49. #define DMA_PRINTK( x... )
    8 a1 y1 I( M; g  Z) e
  50. #define DMA_FN_IN% i" \8 P. m9 ^* [, L
  51. #define DMA_FN_OUT) A: H2 w+ W9 P+ ?$ D* E
  52. #endif4 C" m! u6 E; W3 H# o: A6 I

  53. 0 \* c2 L; |/ u9 L, f, s2 B
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 N9 d1 M6 N5 U8 F
  55. #define STATIC_SHIFT                3
    0 y6 Q: o# L4 Z1 E8 O! }! K
  56. #define TCINTEN_SHIFT               20
    # M; S" ^7 s7 C$ b$ }! g. Z
  57. #define ITCINTEN_SHIFT              21/ I' Z4 [# B; M. c) P8 B
  58. #define TCCHEN_SHIFT                22
    # Q& r6 l! p* _3 O: _2 C7 Z  ?6 A( f
  59. #define ITCCHEN_SHIFT               236 [! h- l+ ~3 T  x2 U, S
  60. 9 G0 T7 r6 a7 i, o2 ^6 n5 z6 P
  61. static volatile int irqraised1 = 0;) @! L; V- S) W: [+ G% B
  62. static volatile int irqraised2 = 0;& g  I1 F7 W+ I' {7 M- K: a

  63. ) X. a- O; M$ r
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . M( R+ C& T; `- z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( Y& H: \, B; Z2 Z  S5 ~& m% v2 p
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & k' _2 \, w8 \+ K1 M
  67. 3 [) P  j  H3 ^9 m3 G
  68. dma_addr_t dmaphyssrc1 = 0;# i# g! r- g0 S0 K
  69. dma_addr_t dmaphyssrc2 = 0;
    % L: r- Z' T$ H5 }5 I% w
  70. dma_addr_t dmaphysdest1 = 0;
    % K3 w. p; C6 q
  71. dma_addr_t dmaphysdest2 = 0;
    ! D" t# Z& i) F! ]+ M8 o, y" b

  72. ! e2 U2 v; J6 l' w: i7 [8 @
  73. char *dmabufsrc1 = NULL;5 E( M. J% g- s, Z" ]$ b
  74. char *dmabufsrc2 = NULL;
    7 q) Q8 a: K# t9 X# l% I, q
  75. char *dmabufdest1 = NULL;
    ) O% L3 n' O1 o5 c( V, T2 D
  76. char *dmabufdest2 = NULL;0 c4 @, K# h  q" w" j$ i
  77. 5 P  t- M: c; |' ]2 A5 V" p
  78. static int acnt = 512;2 l* K1 _% a% O8 ~* o( u3 z
  79. static int bcnt = 8;
    9 Z$ d9 i0 _3 {9 ?/ Q* c& t
  80. static int ccnt = 8;$ a  U/ q+ F/ G3 L' X2 ~% |

  81. 4 {$ f8 E. }8 N7 w  f
  82. module_param(acnt, int, S_IRUGO);6 v+ f8 c1 e1 W  Q0 c* |
  83. module_param(bcnt, int, S_IRUGO);: l1 p* O# Q, T2 z7 H4 e4 W
  84. module_param(ccnt, int, S_IRUGO);
复制代码
* G/ _: K' f4 \! g6 h
" t5 }: X  i  S6 u/ Y7 h# @
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 o: Y( M# a) j% n5 _# ?& Y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' B* P) @# {1 E, D; `: w2 K9 e; W     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ F8 e6 I$ v" G( C! t% D7 {

8 ]0 C: t& S* s3 U/ R' r
4 f# Z  w/ F- P: b+ t2 o& w  X
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-6 08:49 , Processed in 0.040427 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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