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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * |: F/ z1 M5 N# z! q) K2 j
  1. [code]EDMA sample test application$ q+ U+ n9 v3 c) ]( g. ~7 S3 B; |
  2. /*7 |* @2 T2 C. |3 i- U# x8 V5 N' Y
  3. * edma_test.c
    # N8 r4 A( A5 j# b$ P
  4. *5 o, H) W: `1 J* ^( k7 ?
  5. * brief  EDMA3 Test Application
    ! q4 X" v: }3 c! ^
  6. *
    . _8 q' h7 M* b  _- l5 t
  7. *   This file contains EDMA3 Test code.' c" f! C: c! f8 ]" Q
  8. *
    7 s4 E/ f' k' X) Z( x9 ^! n/ k
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, ~7 [. O; i7 R8 |" f1 V; D6 ]" _
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) D! w; u9 U8 k: F# k
  11. *         TO CHANGE.
    ; K, {( l' R2 a& D# h  I  _
  12. *
    9 ~7 u3 |& W' E6 J1 Z9 D
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! T5 P/ \* L. B% w
  14. *4 g. ^6 x; x: H
  15. * This program is free software; you can redistribute it and/or
    4 ~) E/ {9 ~; |7 q7 P8 g0 L! y
  16. * modify it under the terms of the GNU General Public License as
    % b  }8 P& F3 ?3 z: x
  17. * published by the Free Software Foundation version 2.
    / i; k0 {. L2 p( O2 r, u
  18. *
    $ I- B- m7 G" L2 e1 k0 Y7 ?0 a& n
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 x7 W: |. \" W9 v0 Q, R: t: a
  20. * kind, whether express or implied; without even the implied warranty
    $ d1 X; Q0 Q+ V! c& a/ P  J
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ' F$ e- C6 U; M6 V/ C0 Z. ~
  22. * GNU General Public License for more details.7 n% G2 i9 w6 C8 V+ M
  23. */
    * B; T4 p; o0 z: h8 o4 ^
  24. " ~* g- g' z9 s6 N, S
  25. #include <linux/module.h>; w* _) V) K* L
  26. #include <linux/init.h>
    7 w  g, d7 j8 S( v! f( u
  27. #include <linux/errno.h>
    / |8 i% e& t1 v+ n- g. _4 d
  28. #include <linux/types.h>/ B+ M) r& Q  X! k& N6 N
  29. #include <linux/interrupt.h>4 `2 m! Y+ U' M9 d6 p- {
  30. #include <asm/io.h>4 M  O! m4 h0 r) u2 \
  31. #include <linux/moduleparam.h>: l0 P/ F6 \- P) J6 X' b) V4 ]
  32. #include <linux/sysctl.h>1 `1 A( [, B, n# F6 X
  33. #include <linux/mm.h>
    5 C/ s; M( |& M, w
  34. #include <linux/dma-mapping.h>
    $ @  d/ t; K( Q
  35. 2 w+ [# C  f- g  u4 H
  36. #include <mach/memory.h>! g; n7 W1 X7 c5 c' }% O" S
  37. #include <mach/hardware.h>$ L, r/ y2 f; l, f8 D( M" ^# M
  38. #include <mach/irqs.h>2 g2 v+ j* _! `% c
  39. #include <asm/hardware/edma.h>
    , U& I: O" l- r

  40. , W5 x9 J+ V5 E4 G; ^- K  ~
  41. #undef EDMA3_DEBUG5 Q/ o& B+ a8 Z( T  a
  42. /*#define EDMA3_DEBUG*/
    " n& A' v) ?; h$ Z, t; v

  43. / J! G+ P/ L7 o* {9 V  ?, t
  44. #ifdef EDMA3_DEBUG7 b+ R. Y) A# N' c" O) D3 v
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 V6 z" \! n( C( T) p) [
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! N8 Q) Y$ _8 B' R' Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 P1 L: T( b4 n/ d
  48. #else/ ]9 a) S* a1 ~+ x- ]/ j% o! |
  49. #define DMA_PRINTK( x... )
    ' W( @, e# Z! g0 R
  50. #define DMA_FN_IN3 c: Y6 ?' b7 W9 g
  51. #define DMA_FN_OUT" {; F+ E3 p# F" \  P+ P, S; \
  52. #endif/ v- U$ M( ^5 q0 }" {+ T

  53. 3 W' g( L& q+ f, _2 A6 G
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 q1 I+ p; h% i" q3 W
  55. #define STATIC_SHIFT                3
    ) G( q6 Z4 Z5 V" W. H0 I
  56. #define TCINTEN_SHIFT               20+ C* p9 M( [+ d1 M
  57. #define ITCINTEN_SHIFT              21
    + Q% v. Q& H9 f; U; y
  58. #define TCCHEN_SHIFT                22  w9 }& a( {& N
  59. #define ITCCHEN_SHIFT               23
    , i5 F! ?2 }4 ?8 I
  60. . a1 o: k4 r' t5 u
  61. static volatile int irqraised1 = 0;7 p$ Z9 ]# x* l" [9 U/ v& Y
  62. static volatile int irqraised2 = 0;
    " o7 A* _9 ?' ^, W6 W
  63. $ K% G+ k7 M" c. B
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 i4 r" I9 ~- ~* S7 c* @: s
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 x! G9 A( @& x- W
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- B7 A7 a4 N( K8 X2 e
  67.   o2 P) v* B! k" `% G; I6 F
  68. dma_addr_t dmaphyssrc1 = 0;4 p+ ]/ L3 C3 M0 f- P
  69. dma_addr_t dmaphyssrc2 = 0;
    7 u- ^& b2 z, X- K" |8 {$ Y0 k
  70. dma_addr_t dmaphysdest1 = 0;
    $ t( v/ ^2 {& n& X) D4 W9 \( k' l
  71. dma_addr_t dmaphysdest2 = 0;
    ; S$ }  V; i! i5 I) h) D+ M1 J$ Y+ {

  72. : g9 E$ T( q% \. [3 G4 S/ y
  73. char *dmabufsrc1 = NULL;
    " ]5 L% I  q4 M1 t3 X+ K
  74. char *dmabufsrc2 = NULL;2 G  [# v  E) C4 `0 G3 N9 f
  75. char *dmabufdest1 = NULL;5 }" p; p, S) K9 R( ^
  76. char *dmabufdest2 = NULL;
    / X2 j4 \9 q+ e* K* E% m
  77. ' ?: P# B  y$ s& B% H1 W' r3 }
  78. static int acnt = 512;5 D( ?- D) i8 w( p. A* v; B
  79. static int bcnt = 8;
    8 T# I/ @3 d  ?' e- d$ ?  N
  80. static int ccnt = 8;; F! v1 u2 Q7 z
  81. . {  j; D" G. Y& Y( ~, L
  82. module_param(acnt, int, S_IRUGO);
    * K* W3 W6 K0 B: o
  83. module_param(bcnt, int, S_IRUGO);8 k* |- k7 e6 X2 u: ^# w* I
  84. module_param(ccnt, int, S_IRUGO);
复制代码
- j) o0 v4 ~. {9 G
* d6 J: k7 k0 B# N8 b6 ?/ v
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ n! \. E- t: w( P/ D4 u
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) u2 Q2 p: c  o$ _% ^: H
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& Y. q/ u5 `! |+ y; W! e& h

: q( g3 \  ?7 i7 P# z6 |8 Q" t$ E4 w) I1 l
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-9-17 21:40 , Processed in 0.038391 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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