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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ S: H# p8 R2 y# l0 O9 E1 S
  1. [code]EDMA sample test application
    % }9 x; T2 _7 t) d( t- e6 r
  2. /*2 w6 R! l1 D5 E6 o6 D
  3. * edma_test.c* S4 |. {: O3 j9 j
  4. *+ R/ |4 }6 f# C+ Z7 H5 p/ d2 N' |
  5. * brief  EDMA3 Test Application5 c) O3 C! q+ o& d7 Q
  6. *
    / _/ E" Z% u; j4 h
  7. *   This file contains EDMA3 Test code.5 D) r& H/ {1 l# x9 T" A
  8. *
    ! G# T# R: Q3 W  g0 f
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, A7 g6 K! C) \/ p, H
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    - v9 f! a+ e' Y( d5 f' ]
  11. *         TO CHANGE.* h# M2 @  U- I
  12. *% ?, v% F+ F% R
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    . ]- p- X" I( c1 b( u
  14. *
    6 U& X$ o- r3 Z  O, A  [
  15. * This program is free software; you can redistribute it and/or
    ( }/ F8 ~" u. H. f. }+ F7 o: A: H4 S
  16. * modify it under the terms of the GNU General Public License as
    * Q- a  e  L4 _+ ^2 B
  17. * published by the Free Software Foundation version 2., \& X3 h  t& x; Q4 J3 B( h. |
  18. *) ]* w% o8 d) E: ^8 K
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 O' a" X/ H2 Z
  20. * kind, whether express or implied; without even the implied warranty6 T  S1 H; T; t* I- }+ l# ]9 K& W" J( [1 ~
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    " h6 G( N# O5 C1 N2 s% U; Q
  22. * GNU General Public License for more details.
    : ]; N: k8 b" y+ {* l, d7 N
  23. */8 W+ i/ {- o. e5 g$ G

  24. , p$ ]* J7 u) o, M
  25. #include <linux/module.h>8 }9 N( F3 ~: u2 k
  26. #include <linux/init.h>  ?% V3 ~2 U4 g( [. t0 N# z, Z! x2 H
  27. #include <linux/errno.h>
    + _3 U! a' H" |0 ?+ z, E: C
  28. #include <linux/types.h>
    ) d/ L' t9 t9 ]2 R
  29. #include <linux/interrupt.h>( E- ^, p. E$ [, n+ z. c8 r
  30. #include <asm/io.h>* k: M# E7 S3 [  X# s% B
  31. #include <linux/moduleparam.h>* e0 A2 E# t/ _& T1 Z7 I$ l
  32. #include <linux/sysctl.h>
    * }; A3 I# o) l) X! `
  33. #include <linux/mm.h>3 y) v. Z# A( l  p
  34. #include <linux/dma-mapping.h>
    / V3 U- o' J% J; _  T0 S0 P
  35. 9 v1 m/ r2 m7 t4 {8 P7 P; K/ p
  36. #include <mach/memory.h>
    . ~% K* P' ?6 D( w0 g. n$ e: y
  37. #include <mach/hardware.h># o, Z- j; S9 d- |; s/ v% S
  38. #include <mach/irqs.h>5 X& x$ l) N5 W# B& G
  39. #include <asm/hardware/edma.h>- H: d& l# ~3 t# M; N$ U4 X+ C$ _

  40. 3 O5 o( D/ y. F. m/ C7 Z
  41. #undef EDMA3_DEBUG  J: r! Q# z6 i2 N, ]* w
  42. /*#define EDMA3_DEBUG*/
    - X0 y) U1 z0 I3 N- F4 ^

  43. 4 G* m/ Q% f/ [/ i
  44. #ifdef EDMA3_DEBUG, n: t" b0 J  S) ?# J8 r
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    " V  m; \9 m% T
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    0 ?: `& B' s; @) S! a: I" u$ p
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ l8 i4 O" @* f5 r) b& X
  48. #else0 e5 K/ f1 G5 y: ?
  49. #define DMA_PRINTK( x... )* Y9 r3 b+ {- r* V# P3 o* ?
  50. #define DMA_FN_IN* _/ t$ J+ H$ K3 o
  51. #define DMA_FN_OUT7 f4 ^3 u5 a3 e5 ^" k
  52. #endif
    " S7 D! O6 G1 M. ]+ j

  53. * `( h. [/ x- q  c3 p6 y9 S
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    - n* D: r2 q2 h: U3 x
  55. #define STATIC_SHIFT                3
    / w% c  q3 c9 m6 |& p: ?7 T* [
  56. #define TCINTEN_SHIFT               200 j% t2 N8 X& g9 b
  57. #define ITCINTEN_SHIFT              21
    # g' t$ y6 B4 |  G( L
  58. #define TCCHEN_SHIFT                229 \9 R2 k* L% p7 n9 A0 p
  59. #define ITCCHEN_SHIFT               23
    & x1 S3 M: k- ?
  60. 9 @9 W* \  K$ t  N( ?3 a2 i1 G0 F
  61. static volatile int irqraised1 = 0;
    / k; k  Y4 b% x
  62. static volatile int irqraised2 = 0;5 m* `. \% W, J- V5 P  T1 H7 Q& j
  63. " ]3 }' L1 b% O% w
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" r/ y, W7 y) a, b4 [
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * v7 x6 z% d; a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # u& m; _- u% X9 V2 q6 F

  67. % L/ f- T1 L1 W$ C9 L+ D/ _
  68. dma_addr_t dmaphyssrc1 = 0;
    5 i6 u: D/ l/ s" z  c8 n0 U  m
  69. dma_addr_t dmaphyssrc2 = 0;) I8 \8 m6 p/ m# q6 S/ u
  70. dma_addr_t dmaphysdest1 = 0;( e! T/ |- f% n: F( h8 _8 ^
  71. dma_addr_t dmaphysdest2 = 0;
    0 M0 U1 R* F/ b7 c- k" z

  72. 6 W$ f/ @/ m9 Z
  73. char *dmabufsrc1 = NULL;; b: a2 n  a4 U, E2 {
  74. char *dmabufsrc2 = NULL;
    : d$ Y/ z- j9 d/ y1 a: l2 \8 W% U
  75. char *dmabufdest1 = NULL;
    , I5 @, P0 `0 N4 \% F2 o$ r+ s
  76. char *dmabufdest2 = NULL;- k0 m  L$ a+ U1 s

  77. " s5 O$ W2 E# k2 H
  78. static int acnt = 512;
    ) u) y4 N& {! e% o' A
  79. static int bcnt = 8;
    , }4 V" @6 P8 l- E, I
  80. static int ccnt = 8;
    * q5 B8 W) J' @8 {3 i

  81. * u' \. d( \5 S2 X" _! k" k, n% n
  82. module_param(acnt, int, S_IRUGO);
    " Q; t) f/ [3 _, w, e2 ?; ?2 q
  83. module_param(bcnt, int, S_IRUGO);0 _! A# x* |! H- h& l- P
  84. module_param(ccnt, int, S_IRUGO);
复制代码
: @/ O. a& p' ?/ C- N3 D
& |2 Q/ B' _- d9 q+ s! _% `
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 b5 G3 p; h7 k% Aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
  Z' i5 b5 n0 q' g     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 E/ v6 x( x% Q: c& ?& u* q" k
5 @) ^% s. Q. p) n' r7 H9 K  R
1 \4 \: G; i: u, Q: e6 z7 g) j
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-26 20:08 , Processed in 0.038572 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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