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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( v; `$ E3 f! }" x9 h7 Y, ~2 Z
  1. [code]EDMA sample test application1 R- Z( U; H, k
  2. /** X3 R3 e. a6 g2 D
  3. * edma_test.c. V% U! o$ ]) t9 v$ E! @
  4. *
    ' T4 u' t# M. g. {% R2 p" Q& j
  5. * brief  EDMA3 Test Application; j# T5 I4 p4 m, C! w6 y! p6 G0 h" w
  6. *
    : |7 U# \$ j% }& R. q
  7. *   This file contains EDMA3 Test code.
    + V  O* K% ^+ E; g4 B! @
  8. *
    + e+ L5 E& c4 l' L, E7 L2 k
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" A" u/ c. [# G) J. j1 ~
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    / Q) T3 f4 K! {( j
  11. *         TO CHANGE.
    ' z4 K5 e" d3 @5 h
  12. *
    & P9 }/ K1 r, s. F6 b! |" L
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" E6 y% q% C5 H
  14. *+ Y% @" t3 u; A7 `$ q
  15. * This program is free software; you can redistribute it and/or
    $ d; z, u! }# w
  16. * modify it under the terms of the GNU General Public License as& f$ t( V, s, u7 z, s# }
  17. * published by the Free Software Foundation version 2.
    ' ]' r& O. I3 D: G; Y1 W; Z
  18. *
    + K8 t4 s0 w8 c9 x! j# [
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 B7 C* e0 |0 N: g, e
  20. * kind, whether express or implied; without even the implied warranty2 M/ o$ h. y( t- G
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    , q  i8 N& Y+ b; p5 n$ K3 g( z
  22. * GNU General Public License for more details.3 u, x* r8 Y6 J
  23. */
    : s5 y* A- _+ z7 f8 Z7 m
  24. . w) L( U# O4 i
  25. #include <linux/module.h>1 o$ y$ J% I, S9 g
  26. #include <linux/init.h>3 g0 K6 L3 W& ]1 y7 U  K
  27. #include <linux/errno.h>
    0 X& E5 p; s: t" M
  28. #include <linux/types.h>
    % e8 W# u" D' R
  29. #include <linux/interrupt.h>
    ' s8 i% l) F9 ~  Z1 n
  30. #include <asm/io.h>
    & `4 a( R- T7 _. A7 ]3 p
  31. #include <linux/moduleparam.h>
    2 T; g( E* o  V  o/ O2 T* I
  32. #include <linux/sysctl.h>7 q2 G& q, f  I9 _( s* M* b
  33. #include <linux/mm.h>
    0 N* l& R/ I6 L7 u
  34. #include <linux/dma-mapping.h>
    - z3 r6 g5 g2 Y- Y; F

  35. 2 D& I4 l# |5 Q* x8 Y
  36. #include <mach/memory.h>
    3 i* Z  a* [) T' p/ s- K3 |6 M0 g
  37. #include <mach/hardware.h>
    7 Q1 N8 Y$ Z/ V" V
  38. #include <mach/irqs.h>
    + }) Q! x& G1 {% E  p4 Q
  39. #include <asm/hardware/edma.h>. N- ?* O) r' K) W: L
  40. $ e3 n9 D2 T) ~6 L8 \6 m8 x& V
  41. #undef EDMA3_DEBUG
    ; @: ^, H! J2 j
  42. /*#define EDMA3_DEBUG*/
    ( R7 C5 Z+ J- B9 G8 I
  43. 7 o0 q1 s; s+ K  E
  44. #ifdef EDMA3_DEBUG
    . w# B8 c& ?* f) S
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    5 \$ k0 K" X/ e6 u8 y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); L, C$ r8 P, X( Z5 d: H1 X4 ~
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" o$ r$ k& i% V: L) b
  48. #else
    : O( _9 m' [* |
  49. #define DMA_PRINTK( x... )
    6 O0 N% S2 R2 ^0 @5 `( ]1 G& Y
  50. #define DMA_FN_IN
    5 Y( K2 j0 q- ^+ |7 E# I
  51. #define DMA_FN_OUT) f6 o  u4 x1 O3 Q+ e5 C, |
  52. #endif
    5 c1 E4 {% r  L+ p0 e1 H/ ]5 }

  53. 8 b3 Q8 D$ I1 Y1 g& P
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; S6 e$ D4 o9 j3 {
  55. #define STATIC_SHIFT                3* y0 f: ~" \/ j. y% o& k' T
  56. #define TCINTEN_SHIFT               20
    % Y* a* {- D9 ?# m3 x1 X
  57. #define ITCINTEN_SHIFT              218 R% @3 _  m" @" b% u( f
  58. #define TCCHEN_SHIFT                22
    ) U' f. Z' ~5 g  t4 F1 T) t
  59. #define ITCCHEN_SHIFT               23
    : \/ [# t% Y! i) ^: I1 [
  60. ' j! l) {' L  I7 V
  61. static volatile int irqraised1 = 0;/ e1 y) h$ w+ y. m/ y
  62. static volatile int irqraised2 = 0;
    ' J# u2 P' E, i/ [
  63. 8 s$ b- \+ r1 W+ P& f( U+ c
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* F( b1 Y# M" W& w: V
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / z. c' w2 d% W( h
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& ^+ Y3 `) K+ n6 p

  67. ( g; o9 x. s0 g8 P3 l* W0 ~
  68. dma_addr_t dmaphyssrc1 = 0;$ n' M. M* U) E, V$ f9 G2 {
  69. dma_addr_t dmaphyssrc2 = 0;8 O4 d# V+ l: r' M% n
  70. dma_addr_t dmaphysdest1 = 0;
    3 s9 F! v' y/ c% U
  71. dma_addr_t dmaphysdest2 = 0;) j% G2 s0 D) \, M, d
  72. 4 ~: L- M! n$ |3 K6 p" v
  73. char *dmabufsrc1 = NULL;5 f7 R. S: M! C4 _+ C
  74. char *dmabufsrc2 = NULL;8 G1 D- I8 W* Q( ~. _
  75. char *dmabufdest1 = NULL;
    , o- m" [- F0 V; q9 ?6 g: s7 I, L
  76. char *dmabufdest2 = NULL;) Z% g4 B4 ~6 A: |" X, @
  77. ' a5 |1 R3 _8 |/ K
  78. static int acnt = 512;
    " f4 Z( P) H+ V$ l; m
  79. static int bcnt = 8;
    - l" p& @7 c9 x& I/ G3 |! A5 b4 l* ]
  80. static int ccnt = 8;
    ( s5 D+ ?0 ?* U

  81. 7 ^! Y! n! S) N( P8 W
  82. module_param(acnt, int, S_IRUGO);
    ! n* ]4 x- }. j& c4 |
  83. module_param(bcnt, int, S_IRUGO);
    , ]% C; I- f$ r6 O6 y. W9 Y
  84. module_param(ccnt, int, S_IRUGO);
复制代码

9 z) O, f  \- V9 w
9 ~: p; f% k% d2 z/ p- _      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- U$ O; v( w" Farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 C/ F* S1 c0 ?6 b4 R* m
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( F' v" f# u0 C8 j3 |9 {/ o
5 d8 v$ h- \& l) G
: k. E' V3 D0 w3 A
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-27 07:51 , Processed in 0.038149 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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