OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- l2 B: w# ^1 z& {4 U9 u/ B
  1. [code]EDMA sample test application
    7 [) e2 Z) F2 E. _# B: ]
  2. /*
    ' _0 _7 U; W4 h7 m) r/ P
  3. * edma_test.c
    9 w9 _6 {/ X& J  S
  4. *
    + @# ~4 F: X$ E2 u0 ~: r
  5. * brief  EDMA3 Test Application8 U. ^" I3 q) ^
  6. *7 [: ^7 y8 Z/ k0 ~! ^  E4 E+ t* r  L
  7. *   This file contains EDMA3 Test code.* \, n) C, w/ i6 a1 H5 T
  8. *
    $ b3 s6 K. \, N5 ?
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! S5 ^' }. \9 Z" P6 V- x) @0 d, t6 v
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 u# L- y1 a4 b2 E
  11. *         TO CHANGE.1 i3 r' A( k# I% n
  12. *! ?& I( p6 n' ?2 _8 q, U+ a
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' P# e( V' k  a  d. O) U8 z
  14. *1 t& [  M, n* o
  15. * This program is free software; you can redistribute it and/or
    6 m$ x% B5 ^/ e, N/ j2 l$ q
  16. * modify it under the terms of the GNU General Public License as  s& m1 @) K; \; E+ }
  17. * published by the Free Software Foundation version 2.9 x$ c/ @( J1 B; L! o: ]
  18. *
    7 |" I* @, e8 [* w% U9 E: @
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    & r  s( J/ I2 v0 ~7 S
  20. * kind, whether express or implied; without even the implied warranty$ \( J' `) c3 G8 l3 W2 }% `
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* L& o3 r+ O  k9 k
  22. * GNU General Public License for more details.
    8 D  d* ~! r, V2 o7 g: N1 b
  23. */3 j+ F8 r4 w1 [( d

  24. : r: I$ k$ v1 d5 t- F
  25. #include <linux/module.h>
    9 H: f9 F) z& G  f
  26. #include <linux/init.h>- u& s: g- S% O  `2 ?' q- h
  27. #include <linux/errno.h>1 n' i2 t+ p; y  e2 [+ o
  28. #include <linux/types.h>  s$ S" E% m  a8 t* G# [
  29. #include <linux/interrupt.h>" G1 Z6 M2 L9 I; S" d! W
  30. #include <asm/io.h>* n" a7 ~; }0 v" n  F& Y. B! M8 ]
  31. #include <linux/moduleparam.h>$ O3 B4 K) m; k7 A$ |
  32. #include <linux/sysctl.h>& _0 P" A4 o2 J; x( y" D
  33. #include <linux/mm.h>1 u* N  R9 N+ R
  34. #include <linux/dma-mapping.h>
    : }7 f  w) X" B& U$ g3 y

  35. 1 v! s0 |' t7 I2 a. A! [( j
  36. #include <mach/memory.h>" w0 C+ d: c# I' k6 V) L/ L6 Y9 _( ^
  37. #include <mach/hardware.h>& j1 h& U& L- [# O
  38. #include <mach/irqs.h>
    + O$ O- n. \6 {1 k
  39. #include <asm/hardware/edma.h>
    6 F9 l7 J2 m: y' `" U

  40. + u) o: }# }8 h+ E, ~
  41. #undef EDMA3_DEBUG! L/ \8 N; J! |8 c" U
  42. /*#define EDMA3_DEBUG*/, V- j. ?: f) e- n+ F0 q4 ?

  43. % A% r. M1 {% C0 \7 W, B: U
  44. #ifdef EDMA3_DEBUG8 n; U; J$ z1 x8 g0 z* y' v
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    3 s4 c  W. A) d1 R! \) @# K
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! k& R/ q# n- Q) z. G5 g
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - D  Q4 m0 q, U% F
  48. #else7 T% I! H* X) w0 [0 e, H9 F
  49. #define DMA_PRINTK( x... )( E4 X; @0 E& {: n! v; `
  50. #define DMA_FN_IN' y9 x! [" B, a$ D: ]4 L
  51. #define DMA_FN_OUT
    , Y$ x1 b: |" K; s& ]( [) B
  52. #endif& j1 v- a9 r! X! U0 J

  53. & ^4 l5 G8 {! m) Q0 O# e+ E
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)$ i0 L! p. x% q# d2 w$ v2 s
  55. #define STATIC_SHIFT                31 T& _/ t* w8 b; B+ `3 D
  56. #define TCINTEN_SHIFT               200 D& x! m( m+ _7 o
  57. #define ITCINTEN_SHIFT              21
    & ~5 L3 y, x8 b$ H, i
  58. #define TCCHEN_SHIFT                224 n4 F5 D. Z! Y3 [6 @
  59. #define ITCCHEN_SHIFT               23
    : |. J  R& Y: B8 F0 j

  60. * e0 x; m5 f# _6 ~0 M6 f' s
  61. static volatile int irqraised1 = 0;3 I/ i, S, x! i4 j/ Y7 ~: \
  62. static volatile int irqraised2 = 0;( Z. F' O! T, Y6 T2 J2 H

  63. 1 r8 [( J2 g( F6 P
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: ~2 Y6 x' a2 E) _4 V' J2 M
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ \# g% \" H, \/ ?* [
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- t( i3 \7 I; l* X) c

  67. 9 N  F7 _  V4 x; _# S
  68. dma_addr_t dmaphyssrc1 = 0;, S1 L9 }0 X6 a5 W! v  [2 ~6 I* N
  69. dma_addr_t dmaphyssrc2 = 0;
    ; d$ Y' c7 V2 M
  70. dma_addr_t dmaphysdest1 = 0;4 j* U& K8 A1 S" m
  71. dma_addr_t dmaphysdest2 = 0;
    : |4 N7 u! Q1 j4 ~

  72. 1 M- j: M8 U6 m4 B
  73. char *dmabufsrc1 = NULL;
    / f; m6 s9 L1 E6 \
  74. char *dmabufsrc2 = NULL;- Q  j, Q; K- b, J( q+ R
  75. char *dmabufdest1 = NULL;
    7 h* V8 z( p) g+ H6 A
  76. char *dmabufdest2 = NULL;
    - N7 H3 E& m% \8 c- _+ V

  77. % S/ w( Z0 I; i, Q1 s" `0 \
  78. static int acnt = 512;% B: l( E0 k- u, W
  79. static int bcnt = 8;
    9 D7 Z7 Z+ k# u+ f, j0 H
  80. static int ccnt = 8;
      |, F9 e8 R( E7 {2 ~2 Z, \
  81. : d( |! o+ g0 X- V
  82. module_param(acnt, int, S_IRUGO);
    ! E8 e3 D" ^" D+ b( ~0 n3 t
  83. module_param(bcnt, int, S_IRUGO);; [$ L+ k/ d( O4 X( a) a, A3 b' ^/ f
  84. module_param(ccnt, int, S_IRUGO);
复制代码
7 n/ y9 X; P7 h( z. t1 O8 q8 b& G  Y
' R( M9 Q1 M4 N( p5 _% i
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用  m$ w. U$ E3 G; t6 e/ j
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 A. h! Q8 u4 {, R6 m* ~! Q" ]$ F' \     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 ^3 Q5 p6 l4 |: f& v1 Z* M2 f5 v3 y) n
( b: J7 i2 J* T( ?* l1 j
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

点击跳转“创龙科技服务通”

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

GMT+8, 2026-2-3 00:48 , Processed in 0.037082 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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