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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 I  H% Q/ h2 E' K5 I
  1. [code]EDMA sample test application: Q# l6 r) U/ ^; d* y! @' N2 X
  2. /*" B. ~' w/ f; o8 Q; S1 l; U% S, K
  3. * edma_test.c. h6 n' t7 Q3 L. V+ b, G
  4. *" e1 A! I! u" C# N3 C/ \
  5. * brief  EDMA3 Test Application
    7 Y( M, k& R' [$ K& y2 K
  6. *  `2 q, C0 `0 d9 k4 I* t
  7. *   This file contains EDMA3 Test code.
    ) E( W% ]7 a( v! R- V9 S
  8. *6 p5 A1 G6 o. q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    8 ]; C' B. ?6 Y: V) u
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) m3 a! L1 @' q9 x: b" t* `: r# N
  11. *         TO CHANGE.
    ; D& G% L' V6 ^" [  p5 @# `! T
  12. *
    : Z* w# x. ~) S, t
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' C: j+ e" q9 f$ \$ X# \
  14. *0 ~3 W9 U" p$ d8 p$ t
  15. * This program is free software; you can redistribute it and/or4 t; [3 @( j( {! ^+ I5 q2 e
  16. * modify it under the terms of the GNU General Public License as, g" k6 ~6 G6 [4 Y  N3 `, t  _
  17. * published by the Free Software Foundation version 2.! F! E9 ^7 E+ N8 i. c
  18. *5 K$ J, q) i% c3 v
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / p" l8 y; @. C2 m* h0 f0 ?! O
  20. * kind, whether express or implied; without even the implied warranty
    , J7 }% d7 p, b3 o% f! v8 V# B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * S# Z/ O6 j8 s# d7 G. O3 q
  22. * GNU General Public License for more details.
    / B: {0 q) K/ O' L
  23. */% ?' ]1 j% ^9 e7 k. h, M+ E# R
  24. 6 l5 f: y7 b" {' t$ c' U
  25. #include <linux/module.h>1 ?7 v6 P% \- x1 [, F( @2 z
  26. #include <linux/init.h>! F( x; ]+ l8 R/ x0 C) s& ?
  27. #include <linux/errno.h>. v: I1 r; D9 N6 x
  28. #include <linux/types.h>6 B& \* \  a2 @& Y" `1 @. s- z# M
  29. #include <linux/interrupt.h>
    # ^+ y% P: M4 ^& c1 f3 i
  30. #include <asm/io.h>
    0 L6 I1 b1 H4 P! ?- Q6 E
  31. #include <linux/moduleparam.h>
    . V; W; ?+ l( R
  32. #include <linux/sysctl.h>. f. e2 V7 |' c7 l& l3 K/ T
  33. #include <linux/mm.h>2 s. h6 M- o0 W- C2 P$ }& S
  34. #include <linux/dma-mapping.h>
    5 B1 D* t2 B' ?" w) K9 ~- U1 o

  35. . z! H$ [1 `( _3 s  u
  36. #include <mach/memory.h>' r( K6 k' r* P9 i- k
  37. #include <mach/hardware.h>
    0 b+ \% K" G1 M( ~: K1 b, B$ a! D
  38. #include <mach/irqs.h>, Z) w3 [& w" h9 Y
  39. #include <asm/hardware/edma.h>
    ; w* R' y; A7 ~# a

  40. 6 y' g$ s& M( }' r5 Z
  41. #undef EDMA3_DEBUG$ Y  }0 z8 E* B2 Y5 {0 c; p
  42. /*#define EDMA3_DEBUG*/9 D) K/ C/ a: H* |/ k8 Y0 _$ _: y

  43. $ _3 E: I! o0 E" G
  44. #ifdef EDMA3_DEBUG
    2 A* m5 q( B  c, F7 I- @3 |, h7 M5 u
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ; v, v3 L/ \4 k+ V( C. B3 U. m  R
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)  r" n! ~% R! E' J. d: X
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 @# o! o6 D; ?! d4 O4 {
  48. #else& M. o3 Q6 \$ q7 Q5 v/ I
  49. #define DMA_PRINTK( x... )
    $ v2 X- z( _6 e" l8 ^. N1 I2 ]# N
  50. #define DMA_FN_IN" `, B$ n9 V, m$ x
  51. #define DMA_FN_OUT
    / j( G( s& L# o
  52. #endif
    : P! k" L3 t3 }0 P3 _, V

  53. " i7 i; I# a6 S
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( V, J4 P# H% L0 Y% m
  55. #define STATIC_SHIFT                3
    9 i  `0 P& w0 a2 \+ e3 z# L0 d
  56. #define TCINTEN_SHIFT               20* O) D" n5 T6 b# Y' ~
  57. #define ITCINTEN_SHIFT              21) [& z6 y6 X' V; u9 y7 j, g
  58. #define TCCHEN_SHIFT                221 m% m# I2 u# D% z8 V& @# l
  59. #define ITCCHEN_SHIFT               23
    . I, y8 e. l5 r( e
  60. 0 _$ h3 d( d0 L3 Q  E0 ]1 K& u- I5 y
  61. static volatile int irqraised1 = 0;
    0 O6 u' x' M( e5 b7 \
  62. static volatile int irqraised2 = 0;
    ( C; x" Q" _+ ]0 }% t% F* t
  63. / V! P% S" i" y" A
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 ?: |. t% b) w" }* f5 J1 E" N
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 Y$ [) O' U+ L/ W" l2 q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 t* i- ^6 p$ ^: Q! R7 m
  67. 6 U' X# c, X' [
  68. dma_addr_t dmaphyssrc1 = 0;
    ' [' {  d* t8 u7 H' `
  69. dma_addr_t dmaphyssrc2 = 0;( _, I% H% Q! Y; \5 k
  70. dma_addr_t dmaphysdest1 = 0;8 a+ s0 E4 F( H3 X4 V. r$ @) W) M
  71. dma_addr_t dmaphysdest2 = 0;
    . k* n6 J3 R  B5 q7 t

  72. , \8 D4 d) q2 o6 D$ ^0 k+ c
  73. char *dmabufsrc1 = NULL;
    ! b0 _6 b* L! }- L
  74. char *dmabufsrc2 = NULL;1 U; @9 C. O& N* r+ i# ]: d& e
  75. char *dmabufdest1 = NULL;
      a: h3 t$ k' q
  76. char *dmabufdest2 = NULL;
    5 b" A3 x# Q' U

  77. 6 j. T& ^/ v& _7 F
  78. static int acnt = 512;  h: g1 E. B7 T' c+ Y" l
  79. static int bcnt = 8;
    9 d, x" c+ v& R* e7 o
  80. static int ccnt = 8;
    : i  ?3 l- O2 A& A
  81. % z6 V0 I& `3 L! \! U& e$ p
  82. module_param(acnt, int, S_IRUGO);! J' K* I; T% B: F- |6 L
  83. module_param(bcnt, int, S_IRUGO);" U0 z: r7 f- Z$ G/ D2 t5 }* Z
  84. module_param(ccnt, int, S_IRUGO);
复制代码

8 z1 ?& Q2 E' U; i6 O% F7 h3 r5 n$ }6 ~& ^! O
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" e0 J6 s7 O$ B: A
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 J8 ^; T4 p, f$ Q" r& _: O     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& c- N$ v" r  c; ]6 i$ Q: `! D" d' D# m
, f$ a4 ~$ M3 V+ D
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-10 19:23 , Processed in 0.035397 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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