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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 H' W6 b5 k3 g3 I* G
  1. [code]EDMA sample test application* q4 e8 E) {  a, d7 j$ _2 |* Q
  2. /*
    0 G' @8 p" {4 H
  3. * edma_test.c! l. m9 s* i+ B" ]1 t4 H
  4. *
    $ v$ j  D; q' R; f! I$ l2 K
  5. * brief  EDMA3 Test Application, u5 d2 C; M, I/ n
  6. *: m1 M7 N4 A  \% F& K& @
  7. *   This file contains EDMA3 Test code.
    5 _5 _+ O% r0 [, Y! {# B4 ]
  8. *
    ( R0 x. g) P( [8 o7 r
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 M+ v- [# ?( G# i- s
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 a$ W* j- t3 C9 M( e- E
  11. *         TO CHANGE.
    $ `8 N3 I+ t0 r9 C1 ?+ }. T! E
  12. *
    5 V1 D) J, y4 j" b2 s! W! }
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  s% K' z* G) ^5 u; z  ]- v' e
  14. *+ r' W( t7 ?( e  x9 l3 l
  15. * This program is free software; you can redistribute it and/or
    6 m2 b0 h  O0 t; G9 f  r
  16. * modify it under the terms of the GNU General Public License as
    ) G7 [& Z8 j2 o5 D
  17. * published by the Free Software Foundation version 2.
    / N7 e8 g6 [. t+ j
  18. *
    $ p4 d. J$ y4 K
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
      J: [* o* I3 X/ p2 o& b
  20. * kind, whether express or implied; without even the implied warranty9 J3 c; H- G9 f. @2 c! C: n3 _
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    9 Z- Q8 p9 {$ x
  22. * GNU General Public License for more details.
    ' \% s9 X. X8 m2 p, N
  23. */
    , O( G7 n" u# I" K; X- W9 T7 x; w+ l
  24. * c9 [% g9 K1 e  Z% _2 i* ?
  25. #include <linux/module.h>% b$ @8 N, c; N) l) K& w: C
  26. #include <linux/init.h>1 Q1 C' \, N7 G  `- d" o, o, }5 X8 B! L3 K
  27. #include <linux/errno.h>
    3 f0 m: m# x9 T% x: o0 a
  28. #include <linux/types.h>
    & o. Y# O  O/ f5 \& N
  29. #include <linux/interrupt.h>
    : I; L0 e' j( [; h- z/ I0 B
  30. #include <asm/io.h>
    + R" a9 e' n" B
  31. #include <linux/moduleparam.h>
    2 n2 A9 B" p2 i' f5 {. ?
  32. #include <linux/sysctl.h>3 ^4 H; I! j. N- ]3 @8 p! {
  33. #include <linux/mm.h>9 z( d4 k5 a9 s( F
  34. #include <linux/dma-mapping.h>/ P& z1 J! n/ i: ]! ]+ z+ b* X
  35. ' i8 g: N) R" N* `$ ~
  36. #include <mach/memory.h>" s2 E4 D* t2 h
  37. #include <mach/hardware.h>, s- I7 a& H+ Q5 }! i! ^
  38. #include <mach/irqs.h>
    % W* M0 V' \; D2 `1 q
  39. #include <asm/hardware/edma.h>
    % @( X( h7 O! F* i4 f8 b7 m9 w( P
  40. 8 Y. D5 c2 A; o( Q
  41. #undef EDMA3_DEBUG
    7 N7 X6 m: {" `* s# ~6 t
  42. /*#define EDMA3_DEBUG*/- t2 T/ ^! D/ ^4 t1 A$ I6 z. G4 T
  43. 7 a+ W2 k$ _6 a' j
  44. #ifdef EDMA3_DEBUG
    . E; y* ~3 S+ q% A2 D
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    5 ?, {3 @( u, G1 W0 n& {) b8 d0 Z  _
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " u! ^8 i+ [$ j1 G) e) w7 x
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    * o& j. w7 x9 r: o; C
  48. #else
    5 `/ O6 {, T+ v% D5 E
  49. #define DMA_PRINTK( x... )
    # j' i: {  N1 L# p0 s" D
  50. #define DMA_FN_IN7 K! C, v/ _: M
  51. #define DMA_FN_OUT
    ( t2 P- H$ V0 b2 d; n; N  C
  52. #endif7 W  E, u4 y2 A  ?( M4 Z6 A

  53. 8 b, T$ `! t, k: `; X
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : K9 m. e# ~' {. M* d
  55. #define STATIC_SHIFT                3
    , g; r2 g' e* _! X
  56. #define TCINTEN_SHIFT               20; U3 o7 T7 O5 U/ `/ }
  57. #define ITCINTEN_SHIFT              21
    ; T( e# `, x, O9 {, \. Q1 Q% R
  58. #define TCCHEN_SHIFT                22$ ?9 y, s" t4 O& }
  59. #define ITCCHEN_SHIFT               23& P4 |1 i! k4 }( r# O/ f
  60. + k' o& E6 K* P+ O# n
  61. static volatile int irqraised1 = 0;
    ) E6 g4 T" y. i
  62. static volatile int irqraised2 = 0;% z. d" H% [( {  C

  63. 1 S9 N" F  B% e9 C' ]" u" P. u7 F
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & r* c. S; s  _6 \
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 |' p$ u8 L2 ]8 u, u
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) e' J$ b3 w& `) \  H' p* n" m. s' O

  67. 4 k/ |7 d. v8 {8 |: f7 ?* N
  68. dma_addr_t dmaphyssrc1 = 0;+ u5 ]6 b% y; G# ^8 U# s
  69. dma_addr_t dmaphyssrc2 = 0;$ O. v$ N2 N1 O1 Z5 U( m
  70. dma_addr_t dmaphysdest1 = 0;7 I8 H! \& W2 m3 @
  71. dma_addr_t dmaphysdest2 = 0;5 B* x7 _7 Y( a, Z7 w. f* D
  72. 7 @" k, ~6 b/ r: u2 @  e, s; _
  73. char *dmabufsrc1 = NULL;
    1 j! @/ n/ T% b0 s; l+ I
  74. char *dmabufsrc2 = NULL;
    / Z8 P$ j% u5 H7 \: Y4 T0 X
  75. char *dmabufdest1 = NULL;
    & m" }' x$ B' Q8 ^) [! G1 E
  76. char *dmabufdest2 = NULL;
    3 a0 l9 t5 W* I$ q0 r1 T6 q

  77. 0 Q  t  j7 ?5 B% a; F/ Z$ ^# A' s
  78. static int acnt = 512;" I0 k6 c# w; D: r( L& C/ k" z
  79. static int bcnt = 8;
    / G# g- D, M% b, W, C
  80. static int ccnt = 8;
    % g7 H1 X# F: h+ s
  81. / Y8 z  a2 d; y; s( M% A+ [7 V: d& ^
  82. module_param(acnt, int, S_IRUGO);. ?/ o6 Q( Y; ?5 Z& `* F1 H
  83. module_param(bcnt, int, S_IRUGO);
    ! P" n$ W: W1 ]+ _5 |
  84. module_param(ccnt, int, S_IRUGO);
复制代码
+ R# Y* `* C$ S4 a# S  q0 o
7 i, Y8 A$ g4 Z4 f1 }9 ]6 R
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- o0 c9 z7 ~# Sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# h+ F. J8 s4 O2 `! S     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 g& e( r9 M* I6 @# x  Y0 j

7 h- N1 A) x# V0 a) K! ~
. K9 s( s9 d; d$ G* k$ B
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-31 05:12 , Processed in 0.037037 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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