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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! r7 p! l3 C. }: b
  1. [code]EDMA sample test application+ F0 d7 |+ }4 {+ S. R
  2. /*
    ; A$ e3 V( z! O4 k- O: [3 l
  3. * edma_test.c
    4 ]8 D! a  Q% ?8 `/ |* j6 S/ B4 J
  4. *
    $ J2 a8 s! ?$ L$ Q" J
  5. * brief  EDMA3 Test Application
    ) ?3 R9 Y$ l5 S3 ^
  6. *: d4 @2 @% N7 L- n2 Z; T1 ~: u& ^
  7. *   This file contains EDMA3 Test code.
    4 O' }, d, H3 M/ R8 a% O. e
  8. *
    , n& G. b" p" C( c& `& W
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - w- Z, Y, D% _
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    # i& k/ I- \1 _* Q
  11. *         TO CHANGE.
    9 `- O/ O0 x* u( M
  12. *
    5 q0 A( Z! @. O: q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 w. `' F. b- z3 T1 c
  14. *
    7 `+ Z  ?2 D& I( I' w, w+ W
  15. * This program is free software; you can redistribute it and/or
    4 I" A1 k& a, B# @
  16. * modify it under the terms of the GNU General Public License as! f. ?6 ?# E" w" V' s0 i% R
  17. * published by the Free Software Foundation version 2.
    . a) P3 @/ b: p* f2 G
  18. *
    + U( c0 Z$ H0 w' R3 J
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ {7 l) G) |2 X
  20. * kind, whether express or implied; without even the implied warranty; [% E- B8 l2 w" B" J6 H
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the& @4 N9 |5 ?, S; }3 }, f( b: B- |& r7 }
  22. * GNU General Public License for more details.. `8 C5 q3 G; |/ U2 y, a
  23. */5 m( _; \' y) B
  24. " l2 F7 z8 l8 T+ F
  25. #include <linux/module.h>% k  T1 V1 ~" ~
  26. #include <linux/init.h>
    . D# C9 V% {) _$ d- x) t
  27. #include <linux/errno.h>* Z+ L/ e1 m" t4 G3 C$ ?
  28. #include <linux/types.h>
    ' @' d3 B/ U' t1 W5 `# S. S- W
  29. #include <linux/interrupt.h>5 N4 u% [/ G+ e% p$ y
  30. #include <asm/io.h>- h+ j; J$ ?, x" x2 R7 f- F$ q' z
  31. #include <linux/moduleparam.h>
    8 D; j$ g$ m: P, E$ x3 x2 s
  32. #include <linux/sysctl.h>' J" ~+ i' }7 I
  33. #include <linux/mm.h>
    8 q, g* |$ F) g4 G4 @
  34. #include <linux/dma-mapping.h>  _0 ^. w3 h/ ~8 r( ^4 L! O8 [

  35. 8 H, |. U! o: p2 ?+ a
  36. #include <mach/memory.h>' H8 k, y1 C3 Z9 A/ _/ q7 ?* n
  37. #include <mach/hardware.h>
    - k; K8 A. ?- B
  38. #include <mach/irqs.h>: s. s2 t8 q5 P7 t+ z/ ~1 O& r- v$ G* [
  39. #include <asm/hardware/edma.h>$ f' S$ |, w7 `) o: P% Q. j, c& s

  40. ) W& P" I  u- e" X
  41. #undef EDMA3_DEBUG
    5 X2 y1 H, \' H9 e9 u% D$ V& T4 N8 {
  42. /*#define EDMA3_DEBUG*/6 G5 A8 E6 p* g/ z  j

  43. / Y, m$ J% E% ~/ `- A; c
  44. #ifdef EDMA3_DEBUG
    & n: q9 n# a" o, _+ E
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ) d& p+ J* N. j( {( r4 L
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): T0 J' B" J9 x0 ~, ~
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 q: [1 x( x) L$ m4 x9 i, |) v
  48. #else3 y# v$ K3 y, M* i
  49. #define DMA_PRINTK( x... )
    5 x; p8 M2 d: ~6 X! r1 r
  50. #define DMA_FN_IN( F& ~9 t; U: j( e
  51. #define DMA_FN_OUT
    . t& u1 _- m, P( g! w8 {
  52. #endif. d# y1 }+ |# E0 J3 J% t
  53. & Y% z  Y0 ]! e: }' u2 a9 x, ^0 T
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ) }; p! c+ g7 ]1 x/ m
  55. #define STATIC_SHIFT                3" S5 j& N7 T; d' F: R8 D# w% D3 U
  56. #define TCINTEN_SHIFT               20
    & Z, v# ^: H1 [! f6 h
  57. #define ITCINTEN_SHIFT              21  O! ]8 U/ I/ F; E# J
  58. #define TCCHEN_SHIFT                22) K. G5 \9 ]- L  i; r) q
  59. #define ITCCHEN_SHIFT               233 E+ {* {+ s' a  B8 y) H$ J8 m  M

  60. 0 z0 Q: X# F; o2 }6 @3 |8 ~9 _6 {
  61. static volatile int irqraised1 = 0;* V9 v+ e. o4 b2 n0 C+ ~. U
  62. static volatile int irqraised2 = 0;) S) n5 b* f# \. A8 r$ V

  63. 3 R; a" W- a0 L8 b: I8 \) s
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 A- x3 y$ n8 W
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + G' E' X) a, I& j- I
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 G! R' t% E$ [& o- m
  67. $ J: T1 t3 J! N2 g
  68. dma_addr_t dmaphyssrc1 = 0;
    0 `  [& C. E) Z8 N3 G
  69. dma_addr_t dmaphyssrc2 = 0;
    ! v" X8 Z9 M9 W7 p
  70. dma_addr_t dmaphysdest1 = 0;
    / k4 |7 U" @( v  }/ M7 H
  71. dma_addr_t dmaphysdest2 = 0;
    $ a& S9 y  m5 j' g9 B5 @2 k

  72. ' J/ K- N6 v4 x
  73. char *dmabufsrc1 = NULL;
    , Y5 `- [2 E- \7 M5 I- @
  74. char *dmabufsrc2 = NULL;
    # g7 E9 N% A4 ^; a1 S1 Q" ~- o
  75. char *dmabufdest1 = NULL;
    ! g+ B  N# ?+ x5 \
  76. char *dmabufdest2 = NULL;" u4 z' e- Y1 q9 a* h
  77. / J$ Y" L( H  J* R. ~' L5 J" }
  78. static int acnt = 512;6 }) V. [: q# h0 _9 l0 [4 Z* {
  79. static int bcnt = 8;5 Q* r6 g* H% ^
  80. static int ccnt = 8;
    8 B0 g* d" R6 n" H9 t8 q
  81. : g/ E) \& q& k' H/ \2 ~
  82. module_param(acnt, int, S_IRUGO);/ ~* r; J, i% [" s! I/ T! I+ q
  83. module_param(bcnt, int, S_IRUGO);
    + j3 a6 c; A, |5 J
  84. module_param(ccnt, int, S_IRUGO);
复制代码

' P! i# [' m* u: z% G1 O, D- H0 Y1 a- X: J( Q. W& c7 a, M& E5 Y5 ]  s
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 b! ^3 w+ `5 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ r- ~3 J0 B( Q  U
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. Q$ |- b% u2 w: g3 x2 W3 K

! T+ C# k! [  O5 M1 {3 ~0 z1 O6 e; a- R
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-13 00:01 , Processed in 0.041082 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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