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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( ^8 O% d7 E, F8 t0 q
  1. [code]EDMA sample test application
    * x! H# T. Q" N% }5 m1 K" u
  2. /*3 R) P* }" d* h" r/ x( \6 X9 {, l
  3. * edma_test.c
    2 x% m# Z9 X1 U" e# N
  4. *4 X- c3 T; l* o" o* @0 n1 R4 v9 A
  5. * brief  EDMA3 Test Application
    / Z, y# E- u4 }4 a6 m; s3 _- d2 L
  6. *6 P1 y: {8 A' |9 J0 B: N8 K+ }
  7. *   This file contains EDMA3 Test code.
    ' u. {0 M! _  ^! g: i6 h
  8. *3 g1 o6 Z6 C8 y! i$ K: D4 g
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 L$ O" F  k$ v0 i
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) R+ e! J* X8 x. k
  11. *         TO CHANGE.* J5 T; m% h% U6 m
  12. *
    " @8 E2 H) {" P- Q& y9 @  b
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    # o8 Q  M% l; N$ _2 X
  14. *
    " ^  M9 r' l: l$ n& m; c- f
  15. * This program is free software; you can redistribute it and/or$ r! m3 ^: |& C
  16. * modify it under the terms of the GNU General Public License as
    ; z& w5 p/ V' R% ?! B- d( Y# R, i
  17. * published by the Free Software Foundation version 2.4 v$ m! x0 z4 ]
  18. *
    ; S. B. b! P3 Z1 B6 x5 _# u& B
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 r& _, `- \( s# _4 [# ~1 u
  20. * kind, whether express or implied; without even the implied warranty
    / F7 z# C: M5 d9 X( h% Y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    8 `- p) i2 J+ G+ f
  22. * GNU General Public License for more details.
    1 ~$ b0 R- O2 d5 N4 x) f% J
  23. */. W8 o! O0 S1 l* h9 E6 y

  24. 3 ~! l2 }$ y  F
  25. #include <linux/module.h>
    : Q9 C6 H) x( o( i& d; {6 p7 b0 K) a
  26. #include <linux/init.h>
    , a  u- p% p( k) d; L9 _4 U( \! U/ ^
  27. #include <linux/errno.h>
    : h% a( q) A: f& F/ ]" T3 x
  28. #include <linux/types.h>9 O, _3 ~& k0 {# \) D5 A/ q/ _
  29. #include <linux/interrupt.h>
    4 S2 o& M8 p  |" y! G6 m% U, I( T1 h. m
  30. #include <asm/io.h>
    ; V& Z! }$ x8 o* ^; f4 ?
  31. #include <linux/moduleparam.h>* F/ w7 \/ |/ U& [
  32. #include <linux/sysctl.h>
    8 p5 B3 W8 Y( s9 Z- D- H
  33. #include <linux/mm.h>6 S9 b; I8 o/ [# H& K1 g) m
  34. #include <linux/dma-mapping.h>
    7 r0 m9 j% q. u/ v# M
  35. ) i1 O( X: k! e8 I  c1 g4 e
  36. #include <mach/memory.h>- d6 T  N! `( y( A3 n0 I
  37. #include <mach/hardware.h>( b+ ?& Y0 p: K  H1 L
  38. #include <mach/irqs.h>+ i* T. y/ t8 t" F9 F
  39. #include <asm/hardware/edma.h>% K/ U# e$ H& M3 C

  40.   M8 g  `* x7 b, R$ g  U7 E5 ^
  41. #undef EDMA3_DEBUG
    ' n  R( o) w+ _
  42. /*#define EDMA3_DEBUG*/
    6 E* ~' O' S7 A1 [4 `
  43. ! X! d1 w$ w% R* V" g5 q
  44. #ifdef EDMA3_DEBUG
    % r" Z# T. R" r
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 q, C* Q! j' p- k( H! F5 }
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    % @# E1 \% s7 U, q) |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 l& ~4 y9 v1 A6 t  J) s0 \" B
  48. #else
    2 m) ~/ M2 v  P* k& ]3 R- B% N3 P' F
  49. #define DMA_PRINTK( x... )
    0 H9 U: n% s- D
  50. #define DMA_FN_IN
    ! N9 Q5 {' e7 p: ~# J  I
  51. #define DMA_FN_OUT$ A. d8 Z1 H; {$ I8 L3 u7 ^. Y
  52. #endif
    ; V# ^' j) i! D" W8 P6 |
  53. 8 ~; b0 Q) _+ f9 ^5 p; m$ u! [
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( Y6 E/ n# {* T$ D) c) K6 o
  55. #define STATIC_SHIFT                3- T* [% I" b) b7 _  M
  56. #define TCINTEN_SHIFT               209 G! Z) d( U8 Z
  57. #define ITCINTEN_SHIFT              21# `. N  G& Q8 P: S& h
  58. #define TCCHEN_SHIFT                22
    ; K7 x, K2 x) Y
  59. #define ITCCHEN_SHIFT               23
      v- m! D! d. T3 N7 U

  60. , W0 i) P3 x1 ~( Q: d- y
  61. static volatile int irqraised1 = 0;0 v" @6 t$ A' j$ I6 V1 `9 j& z
  62. static volatile int irqraised2 = 0;3 W6 U# J- h- O9 r. e
  63. 5 y* q( z! ^$ W$ W7 I  i
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " }3 n* r; ?" h  e. [6 z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 _! d" \; g. K4 U* H, I
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 |7 \4 F  M$ G7 m
  67. ; o: N$ J9 ?6 a# M
  68. dma_addr_t dmaphyssrc1 = 0;: [3 J) i# j. e; N
  69. dma_addr_t dmaphyssrc2 = 0;
    4 F5 v4 K+ B' Q/ B2 r
  70. dma_addr_t dmaphysdest1 = 0;7 j2 N0 Q& @) j' l! y
  71. dma_addr_t dmaphysdest2 = 0;
    * q6 c2 Y, v0 @6 B4 p* B
  72. 7 x1 Z: b) n. I+ U3 Z" ~: r7 Q
  73. char *dmabufsrc1 = NULL;
    9 W- a' b; O( `3 C* y
  74. char *dmabufsrc2 = NULL;
    1 H& c. a/ d& W+ |8 G6 X) i+ ^
  75. char *dmabufdest1 = NULL;
    4 a/ H/ J' p* I/ e+ |" L5 V1 k( _" ~9 z
  76. char *dmabufdest2 = NULL;1 O& j9 T: L* K) N- u  X7 e" h
  77. / m. g* `" |# B  E* {
  78. static int acnt = 512;' U0 W6 ^6 d3 m* A' Y
  79. static int bcnt = 8;+ C: Y! ~& L: @2 z$ {
  80. static int ccnt = 8;; ]: o; l1 h6 I2 M5 J' q8 b# s% W! @

  81. & `3 l1 ~1 c$ s) _: k- b, s# C3 m
  82. module_param(acnt, int, S_IRUGO);
    9 R/ i+ Y6 F* M8 r7 x
  83. module_param(bcnt, int, S_IRUGO);
    1 p& Z' h+ R% H" V' j4 M7 c. ?$ v/ K
  84. module_param(ccnt, int, S_IRUGO);
复制代码

+ F1 P. V8 F* D, g" L% ~1 t
- p  E, \' g0 |      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 k& Z- ]( T4 Z7 `- 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" m8 j9 k5 C- |7 @  a6 P     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& a2 l/ G7 N( @% t! V% |* b5 G

! O* @+ ?5 e/ ~# r& B
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-5 21:27 , Processed in 0.043103 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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