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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + ?' D, F4 o) R1 I
  1. [code]EDMA sample test application
    % R: M4 s) Q+ D% Q. i$ G3 X0 X2 I
  2. /*& }; N- r5 t0 ]$ v% O( q
  3. * edma_test.c
    # a5 ^0 c( }4 g' f( J* h
  4. *
    ) `; s& ^* f* O# l2 v
  5. * brief  EDMA3 Test Application
    ; W6 n1 L. \5 H5 @2 n
  6. *# u0 J2 t6 d1 H1 |- F; g) j8 a# c$ k
  7. *   This file contains EDMA3 Test code.
    5 }" Y- r8 w# F2 k* R
  8. *6 H1 {) j/ Q0 W! q7 q2 i8 G8 C9 e) W
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    % P8 f8 b4 S% b
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & p5 q( Z% F/ e0 K7 |7 ]
  11. *         TO CHANGE.
    % H+ @+ d! Y" h
  12. *. a/ D/ N0 a: c$ M& `
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 W& v8 s( p& @5 `* |# \$ j0 a* b
  14. *7 Y5 x, {+ p7 k
  15. * This program is free software; you can redistribute it and/or
    2 J* {( U3 C- N6 J6 |
  16. * modify it under the terms of the GNU General Public License as
    ( y" @. ^/ G  r- V! n) _5 R
  17. * published by the Free Software Foundation version 2.4 h+ r7 j4 G$ h
  18. *+ D& D  \- ~$ B+ M1 u8 W
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any% W9 W& Z3 o! C/ [
  20. * kind, whether express or implied; without even the implied warranty
    3 @8 w0 K5 \5 B' d( Q$ o( w
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * g5 i: T6 j7 A0 g) a$ X  x% a
  22. * GNU General Public License for more details.
    3 H( J, M8 p  I$ q" b
  23. */* d& k9 @  D5 k2 C$ J, |
  24. 4 A8 [9 A' O: @4 n
  25. #include <linux/module.h>+ x* [3 O9 V* V* }; w$ p
  26. #include <linux/init.h>
    ; t$ f+ M$ F( @: ]1 C0 l0 h9 f$ ~
  27. #include <linux/errno.h>
    2 ^7 v" V6 {: @- {
  28. #include <linux/types.h>
    0 x0 M9 d* g# L1 V6 ]9 S
  29. #include <linux/interrupt.h>/ G4 K) z9 ~7 D* M1 `& ^
  30. #include <asm/io.h>
    $ F( l1 ~0 o. g1 j; e* U5 {4 ]
  31. #include <linux/moduleparam.h>& X3 h& {6 r* N5 P) K
  32. #include <linux/sysctl.h>
    $ ^  d+ V( ?& b/ I" y, k. P
  33. #include <linux/mm.h>8 m, x8 C$ t5 |- u
  34. #include <linux/dma-mapping.h>
    9 j) \1 C9 \: ^- k
  35. , H6 M2 |2 H( n! e0 y" W
  36. #include <mach/memory.h>
    ( w) O# R0 w8 ^4 i/ u1 w2 I8 b* m
  37. #include <mach/hardware.h>
    3 S7 j' ]: U0 s; j1 P' \
  38. #include <mach/irqs.h>2 C: `3 M7 H  l' H  M' Y4 F% }! h& Z' {
  39. #include <asm/hardware/edma.h>
    7 U8 i0 L! o: G, r! C+ R

  40. : ~* D5 _( f2 c* i# B& R; C/ S% m
  41. #undef EDMA3_DEBUG: a1 @7 p4 S6 T! `
  42. /*#define EDMA3_DEBUG*/5 A( x' u, a' n# Z3 `, T! d4 m

  43. 8 y6 I; q7 c) e1 D
  44. #ifdef EDMA3_DEBUG" }. |7 v0 U; g4 H; E
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    4 l" G) h; m( J
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! z! S6 y5 z$ ^
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 f9 I' }9 @  f' d# ~6 M
  48. #else. l& @8 h7 Q7 }
  49. #define DMA_PRINTK( x... )4 _8 c1 D5 w' X) Z5 I% u
  50. #define DMA_FN_IN
    ! `7 b/ a4 J/ C2 J8 `- ^1 P5 c4 ^5 C
  51. #define DMA_FN_OUT
    9 G' I: i8 [" Z: B# n
  52. #endif% I8 M7 N" G, t  n: n4 H$ D
  53. * X% s/ b' h6 R7 _) w
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  _: u! c' K  Y& }+ [+ X: O
  55. #define STATIC_SHIFT                3
    1 A! k7 [( [* a& E3 D" M6 g
  56. #define TCINTEN_SHIFT               20* ?- V/ \9 N; ~7 K
  57. #define ITCINTEN_SHIFT              21
    # K% a! a" N+ V
  58. #define TCCHEN_SHIFT                22" G4 E7 h; u6 F5 f" G2 D, G
  59. #define ITCCHEN_SHIFT               23( ]' E6 T1 y6 U4 |
  60. 2 Z9 f8 s, t: C% _! C
  61. static volatile int irqraised1 = 0;
    ) ~5 w1 ^6 V1 k3 T) J
  62. static volatile int irqraised2 = 0;
    7 {" X3 R4 Y, T9 N7 S/ T% x7 ^7 ]% r. n

  63. 0 ^! l/ U8 v8 X! ]
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 U; F7 h' E$ O. X" {" g
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 I/ |/ E0 w( _. V3 ~+ Z! J
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 D) q) @. j, F$ Q9 o
  67. & x3 s7 J( o' v* b( ]! y
  68. dma_addr_t dmaphyssrc1 = 0;
    1 f- x$ l# ^+ c) w9 g/ Y
  69. dma_addr_t dmaphyssrc2 = 0;
    / o% H% B8 L% h! A. T! F
  70. dma_addr_t dmaphysdest1 = 0;7 n' O3 t% S7 K: H2 c' l; {
  71. dma_addr_t dmaphysdest2 = 0;, @. M. B2 Z' M* ]- [

  72. : Q  n! b) B( D0 U
  73. char *dmabufsrc1 = NULL;
    , ]5 ^- j- g$ ?4 ]4 `
  74. char *dmabufsrc2 = NULL;( f, ]" J* `) H3 P) c
  75. char *dmabufdest1 = NULL;" [  H: }; |3 r. u5 K, l1 F: V3 n# k
  76. char *dmabufdest2 = NULL;' s8 D& v1 \, B3 `

  77. 6 r# Y+ e* ]  U' g1 S0 I
  78. static int acnt = 512;
    * a) X+ R7 u- i& J2 j8 b, U
  79. static int bcnt = 8;* O3 z7 E1 Z; b- M% I5 P9 B
  80. static int ccnt = 8;
    + }) M  A" I( a/ Y' p2 c) W
  81. ' A/ b; a" b3 L8 F' E
  82. module_param(acnt, int, S_IRUGO);. g- o. r( R: P; y  V' ?0 e
  83. module_param(bcnt, int, S_IRUGO);
    % N# T% W8 J! Q- g, e' G& ?' `: D* E
  84. module_param(ccnt, int, S_IRUGO);
复制代码

9 h  Y  v9 H* f( G) ~- T, G( @! A1 `+ @2 D4 I
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 Q" y8 I  j: V6 f1 P* 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ N3 I- z2 s; J# j; s6 G: P% f# J7 c     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# G- m9 A; `0 [1 d  V. {" n) r! p" A# F

; h! A; O3 Y/ d0 a9 O+ Q) g: }' u# e# \# K1 s
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-3 07:46 , Processed in 0.040586 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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