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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ m; @, m! Y( a& q( d; _
  1. [code]EDMA sample test application
    / _4 \* U9 W+ `: L
  2. /*! o; ^: E6 |: q# x, c0 l
  3. * edma_test.c9 {: q4 g. U8 a1 I+ _( [1 I4 ?; ?
  4. *1 _. Y, z4 R  w: Z
  5. * brief  EDMA3 Test Application4 ?5 p, ~0 B# `) k
  6. *
    3 i+ A* d  R9 h8 s$ ]4 [  I! b
  7. *   This file contains EDMA3 Test code.# t4 W/ s3 U- {% A  B3 e1 r
  8. *" r, Y! A6 a2 @* |2 j* n
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: F3 l7 R6 r" H" T+ Y/ [
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( E8 C5 x9 v8 m
  11. *         TO CHANGE.
    ' O  x& q0 r. O7 |5 C5 J* R
  12. *
    $ {4 `: B, _* l/ @5 V& ^6 O' g
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, t$ H" S; s& f* [+ ^2 b4 f+ F
  14. *
    & U* `) v$ k: Y' @# T
  15. * This program is free software; you can redistribute it and/or
    8 s" u* t2 T5 C
  16. * modify it under the terms of the GNU General Public License as
    , H0 ~' F& X- ~/ V! v
  17. * published by the Free Software Foundation version 2." ~9 b! _" L4 D; `* P; Q8 j
  18. *
    % @) z* e" j. l% w# g9 p" F
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; p) [- D1 ^0 P6 z: g- \
  20. * kind, whether express or implied; without even the implied warranty
    2 v8 c# a% m. z3 v/ h* m
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ' C1 _# _6 u  _6 p
  22. * GNU General Public License for more details.# N: x, L6 d% B! q( j, J
  23. */
    " t: h: {- @3 ^5 [' A, }
  24. ( Q! ~$ k! P6 I' D; R" j
  25. #include <linux/module.h>% V6 N8 t5 u% d
  26. #include <linux/init.h>9 k) A4 H, T" p; _# A
  27. #include <linux/errno.h>
    0 H: h% ]$ o8 |  j  J
  28. #include <linux/types.h>
    ! w# x0 v, `. i; z+ u. y
  29. #include <linux/interrupt.h>
      \, u' h5 f  N2 K
  30. #include <asm/io.h>
    : c6 f6 m* @# @8 [( z
  31. #include <linux/moduleparam.h>3 Z; X* C0 P) i! P, V
  32. #include <linux/sysctl.h>2 N6 u6 ?; e+ C  @! R0 j
  33. #include <linux/mm.h>( \5 |) J, K0 }- ]! q8 c
  34. #include <linux/dma-mapping.h>
    4 N6 j* e2 o$ M

  35. * G0 v5 X+ J7 q" v; u
  36. #include <mach/memory.h>
    + w. [8 v& p; V' j4 b, W
  37. #include <mach/hardware.h>
    2 C2 f+ _) H, p- K( B& C
  38. #include <mach/irqs.h>8 ]6 L7 P  D  O2 ~
  39. #include <asm/hardware/edma.h>
    % N4 \* w8 A3 o: r; \" ]4 I. A1 Z

  40. $ D- t4 w: {) M
  41. #undef EDMA3_DEBUG
    3 p1 {: h. R/ I: g0 v1 E
  42. /*#define EDMA3_DEBUG*/; E& q4 E1 Z. D. I: ~% z, H
  43. 9 Z8 L2 q, a" Q% m' P
  44. #ifdef EDMA3_DEBUG  [* d. V# \1 ~
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); G3 I$ U5 B: t7 C- Y8 I* O9 Q1 M
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* @6 _( X! p; q$ Q" w
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ d3 {" `& w# K# e- A5 Y1 ^
  48. #else: X7 W) B' E& n+ P  D+ ~
  49. #define DMA_PRINTK( x... )' c1 d2 Y& i% D' _% n
  50. #define DMA_FN_IN& S  M6 `. ^5 w2 o% p0 X' x0 [
  51. #define DMA_FN_OUT  M# x! ^2 x0 d% N; S
  52. #endif- r: A* U9 D+ s8 E: `
  53. * l. y: u6 q, m: S% ~
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    $ R! D& @9 ]2 x2 n3 O1 ^' B- V
  55. #define STATIC_SHIFT                3
    0 _3 z  y9 R. D/ _! Y/ ]
  56. #define TCINTEN_SHIFT               203 z( e% q, N& j) V) u
  57. #define ITCINTEN_SHIFT              21
    1 b7 L6 w" z9 ~/ P( I2 K. _
  58. #define TCCHEN_SHIFT                22( s$ `( c4 V% F7 W0 b
  59. #define ITCCHEN_SHIFT               233 U0 T( U' ^+ i3 x. r8 `
  60. 2 U; Q3 b, I) A& {# F$ o1 X
  61. static volatile int irqraised1 = 0;5 N  |) @8 n) q$ W0 I+ ^
  62. static volatile int irqraised2 = 0;
    2 D' O! g9 `- [

  63. - Q4 Y# C) @9 q; y  F
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ [# d& q( R; l. d0 h
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 _9 }( \* N: s% f/ M4 e* ~
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 x2 F1 q- n) R- g* ?

  67. 5 E: U6 j' W* u: h
  68. dma_addr_t dmaphyssrc1 = 0;
    6 P7 k' D0 w- x; c
  69. dma_addr_t dmaphyssrc2 = 0;7 c, W2 ]+ u! s) M: L5 K" c3 N! Z( A
  70. dma_addr_t dmaphysdest1 = 0;1 T( e/ k& {- D: Z
  71. dma_addr_t dmaphysdest2 = 0;
    * l% F: h, ~6 h( J1 \4 q$ P/ E
  72. 6 A2 p, R, L5 r2 a
  73. char *dmabufsrc1 = NULL;
    1 V. Y9 D# U" F$ B
  74. char *dmabufsrc2 = NULL;. [: E, J! y  G5 }  D2 O
  75. char *dmabufdest1 = NULL;
    : I% d4 H, J+ l1 u7 @7 F
  76. char *dmabufdest2 = NULL;- Z, @3 L# W* \
  77. 2 {0 E8 D( \) [6 G1 }5 X- C
  78. static int acnt = 512;7 R( C6 s, M3 D, T9 C
  79. static int bcnt = 8;  p0 k& J8 P1 s( J% [' K
  80. static int ccnt = 8;
    ( a4 R1 L0 s/ A, F, g$ ~8 v7 S. c% v
  81. 0 x) k' X% F6 ?. e* c+ c
  82. module_param(acnt, int, S_IRUGO);4 n2 ?2 y. d! }7 j5 Y
  83. module_param(bcnt, int, S_IRUGO);
    ; {7 o3 `8 O) S1 r: B- y
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 x2 i; @3 Y' _1 v
9 ]( }+ i2 z8 T5 K0 b  X8 @" `5 k
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 H# \5 ^8 s7 N  |
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: k/ B. `, Q( W* _
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( ~9 ]/ a! ~4 O0 m2 t! ?9 w- y) @& Y/ w; t
  F: s% P: P4 @5 x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-20 05:00 , Processed in 0.040171 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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