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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : B& L- O/ J6 r: l6 [& I
  1. [code]EDMA sample test application4 \6 s( u, z5 S0 Y' i% M& H, ~  A. I. b$ p
  2. /*
    5 s. M9 M; k( Z2 k- M& t
  3. * edma_test.c8 o+ s6 {6 ]9 h. W* e% k6 U6 l
  4. *) x$ Z* q+ ?7 R( O
  5. * brief  EDMA3 Test Application
    : J) x+ ~. K2 M! R- ~& j
  6. *
    6 }1 \; U9 E8 k! h: _8 {( {
  7. *   This file contains EDMA3 Test code.
    ' F8 h- J+ n! i* [7 r4 u. L
  8. *
    / ~4 x$ D1 |0 m% t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ) `2 h! Y% l5 B( b
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    " \; d6 y+ O9 M' a* q" ~) R5 ~
  11. *         TO CHANGE.
    / y8 ?2 ?! f; x3 J& S# G0 [# J
  12. *
    $ W7 `  ~  H9 X9 ?
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 y2 s: m5 ^. ~) d9 O: I: ]- H6 @
  14. *4 F& Y  h2 q( g6 s* O
  15. * This program is free software; you can redistribute it and/or
    + x2 h/ Y6 G$ R% z! c+ v
  16. * modify it under the terms of the GNU General Public License as
    1 j9 ?9 L% y8 ]. H. d% u3 ~; u! ~
  17. * published by the Free Software Foundation version 2.
    ! Y- W* }; {7 i5 X
  18. *
    5 S4 d# d+ M2 s; ^3 \
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    * [7 n% N  u' G% B0 x( ^; R
  20. * kind, whether express or implied; without even the implied warranty- W" K% E6 w' x' j
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # g! R- s5 y0 P) @" x
  22. * GNU General Public License for more details.
    ! p: J1 i8 y+ Q8 [
  23. */  e5 x; P3 ~& d# o8 j

  24. 3 I$ ^0 M3 }- F: g) U5 G
  25. #include <linux/module.h>/ d# W# D$ \7 N+ y
  26. #include <linux/init.h>! Z8 [2 @+ ?- y- M" N0 P; {- V
  27. #include <linux/errno.h>
    ) n$ Y: h: R3 i) f* @, ^# F# b
  28. #include <linux/types.h>1 P2 G% P  X! t8 P' A! n
  29. #include <linux/interrupt.h>
    : a8 C  W/ X- J3 h1 w# \
  30. #include <asm/io.h>, _9 s( s4 g* O8 W/ h
  31. #include <linux/moduleparam.h>
    & X# N% {% M' C0 ?# t1 |, {6 ^6 X1 ]- T) j
  32. #include <linux/sysctl.h>' p0 E" V+ x/ p, |% l
  33. #include <linux/mm.h>
    * D9 ~* c$ m$ L. O4 [* B
  34. #include <linux/dma-mapping.h>8 s; i3 \& D( R+ o, r+ r; K- u7 O
  35. 3 A. Z: C3 b3 j) L8 _2 s
  36. #include <mach/memory.h># S2 `/ `, \, V; ~2 _4 k
  37. #include <mach/hardware.h>1 c1 p; P8 T% y8 B) f) U& d' Z
  38. #include <mach/irqs.h>
    : I  S6 |5 ^3 X5 ]
  39. #include <asm/hardware/edma.h>3 g9 M) v2 l5 @4 A* @; ^" S8 F
  40. 5 b* D5 t- R2 a8 N- f( X
  41. #undef EDMA3_DEBUG5 I8 T% w( g9 s. |; J# C( T: W
  42. /*#define EDMA3_DEBUG*// k& [% A. l# ]7 i9 e
  43. % _$ E5 k& k) ]* L* s
  44. #ifdef EDMA3_DEBUG: e. d5 _  f/ x( y+ m- F
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% A; r+ u3 I6 |1 K. w/ N( b. K. n
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    + G. E) [( [2 w- t* ^4 ^. |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    : ~& r! ]4 B! R2 F
  48. #else5 l' Q( g" x' o. J. e2 [9 y% E6 i
  49. #define DMA_PRINTK( x... )
    * L( m  }: o$ q+ _* T7 M* a1 F8 J0 J
  50. #define DMA_FN_IN
    + m: x  M8 r7 M! h: e
  51. #define DMA_FN_OUT
    / l# I" m3 Q% m, V. |* K; ~3 w
  52. #endif
    + ~! K* i& z& X

  53. : ~2 Z$ A- ~- S1 d7 M
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
      n0 n8 n+ k( w* o
  55. #define STATIC_SHIFT                3$ @0 R* M/ u/ O. x4 h- r
  56. #define TCINTEN_SHIFT               20
    7 G6 n/ V+ ^6 a- h' W) t
  57. #define ITCINTEN_SHIFT              21
    9 }3 B8 H: O2 a" m7 e, _( o2 H% S
  58. #define TCCHEN_SHIFT                22; j& `% @: `7 X: L0 N; |
  59. #define ITCCHEN_SHIFT               231 `7 m/ I* C% H9 F. A! ^5 Z

  60. ' r2 w2 ?% U' P! ^
  61. static volatile int irqraised1 = 0;
    ; l, N$ {5 x6 u
  62. static volatile int irqraised2 = 0;, U9 P* e5 j2 I" a

  63. ; c- t% I  T; x+ L
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . G$ t! @9 [0 @( w# d
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' Q- J9 d" T* J# ~, V
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* J  y; Q4 L. a. ~1 o

  67. & H+ ^& r! ^0 \2 z. g; J
  68. dma_addr_t dmaphyssrc1 = 0;
    0 e0 D1 U& Y0 X6 U- ^9 H6 h
  69. dma_addr_t dmaphyssrc2 = 0;
    & {- m" @( ~2 y2 i& \7 o
  70. dma_addr_t dmaphysdest1 = 0;
    $ ?/ k# X. x" S0 w
  71. dma_addr_t dmaphysdest2 = 0;
    % [+ t2 f& n6 O$ H) l6 R
  72. 1 Z5 Y  w0 E$ b/ K8 m& `
  73. char *dmabufsrc1 = NULL;
    % T, q1 ?5 g' F5 }  Y/ [
  74. char *dmabufsrc2 = NULL;9 j0 S) U: \2 F* ?
  75. char *dmabufdest1 = NULL;& ~  t, _) n! K. l9 F. b8 K
  76. char *dmabufdest2 = NULL;( s' D4 y! R$ v$ D9 b# E' X# u
  77. , u4 e2 X3 N' `9 r' S. f
  78. static int acnt = 512;
    5 b- N+ W6 I5 N+ u
  79. static int bcnt = 8;' R3 n5 P. n  Y1 t8 m( u# E
  80. static int ccnt = 8;0 S) T# k7 N4 X5 p+ H4 a5 x+ G2 F

  81. 3 t' L" s) P% L9 }2 K/ p% q  Q
  82. module_param(acnt, int, S_IRUGO);
    $ S" }+ G% W, x# G+ E, v! s3 Y
  83. module_param(bcnt, int, S_IRUGO);
    7 [2 \& K, y: b4 x
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  K9 i+ J* W/ Q
8 L$ k5 U' T, s3 m% B" e      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 I% y& I8 @1 Z! p! W" W
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ D. C8 e$ r3 a1 \3 Q& v
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, X( Z- z& H$ `- e4 q* H1 m

6 k# L" w0 z5 q  ^: f& ?: q3 F% R3 z7 H
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-7 19:05 , Processed in 0.038200 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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