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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 e6 p& s# r, y+ ?
  1. [code]EDMA sample test application
    4 o. Y+ w( F. C' Y6 n& N
  2. /*! u( W+ D$ g1 P5 u
  3. * edma_test.c; y1 k1 w/ R5 J. e6 \' v1 G/ q
  4. *
    ! u7 ]" f8 `3 ~5 E& A
  5. * brief  EDMA3 Test Application
    - e: S2 [  [! c* h
  6. *
    7 u6 P! o6 }& B! q, _: M
  7. *   This file contains EDMA3 Test code.2 [2 p4 F; l$ k0 ?  H# y
  8. *% j" U+ {. O+ Y  k: U
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + ?  `$ L  W: _: u5 U
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    * n+ E% }. l' P9 ?
  11. *         TO CHANGE.7 {4 W5 Q+ o. A% B
  12. *0 x# e. b0 H$ L: |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 [/ e! `/ P0 D/ q6 N8 p0 o( p
  14. *
    ' x4 p' N+ {$ `" A2 y
  15. * This program is free software; you can redistribute it and/or
    & Q* B- N& @" {/ i* }" K
  16. * modify it under the terms of the GNU General Public License as
      @4 _5 \5 e1 x; }. G6 e' _  a
  17. * published by the Free Software Foundation version 2.
      r  `1 a3 y3 Q# M/ V
  18. *
    9 _) r" S/ x! o( ~7 J
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    0 K+ G) U8 L2 D) w" C% z
  20. * kind, whether express or implied; without even the implied warranty
    0 ?- @7 o5 \4 l# D0 C1 d9 X( O3 X
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' @' r' {: N6 N2 d
  22. * GNU General Public License for more details.
    / T# |0 n& z; J) K" J/ ]1 }
  23. */! g" D1 R/ [+ T2 F
  24. , n8 D  ~1 s8 X
  25. #include <linux/module.h>
    ; w6 m; H; c* t. E. l9 x+ I
  26. #include <linux/init.h>& N" z9 W  g9 f1 s. R5 q3 K# N
  27. #include <linux/errno.h>! ]% u: a6 d) K. x/ m5 m
  28. #include <linux/types.h>( k8 a% q# g/ x0 q7 |0 T
  29. #include <linux/interrupt.h>
    # _% Y0 W  a* U' [: c
  30. #include <asm/io.h>
    9 |  z+ L# D) G* g# o
  31. #include <linux/moduleparam.h>( t3 E  X% Q! S- q8 h5 u2 T& U
  32. #include <linux/sysctl.h>
    & U$ O3 g( X, @" A2 m4 w
  33. #include <linux/mm.h># L- H, a, E* m& K, m0 z
  34. #include <linux/dma-mapping.h>8 l' B3 @# \" y. z* M$ g
  35. / A. H3 T2 \. P5 p+ T/ y/ a
  36. #include <mach/memory.h>
    * {& w7 u! H, h6 m% G( d1 o
  37. #include <mach/hardware.h># B% C! X4 w2 [% p
  38. #include <mach/irqs.h>
    & r4 S6 `( k: f( k
  39. #include <asm/hardware/edma.h>, a, l8 ]$ ^% p3 ?: Q
  40. $ @2 Y- O$ }) x, v) H9 n
  41. #undef EDMA3_DEBUG
    / e( q$ W( M9 H6 M; a7 C3 t* k
  42. /*#define EDMA3_DEBUG*/$ m  }% R5 s& G2 ?) {9 f3 \
  43. % [4 E$ m% j* x, F0 ^" Z' M/ \' R
  44. #ifdef EDMA3_DEBUG- Z1 T2 f. p  p% T. \5 x
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! f  d, ^5 l- s2 J4 X
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& z7 N8 J" @, _" x3 G
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)  Q. T5 S4 C) l9 [2 f
  48. #else) p+ o2 E$ k$ O  U. ?
  49. #define DMA_PRINTK( x... )' L) Q0 v9 o. y9 p; Z, ?
  50. #define DMA_FN_IN% ], w7 ]7 x9 u. ]- l. e
  51. #define DMA_FN_OUT
    % E1 x  N% L3 E
  52. #endif. h( U  x* {0 _: J

  53. + ]* b- q0 I/ N1 `  _4 A. V
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)6 x8 g% M2 y! b9 H2 a/ T
  55. #define STATIC_SHIFT                3
    ) c: \3 l0 o* z/ D" E
  56. #define TCINTEN_SHIFT               20
    " O: }0 R0 A; H% O6 ~" j1 d
  57. #define ITCINTEN_SHIFT              21
    1 u, q3 p; y$ U4 f6 Z% k
  58. #define TCCHEN_SHIFT                22
    9 ^& L1 |0 ~% n! h% S6 m$ [
  59. #define ITCCHEN_SHIFT               23# y' ~; g2 T" P' f, T- t4 y

  60.   ~4 h" f5 J7 I9 x) y
  61. static volatile int irqraised1 = 0;6 U- g6 s8 Q, c6 F3 R
  62. static volatile int irqraised2 = 0;
    ! m7 b0 }: W! N7 r' r2 R7 h- H

  63. # Z  ^5 s# {' j1 ?4 r3 S4 ?
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" V+ v0 `! n+ r
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& X$ W1 F' A$ `& E' w2 s
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & U& |# J( ~! Z! i  w: k
  67. % w5 _* U# A( a- D3 M' j: O
  68. dma_addr_t dmaphyssrc1 = 0;. ], `# s8 @8 x. m
  69. dma_addr_t dmaphyssrc2 = 0;, q; M: ^( s  c' S5 d% k
  70. dma_addr_t dmaphysdest1 = 0;
    2 Z/ r2 O0 w4 q8 w: s* a& O, o
  71. dma_addr_t dmaphysdest2 = 0;
    # Z' j8 C0 x  C. i- c2 \
  72. * O$ x: o1 U! d0 d' k
  73. char *dmabufsrc1 = NULL;
    6 u4 x" n+ i  I
  74. char *dmabufsrc2 = NULL;8 Q0 u0 `5 Y. u. D
  75. char *dmabufdest1 = NULL;
    & w1 v0 N8 ^: w* `1 J1 r* @
  76. char *dmabufdest2 = NULL;7 Y% H1 C4 y3 ~; ?6 r
  77. % s9 y4 w9 x7 m1 P1 u$ o
  78. static int acnt = 512;* v& z8 ?; B! E0 d; n, p8 C0 \* o
  79. static int bcnt = 8;" S$ L) C: d9 \! v3 M; S
  80. static int ccnt = 8;" r+ n; I, a' D* q. {# b

  81. ' ^7 j2 j  y. ~
  82. module_param(acnt, int, S_IRUGO);8 |/ l3 _/ Z; Y9 R1 E3 M: p
  83. module_param(bcnt, int, S_IRUGO);
    6 z# Z7 P5 }% z0 u
  84. module_param(ccnt, int, S_IRUGO);
复制代码
" q! s) |3 Y- _. e1 {7 M( x

" A6 J* O) x: r      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: R4 l  H& a; Y# X4 U# J: _6 V
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" Z8 ]1 w3 w. D5 c' x  g     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 G2 r. Y. C  l, ]+ }. s6 o

" Q. s) j. a6 k$ K0 @# m9 X+ X* `; Z. v  c" v5 q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-31 11:40 , Processed in 0.043606 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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