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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" ^* }, {5 }  c/ j, P6 O) W7 u
  1. [code]EDMA sample test application
    - p2 Q" u8 Q- X4 A8 q
  2. /*# K: N" D/ O( y5 f  [3 R. B/ {
  3. * edma_test.c
    4 c+ W5 T9 u1 }  X
  4. *
    8 ]! D7 y) C/ E; S
  5. * brief  EDMA3 Test Application
    ! I2 u9 y8 i# ~* o6 e  c+ P$ y
  6. *
    # n; [+ t1 |: @, D
  7. *   This file contains EDMA3 Test code.
    " U' f1 |' y0 V- i: C  ]3 V# [
  8. *
    5 d! o4 w" }+ O8 W' [' M
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    6 m3 q' X/ v$ y! x
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
      Z3 M2 W. H% u6 E9 }+ S
  11. *         TO CHANGE.$ m5 a+ O: p  ~) ], x3 f9 x& V# b0 j
  12. *! k7 ~* n- u+ h- z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! Y* `2 x, s8 i7 b, o5 k
  14. *8 w' a& l( c) P3 ]( D0 H
  15. * This program is free software; you can redistribute it and/or
    - a4 ^5 y* w0 K
  16. * modify it under the terms of the GNU General Public License as
    , C+ @* ?+ H3 D9 X+ |, K
  17. * published by the Free Software Foundation version 2.8 {& Y$ W- ?1 n3 V' f( m
  18. *; `, e+ T: G0 W; f2 }+ f0 K
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 C+ d3 H: |' v: Q( p5 e, R
  20. * kind, whether express or implied; without even the implied warranty
    , l' [* {  o- F; t9 e; N6 M( D
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / `) F/ {* d4 w3 p3 v! }
  22. * GNU General Public License for more details.  K, P6 _$ A5 j, _- O
  23. */
    / n- N+ W$ z& j9 y+ _

  24. 4 U6 m. k) q6 }9 X9 Y6 z7 U
  25. #include <linux/module.h>
    ) u. O4 q! e8 ~' @( r- U* b
  26. #include <linux/init.h>
    ( n1 \/ u4 j7 l+ r8 k) w
  27. #include <linux/errno.h>
    1 L2 I* W: m2 U, e+ h
  28. #include <linux/types.h>/ D+ H  {- Z) W3 g' T9 u3 x
  29. #include <linux/interrupt.h>; L# i. g" x; M) w; \, w5 v) k
  30. #include <asm/io.h>
    # V0 b# b+ V$ ]5 f( V& G
  31. #include <linux/moduleparam.h>
    % R0 G: d; V; j" T5 x8 z& B
  32. #include <linux/sysctl.h>
    # E1 r1 [' g. V! M4 S6 p% N/ D
  33. #include <linux/mm.h>- P# x" }. V8 e. D* o) p
  34. #include <linux/dma-mapping.h>- P" E% a2 n8 U$ c  e4 e7 T# D

  35. 0 W$ ~: Z2 x1 o; r+ y! p
  36. #include <mach/memory.h>3 O& e7 b8 o0 B4 C
  37. #include <mach/hardware.h>; V! @, t+ p5 L  [2 s  {
  38. #include <mach/irqs.h>8 w/ V5 D7 B; C
  39. #include <asm/hardware/edma.h>7 Z' `) p( ~0 Z3 x) T2 O
  40. 3 h/ R8 I: q- b! C' F5 D; t
  41. #undef EDMA3_DEBUG8 [9 N4 A* ~3 r/ B" V
  42. /*#define EDMA3_DEBUG*/2 e/ I$ {4 y6 t; T! u
  43. & B8 s# {2 l( b
  44. #ifdef EDMA3_DEBUG
    9 Y5 C) B2 S( ?$ o
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    $ n* Z0 d5 [1 J' p
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 F# C# s$ p6 _1 J4 ~. ]) ^: a! X
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ P, u& [& C( J& o) ]  D* M% m
  48. #else! P* n' K' |( }% |% T
  49. #define DMA_PRINTK( x... )1 {/ j- v: g6 G
  50. #define DMA_FN_IN
    5 @5 i* |5 A' g8 y  l
  51. #define DMA_FN_OUT4 |- O# M) ^& d, x6 A
  52. #endif- S9 V4 Q: U, n! j/ D6 [- K7 D0 ^

  53. 6 m( E0 I% T! r6 q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ' |# P' b% C' G& z& _
  55. #define STATIC_SHIFT                3' e2 F( f- J) J8 T& E+ U6 x, e
  56. #define TCINTEN_SHIFT               20
    & D! `% C9 n5 Z4 D1 x9 x
  57. #define ITCINTEN_SHIFT              211 g! o" t, _& J/ g! T  l
  58. #define TCCHEN_SHIFT                223 W* `6 k$ w3 }- k6 q
  59. #define ITCCHEN_SHIFT               23: k: p- q8 [: P' p
  60. $ l& x0 p, s; Z, Z1 a
  61. static volatile int irqraised1 = 0;
    1 l  t1 q  b& V# [
  62. static volatile int irqraised2 = 0;$ ]7 {# W2 t5 {( [" S( s8 A
  63. 3 p7 ~0 x# p+ O+ j% d
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) @& q3 q( s' S+ W/ T! {
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " R" g& T+ i4 Y# x( H
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " T5 X: v8 ]% z' I

  67. ) c" d+ i- c6 @7 S, ?6 N
  68. dma_addr_t dmaphyssrc1 = 0;7 D2 g. H. g& D0 y
  69. dma_addr_t dmaphyssrc2 = 0;
    5 C( R7 U9 ]: @0 k( B3 S
  70. dma_addr_t dmaphysdest1 = 0;/ p% P5 z9 l# T2 w9 X
  71. dma_addr_t dmaphysdest2 = 0;
    + _" E, J: G6 A/ @2 F7 l5 o
  72. $ o. y# k; n. J! D6 l: e# R
  73. char *dmabufsrc1 = NULL;) k0 Q8 |- y) S  m. I
  74. char *dmabufsrc2 = NULL;# \! R/ F  s3 O5 G
  75. char *dmabufdest1 = NULL;
    ' D5 S' k# ]. \8 ^5 m" @
  76. char *dmabufdest2 = NULL;" X& p. w7 }7 u5 F. q9 ~; V8 T& y
  77. + g9 {* {8 N9 n- |1 b
  78. static int acnt = 512;) m7 O( j0 G4 ]- I" N- p5 c
  79. static int bcnt = 8;
    ( m2 V) I; A* h) l+ T
  80. static int ccnt = 8;8 d- f1 [: U4 T6 `6 G( M  u
  81. - u/ Y  ^* [: u( p  e: U
  82. module_param(acnt, int, S_IRUGO);
    , u# f- C* h* p/ y5 L! G+ V
  83. module_param(bcnt, int, S_IRUGO);/ D, K0 Z0 p0 `4 J/ N0 R
  84. module_param(ccnt, int, S_IRUGO);
复制代码

, ?( o% y! \. m6 \) B# V8 q1 k
9 c+ n/ T9 Y6 ~4 X, g# e      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ Q4 r! ~$ T. F  @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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" `" ]  Y% T$ z9 A% e3 s
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 U0 }8 f% [3 ^% [9 T
6 X; b; h! H4 l% R; }2 L7 w

0 F' |6 w* @# `2 z9 S- h1 g
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-6 10:36 , Processed in 0.038535 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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