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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  V9 s$ i6 J$ f: u5 x4 r
  1. [code]EDMA sample test application. v* J5 F( A5 j! u8 N+ n$ B7 D8 p
  2. /*# V2 ~7 O6 r3 W' f
  3. * edma_test.c2 R7 B  |% ]; W7 r7 Z
  4. *
    . \& i, A2 l- Y/ B' t% Y- x+ Y
  5. * brief  EDMA3 Test Application8 O. \7 H) ~" c. [2 m
  6. *) b# D5 B2 w5 x3 d
  7. *   This file contains EDMA3 Test code.
    1 [' r$ r( @/ y" d! s
  8. *
    ' M4 H1 X1 t  X9 g
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 `# W/ {4 z: A2 M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# ^, H+ K6 V3 M% U
  11. *         TO CHANGE.  y" d: p- q0 A
  12. *
    $ ?- ~4 d9 F: w! s* L
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    2 u& y# k% o) a5 P9 e3 [& J
  14. *
    , I/ a7 j& f3 E2 \& C* g; E( j* }
  15. * This program is free software; you can redistribute it and/or
    ' O2 M/ m3 y0 x5 f9 ^
  16. * modify it under the terms of the GNU General Public License as
    1 T' q; }" e  A* h
  17. * published by the Free Software Foundation version 2.; `- |& ~1 K8 W2 r) t) a" ~
  18. *
    . M" A7 I9 D% R
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 n! Q2 |  f1 T% W1 s3 r5 S
  20. * kind, whether express or implied; without even the implied warranty9 H% n5 [  W  T& Y  j
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7 \, ~0 D9 q$ B7 I& d& c5 b1 @
  22. * GNU General Public License for more details.0 E& F0 d& ?* c: l( m/ ~
  23. */5 ?1 b- @; S; G; P- u

  24. ( i& F2 k' O% j1 x" Z1 t+ L+ |) F
  25. #include <linux/module.h>
    # M+ f( x; k3 S9 a5 ^
  26. #include <linux/init.h>
    8 Q! D; Q# G3 f2 k( e3 E
  27. #include <linux/errno.h>
    ; Q1 Z) f$ W2 C3 U# j: _. i8 V" y
  28. #include <linux/types.h>7 S' O+ @- ?+ Q) Z- A
  29. #include <linux/interrupt.h>( j3 e: S- F2 X: l/ t
  30. #include <asm/io.h>
    + p$ b5 D9 \# I9 N
  31. #include <linux/moduleparam.h>- |4 D& |% R8 T' F8 N+ ]
  32. #include <linux/sysctl.h>1 @+ k  g) b: |9 \9 g; i" l
  33. #include <linux/mm.h>
    5 i) ?1 [; v) v* q5 I5 v
  34. #include <linux/dma-mapping.h># j' f5 g; B. @7 i% W

  35. / o* y7 r+ W. P+ ?0 F  c6 x7 B  r
  36. #include <mach/memory.h>
    # h7 J& a' X8 ~$ r% i1 x
  37. #include <mach/hardware.h>( r+ q6 x2 }/ ^1 j
  38. #include <mach/irqs.h>
    6 P" p8 \8 [$ ?; \4 p$ ^
  39. #include <asm/hardware/edma.h>
    5 x0 m  q+ O+ S0 \

  40. 1 q" y; u  [" ~: o  l- ]5 Z+ F1 ^6 M
  41. #undef EDMA3_DEBUG0 i0 n$ l' p0 l# C% B; _
  42. /*#define EDMA3_DEBUG*/' w, \) Q3 z- t) y4 t

  43. 3 Z1 S: s4 K0 V
  44. #ifdef EDMA3_DEBUG! o; Z9 X- U" ?& |3 [
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    5 J7 P8 D9 N: R3 V  U# f
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' {  g# ?: m5 t; R: c
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) N; `: U* O3 ^9 g# g6 i0 u3 B
  48. #else- |9 B* d% \# C- K$ c
  49. #define DMA_PRINTK( x... )
    0 m' `- q% W( u- r; [% C
  50. #define DMA_FN_IN! `! b# I% `0 F5 C3 A' R: {& J
  51. #define DMA_FN_OUT
    0 X% H% V3 s& `
  52. #endif
    , i# ]! |# n  e- `
  53. $ j- Q; p1 Z$ G# K( M) H
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; i: P- ~! A5 D! D, X( _$ P2 i
  55. #define STATIC_SHIFT                3$ i+ k( E0 v3 V$ S: M6 ?
  56. #define TCINTEN_SHIFT               204 r( q9 g" N. _8 V
  57. #define ITCINTEN_SHIFT              21
    3 n+ r7 i- q; m6 S) h
  58. #define TCCHEN_SHIFT                22
    5 @6 H5 K1 P0 [- m1 o% a
  59. #define ITCCHEN_SHIFT               23
    , Q" e7 g+ r" c
  60. # \0 E  V7 \3 p! n/ J+ L1 i4 Z
  61. static volatile int irqraised1 = 0;# N& i7 B! W4 N
  62. static volatile int irqraised2 = 0;8 c  n7 {  n) j" N2 u4 O8 D
  63. ) l7 T2 y8 P2 O) P  [( `
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 n9 H  M9 z( p" O* F& ]
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) e" ?6 ?' R& n+ ~7 R' q) W
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + d: R0 ~4 ^' Z! s6 N, b, ]

  67. & i+ R/ [, [5 g% N# u: Q
  68. dma_addr_t dmaphyssrc1 = 0;
    : Z8 `. {0 s0 X+ [
  69. dma_addr_t dmaphyssrc2 = 0;
    % ^9 a6 d+ f  d# |
  70. dma_addr_t dmaphysdest1 = 0;
    - x) S- _4 T. V4 Z  U0 e
  71. dma_addr_t dmaphysdest2 = 0;1 ]* a- X- c# {% e  C

  72. 8 x! H/ \1 X5 b0 {$ L! x6 l1 y
  73. char *dmabufsrc1 = NULL;
    4 L3 F3 q' M% V4 N* K
  74. char *dmabufsrc2 = NULL;
    , y: I3 v8 q( q1 H8 d
  75. char *dmabufdest1 = NULL;3 |& b. F1 _3 V2 \7 P  X
  76. char *dmabufdest2 = NULL;7 e- {. T0 u) X/ J* }3 {

  77. 6 L' Z3 y) ]9 q5 p7 m, Z
  78. static int acnt = 512;
    6 w' M$ x/ \) I- Z8 p
  79. static int bcnt = 8;
    3 _2 C3 l1 s1 X3 m) m& P+ X! d
  80. static int ccnt = 8;
    4 y8 E& |) i$ ^4 d9 K; b0 [

  81. + X8 G) U2 F& Q& O
  82. module_param(acnt, int, S_IRUGO);  s$ C6 G5 X# S, o9 s8 k3 p8 M
  83. module_param(bcnt, int, S_IRUGO);' J4 d+ F( c9 j
  84. module_param(ccnt, int, S_IRUGO);
复制代码
/ M1 ~' J% ^* k

- ?' i" G- k1 Y8 G5 U      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! V; a5 m" @2 P
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- G$ @: L; m7 e. V* ?
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 G7 g8 J! \" u; M
+ g" \6 d2 @+ t6 n( O
. w2 D. A8 F; f+ [
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-13 07:02 , Processed in 0.039241 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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