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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 T! X: ~( ?) J
  1. [code]EDMA sample test application
    0 f7 a" P4 ~+ A, V2 u/ s
  2. /*6 W8 M# @- G- k2 m, d2 }
  3. * edma_test.c% u; h9 W# S8 y- S, z- l
  4. *4 \4 o9 x3 a. L; q& w! t$ F" S
  5. * brief  EDMA3 Test Application, U5 i& M0 g' M1 n0 T) q/ ]( I
  6. *' q. a( x& z. x4 s
  7. *   This file contains EDMA3 Test code.3 R$ D+ x" I" ^, J) m
  8. *
    $ I/ F4 W" _4 b0 v# b: X; K
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ) i: M" g( K* z2 {9 g
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 O7 \4 @3 m$ }2 ]6 S
  11. *         TO CHANGE.
    ) l& u; f0 D% k9 Z
  12. *& Z9 m) [3 F2 J* P" Z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% X  v( f- J4 R; V) Z/ p
  14. *# G9 C, }- N* S2 J+ U, v5 \- a
  15. * This program is free software; you can redistribute it and/or
    3 ]+ v1 {& F' K
  16. * modify it under the terms of the GNU General Public License as8 j4 [: U, ?: ?* W
  17. * published by the Free Software Foundation version 2.: |% h" ^! z6 {$ s3 w' _2 m0 f
  18. *
    5 r# I; ~4 N; T. q8 b
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- m, O1 H; U$ i& B- `
  20. * kind, whether express or implied; without even the implied warranty
    # {% X( E# T& Q5 T8 F8 f
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) v2 p1 q. ~0 d8 T
  22. * GNU General Public License for more details.
    + `0 _' w3 ?9 f
  23. */
    7 o/ {, V! O% G/ f' s# [
  24. 8 }; B& t8 e/ Q, I
  25. #include <linux/module.h>
    5 Q$ O& M4 h- |. n* s: S% X
  26. #include <linux/init.h>
    7 g3 v2 f6 R' _; B. D3 C/ y
  27. #include <linux/errno.h>
    3 Z4 {9 H8 I7 G. S4 x( g0 @
  28. #include <linux/types.h>
    ) r. |+ ^# q' m  w- P
  29. #include <linux/interrupt.h>
    $ r/ Z: f, H% s) G  t- Z$ P: J; |- M
  30. #include <asm/io.h>
    $ ^8 t3 g, T; k7 [6 K( M6 x
  31. #include <linux/moduleparam.h>/ _0 M7 T  G" h* H
  32. #include <linux/sysctl.h>) L0 s0 T" v/ o8 {- u' b2 ?
  33. #include <linux/mm.h>
    # c" S# `1 x' R& t) u+ W
  34. #include <linux/dma-mapping.h>6 t3 X* E" S$ y

  35. 9 r% y: C5 S1 E! K( N5 q  s2 G' P
  36. #include <mach/memory.h>
    $ a8 k7 w! B' X) ]3 }8 l
  37. #include <mach/hardware.h># P4 Q: l( S- L- T; N3 J
  38. #include <mach/irqs.h>
    & B' o: v8 V' r! z  I0 y
  39. #include <asm/hardware/edma.h>
    ( W! \3 @3 f* r: @1 O/ @

  40. 3 d5 |/ }7 ~7 }+ u* J4 a
  41. #undef EDMA3_DEBUG# V2 D4 G. U7 s
  42. /*#define EDMA3_DEBUG*/
      v! D. G3 ]. O0 _0 j( b/ b

  43. / ]/ e0 e& `$ _. v; f: d% S: G, K  G9 {
  44. #ifdef EDMA3_DEBUG
    7 F* s5 R& k) F: T7 D5 {
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    3 _) e/ f2 p0 B& n% ~  ~
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 @" @7 X" f; u+ _3 M1 Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 ~/ y  ~- R% O9 \2 u! Z" \# ]
  48. #else
    . E4 [4 c9 n7 l6 i6 P) K- w" v
  49. #define DMA_PRINTK( x... )5 H" D/ G3 p, `4 }1 v
  50. #define DMA_FN_IN
    # l5 }& u- j6 f7 O8 ]- n. q
  51. #define DMA_FN_OUT6 |9 M4 ]* H( ~
  52. #endif
    - j! ]+ b4 A9 `9 t
  53. ' a& }0 b) M/ l* Q# B: C3 H% M
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 {  g' Z0 F) e4 \) p2 Z
  55. #define STATIC_SHIFT                3# c5 w# i8 V% x1 |  q$ j
  56. #define TCINTEN_SHIFT               205 l# Q  C+ [. z% z7 p) a
  57. #define ITCINTEN_SHIFT              21- l' V! m% W2 O
  58. #define TCCHEN_SHIFT                22
    0 B3 E+ M, a* t9 l
  59. #define ITCCHEN_SHIFT               23
    & @& r3 G- g  T; I$ ^
  60. * K$ a% q: J- T
  61. static volatile int irqraised1 = 0;9 h* S- X$ H% N' m1 u$ ], J3 K
  62. static volatile int irqraised2 = 0;9 U) q- c6 C; W/ _7 q! M3 M  n" ^5 r
  63. + ]  K  z7 _  W. C
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 p" A3 J$ z7 x; t# m; G& G
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 d4 c0 E1 I$ v; D6 J$ r" ?
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) `' F, B6 F, }" G

  67. 7 S% K; d: y6 L
  68. dma_addr_t dmaphyssrc1 = 0;( c' l" B3 X) L- Y: G$ M0 `
  69. dma_addr_t dmaphyssrc2 = 0;
    2 |' t5 w( L) _9 z; g
  70. dma_addr_t dmaphysdest1 = 0;
    $ O( J1 _/ S; k2 {3 a
  71. dma_addr_t dmaphysdest2 = 0;4 i7 ~) `; y! e! D, I$ s

  72. ' U' p! x, V5 E2 C# l4 J
  73. char *dmabufsrc1 = NULL;
    " L6 V7 D9 k: d" y& O
  74. char *dmabufsrc2 = NULL;9 s4 _& s3 R: b( K
  75. char *dmabufdest1 = NULL;
    $ g7 `5 p( ~: M7 E7 N* \& I
  76. char *dmabufdest2 = NULL;
    ' P! E/ q( l6 k# O( J* Q" _# U

  77. / y  P9 \) D; m; c& l& K% F$ @+ m
  78. static int acnt = 512;
      ]* w. J9 A$ t1 S" ?2 Z" C+ b5 O' {
  79. static int bcnt = 8;
    - D0 ^1 B. D" Q5 k0 g
  80. static int ccnt = 8;
    6 p) H- z* A+ B+ p5 P( E' k
  81. . j0 \; o/ k, `
  82. module_param(acnt, int, S_IRUGO);! U( q6 o1 M! x% A/ p9 j
  83. module_param(bcnt, int, S_IRUGO);
    8 p" E1 x# G! @+ [% J
  84. module_param(ccnt, int, S_IRUGO);
复制代码
# M# r: Y/ b" S, I
# s! J& y+ D0 {1 _* l2 t) a
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: m9 Y' Q- F; f  [3 W8 l' j- {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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% a, ]5 J" n' q: {- N" K& L; A8 y6 F
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' s2 m% a2 a, w' _( V+ a: n5 |: |1 g4 l% s- M
4 I# d( O6 H1 }+ W% K
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-4 23:08 , Processed in 0.038424 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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