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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # I, V3 t1 E/ E, Y% j1 l" d
  1. [code]EDMA sample test application
    7 B; R" X3 w+ A
  2. /*: _/ e! j, A4 s( b
  3. * edma_test.c
    6 ?9 n3 C3 e$ D. ]
  4. *
    ! s0 P+ ]* x, t/ c1 [
  5. * brief  EDMA3 Test Application
    ; s, `* Z8 ]8 w8 i- }" T# E
  6. *
    2 N5 t4 L% G0 c
  7. *   This file contains EDMA3 Test code.) ^6 g# }0 f8 b0 y# W- B; {
  8. *7 k0 S7 o5 i8 G5 Q- F# n
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ Q! ^" K3 P# M/ a: d+ b% g
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 @6 J' g4 j1 Z4 r
  11. *         TO CHANGE.
    + u; u* t/ a4 l. |. v, g
  12. *0 q7 _- t% ^" _( c4 Y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  ^7 ~+ h' Z+ s7 }7 i
  14. *3 ]# s. o. D% a$ `3 `7 F
  15. * This program is free software; you can redistribute it and/or! D. k2 q& C5 m1 u
  16. * modify it under the terms of the GNU General Public License as& s" X- W  m  B) D
  17. * published by the Free Software Foundation version 2.+ h; d; A. y. k: ?" [6 o7 X' W
  18. *
    1 y+ e7 n" V0 Y& I1 t
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    0 c7 t1 ^# }2 z5 t# O5 F
  20. * kind, whether express or implied; without even the implied warranty
    9 c- r& J2 I/ U4 ^
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      t* \" ^/ ~5 p2 x5 V! ~, ~* ~  Q
  22. * GNU General Public License for more details.+ r% L/ V; s: v. z( F% n
  23. */
    - z( q' d$ h: s: d3 ~- W- K# r+ D; V/ |& r

  24. ' A9 b7 n9 n0 K2 q8 |8 H
  25. #include <linux/module.h>
    ! S# H) `. f5 J: A/ d
  26. #include <linux/init.h>8 s) m9 A' J5 n3 A4 i; m' G
  27. #include <linux/errno.h>" E) D0 W1 x8 M4 k& E2 a
  28. #include <linux/types.h>& O+ _  {% i1 A" V1 W# s
  29. #include <linux/interrupt.h>/ O; i+ F5 u: R% s( {) v, G
  30. #include <asm/io.h>, j+ I' K* i0 W9 \* b
  31. #include <linux/moduleparam.h>7 S* g) \8 J, ^8 B1 U) U/ z
  32. #include <linux/sysctl.h>- E! Y" X  z- c+ T" A0 f
  33. #include <linux/mm.h>% A8 N- d; a- M0 X/ f
  34. #include <linux/dma-mapping.h>
    1 u5 J' Q& Q* y. ~+ i2 n. ^! W

  35.   g9 ~- B- j  p! H- R
  36. #include <mach/memory.h>8 K" z' t" [: t) z
  37. #include <mach/hardware.h>
    2 R- o/ u8 B3 H2 b$ A) F! K4 f
  38. #include <mach/irqs.h>
    3 Y5 I- E' ?+ b, c7 V, {# h/ z- p
  39. #include <asm/hardware/edma.h>: D5 i, E; u$ L" d: \
  40. 3 f4 B5 @" O; B! m
  41. #undef EDMA3_DEBUG1 ?; T: M0 c3 B  C
  42. /*#define EDMA3_DEBUG*/
    3 y0 y9 [8 u, `2 h  q

  43. / J' M* y; S8 t4 f1 O
  44. #ifdef EDMA3_DEBUG" W- o4 k# \" {$ Q! Q( S
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    / T5 j8 \9 Y! C6 H. R1 e' |! _
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    6 i% G4 Q* v; q* j
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 o% b- Q) a& L/ C7 _/ S' Y4 m  [2 }
  48. #else% ]0 Q9 S2 C/ w$ S
  49. #define DMA_PRINTK( x... )
    ' a  v% _" ]' J. K* g5 e
  50. #define DMA_FN_IN
    : c- o) K( [, d" ]) B5 |4 n  L. J
  51. #define DMA_FN_OUT5 d5 f" k4 ~: C; E4 z; u' c) |
  52. #endif
    + z% @7 y: M* p7 V& \" _& |

  53. + l4 p7 b4 J. `
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)) a5 Q/ F) J) J8 A+ _% _% X6 T
  55. #define STATIC_SHIFT                3
    9 |1 J$ ~& b( T6 _! ]
  56. #define TCINTEN_SHIFT               20
    ' C3 n: U8 p5 i: L) s2 y2 m! Z
  57. #define ITCINTEN_SHIFT              21
    3 I; \9 A# O( w( s' [
  58. #define TCCHEN_SHIFT                22
    ( s! o3 e( V# i1 w: _
  59. #define ITCCHEN_SHIFT               23+ A2 B4 f4 s* t- j) E
  60. $ V5 H9 U' h0 `2 |
  61. static volatile int irqraised1 = 0;" k" ~# J# E# I1 h% \' k+ m
  62. static volatile int irqraised2 = 0;
    # J: h- ^8 z4 F/ ?& X

  63. 5 W1 {6 W9 ~) l* k1 u
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 Z# Z4 F! i: K
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 E" G' {$ y$ L6 r/ K5 U7 \& Z% O4 `
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      v6 N7 y1 z& Y9 [& f" B, f

  67. - O. e& V7 F4 Y7 t. m2 d
  68. dma_addr_t dmaphyssrc1 = 0;; s- f5 G; {& l$ ?3 k+ t/ ?" p
  69. dma_addr_t dmaphyssrc2 = 0;0 p" W0 o. s$ d! J- k& S* o. Q& V
  70. dma_addr_t dmaphysdest1 = 0;
    , [  Q+ E/ T- [  L) B% e2 h% b8 Z
  71. dma_addr_t dmaphysdest2 = 0;) R; A6 e3 i/ C8 q$ I, ]

  72. 7 Y3 j3 z2 z0 H4 ^( @* Q3 Q  @7 N
  73. char *dmabufsrc1 = NULL;
    . X) j: u/ M& k, l( f
  74. char *dmabufsrc2 = NULL;! K7 I* k! Q) f6 ?* Y
  75. char *dmabufdest1 = NULL;. d4 t9 T" g7 ~$ g/ b5 H
  76. char *dmabufdest2 = NULL;  x; P' O! n. G( Z( n$ H
  77. ! a6 b& e; y0 M6 h  O+ Y
  78. static int acnt = 512;
    " i5 T4 ~# m( r, o. B
  79. static int bcnt = 8;
    6 `9 E% w2 O6 O' h$ o6 @3 e
  80. static int ccnt = 8;7 O0 \# F# d2 c3 b5 n( E& |
  81. ! z0 o0 [9 Q  k, g( G: [0 [
  82. module_param(acnt, int, S_IRUGO);: E/ K7 `8 }# W9 x' p" p( P
  83. module_param(bcnt, int, S_IRUGO);
    % y/ H$ w. m5 j1 K4 ^
  84. module_param(ccnt, int, S_IRUGO);
复制代码
* \# J0 i: c6 S3 A

# n2 u& D1 D7 ~) Y# _6 q9 P      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 _# K/ c) _1 d  p$ r
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ K% \5 }8 C# W2 S9 U- n5 x
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. e8 C: d0 v& Y
- T" q# Y5 E7 k" @- e: T/ |9 j
0 V& X/ r- {2 W7 d
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-25 16:12 , Processed in 0.041215 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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