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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 l9 w" s  |# ]) r
  1. [code]EDMA sample test application
    7 H6 B( R" n- D+ `
  2. /*, g* N8 _+ s; l, {7 x
  3. * edma_test.c
    ' g' ~3 I- G6 m- C8 }! j% E$ d" f
  4. *
    0 K. c9 e" x7 F+ `) J* p+ B
  5. * brief  EDMA3 Test Application
    5 ^6 X& ^# I; X4 P3 l
  6. *+ E/ Y6 }) F' ?# l+ d  A
  7. *   This file contains EDMA3 Test code.
    " B) }' q* ~! z' T) c
  8. *) G& [' d7 L& K7 M( ]
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / B7 P3 v( O4 a4 B4 `' p0 B
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 V8 `' I. a7 i% ]# u( g2 U
  11. *         TO CHANGE.
    % R  V2 {% \( Q9 o
  12. *5 n0 z2 w/ a* r4 v" t
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    9 W6 g: I- e; K  {$ |' ?  p) h# ~
  14. *" S* Y! n' {5 n" l# ^. ^# h
  15. * This program is free software; you can redistribute it and/or
    ' D7 v7 t5 a2 E- G
  16. * modify it under the terms of the GNU General Public License as
    7 \8 n9 Y) O! z3 b
  17. * published by the Free Software Foundation version 2.
    3 D$ J' V+ x6 T' \! Q
  18. *
    / ~; w; e9 v- I' Z  O; u
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 h  n2 B9 _* ^4 s/ E
  20. * kind, whether express or implied; without even the implied warranty  L2 [3 C7 F# Y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - o* ~. c1 A7 v6 S$ s
  22. * GNU General Public License for more details./ C) M2 D% L1 u  w- s; U9 p- |
  23. */
    . p+ T9 t1 N" W0 y# J

  24. $ M" O% @( r/ f( V
  25. #include <linux/module.h>6 ~9 R% _+ M) j- b! q) R$ [
  26. #include <linux/init.h>0 u: J" t2 k1 }3 D2 \! P1 N0 O
  27. #include <linux/errno.h>
    # p3 ]; X9 ^- t- m
  28. #include <linux/types.h>
    + S' [/ U/ `! v
  29. #include <linux/interrupt.h>& ~: g3 e; g. [: P, N
  30. #include <asm/io.h>; X, \7 D$ X/ I8 i$ {! p7 S4 J
  31. #include <linux/moduleparam.h>9 q2 Q* n% a/ a' R
  32. #include <linux/sysctl.h>" D* y3 d; x7 C- r4 T: A' P3 T
  33. #include <linux/mm.h># z" _% [) H1 p, `2 T
  34. #include <linux/dma-mapping.h>: i( f/ u. Y% H4 S7 J7 V

  35. + ]7 \4 T  z2 Z2 o* s. Z
  36. #include <mach/memory.h># c0 b0 F/ t3 w
  37. #include <mach/hardware.h>
    2 c3 H; f# F& v+ `/ A
  38. #include <mach/irqs.h>
    ) m( L7 D# N* R. ^4 \+ O( W
  39. #include <asm/hardware/edma.h>
    - x4 Y' G3 o8 N9 o: t
  40. / F- X7 x. T& U6 C- q1 H! n
  41. #undef EDMA3_DEBUG9 R" m+ U0 E, G2 O; x( S
  42. /*#define EDMA3_DEBUG*/
    8 R1 I: p2 B1 u7 }, D

  43. ' v: m% Q" K& v. H
  44. #ifdef EDMA3_DEBUG$ z2 h+ o( P* R3 k  _: Y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 H0 ^5 [  S! J8 d3 p
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); p% G/ [+ K' G" z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& D' X: w# n$ s1 R# q! ]$ P! j
  48. #else
    , N4 X6 n9 B) J/ f& K
  49. #define DMA_PRINTK( x... )
    3 L2 e: f2 j3 B* `
  50. #define DMA_FN_IN4 e3 z7 a# w" Q! [& [
  51. #define DMA_FN_OUT
    + _- @/ ~) ^, u" v
  52. #endif
    & }* {" z/ K: k$ M7 e2 K; i" b

  53. * ]& |% u$ r7 S* H( x# @
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    $ c5 \) `0 W6 A1 S5 z* }
  55. #define STATIC_SHIFT                3
    $ Q) y' J. s: }# e) V7 t4 Q4 P' Q
  56. #define TCINTEN_SHIFT               20' L6 v" h1 [. t% ^
  57. #define ITCINTEN_SHIFT              21/ c  }/ m, U4 o0 h
  58. #define TCCHEN_SHIFT                223 q6 q5 _+ M- [
  59. #define ITCCHEN_SHIFT               23
    ! ?) @8 [( u# j* v! q: e' z+ u

  60. 9 f' o9 r: }/ Q8 B
  61. static volatile int irqraised1 = 0;
    0 Q, f* b! P/ K; @
  62. static volatile int irqraised2 = 0;0 s0 X3 \+ D  _2 x+ R) z+ y3 L

  63. : N7 ]! _3 }, r
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 P: I. k# `2 S0 B
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 s2 H/ n7 I$ o: i5 b% e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 j! R: }+ m% X( @9 v2 S$ |

  67. : N0 ~0 i+ ^. r$ f
  68. dma_addr_t dmaphyssrc1 = 0;; C/ }1 \: W2 @7 I
  69. dma_addr_t dmaphyssrc2 = 0;5 Q# M2 {; }! I  S
  70. dma_addr_t dmaphysdest1 = 0;9 C: u  Y& y1 l. ~7 B
  71. dma_addr_t dmaphysdest2 = 0;
    5 K, }1 i# }/ Y& n6 x3 t

  72. ( [( L: l- }2 N$ k
  73. char *dmabufsrc1 = NULL;' V# b) [$ i2 l" f4 N: o" W
  74. char *dmabufsrc2 = NULL;
    5 C. b+ x$ U: J. g9 c% L
  75. char *dmabufdest1 = NULL;' G" A8 Y: s, u( C& o
  76. char *dmabufdest2 = NULL;
    ; I4 a6 j; R7 o- F

  77. ' O8 r/ B9 S( S9 ^
  78. static int acnt = 512;
    / ^# ?' p$ ?8 F2 L
  79. static int bcnt = 8;  b4 D3 ^& P! K9 P: M
  80. static int ccnt = 8;
    8 N  O& Q/ T! }! n) I

  81. ) P  k  ~7 C* z' G) ], w7 v' b; z
  82. module_param(acnt, int, S_IRUGO);
    ; Q8 b5 V# f% t, b  I7 y
  83. module_param(bcnt, int, S_IRUGO);' V6 O! o" Q/ R. }
  84. module_param(ccnt, int, S_IRUGO);
复制代码
- O5 C6 h2 V% k2 Z5 a
- W3 K2 a0 l9 H. a& [; {
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 F: X- }$ Y$ x+ I
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* c# o- y# L# M6 z# \     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- C  `) c. g3 v: \) N" V( y$ T* ?* u$ M# C- z4 o+ B. D
! q* r: V4 o0 ^1 A
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-1 14:35 , Processed in 0.038521 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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