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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & k/ `8 x9 u* v5 }5 i' U* A7 y8 z
  1. [code]EDMA sample test application- V% Z  x* J+ j# E. F( H
  2. /*
    . v' ~* R$ f& o! V( o7 |
  3. * edma_test.c; K$ J0 P# r+ L; d3 @: y) l% v
  4. *1 q7 B1 U. G/ W1 ^$ F% t3 e) C
  5. * brief  EDMA3 Test Application
    ! v, o/ z, x; V, C* v& m! i5 P
  6. *
    : e" i& M) {0 t3 x& k/ ~
  7. *   This file contains EDMA3 Test code.
    1 y$ _( @/ m, P$ i! i
  8. *
    ! Y8 d6 p3 Q" e4 o
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 r# X5 E" r# N) w% Y' A* m; y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    2 K$ e7 [6 ^5 g4 Q$ J
  11. *         TO CHANGE.
    8 o0 L" \" \, V  q
  12. *7 O2 [8 r, X0 t& ]
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    5 c6 A( ^6 O# \, u
  14. *
    % l( M! e) R! c' s" |
  15. * This program is free software; you can redistribute it and/or
    + v  g1 q" w5 l
  16. * modify it under the terms of the GNU General Public License as1 c4 D# }' K2 r" Z; p
  17. * published by the Free Software Foundation version 2.
    ' z8 U/ Y6 i9 w) J
  18. *
    4 u3 C) R  V, x  g9 ]* A
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    7 F, B" Y+ I; K) V
  20. * kind, whether express or implied; without even the implied warranty% B/ @$ I; [9 o
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the9 u$ K3 T% V9 K9 Y
  22. * GNU General Public License for more details.
    & k3 b" ^7 U  K+ R* P
  23. */% U7 Q$ Z) z9 a# S4 ?8 b+ C

  24. $ p* O7 G  R/ O5 C2 Y
  25. #include <linux/module.h>
    % D$ q6 ^7 A' \7 B6 r
  26. #include <linux/init.h>3 Z( |- ^% s* E. u2 o' @
  27. #include <linux/errno.h>$ c) Z  ^0 E& m' `5 {9 y/ e! k' J( N
  28. #include <linux/types.h>
    4 H( ^; }0 x- p( ?" H2 D" V
  29. #include <linux/interrupt.h>( b) W2 o1 b9 {& |4 p2 |
  30. #include <asm/io.h>$ X5 d9 Q3 ~+ ]3 u; }
  31. #include <linux/moduleparam.h>
    * h/ @. D+ Q( \* W5 L, w
  32. #include <linux/sysctl.h>
    9 V7 d5 p* X# m- t2 I2 D
  33. #include <linux/mm.h>
    ; m; `6 {, ?9 [/ N: J: K
  34. #include <linux/dma-mapping.h>- Z- Z8 R& l: G' b

  35. # V1 C4 W, I, q4 j% k5 W" v3 M/ A: g
  36. #include <mach/memory.h>) {) U# Z' c% x% \" H
  37. #include <mach/hardware.h>
    9 M  I8 i; b* ~' c
  38. #include <mach/irqs.h>6 n  E6 e& N; \( R: J$ a2 s( n- O3 B
  39. #include <asm/hardware/edma.h>
    6 h  p! ], l6 X7 Z1 d+ V
  40. * q4 ]& ~# p* P, p  H2 S
  41. #undef EDMA3_DEBUG
    ; _3 Z) @5 r. c, u7 F1 q
  42. /*#define EDMA3_DEBUG*// b; F& x# C5 e; S4 q
  43. 4 t% s. l  k+ p; p: F
  44. #ifdef EDMA3_DEBUG6 M' H& u1 s; W) h# _7 l1 [
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    $ a7 [* A* \* ]+ v. [
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    - c/ h! G) {; b
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    : d& q6 y6 s. H  l" ]
  48. #else  f9 o$ t3 y4 l) Z( n7 M
  49. #define DMA_PRINTK( x... )
    + G2 |2 k# e2 \: h- h; U* @3 r1 U
  50. #define DMA_FN_IN3 c# O1 Y% O  j  S
  51. #define DMA_FN_OUT
    : C" I7 [. A! _& [2 T
  52. #endif
    1 {0 ?0 F# f9 f- x. o' E/ q
  53. 9 W: J' i0 m; @. e
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)5 e5 b. M8 ]; c8 z. @6 E! h
  55. #define STATIC_SHIFT                3) @# \, [  e" ~! d7 r
  56. #define TCINTEN_SHIFT               20' W9 |5 b+ {; h: \8 `) r
  57. #define ITCINTEN_SHIFT              21/ j8 y& J4 T) m0 T  Y% k0 D- ]
  58. #define TCCHEN_SHIFT                22
    8 T" v9 f. Z. `  j% e- k3 p; _
  59. #define ITCCHEN_SHIFT               239 M8 u% D9 d8 n
  60. : y+ ]+ ]* m# N
  61. static volatile int irqraised1 = 0;! x: c& V5 B9 s; p. t7 H; G2 e8 M! [
  62. static volatile int irqraised2 = 0;
    1 b" P+ Q0 n' f% f" n; h

  63. 8 [1 p% {. j& a8 h, w) o' \
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 O! N' i6 S5 P% `
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ {' S- _: T" O' K. p# i
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) `) {# [3 e$ d3 ^
  67. 3 M( I) ]8 J0 F9 t; i& o* ?
  68. dma_addr_t dmaphyssrc1 = 0;
    . V# G6 J' I0 i3 u
  69. dma_addr_t dmaphyssrc2 = 0;  n# r" X5 S( k" I5 ^* {' P
  70. dma_addr_t dmaphysdest1 = 0;
    5 E9 y$ g$ m5 P; Z" `
  71. dma_addr_t dmaphysdest2 = 0;
    * x4 b/ f: F8 ^* r

  72. ; C- f2 h' c4 ?6 D; c/ }4 a: k
  73. char *dmabufsrc1 = NULL;
    5 [6 `6 U3 C3 S5 P8 Q& B
  74. char *dmabufsrc2 = NULL;
    1 Z5 i, W$ G7 K1 l! y/ |
  75. char *dmabufdest1 = NULL;8 v% z6 w. x: L7 t
  76. char *dmabufdest2 = NULL;7 H, ^. S  f; G4 d: k

  77. : g8 \# J3 R/ ?
  78. static int acnt = 512;' p2 j0 C1 w+ N; I( [2 l
  79. static int bcnt = 8;
    & h: K. n7 h4 O1 b2 n9 G
  80. static int ccnt = 8;
    3 ?9 R: ~, i1 X) ~0 [+ g
  81. , ^  N+ _2 e4 g8 ?- i9 U. ^/ w
  82. module_param(acnt, int, S_IRUGO);8 `0 T6 I* q# P5 o4 g$ b
  83. module_param(bcnt, int, S_IRUGO);
    1 y8 t4 u4 T1 V& `' f# D
  84. module_param(ccnt, int, S_IRUGO);
复制代码
/ Q7 R+ K" m, K9 {& d
$ K0 y# `+ W3 x! [1 o0 [
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# i6 }' U2 m+ C0 g3 F. qarm-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 c( F+ E- w) q2 l7 c4 `6 I- A     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 f" P/ U6 H3 i* L' `, g5 s$ h% @2 Q! y1 P- m! p6 J, b
0 W  J  @) w1 u6 c
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-27 22:15 , Processed in 0.036980 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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