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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 x8 y4 h! l9 X' v0 w+ S4 }. ^) ]
  1. [code]EDMA sample test application2 U& B) K  L+ Q5 y! m# [
  2. /*  A* w3 C  Y; [, W3 a
  3. * edma_test.c
    0 s+ ~9 \/ A% Z
  4. *
    * T, w# D8 w% _, d! }6 D
  5. * brief  EDMA3 Test Application
    1 Z% P3 V/ j; t. K9 l5 Z+ L
  6. *
    4 X  Y1 c; l8 V+ P  s
  7. *   This file contains EDMA3 Test code.: C' a' J, ^3 I9 o4 f* x
  8. *) @; k! u: s# U9 _7 r8 D. `
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 ~% v" c2 a  j1 V6 I: n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    0 s; i8 f# @6 r/ X: m& u
  11. *         TO CHANGE.
    7 C6 X  M8 I! x3 j" I1 N# t8 o
  12. *
    9 J: G. H# z7 y9 l  j8 ?4 a
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " b# ]* m, ]* ?& ^
  14. *
    2 ~2 n! [, s' Q# @" j
  15. * This program is free software; you can redistribute it and/or4 {0 N; o- o  f" E
  16. * modify it under the terms of the GNU General Public License as8 x$ h& N' E# k% x5 V
  17. * published by the Free Software Foundation version 2.6 U6 \! Z: x! @8 B: O
  18. *" [: z# Q0 y7 m: ?  K& m) s
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  E. A- c) h% ~' F! }" v
  20. * kind, whether express or implied; without even the implied warranty
    9 u* w, Z, \" p, R; m2 E! a
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . V: E/ |) D1 i5 s) \8 ^: Q1 x! X
  22. * GNU General Public License for more details.; L. u9 F) ?; W- h' h; [' o* R) H4 s
  23. */8 t; w$ M: _1 B" T& X* }

  24. + ^" U7 |, a4 h4 [/ F
  25. #include <linux/module.h>% q6 w- w0 a% m* F. s1 C
  26. #include <linux/init.h>" }# l/ m, m. O$ B' x) s6 \9 z
  27. #include <linux/errno.h>4 l& p1 R8 `* B+ C6 l6 E
  28. #include <linux/types.h>
    " E. k5 s4 l* H6 t" {- p# |
  29. #include <linux/interrupt.h>
    6 d, W; r6 I4 v: H5 a2 M, E
  30. #include <asm/io.h>
    1 O2 |3 _3 T- j# I) ~0 Z( \* ?+ W9 ]: H
  31. #include <linux/moduleparam.h>: T+ }3 B) ^3 J
  32. #include <linux/sysctl.h>3 x3 r9 T9 k1 O/ s' p- [- L0 }
  33. #include <linux/mm.h>% Y/ W+ \* D( @4 A* ]; C, r  @
  34. #include <linux/dma-mapping.h>1 W% l! a! m5 B. b8 F
  35. - {0 `7 U- U4 m4 @% @! y
  36. #include <mach/memory.h>
    . I9 h& X2 v' U
  37. #include <mach/hardware.h>
      w0 S  j! @& m5 K- Y3 \( F
  38. #include <mach/irqs.h>
    ( Z1 T! v, D, p* g( _; ?& b/ q. C
  39. #include <asm/hardware/edma.h>
      |+ a9 ^5 Y4 Q# p- ^
  40. 5 V( [  Q$ }* N* m3 i& ]& w( z9 L0 j
  41. #undef EDMA3_DEBUG
    ' x& q# n: v- }" P2 E! s, ~
  42. /*#define EDMA3_DEBUG*/3 y+ l: z7 R+ \& t
  43. 1 i9 Q! h' ~- n( r
  44. #ifdef EDMA3_DEBUG
    * V+ M% g8 l# ?/ d1 U' {
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    9 r! E" S* R9 V! o  V+ I
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 `. |; O, [- A# r2 i7 Q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 H- F: |# A3 y) H* z9 e
  48. #else
    ( \: U) q7 f0 j! m/ E0 w# `
  49. #define DMA_PRINTK( x... )
    ' v7 y: ]5 u4 Q0 B
  50. #define DMA_FN_IN
    2 i+ B% G2 R- C+ @1 o
  51. #define DMA_FN_OUT
    ; f' E$ X6 N2 G+ \" w. c
  52. #endif
    ( K: I9 c* x1 r' `, f/ L
  53. , b% I* }8 {& P# D2 _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : n/ o# P3 N) L
  55. #define STATIC_SHIFT                3+ H7 R" ^( G. M+ \* n  j$ g
  56. #define TCINTEN_SHIFT               20
    : E) m5 W) c7 Z6 Q8 T
  57. #define ITCINTEN_SHIFT              21
      b- @' E" v% l* d! Q, Y2 a0 b
  58. #define TCCHEN_SHIFT                22
    ' u# o) J3 d+ m( g
  59. #define ITCCHEN_SHIFT               23
    ; |' i; Y4 b/ k/ S6 l
  60. & R! n; m/ J# X9 i* ], ^9 Y
  61. static volatile int irqraised1 = 0;
    ( X4 o5 S8 O; |+ Z5 D" M/ F# G, D
  62. static volatile int irqraised2 = 0;# j/ h5 Y$ T& S$ h

  63. , h0 P- t* e* _% e/ j( \/ d) C
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 J$ E( u% Z, i2 @( [! m
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " ~" h/ X6 q* L0 o$ u8 Z# C
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; i/ b, n( b, U/ Y; r6 c9 [

  67. & Z/ G1 j/ [2 w# A+ C3 C
  68. dma_addr_t dmaphyssrc1 = 0;6 O' \8 n8 b4 [7 \# S
  69. dma_addr_t dmaphyssrc2 = 0;
    . M7 D8 q6 H; l4 M( b8 T2 {# S
  70. dma_addr_t dmaphysdest1 = 0;
    / f7 D# N9 }' r; X' U, [
  71. dma_addr_t dmaphysdest2 = 0;
    2 e: P: z4 H1 O& V( ?0 i4 U; E

  72. 5 a% `6 V# M. a
  73. char *dmabufsrc1 = NULL;  }' [( R9 }: v7 H
  74. char *dmabufsrc2 = NULL;) U+ ?7 K. O- D' H' B
  75. char *dmabufdest1 = NULL;8 L: }1 h" y& v. b0 N
  76. char *dmabufdest2 = NULL;
    2 S( Y( l! l5 U9 }: z9 N+ E/ U' \

  77. * o% Y2 r# P3 F! z
  78. static int acnt = 512;
    8 f5 A3 m5 V" i, x& z( A
  79. static int bcnt = 8;8 R1 y+ q6 h* J- o3 T% V, w: r
  80. static int ccnt = 8;8 i& @7 U! B  ]" E- D. {

  81. 4 {7 L9 H5 @: p6 r  q
  82. module_param(acnt, int, S_IRUGO);
    . }' ~) x% e" z) `7 ^
  83. module_param(bcnt, int, S_IRUGO);/ d4 `, m  @4 w1 ?  R' L
  84. module_param(ccnt, int, S_IRUGO);
复制代码
. H' C8 h5 D0 L1 W9 R. @9 i9 w( p

! H! a2 Q8 }3 T      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ E& m. ~! W+ b) A- ~1 I4 t
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 o1 B; Z* R# k0 s3 A% g, `5 V  y     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 d" |  P6 D) M6 D6 i1 x

, h$ v/ N! A+ P5 ]2 e' x3 H8 V- k8 T9 J4 ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-13 01:18 , Processed in 0.040150 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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