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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' A, k! \/ L( G/ M
  1. [code]EDMA sample test application
    5 S! D* d6 I( Y( L
  2. /*
    $ z. l$ ]8 M7 }4 x2 H) n3 {
  3. * edma_test.c
    2 ]) U2 E1 `; f. l9 N0 ~2 T7 B7 d
  4. *2 q6 \/ g( l" [+ _2 g5 D* U) @& Y. L
  5. * brief  EDMA3 Test Application
    ' ~5 g4 _+ z5 q
  6. *: {8 _* i9 ]8 C% C
  7. *   This file contains EDMA3 Test code.
    5 C  T; T1 y' |* ^
  8. *  }2 J9 W8 h: [' A, S- l
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 b# h) X2 j2 G7 g, q) j* A
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    " C/ }' ?  x4 e: w, q
  11. *         TO CHANGE.
    $ y* w: r" C) F6 h/ G5 F- [' |) ?
  12. *
    % W! e$ w0 [8 }; L- l4 q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    : L# [1 }0 d7 |' O# e* k6 c( w
  14. *
    8 U. z) o4 O6 k& w/ F
  15. * This program is free software; you can redistribute it and/or& {/ T; d& S) [) z2 e* V
  16. * modify it under the terms of the GNU General Public License as/ ], k! s% I5 c
  17. * published by the Free Software Foundation version 2.
    5 ?9 Z" P) \0 \, O) s9 e" W2 {  D3 v
  18. */ y, C6 U3 T6 U. d6 @
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    2 F3 d6 d% r3 K  E) {+ z
  20. * kind, whether express or implied; without even the implied warranty% O# ^5 P; O. V, d0 x: p! t  o
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3 ~& |5 `) E" j& B
  22. * GNU General Public License for more details.
    6 n8 b9 u9 Y' A. A. W
  23. */3 B, a4 {, g) p5 ]" O" b) C% Z
  24. 2 W0 p( k7 b- ?; y5 L6 A# p+ Z7 Z
  25. #include <linux/module.h>% ?! l: P# e5 e$ u% A0 J0 K
  26. #include <linux/init.h>4 s# H! S& ^, b2 Z. Y' Q/ V
  27. #include <linux/errno.h>0 b' \4 l3 H8 S' U
  28. #include <linux/types.h>
    9 J1 n  q- J- K7 J& i6 V
  29. #include <linux/interrupt.h>
    ( z2 \5 j, L- u" z5 d
  30. #include <asm/io.h>, p: f+ K+ ~3 }
  31. #include <linux/moduleparam.h>
    ; O$ x  I4 u- ?6 S. ?" e
  32. #include <linux/sysctl.h>$ b% m: L; M* {. z, `
  33. #include <linux/mm.h>
    $ J) v" v* F1 j- `% @9 b6 t
  34. #include <linux/dma-mapping.h>
    ( e$ U$ o: X7 f

  35. & ^4 w: v: ]5 M4 [
  36. #include <mach/memory.h>
      ~# V+ q; N4 @/ p8 |6 j- G7 z
  37. #include <mach/hardware.h>
    2 D% V) p6 v! A& U( Z$ R1 y
  38. #include <mach/irqs.h>
    6 n$ M+ b1 d4 D# ?; B3 n; f+ G1 D( W
  39. #include <asm/hardware/edma.h>
    4 B$ p9 {+ s! h4 O5 z2 V, E. A

  40. - J* Z5 n8 [; H
  41. #undef EDMA3_DEBUG
    # N' l7 t9 X0 ?- a& z' v/ C
  42. /*#define EDMA3_DEBUG*/- `( m& \: n8 x) }! r' R8 C

  43. 6 W" @2 }3 f5 q9 S$ E1 v
  44. #ifdef EDMA3_DEBUG3 a9 ]0 x$ M0 J. o  u" g
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ) W$ E( i4 H, C" U& t3 w7 D( f
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    5 [$ @) `- X% v4 D' ]5 j
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      I& \; ?9 P# G. k$ N
  48. #else9 f. ?; v9 k: _6 v5 m- }1 ~
  49. #define DMA_PRINTK( x... )* r9 r4 i% k8 {, g
  50. #define DMA_FN_IN
    + s1 i" m2 b" @1 Y% o
  51. #define DMA_FN_OUT
    5 z5 R  m: P, T: a
  52. #endif/ |8 `' Q7 S- a. ~/ Z+ @1 B

  53. ( Q, |8 r8 B) v
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)1 A( l' n: W, h+ O
  55. #define STATIC_SHIFT                3- b1 v" u  b3 e- E9 d
  56. #define TCINTEN_SHIFT               20
    : U7 g& L0 p: Y2 Q
  57. #define ITCINTEN_SHIFT              21
    2 [1 D9 _9 c' u2 N$ P* G9 h3 o
  58. #define TCCHEN_SHIFT                22
    & n; Q8 e# |3 |( }" p& {
  59. #define ITCCHEN_SHIFT               23
    ; }( E/ |' j3 o( h" |9 q
  60. 5 y( c, I$ f: Y$ P% b* w
  61. static volatile int irqraised1 = 0;' v$ y/ w4 E9 b9 `
  62. static volatile int irqraised2 = 0;
    8 F5 P6 K# U* D7 F. L
  63. : F: B0 N2 O" @5 K- F7 j# J
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ W" T' n. p% b$ K3 h( d
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# B. y3 M" W4 x
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 c( S3 K% m: b$ ]

  67. - }3 G+ y7 j: L* @! W6 A
  68. dma_addr_t dmaphyssrc1 = 0;
    / x! w/ T9 w+ ]0 |
  69. dma_addr_t dmaphyssrc2 = 0;
    ( L4 x+ P! H7 {
  70. dma_addr_t dmaphysdest1 = 0;
    ! S' H- r' }) b
  71. dma_addr_t dmaphysdest2 = 0;; _! o' N2 ^" ?

  72. * m. |1 q! G  F/ N6 o
  73. char *dmabufsrc1 = NULL;
    . o; G/ Y* |6 \7 `: F/ ^
  74. char *dmabufsrc2 = NULL;' M- g0 u4 t& g( P1 J; o5 @
  75. char *dmabufdest1 = NULL;
      h4 P% f. x. {8 O& L
  76. char *dmabufdest2 = NULL;! p7 f' h: c# A8 f6 L$ l. n9 @9 Y& x

  77. 3 p! m+ C( U3 t! @# q
  78. static int acnt = 512;& Q3 K. Q: j( Y
  79. static int bcnt = 8;
    4 Y" i" ?' \0 D( ~
  80. static int ccnt = 8;% U1 G# p+ A, ?" X6 V: a

  81. ! y; H- j5 @9 X: u3 x( \2 p2 j
  82. module_param(acnt, int, S_IRUGO);6 P, @/ E/ s: _* M2 j
  83. module_param(bcnt, int, S_IRUGO);
    7 V- t  Y; `& N  V. e
  84. module_param(ccnt, int, S_IRUGO);
复制代码

' E: Y2 r. b% a; M( {' B$ L4 D/ }  V
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& P/ j* C8 E) m$ U2 P5 k% warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 W4 u6 y" J4 S; i9 |+ E- R6 \7 M( O     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 {. ?) M1 U% g- q) i2 M

% b5 n' j! y; x( h* k2 ]" U+ J3 J# H
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-29 12:22 , Processed in 0.042777 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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