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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 r: b1 y% c. ~, I6 t3 ~# A
  1. [code]EDMA sample test application
    * a4 A1 s2 o) G2 I! q3 q1 J
  2. /*
    1 Z/ u! j2 i: n, D1 Y' v
  3. * edma_test.c5 z& w& F3 q& B! W
  4. *# k$ {  t$ @8 u& F. I/ a
  5. * brief  EDMA3 Test Application  i3 X4 T  D8 K7 }; d
  6. *1 z, u0 ?% m5 _+ y
  7. *   This file contains EDMA3 Test code.& d  k5 w8 o6 G6 H* N
  8. *( g2 _4 m( D8 Z) s6 k4 H7 T* i
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + ~3 o7 k9 Q& l2 ]$ e; v# j
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; t( y- o0 S* H+ c2 D1 I
  11. *         TO CHANGE.
    & a* g1 u' C* `: {$ J
  12. *) Q; k* L* _9 C* T. Q' N% I. k
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    & f% ?, }0 w! B3 v
  14. *
    - a8 `4 c: I: y2 t1 k/ m9 d
  15. * This program is free software; you can redistribute it and/or% n# s$ @. g: b/ F& T
  16. * modify it under the terms of the GNU General Public License as* r! x0 d1 m+ @% v  t+ Y0 M
  17. * published by the Free Software Foundation version 2.
      v/ w* {3 D2 l$ B: o
  18. *7 ]0 V0 v3 v1 X; |* |  b: `
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any! C) h- ^+ |% Y+ C
  20. * kind, whether express or implied; without even the implied warranty
    ) |, D  K/ k( y7 \' F
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ' A2 u5 x7 O/ L7 r- i; i
  22. * GNU General Public License for more details.
    6 d! n/ W$ |6 E
  23. */
    ) M; M/ E" G8 a: d) I/ M, g
  24. 8 P, t$ F4 J6 r# w' U
  25. #include <linux/module.h>
    , R8 e5 y& }" J, P
  26. #include <linux/init.h>& l' b% [! l) c4 c4 Y- S/ `
  27. #include <linux/errno.h>
    # k5 E# I9 u* [/ Y9 C
  28. #include <linux/types.h>0 b+ Z3 ~* {. H' x+ A
  29. #include <linux/interrupt.h>
    2 I( D8 G* g  |! |( T; l
  30. #include <asm/io.h>
    . H% O" `+ B0 `2 A- F) t
  31. #include <linux/moduleparam.h>
    + U  O8 @* F* N# C& Y$ t3 x0 g
  32. #include <linux/sysctl.h># t& ~: e* N1 k
  33. #include <linux/mm.h>4 u0 _$ `" g3 `6 ]3 x
  34. #include <linux/dma-mapping.h>
    ) F" s4 F5 E0 Z" r1 F8 e9 y! t

  35. 6 y. }( w- Z# v1 t
  36. #include <mach/memory.h>+ t& f, w7 v" |4 J. \, `7 `1 W
  37. #include <mach/hardware.h>
    0 \7 I9 j* i# W) A
  38. #include <mach/irqs.h>
    , [3 [) r1 y5 x
  39. #include <asm/hardware/edma.h>
    6 }0 L7 }' L) X! Q- ^5 Y2 r  D( ~9 Z
  40. & A- ~) R7 t9 L# a8 z& @$ r, |
  41. #undef EDMA3_DEBUG
    + w1 D; m. a; T  z/ P3 t4 |
  42. /*#define EDMA3_DEBUG*/
    * v9 X) h0 T8 [8 w  J

  43. 7 T1 F+ N) M# e( d" W
  44. #ifdef EDMA3_DEBUG
    $ X% e  _* [. }" P+ l, I3 y& N
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 F: s/ y( y* O- K, p1 i3 V
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    6 k; Y& c5 g6 K- r
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      [% ~& U* p0 n( Z
  48. #else
    # d5 `8 r( n  @/ N" n: ?
  49. #define DMA_PRINTK( x... )
    ; H" r+ o7 h  P9 c/ {- ]3 J9 L9 g
  50. #define DMA_FN_IN- D' y1 }6 I, N
  51. #define DMA_FN_OUT/ G7 v7 n) I% a7 A, m
  52. #endif( \: j! ?  U' Q" t; P8 o

  53. ) a4 n/ D% c: E" Y% J% B4 f  A
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)8 ~# E( {: H( {( A
  55. #define STATIC_SHIFT                3
    ! v& @1 Y7 O6 @/ v2 Y; f* ~
  56. #define TCINTEN_SHIFT               205 g# J/ F  {$ b$ u7 ^* i! ?% E0 h
  57. #define ITCINTEN_SHIFT              217 A+ B8 F& }- M8 J$ _6 S/ Z
  58. #define TCCHEN_SHIFT                22
    % P0 v$ e$ J% q5 _! Y
  59. #define ITCCHEN_SHIFT               235 B) _5 I+ g/ I9 l7 c

  60. 9 q7 v+ O: V. ^- G
  61. static volatile int irqraised1 = 0;
    8 S/ _( E0 r8 X( A& P
  62. static volatile int irqraised2 = 0;
    0 o+ D8 F) f+ \
  63. & d. b) W: Z# m
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 F1 G! X+ \& v' n0 s
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( {/ a% h2 }4 e" A& t/ n# f! L8 G
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * [8 E! X1 J  y+ G# i0 W" a. a

  67. . c% B  Y$ ^: H) ^- i
  68. dma_addr_t dmaphyssrc1 = 0;1 M9 _# b$ {# x- X$ }" x; h4 Q
  69. dma_addr_t dmaphyssrc2 = 0;- n0 y) E! U* S; F0 u6 d4 m9 T
  70. dma_addr_t dmaphysdest1 = 0;' H& Y; X9 I2 l8 l0 u4 D
  71. dma_addr_t dmaphysdest2 = 0;
    8 v2 ]3 i" C% T% `
  72. 2 t1 V6 p; @: g
  73. char *dmabufsrc1 = NULL;
    . K9 ~4 V: L* l4 M9 b. ?
  74. char *dmabufsrc2 = NULL;/ ~- u: Q* C. ]& ^9 I% C* `6 |7 y
  75. char *dmabufdest1 = NULL;
    ( v  X6 v3 d. k- @$ ?6 x
  76. char *dmabufdest2 = NULL;
    : X: U) C  P2 Q

  77. % ~' h+ `/ n% x- O+ ]. [9 G! [  H% C
  78. static int acnt = 512;
    8 ~" s# u" m, U! B. q: k
  79. static int bcnt = 8;
    " J* B4 B# i3 p/ l
  80. static int ccnt = 8;6 c0 ~2 g' p' s/ T( H5 W
  81. 4 Y! T+ ^/ k2 N% H
  82. module_param(acnt, int, S_IRUGO);
    # k6 v! T: S# h
  83. module_param(bcnt, int, S_IRUGO);
    ' N$ u: \  g9 D. O; }5 Q. h$ Q
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 }7 ?) y6 Q, s7 @2 \
" S! {* J# V" O
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) Y, q+ {3 c. ?# e6 ]! b4 t1 @" _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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# l' v0 {2 o, @) Z     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' b, x/ `& m7 W3 v$ w5 S+ }
" \2 i! A/ x5 G- T; |" Y

* f- O) n3 c- K
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-30 16:48 , Processed in 0.037450 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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