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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 ~  V- s+ N% @) V8 |1 J7 j0 V
  1. [code]EDMA sample test application( j) Z& D9 Z2 T8 t$ L4 g! j
  2. /*
    ' J3 y; c" E8 w8 m& ~
  3. * edma_test.c
    1 g; t) Z; h: O4 r+ _
  4. *. [% V0 y( Y/ V& @& K
  5. * brief  EDMA3 Test Application1 E9 L& f. l3 N1 [" b
  6. *
    4 w' m9 L! a4 ~, h/ `
  7. *   This file contains EDMA3 Test code.
    # D5 q9 t& u1 l! s- i9 |) M
  8. *
    : p  \6 z0 H$ E! _# |
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( e/ K* C3 X5 _- O+ C7 b
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    / j  d! i; y/ I
  11. *         TO CHANGE.
    # v3 H  S. f' ?. Q9 R
  12. *: d& y7 y% W; m- Q' H* u8 f
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 @7 Q. J# T" r  B
  14. *
    & l- }( X6 Z* s" z5 I
  15. * This program is free software; you can redistribute it and/or/ _# T/ e4 \2 J5 i# w6 i
  16. * modify it under the terms of the GNU General Public License as
    3 U7 W5 S& ]& X5 X* |7 S9 o2 u3 _
  17. * published by the Free Software Foundation version 2.3 y$ n- U. j* z5 I
  18. *0 m3 ]) z& c; g7 h0 e
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ Y0 Y+ ?" r# ~% \8 V- d9 p$ z! I
  20. * kind, whether express or implied; without even the implied warranty) W, d- n( C5 S$ }1 Q* y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    $ O6 d0 N7 z3 o- F. j0 n% V
  22. * GNU General Public License for more details.
    ! b  x6 @$ i; f" l4 }
  23. */0 I" v% \0 Y& X

  24. + F  R$ W4 @; ~
  25. #include <linux/module.h>
    3 B& B  D- b* l# ^% \
  26. #include <linux/init.h>; V6 a! }  O4 y8 X9 j
  27. #include <linux/errno.h>
    # n+ G  C3 A. @) R7 [. @" G: a
  28. #include <linux/types.h>% [( T! [, C' T2 \
  29. #include <linux/interrupt.h>
    / T5 z; Z' r& W5 Q
  30. #include <asm/io.h>6 p' k- E7 V, M. ?9 c
  31. #include <linux/moduleparam.h>
    + t- C: K0 Z( H3 y1 I5 H: e6 @
  32. #include <linux/sysctl.h># d6 A- @" z' B
  33. #include <linux/mm.h>
    * _8 d' Q& k$ T( H: l9 i
  34. #include <linux/dma-mapping.h>
    * J" k0 {' B/ V. [7 Q0 i

  35. ( x" \# [' \. |$ U: j! r6 [
  36. #include <mach/memory.h>  `" w! n' x4 d& @5 g& c
  37. #include <mach/hardware.h>
    7 ?, F5 i7 `7 A0 c" |) s% E7 d
  38. #include <mach/irqs.h>' U1 e: Z6 S2 x4 j2 P; u+ x/ S
  39. #include <asm/hardware/edma.h>
    7 Q4 f$ Y7 C& G. s1 R

  40. 0 ?; K) P6 Y4 K5 j
  41. #undef EDMA3_DEBUG
    $ |+ k- l% h+ e) e* `% W' v
  42. /*#define EDMA3_DEBUG*/
    & Y+ `- h" l+ `

  43. : ]+ F* S3 S! Q* U- [! g$ {% |$ L$ H
  44. #ifdef EDMA3_DEBUG
    ( R' H4 i0 y( y' Q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 k1 O1 K2 [: ~9 a9 P
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), F2 [6 d1 t3 @4 M
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" g' S% i5 c9 S0 v1 ^/ Q
  48. #else. V7 z! S; @; a  g9 }  @
  49. #define DMA_PRINTK( x... )/ a: D' S# _8 y6 Y6 S
  50. #define DMA_FN_IN/ |7 u( h9 ]3 J" L( M4 ]4 u
  51. #define DMA_FN_OUT
    * I( i$ p/ B: Q3 ]
  52. #endif
    4 S! |* b* X, y3 t& f8 T
  53. 2 a9 r5 h8 q" E2 m
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ' j7 `" W7 o( b
  55. #define STATIC_SHIFT                3
    / F* [! p: F8 z+ `; a% P6 [: D. Z
  56. #define TCINTEN_SHIFT               20
    * A% ?+ `6 h$ r' \% m9 X% v
  57. #define ITCINTEN_SHIFT              21: `0 H0 u% A- @( D2 P: y5 L2 K
  58. #define TCCHEN_SHIFT                22
    2 S+ ^9 H; h& M! x
  59. #define ITCCHEN_SHIFT               23; J" J5 c9 y$ v& o, Y! n
  60. 4 M5 d2 W6 ?2 Y& f, Y/ _
  61. static volatile int irqraised1 = 0;7 `6 n2 h# o6 M
  62. static volatile int irqraised2 = 0;
    * P( U" q3 Q) W- i6 F' o, i
  63. 5 R8 r) z* G. n' V. I: V  t  W
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# I2 y, v3 i. D+ l, a3 g# I
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 {$ b/ a1 W+ o) ~- H: V
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # \) V* y4 `/ W& H

  67. : v# ?# R4 `; H; g) Z7 ?. P. a
  68. dma_addr_t dmaphyssrc1 = 0;
    - Y1 U* u% f* S0 A
  69. dma_addr_t dmaphyssrc2 = 0;7 E8 d* E" A4 @: N: ]4 t" a
  70. dma_addr_t dmaphysdest1 = 0;* W& ~8 F2 e& I5 U* e
  71. dma_addr_t dmaphysdest2 = 0;
    ( s/ ^; \& A3 N- B

  72. - g" v# E. M  d) N1 b2 m# n
  73. char *dmabufsrc1 = NULL;
      x, K- y% U2 C+ a$ M( E
  74. char *dmabufsrc2 = NULL;
    % y& R3 N& l/ {. T" M, E
  75. char *dmabufdest1 = NULL;
    " t1 @' W9 p' g% ~- g: _0 W/ M
  76. char *dmabufdest2 = NULL;. N, @8 u! ]3 {4 K' O; F, |5 ^2 g

  77. % X$ X$ _, f6 O3 N
  78. static int acnt = 512;1 z& n, `  h; U! r0 L& r
  79. static int bcnt = 8;
    ! d8 G8 Q) O/ E
  80. static int ccnt = 8;1 p0 X0 ^: b8 ]& }" Z& E

  81. $ t9 K8 f* f6 K/ S
  82. module_param(acnt, int, S_IRUGO);
    - O: ~- l: W- a; X* H4 `
  83. module_param(bcnt, int, S_IRUGO);
    7 d' p. v: y+ d
  84. module_param(ccnt, int, S_IRUGO);
复制代码
% M1 C+ J# [1 |5 ?) J
9 n/ e& a5 }8 H) g. l
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ Y0 @) f; P* U( {: f: J' {
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! u0 u1 E. Z- J     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
  ^! W. l" i' b
( E% N+ {2 Q6 E/ R/ g, V$ J% [# c& X
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-1 14:08 , Processed in 0.039091 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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