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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 N7 O3 d; U2 q! ?2 P2 W
  1. [code]EDMA sample test application
    / R. h# |0 ^0 w6 M% U2 x
  2. /*
    - e% A$ E' q& F0 Z
  3. * edma_test.c
    ) x2 Y) [$ l6 i3 D$ \; `& Z
  4. *2 K$ p6 Y5 h- @
  5. * brief  EDMA3 Test Application( r9 R; l8 E. l% r- @+ t* x' [! Z
  6. *2 ?% s( V( Q5 L5 b2 M, Y( Y
  7. *   This file contains EDMA3 Test code.
    3 `9 b$ V" A8 b  K4 L$ C( F
  8. *
      a- y; U* ?0 a
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ) ^+ `% X! t* j7 T& X6 X
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    8 M( l/ R8 c; ]5 }- m2 u
  11. *         TO CHANGE.
    ) j# W7 `2 g$ ?( m$ l5 I; ?
  12. *: h% F0 k/ b: w" Y  L
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ _1 {9 C) P9 @( R
  14. *1 W& d; ~$ J  u# J9 {
  15. * This program is free software; you can redistribute it and/or' x! ^$ a4 D  g
  16. * modify it under the terms of the GNU General Public License as( P+ v, U( X0 B
  17. * published by the Free Software Foundation version 2., q0 ?4 o4 h! w# I9 N
  18. *
    . c; _* Q/ F' M6 x; _6 G) ]# i
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 M' M+ v5 w; J
  20. * kind, whether express or implied; without even the implied warranty/ K( B) k+ S0 }
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + ~7 ^0 v& I  x8 r4 m8 z$ C
  22. * GNU General Public License for more details.8 X: b* q3 V4 S* p( x% T+ x
  23. */! c0 h  _2 _4 o! e7 x: a8 \3 J# r& f' }
  24. 3 Z! W+ }6 v* e2 R+ N5 L
  25. #include <linux/module.h>4 u/ h. T' U: J# ?) I: I2 H
  26. #include <linux/init.h>
    $ f* ~3 x( V" J) h7 v6 u8 i3 T) b+ W
  27. #include <linux/errno.h>) q. ^4 ^5 v4 i, P
  28. #include <linux/types.h>0 V# W1 S8 z* w- p, |* L/ Q8 H+ z
  29. #include <linux/interrupt.h>8 H, {; ]0 Y7 x  E9 W1 h
  30. #include <asm/io.h>
    $ h2 F% Y! ~% p- a- X4 H" v( S
  31. #include <linux/moduleparam.h>
    + J: f- T$ j: v8 s
  32. #include <linux/sysctl.h>9 H0 D3 i, I/ e  [
  33. #include <linux/mm.h>
    9 q( X; S8 R, Q+ l$ G: ~% M
  34. #include <linux/dma-mapping.h>
    1 ]9 ^, _& S! P7 ~; `5 a! \: _
  35. 7 v  q% @9 w& W5 h+ h& x/ V5 Z# S1 }
  36. #include <mach/memory.h>1 J! S5 B0 ~' u4 a8 X
  37. #include <mach/hardware.h>9 E0 E5 h) Q  r
  38. #include <mach/irqs.h>) Q7 N; H! J; _2 A
  39. #include <asm/hardware/edma.h>, z& ?( U4 J! M. U) d" _  S
  40. $ ]% X/ _" E/ p8 o
  41. #undef EDMA3_DEBUG8 l" n; L+ p7 X7 p- G
  42. /*#define EDMA3_DEBUG*/& w( {# n2 q! x5 @9 [5 a

  43. ! L6 S; A( e+ \9 j" T4 _: ~* M
  44. #ifdef EDMA3_DEBUG
    0 `  Y6 l9 h, k' Q- U1 v& E! W
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    + W, ~# q' o& I  Q# a7 F( c* d5 S* B
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 X; D4 O; b! H+ X
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# \: I) a- r8 r- o
  48. #else
    8 W" f: e( M; ?+ X# `% f- S
  49. #define DMA_PRINTK( x... )
    # Z- V8 n* Q7 u0 D
  50. #define DMA_FN_IN
    1 p, Z1 J2 i  q5 ~, ~/ S
  51. #define DMA_FN_OUT
    9 k7 ^1 M2 \- F+ `3 }
  52. #endif2 O4 v8 _7 e8 A1 [8 Y4 p
  53. 0 S+ t2 S$ M$ D( `( k
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    9 s. x7 F% b$ c% ?% s' N4 j
  55. #define STATIC_SHIFT                35 H  V0 ^- @% q+ t& B, ]
  56. #define TCINTEN_SHIFT               206 e/ ]0 [0 }; Z/ z6 e1 S! w+ E
  57. #define ITCINTEN_SHIFT              21
    " |5 o' ~4 E( M  u' S
  58. #define TCCHEN_SHIFT                22# h- S+ s* U6 i2 E; `' v
  59. #define ITCCHEN_SHIFT               23' K+ f) N$ U9 ~2 n2 z) ~
  60. . @, E& [  T4 f* _$ x. l& X
  61. static volatile int irqraised1 = 0;' d# j5 Q, |0 W/ v, g
  62. static volatile int irqraised2 = 0;4 q# R6 p7 i, G' j

  63. : k+ b! v: ~$ O; K' c
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, t/ e+ U, Q; v/ J7 k1 T
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , s/ j1 q3 F4 u4 [6 {- ?
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # v$ C& g( l# e. V8 b* e: k

  67. ) r7 F8 a( T# k9 j
  68. dma_addr_t dmaphyssrc1 = 0;
    + x/ d0 V. u2 L# X
  69. dma_addr_t dmaphyssrc2 = 0;
    " z( X7 t6 a' z5 t& f, Z
  70. dma_addr_t dmaphysdest1 = 0;  ]4 m9 s& e% k1 ]  q2 p$ W
  71. dma_addr_t dmaphysdest2 = 0;0 c( D/ i2 T4 G, o: T/ Q- Z
  72. 4 R# m7 U& M, M+ i  c8 g
  73. char *dmabufsrc1 = NULL;
    % d* F  `- q8 A  D6 b, m# B
  74. char *dmabufsrc2 = NULL;
    $ _2 V/ E; f$ T$ |$ Q
  75. char *dmabufdest1 = NULL;
    % q$ _" X" ~" V5 C' S1 ?3 O
  76. char *dmabufdest2 = NULL;
    8 L5 K7 J, n; F* a
  77. ) I2 ]: o4 O  u2 H6 ~% ~
  78. static int acnt = 512;2 P& B6 h. `, ]8 _+ {: Q8 T* `
  79. static int bcnt = 8;
    : G) P* ~0 [+ h  E
  80. static int ccnt = 8;
    9 P) ?3 W+ M3 d5 D# t1 r' {

  81. / C# T. z( F$ k$ d8 i0 ]
  82. module_param(acnt, int, S_IRUGO);% g8 g( P- @$ B) F, A
  83. module_param(bcnt, int, S_IRUGO);
    - |. q/ A; u+ K8 N. H* [
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 u" X4 s  G, ~1 |( x7 j
" n- z  e1 u' ~- c. f) g
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' d: b. ?" Z8 f8 barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" T+ E& e7 ~; k# i3 Z8 h
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% ^3 w7 r2 K) R( e3 w5 k, i9 n: ?- s# N4 A
% Q$ g1 T6 q" w6 B' o" G* E% F
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-16 20:35 , Processed in 0.040671 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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