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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / L& E! Q" I7 ?( l
  1. [code]EDMA sample test application! b9 Z, i% @# _# A0 i
  2. /*
    ) K# h0 Z5 K! p( [0 O7 ~
  3. * edma_test.c
    % c- j2 v- ?2 L' t
  4. *
    / S. l$ s8 j: F
  5. * brief  EDMA3 Test Application
    . ^& E. n: T9 \
  6. *
    % y$ R$ ]/ H$ h) j; ~4 ^
  7. *   This file contains EDMA3 Test code." k  b  ]& O/ _3 d; N  ?- y
  8. *. O9 _* @; J, m/ K' e
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    , w$ |6 Y2 n: E9 h9 B: ?
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 y% P# {5 f& s3 r
  11. *         TO CHANGE.$ y# K9 r1 r1 y8 G: [
  12. *6 `' H* ?9 s' V* p0 R1 ~  r6 ~' q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ( X- `$ _- P7 L( t/ ~% q: q3 ]
  14. *6 U2 q, L3 o0 B; F& e
  15. * This program is free software; you can redistribute it and/or. {) `$ ]# ]& r, R8 [9 `
  16. * modify it under the terms of the GNU General Public License as
    0 Y% j! z( h, q' Z+ w3 x8 }
  17. * published by the Free Software Foundation version 2.
    7 ?& r4 ]5 {% {) F! Y9 ]
  18. *$ u# ]. _0 z1 }0 |6 Q' Y+ L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 f7 {( l% ~' ^, u5 g- a9 X
  20. * kind, whether express or implied; without even the implied warranty# a- k  \8 p- _
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the" k, I! ]6 q/ @1 r
  22. * GNU General Public License for more details.
    : W9 T' @8 g! i# }2 u) n" h
  23. */% A3 s9 {8 s' q4 a/ \& b
  24. 2 R: d6 ~+ w9 d" [
  25. #include <linux/module.h>" C* E3 C& o; ^  G2 G. G7 e
  26. #include <linux/init.h>' Y5 K; {" ^! z$ N% {1 u
  27. #include <linux/errno.h>* W0 i  u8 V  T8 U* _& g
  28. #include <linux/types.h>6 O3 ^6 U# F! [
  29. #include <linux/interrupt.h>
    : M! L  f. P, I  G( O4 R# R
  30. #include <asm/io.h>2 |2 T# H( W5 W4 [2 f/ m/ {  B0 \
  31. #include <linux/moduleparam.h>/ l8 T: T8 D) V, a" f
  32. #include <linux/sysctl.h>
      P) D* m; J& W* p5 C8 K* }0 J  a
  33. #include <linux/mm.h>
    7 }6 W7 y, P+ w* `
  34. #include <linux/dma-mapping.h>" h6 }. P0 ]0 C2 C) H
  35. # g; S4 w* M! v3 `
  36. #include <mach/memory.h>
    9 |# [* S0 c) F( U# L$ }$ u
  37. #include <mach/hardware.h>
    / P5 w7 }) O; S, C
  38. #include <mach/irqs.h>5 ^* _7 U0 w' M. Y& ?
  39. #include <asm/hardware/edma.h>6 y; G3 Q5 z: X6 P& S* Q" o

  40. ' E1 L8 N/ G3 D
  41. #undef EDMA3_DEBUG( Q9 A+ ~1 Z: N, \% e$ [
  42. /*#define EDMA3_DEBUG*/2 u9 `% [. N. z7 k
  43. 9 S. Y; j" L$ u2 H) F
  44. #ifdef EDMA3_DEBUG  |1 H! T. T: l2 R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 v6 z: x' P; [( z) N1 V6 C
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    9 L  M. f; K' D7 _, r
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); A& u% e5 T" N9 W% |  A
  48. #else
    * A# h8 P  o( }) m
  49. #define DMA_PRINTK( x... )
    : C, b3 T5 O5 p, E+ m8 _2 ?
  50. #define DMA_FN_IN. ?. _, z+ s6 r$ c" n+ W
  51. #define DMA_FN_OUT
    + O& h5 ^* c/ F- }
  52. #endif
    ' y! P0 ]; k3 H+ ?; R- x

  53. 2 Q9 P4 w9 d6 f) T5 Q( {5 C4 ?
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 n1 H" P" j/ _+ C; @
  55. #define STATIC_SHIFT                3
    8 e, y/ k# Y. A* P+ C. F
  56. #define TCINTEN_SHIFT               20& ~* f4 B' g* [( d
  57. #define ITCINTEN_SHIFT              21
      {3 B8 n+ c. _
  58. #define TCCHEN_SHIFT                22
    + s) j$ Z4 Z0 P8 I' G0 z
  59. #define ITCCHEN_SHIFT               23( u7 Z- c. }) q$ m3 M

  60. 5 o# v* L1 Y+ t) q* ?& ^5 y( y
  61. static volatile int irqraised1 = 0;0 E3 i  j0 Y0 l% K
  62. static volatile int irqraised2 = 0;5 E2 T) B, h4 b8 b" Q# m4 Y

  63. : _6 N+ X* `' ?* b8 K- Q+ U: r
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # f4 h" L" A. F& t# Y* c" D! R* F
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - e+ b5 R+ x1 ?: b9 K. S0 ^- s: N
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ Q* T( N' N& s& l, d+ J1 u
  67. ' [. ?" v7 e6 v; j) f
  68. dma_addr_t dmaphyssrc1 = 0;
    8 t7 ]2 G  W2 }9 X8 t, Y8 _
  69. dma_addr_t dmaphyssrc2 = 0;
    & S  P$ @& `/ F9 W2 B
  70. dma_addr_t dmaphysdest1 = 0;  d. m/ Q' x1 r  _  }: M
  71. dma_addr_t dmaphysdest2 = 0;
    7 w2 _- B' X' q8 Q

  72. * x, ?) `2 n' o" Z; n( [  [) v5 f
  73. char *dmabufsrc1 = NULL;
    - v5 P( t: U" q9 ~9 t! A7 P- E" c
  74. char *dmabufsrc2 = NULL;
    6 C) n1 i8 e% i
  75. char *dmabufdest1 = NULL;
    ) q* E0 V; ?4 u, ?5 r. _! ?# A, K9 l* C
  76. char *dmabufdest2 = NULL;
    & H! w9 d3 |1 W5 P. T* s, E5 g
  77. $ h7 s7 J" z  C) o, g7 g
  78. static int acnt = 512;
    & F$ Y  C/ S+ b( w% x
  79. static int bcnt = 8;
    % i2 d0 C' r  S1 M
  80. static int ccnt = 8;& V0 w0 {% E) E/ i7 V
  81. # ~4 r7 _4 Y6 g+ t! w
  82. module_param(acnt, int, S_IRUGO);
    $ L3 u* E/ ^& i
  83. module_param(bcnt, int, S_IRUGO);5 X8 U0 j$ o  j, h8 F$ m  n
  84. module_param(ccnt, int, S_IRUGO);
复制代码
+ t# ?/ K& R7 }& v; Y# C

" {. j2 |0 U$ w! P1 I      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 \9 g/ W0 c& oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! n$ q+ d' I% n
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 f9 i4 K8 p1 ~+ w2 X+ f8 @

+ \1 i' B& _( i/ d
2 r8 }: n/ b3 L9 ?$ ]9 _
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-10 08:32 , Processed in 0.036985 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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