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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; c# l2 B  m: s" Z" l
  1. [code]EDMA sample test application
    ; r% N+ A6 P! d" L& q
  2. /*
    2 C' ?" O; F0 S3 j
  3. * edma_test.c
    ; O- z2 x& I# a2 V$ Z
  4. *, i6 i. M! w) s- R! Q
  5. * brief  EDMA3 Test Application" u2 d9 b& O# h; Y' F4 ~4 ?: |
  6. *# `' n$ _8 O5 p0 \7 q! D) Q8 h- q
  7. *   This file contains EDMA3 Test code.4 J% c; @' B7 n! g
  8. *9 l+ ^$ K- d4 o2 b" L
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! e2 e$ k: ]5 F2 M8 w7 y* _1 h6 b
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: L6 b3 ~+ s+ n6 p, ]
  11. *         TO CHANGE.6 b. M) J% `0 \  U6 U
  12. *
    * S; T+ I; x; @) y3 d/ x) T% s
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 E0 h0 R- \: U
  14. *4 ~$ R/ X6 X' G' S. x3 F  R# N
  15. * This program is free software; you can redistribute it and/or
    ) v) [$ b- t3 q! z2 Z+ L
  16. * modify it under the terms of the GNU General Public License as3 n; z% n+ e9 w# D6 f* B7 |# c
  17. * published by the Free Software Foundation version 2.5 g1 m' s4 }. V  S
  18. *+ p% u& i) S! T# z8 u
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    * E. }( i6 u5 t0 [: P
  20. * kind, whether express or implied; without even the implied warranty
      T: l' @) x) w( e
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* U) r" Q+ J. l$ P: f
  22. * GNU General Public License for more details.0 `7 v1 B: y0 I# _; o
  23. */) i" m9 W& o' o. F  k

  24. $ [3 Y+ _% _& x
  25. #include <linux/module.h>% g6 I: g2 y. p( F2 h- I2 P
  26. #include <linux/init.h>/ y: m7 G7 w+ Z% Y
  27. #include <linux/errno.h>
    ' @* }1 e! u/ w6 D0 u) K
  28. #include <linux/types.h>
      m0 D1 n3 M/ e& h+ A5 p; p* f
  29. #include <linux/interrupt.h>4 q/ x! j0 X( m  \; m; [4 y
  30. #include <asm/io.h>
    5 p# t2 M) f0 g- T, c
  31. #include <linux/moduleparam.h>. m1 e+ j- C; h$ L: M3 w  E. Q
  32. #include <linux/sysctl.h>! G" e  G* @6 D* |" m2 c
  33. #include <linux/mm.h>6 ]' `% w+ I  \  _4 V1 P+ ^0 x  _: F
  34. #include <linux/dma-mapping.h>
    ' [; o0 s& M* R: ^

  35. ! ~" G6 {+ d2 _2 ^9 H' k
  36. #include <mach/memory.h>
    + E! Y7 l+ E+ i
  37. #include <mach/hardware.h>5 E6 ^8 ]2 d: J' X  `5 a5 L
  38. #include <mach/irqs.h># A4 S+ ~& U+ h. D% N9 E
  39. #include <asm/hardware/edma.h>9 x3 A  A1 {2 ~9 F+ Y) q

  40. & U! \+ [7 R) }# D4 }2 b1 @1 N1 d
  41. #undef EDMA3_DEBUG
    ) O+ N! W9 a" t6 `1 Q) l
  42. /*#define EDMA3_DEBUG*/
    : x& P6 o2 J% B& ]* V! x
  43. ) z% k$ O8 u1 C9 m- f. |9 @  }( U
  44. #ifdef EDMA3_DEBUG! X) t: Q4 w) [3 d1 X! D
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    6 v1 U9 T1 b5 N  G, x
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # D# M8 T7 g1 M) b  B8 V- b1 _
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 ^6 f  ~' a) A
  48. #else
    # T. ^2 j6 U% F; |4 V- N2 b
  49. #define DMA_PRINTK( x... )' B% T/ C8 t! l3 D
  50. #define DMA_FN_IN
    - p+ o2 `3 |" O$ q$ W' E+ D" r
  51. #define DMA_FN_OUT2 z) v  G0 e+ J
  52. #endif$ W' M* W: S7 {; a; t$ o

  53. " c  P! W9 H1 S: X" O' e: |
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , t6 y* v; g4 B9 a' U
  55. #define STATIC_SHIFT                3% }7 a: ~, P5 r8 S+ M. ~5 Y
  56. #define TCINTEN_SHIFT               20
    & ]6 j6 e1 ?  W# v" Y& `
  57. #define ITCINTEN_SHIFT              213 r/ g8 `* B0 e0 b
  58. #define TCCHEN_SHIFT                22
    0 k  ~( W* X) o7 H4 }8 A
  59. #define ITCCHEN_SHIFT               23/ f) z, D, [& l( {& n0 c
  60. $ |( k# k8 O" P4 G% n8 V6 i& U
  61. static volatile int irqraised1 = 0;
    7 I  D3 F4 ]' Y3 e5 H' X
  62. static volatile int irqraised2 = 0;
    0 e' ~+ \9 J8 F# @* q
  63. 2 n# W5 T0 L( H1 Z: M9 i7 j8 B! X- x& U
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ ?" b  a' [% x8 P2 g
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: C4 o' w/ `& m- A" F
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% h4 i$ ]- i0 M1 a3 a
  67. & Y5 ^4 j0 S: M/ ^' E
  68. dma_addr_t dmaphyssrc1 = 0;
    ) r* J  n. S0 X$ |/ k# a+ j6 A
  69. dma_addr_t dmaphyssrc2 = 0;8 V2 _) W% w$ M
  70. dma_addr_t dmaphysdest1 = 0;) v  a# W. V& y" m2 e) Z
  71. dma_addr_t dmaphysdest2 = 0;" [- M3 x( S" o3 Q% C
  72. - b$ h% {7 k# ~' a1 y9 O) `% D2 c+ e9 p
  73. char *dmabufsrc1 = NULL;
    , R5 G5 c0 K. ~" \
  74. char *dmabufsrc2 = NULL;- ]. ?1 Z- q- |  e! s/ H" `% c
  75. char *dmabufdest1 = NULL;! Y! J% M% J5 f% O- i) _" _# x  d
  76. char *dmabufdest2 = NULL;
    # q2 B# Q+ f9 O! Q  g8 o

  77. ' Z$ \- o$ p! w- j! l6 g4 X
  78. static int acnt = 512;. n) o6 v$ T6 A* s4 Z9 y! ~
  79. static int bcnt = 8;
    3 c# N; P; M  ^1 ?- p9 |
  80. static int ccnt = 8;
    9 ~: ?3 j, ^- Y- A

  81. 3 h; a& z: S9 K' ]3 O. x
  82. module_param(acnt, int, S_IRUGO);- g2 D, M4 x" S5 W
  83. module_param(bcnt, int, S_IRUGO);
    4 {( V/ X2 H( m  K; s3 T
  84. module_param(ccnt, int, S_IRUGO);
复制代码

0 t+ F3 r! J; n6 T8 U, Y" K5 w, L( ]) E$ |2 @5 H7 f
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 o" q/ C( x1 O$ P
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. {7 S4 f- t  u0 s0 C
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, h$ Q* p! w, ~+ B4 w5 {
- x& v4 s9 ]2 H! B6 P

9 |. Q* ?+ `4 D: \; V) O& w3 G% I
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-1 23:33 , Processed in 0.039357 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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