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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! j5 D1 x/ f5 l6 b1 ?- I" [$ u
  1. [code]EDMA sample test application
    2 ~+ M6 B: i. ^! T
  2. /*
    * h- U- V* z( B- X) H0 f& q
  3. * edma_test.c
    7 r! S# l* @# [" O9 }& u- C6 j" A  M
  4. *
    - a2 i' n; W" h' N% H: j
  5. * brief  EDMA3 Test Application
    , V. p- D" n2 C  J4 @# `5 j
  6. *4 u" w* u" y; @/ L+ G) c. S
  7. *   This file contains EDMA3 Test code.  ?& V8 M1 B+ D0 ~
  8. *
    2 X# {4 Z. K" v4 c7 p
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    9 z0 Z' F+ V* p7 ^, C
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 O+ w0 k/ h3 l- `9 u
  11. *         TO CHANGE./ X* b% Q6 |; _! k
  12. *6 z9 H' y. L9 f; A8 A" Q8 S( b/ r
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. q9 L; s! x3 \5 E4 a: p
  14. *
    4 d. K" C7 @/ c* q- p
  15. * This program is free software; you can redistribute it and/or
    $ A) }' ^' y& T% B* W
  16. * modify it under the terms of the GNU General Public License as$ i; [( ~# C- a# u! a: e
  17. * published by the Free Software Foundation version 2.8 K5 b( `5 [: C) v
  18. *
    $ A; F( Z7 Q0 F/ Q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    " C' l' V$ m6 A' M! [) C
  20. * kind, whether express or implied; without even the implied warranty2 W4 S) _4 v* l
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    " [3 M- T5 f- L% U" w
  22. * GNU General Public License for more details.
    $ |+ q+ m1 }& G: s
  23. */
    ) `3 V0 G) `, g8 f7 Y  p% G. \
  24. ! z& b6 j  R# Q
  25. #include <linux/module.h>
    % R, L: z, {! c* x
  26. #include <linux/init.h>
    7 w, i8 |! b4 x9 ?2 D9 H# \9 Q
  27. #include <linux/errno.h>4 [( A! \( R1 v8 S4 p2 n$ ^1 U
  28. #include <linux/types.h># i( s5 b# f8 h, u( a! m' i
  29. #include <linux/interrupt.h>" }. [8 _. N! s! L% c/ p! ^, W+ n
  30. #include <asm/io.h># k% N/ j/ E& P+ Q) S2 y& q
  31. #include <linux/moduleparam.h>2 H, I/ _5 e$ ~9 X
  32. #include <linux/sysctl.h>
    ! T- L, w4 T  w
  33. #include <linux/mm.h>
    & y) A! J+ F( V: v/ B& t' d/ h
  34. #include <linux/dma-mapping.h>
      z5 K( L5 |, [- Y
  35. " P8 L  N7 K" s$ ?- Y
  36. #include <mach/memory.h>
    8 t2 D+ W' k- z" A2 q
  37. #include <mach/hardware.h>1 s- S4 A0 b+ a( ?2 x! A  u
  38. #include <mach/irqs.h>
    . M0 Y  ]# z& L% E& a$ {8 z
  39. #include <asm/hardware/edma.h>5 S4 P; D$ T6 `. O
  40. ( A! h9 r/ J9 W1 t; T2 G6 H
  41. #undef EDMA3_DEBUG! O- x: V; j) Q+ X. k$ {/ \+ M
  42. /*#define EDMA3_DEBUG*/
    3 W8 L  s4 S/ f. ^7 J2 Y
  43. , I  x+ K4 b" f4 f
  44. #ifdef EDMA3_DEBUG
    ' T# D) q1 ?9 ~' H5 t
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' d8 p/ @. R2 U; M
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    3 X: `- }- V6 t# I8 p- J( N6 `+ I* s1 ~
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 d3 W) O. C. H2 ^5 C
  48. #else
    , j- b) w: c. V
  49. #define DMA_PRINTK( x... )
    $ q6 ~, e' X, ]
  50. #define DMA_FN_IN
    " H9 j; ?7 I7 |8 ], _# K9 \
  51. #define DMA_FN_OUT. E) }" j  j/ R* n6 ~9 X* ?2 a
  52. #endif/ \; }' U1 U: e; ^% r

  53. + l- t5 x6 Q9 t; u; e. l: s/ h5 c
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 G  e- E9 m, \8 a# t# P& O
  55. #define STATIC_SHIFT                3/ Y, U6 R% q' T. r7 t; r
  56. #define TCINTEN_SHIFT               20
    ' `  _8 H- P9 o) {5 o6 |9 Z
  57. #define ITCINTEN_SHIFT              21
    / f/ }1 l+ f/ g' g1 q
  58. #define TCCHEN_SHIFT                22
    8 H/ O7 F/ p* V6 q) _8 z
  59. #define ITCCHEN_SHIFT               23
    4 T/ @- ^8 D. [4 D. n
  60. / D% a/ \3 u, E4 W
  61. static volatile int irqraised1 = 0;* h% M1 m! p# ~! k' z: l. K
  62. static volatile int irqraised2 = 0;, X4 m" t3 {0 x2 l- x

  63. 9 _2 W- x9 M4 [/ E- k& e
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ W6 n( F. _: w2 o# t+ [# K  J
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: ~- }9 j" A1 H5 ?7 o7 Q: S
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 \+ e" ^) d& W3 R6 L) X

  67.   T$ Q( M) U1 b7 D) V. B
  68. dma_addr_t dmaphyssrc1 = 0;
    * F3 i) U* {- m# d3 \
  69. dma_addr_t dmaphyssrc2 = 0;
    ' a$ w; d" W  T0 ]) ?
  70. dma_addr_t dmaphysdest1 = 0;
    ' @$ ]4 R7 @; N
  71. dma_addr_t dmaphysdest2 = 0;/ y) A, I% U7 \. g

  72. ) z- Q# q$ M1 H. J/ x. Q
  73. char *dmabufsrc1 = NULL;
    ) D+ \- V# J) V3 W* G) A9 v" c0 h' S
  74. char *dmabufsrc2 = NULL;
    & K. D7 C- G' O& w+ @2 s1 c: R! D
  75. char *dmabufdest1 = NULL;
    3 W) v6 q# Q! }# _& D( Y
  76. char *dmabufdest2 = NULL;! F5 T/ {8 a  h8 l  p

  77. 8 J4 J% o+ l+ B( s, q! f
  78. static int acnt = 512;6 t4 {7 x; E8 q6 j
  79. static int bcnt = 8;
    5 e3 _2 a8 L9 l
  80. static int ccnt = 8;% w- N2 v6 C! n; i/ d( _
  81. 3 A; e- M5 a, R5 d. c
  82. module_param(acnt, int, S_IRUGO);% @- b  p! u: N; d& x  v, S
  83. module_param(bcnt, int, S_IRUGO);4 H; g* r9 D- ], e  \+ a8 ^
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 ?- m& P. b0 ?) l5 a6 l) i
7 T) ^0 |7 P7 m  E1 y6 y
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( p+ X* g; w8 g' A' V- z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ @: s% D$ \& Y" h2 h     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) ]* U; G0 S8 g1 T' w4 r8 s( v# o0 h; k# z5 g7 L
7 L" s4 k' I) G* @& Z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-1 14:30 , Processed in 0.037953 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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