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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; f9 V, x  F9 ~. Y) X/ x
  1. [code]EDMA sample test application* R8 }2 C6 V9 q+ t" ?' V
  2. /*
    / T% I- h4 [; Z- M+ {
  3. * edma_test.c: `, j( J+ U: [2 f9 }7 ~9 D! Q" f
  4. *5 g2 h" A0 e* y3 l: M! R
  5. * brief  EDMA3 Test Application) |" p5 m2 E8 v4 e) ]3 g3 d2 h
  6. *7 `1 b! d4 S0 t2 i# e2 M7 H7 }  X
  7. *   This file contains EDMA3 Test code.2 Y+ W2 a7 ?7 N# ?& c. N
  8. *
    9 J3 e. ?: r+ V+ t; V
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ I# j* z8 O- j2 p# f" M, `8 p( o
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    0 I  M- t, S) W( Y
  11. *         TO CHANGE.
    / f. a- K3 d' A" C) N
  12. *
    $ J7 `1 G' f0 l" _. T
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ( s$ L+ N- w. L$ Y
  14. *- ]; h* }2 w* W! }  B. ^9 x
  15. * This program is free software; you can redistribute it and/or
    1 ]6 f* C3 }6 O; i) M
  16. * modify it under the terms of the GNU General Public License as
    ; ?9 m! x2 g( |( J- _2 ^
  17. * published by the Free Software Foundation version 2.
    6 e) A. {. R# a5 O1 h' j
  18. *$ A" t) K- k2 d+ D- g& j* ~9 O
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    0 ?$ r- N0 ?1 d. W- i; O; y8 J
  20. * kind, whether express or implied; without even the implied warranty
    4 _, S1 ^! J  Q4 E( w- u
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + }+ P# g4 y  w
  22. * GNU General Public License for more details.
    7 l* y! n, M2 d% M8 T- d
  23. */( w: d8 ]9 D$ f& A! q
  24. * G3 u8 }. k3 t* \2 `  K
  25. #include <linux/module.h>3 F" q7 h8 O  H
  26. #include <linux/init.h>9 {; U- b6 S4 z1 p8 G; G' Z
  27. #include <linux/errno.h>
    0 |1 _  P& k. s( e) U
  28. #include <linux/types.h>
    & ?+ A* p6 [+ x: P/ m
  29. #include <linux/interrupt.h>! T% n6 g$ Y7 J5 U
  30. #include <asm/io.h>' w" D2 V: [0 ^; b
  31. #include <linux/moduleparam.h>5 O. n5 {8 F3 H7 s
  32. #include <linux/sysctl.h>6 R) D" ?5 }% b& W
  33. #include <linux/mm.h>; ?. ^0 ~) K3 g+ C! U' U
  34. #include <linux/dma-mapping.h>
    % \8 A9 C. I) \

  35. 3 H* P# c! R0 k* V4 r
  36. #include <mach/memory.h>. H6 S4 d9 p# K, O) f' D7 G
  37. #include <mach/hardware.h>! j. t: ^* N8 v6 l/ w8 |: D# L
  38. #include <mach/irqs.h>
    % F( Q/ K4 q/ i, v9 y
  39. #include <asm/hardware/edma.h>5 L! A" U% G4 i2 [

  40. 1 O7 b7 y: C( t! c2 v3 W
  41. #undef EDMA3_DEBUG
    8 i8 j$ k3 f2 T
  42. /*#define EDMA3_DEBUG*/$ O) G% a# y; d4 ^- Y

  43. 4 ~& {2 V; u7 O: Z; w6 |) H6 K
  44. #ifdef EDMA3_DEBUG; ^; u  _# U( L  O' q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    # ~; k3 G, \% H$ t3 x. a* Z7 X- d
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ) D. b; a! Z* {5 w
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + Y( k0 I3 R6 Y% F& X. W0 @5 z* t: M
  48. #else
    + m- K$ b6 a' j: W% B7 ~' C
  49. #define DMA_PRINTK( x... )# u% D- C5 [1 Z' |. F. N
  50. #define DMA_FN_IN
    $ L! e- g% C( f. P' o+ m- O
  51. #define DMA_FN_OUT8 C. d: H9 q* x% H: Y$ o
  52. #endif1 A/ A% ~$ i5 L6 ?, s

  53. 6 I# f; g& F) k6 s! x$ \6 a
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)* W) r2 o( h4 g' z/ e, [
  55. #define STATIC_SHIFT                3) ~% d  Q% D. e/ N2 [: `7 m+ d) V
  56. #define TCINTEN_SHIFT               20/ q6 F9 q# d! L8 h( ~6 s
  57. #define ITCINTEN_SHIFT              21" Z: ~) a, G" v+ Z
  58. #define TCCHEN_SHIFT                221 v& ?) A8 ]' e# x3 O6 `- z
  59. #define ITCCHEN_SHIFT               23
    7 U! r( v2 ~4 R6 p6 g
  60. 8 {3 u2 q! m( |" w, |1 A3 r
  61. static volatile int irqraised1 = 0;
    4 \* S. C& M6 i, V1 }
  62. static volatile int irqraised2 = 0;. ^. I2 t7 v3 m7 v3 q8 X

  63. & P8 l% g. G; R$ m* Y* ]& c1 B, U3 N1 y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ ^& O% _/ W% S1 j5 x
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  {- |0 l  X8 P4 m4 N
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 s$ S" ^5 a9 }# h8 g& H5 |  `3 }5 N
  67. " N, c& B0 X$ G$ H- f' k8 S! O
  68. dma_addr_t dmaphyssrc1 = 0;0 W% G+ M8 S$ e9 U" L# ?4 p: {
  69. dma_addr_t dmaphyssrc2 = 0;
    8 O1 u! C4 Y) s) C- V
  70. dma_addr_t dmaphysdest1 = 0;* F+ R9 C* c4 S! y
  71. dma_addr_t dmaphysdest2 = 0;; j: S; I' a$ D9 p2 H

  72. ' y) D' ]6 s8 O) I" k
  73. char *dmabufsrc1 = NULL;* x# n" [* w7 t. u; T! W
  74. char *dmabufsrc2 = NULL;
    6 w; u/ {, C: g% z$ z
  75. char *dmabufdest1 = NULL;
    6 p$ G, ]: I) H8 ]. {! z2 V0 h
  76. char *dmabufdest2 = NULL;8 F0 `, ^' ?6 [4 ?3 \7 |' [3 ^3 @
  77.   A6 T1 c$ _1 u0 |3 V# v: s
  78. static int acnt = 512;2 y6 Q3 e0 C3 D# ~6 u
  79. static int bcnt = 8;
    * G' Z5 _# e% k
  80. static int ccnt = 8;
    ! Q" v" l1 w! d+ _, n  c) o

  81.   v2 X' b, C" E* l/ v* [$ Y
  82. module_param(acnt, int, S_IRUGO);3 H" v- ~8 _1 J; {) s0 a0 ]+ n
  83. module_param(bcnt, int, S_IRUGO);
    3 H* E: ]# x# o( e
  84. module_param(ccnt, int, S_IRUGO);
复制代码

& U% G1 ]: c# d1 T3 ?6 v8 R! [4 K8 o! a; q
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& y" I8 A* }3 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 [7 _# }7 ^$ w/ T+ W& G0 \( c+ E     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' {9 B1 Q8 }0 P! V- a, u' ^' m8 D. Q1 F$ B
. |& y& P7 X4 Y/ T
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-22 12:05 , Processed in 0.037173 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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