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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- U) b: d$ h+ @5 H- }" _) J- j! R
  1. [code]EDMA sample test application
    2 I2 n# }. B8 V& d+ m! B/ S0 O
  2. /*
    ! |& j; ^% x7 Y$ d
  3. * edma_test.c* w" z8 ]+ e8 Z: J2 H: T) O
  4. *9 e, ^% w- t4 M
  5. * brief  EDMA3 Test Application
    1 M6 ?7 U+ Q' U7 f
  6. *: ~( g1 R; p' l' ~4 P
  7. *   This file contains EDMA3 Test code.& _' a5 H6 \" A) c6 \  k
  8. *! t, Z  z9 Y* T9 G6 e' y9 Y0 F
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / B" z) k5 o8 ^7 a! Y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' Y  n( e7 p7 W7 ^
  11. *         TO CHANGE.& a- V6 @# i7 U
  12. *
      p5 o  u1 r! D9 @$ G
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 V, v( o7 ~, P6 V! b, Z, G
  14. *3 |4 a8 o6 @3 I! V; X7 b
  15. * This program is free software; you can redistribute it and/or# h: Z0 P% j7 H
  16. * modify it under the terms of the GNU General Public License as
    - z+ B5 S7 O! T# T' u4 T
  17. * published by the Free Software Foundation version 2.
    6 M6 D$ J! g0 P) J# i0 ?% `
  18. *1 Z! h8 c4 Z4 y8 @
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    + ~$ ?( `# P+ E( P) Z, d
  20. * kind, whether express or implied; without even the implied warranty. K1 ^' I$ o& Q3 o! W+ _
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the% s4 V* \- F% _7 u% x
  22. * GNU General Public License for more details.  `& r* |  y8 g% u
  23. */
    " V/ Q9 K+ u4 h1 E; s

  24. / d& ~+ ?6 d' Z# v
  25. #include <linux/module.h>( @4 R$ K8 M* y- I: {
  26. #include <linux/init.h>) v: y. z! x& L7 I  Y# S0 X& m( V
  27. #include <linux/errno.h>, [; a4 ^0 |* O
  28. #include <linux/types.h>5 M; R/ v0 P0 q7 E
  29. #include <linux/interrupt.h>
    - M& e! S! c' M3 f" E: o5 P6 I
  30. #include <asm/io.h>
    ! b; z4 z2 T5 G  H" E
  31. #include <linux/moduleparam.h>
    7 x2 Y0 Z( w& ?. Z3 |
  32. #include <linux/sysctl.h>9 {: C/ ]8 T. w* J
  33. #include <linux/mm.h>0 s" n% u  x8 R: S, Z
  34. #include <linux/dma-mapping.h>' ?3 J/ F; B. x7 x- T& i0 u
  35. & R, T: P/ c/ a/ {. y, H
  36. #include <mach/memory.h>$ h; W& O: _* I# D+ r3 G
  37. #include <mach/hardware.h>
    : C* y/ B0 J( a" U( f
  38. #include <mach/irqs.h>
    ( h* X; f' l& }1 a/ m
  39. #include <asm/hardware/edma.h>
    3 q6 V8 |% \- \) G
  40. & p/ z( B9 @) A6 V
  41. #undef EDMA3_DEBUG
    8 E6 a( W% E/ n6 \
  42. /*#define EDMA3_DEBUG*/
    % n4 `/ i. }2 ^7 i$ f
  43. * @  y$ _+ ?3 q, r
  44. #ifdef EDMA3_DEBUG
    1 C4 T2 f: b- k3 Q$ [; d( f
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    # e" G2 g' q6 V- t8 x& @0 f
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 J- d9 s6 [! b- I/ J% S6 q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 s7 U' q  \: l9 f1 ?3 Q
  48. #else- c/ }: Y/ X! B5 I# @! B' X
  49. #define DMA_PRINTK( x... )1 ]9 D! K- M+ Y# C, u8 I
  50. #define DMA_FN_IN
    6 ~# o/ h) [& W4 X$ c: h% D& w+ ^
  51. #define DMA_FN_OUT
    % ~% u& r0 }- G) B. d
  52. #endif5 B6 @# F, ]( M; J+ ~

  53. . y" J8 L+ e3 Z0 m$ A
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)0 T. u  ^8 x( d& V4 w0 B
  55. #define STATIC_SHIFT                3
      X6 S8 G* O* C1 N8 R
  56. #define TCINTEN_SHIFT               208 F0 D5 q6 O: {3 c. q
  57. #define ITCINTEN_SHIFT              21
    : j/ _* |* K* G. q7 n
  58. #define TCCHEN_SHIFT                22. K" Q1 I" f/ x; R2 q
  59. #define ITCCHEN_SHIFT               23) i4 O0 @6 k( W7 J1 \; m" e
  60. & v8 w+ N; I; m7 D
  61. static volatile int irqraised1 = 0;0 K8 ?7 F9 _/ {
  62. static volatile int irqraised2 = 0;
    ! g# v- @, d" O3 H
  63. * S$ Z' B) z1 K
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 j1 f5 ^- ~- l! [% A% k' J" @
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 }7 l2 o7 O+ _
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( ^6 K) d1 [1 Z. X$ }
  67. 8 g% L) q( \4 F5 g) W; ]
  68. dma_addr_t dmaphyssrc1 = 0;  ^1 u3 _7 E# B. Z
  69. dma_addr_t dmaphyssrc2 = 0;
    ; @. r& r. h( [  p0 u, K
  70. dma_addr_t dmaphysdest1 = 0;
    / M+ N- d- W' O3 V& B( c; j
  71. dma_addr_t dmaphysdest2 = 0;- G$ O" \) `( q  L
  72. * ~" p1 o& A! s
  73. char *dmabufsrc1 = NULL;- v6 p4 r- k; W8 D  b! e
  74. char *dmabufsrc2 = NULL;
    , T/ J# P; M3 J" u1 L) _7 ?# ]! ^3 A4 C
  75. char *dmabufdest1 = NULL;/ `1 p. \8 ^( K2 u: P+ a9 b5 S7 b
  76. char *dmabufdest2 = NULL;% q! G7 V( `! Q# D3 `0 U9 E9 p
  77. 4 v' t) }( X0 M1 K! U
  78. static int acnt = 512;# \1 K6 W" m9 Y! a- n8 [. P. w
  79. static int bcnt = 8;  p4 p- @9 @0 x; _8 v: y7 o
  80. static int ccnt = 8;
    - ?1 U- R9 P; }! v1 c7 j* I

  81. # W! U2 d# V5 Q9 a/ \  `5 ~6 l
  82. module_param(acnt, int, S_IRUGO);7 t1 o; K/ Z& d7 O1 j! z
  83. module_param(bcnt, int, S_IRUGO);' |0 z, Q% P* O. h. a+ K8 n4 Y8 T
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 s7 P+ N. V' G% I, P

$ K. j4 B3 Z5 k7 m4 b      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ ~6 D# k3 ?* J& Y. E0 g8 v  garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 E0 D, J: S1 y( Y     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 @3 ?& D( f, S* }- O5 A& y
) w- P% T$ e( b4 e  \5 v+ H7 }5 e  @" M1 t
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-26 18:17 , Processed in 0.039162 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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