OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 Z2 m1 f! u4 n( z$ g6 P
  1. [code]EDMA sample test application) h% e' v! U5 z5 }. k: ?
  2. /*
    ) Y8 u3 j) t' K% D$ J7 e4 L. O! l- e
  3. * edma_test.c
    & I1 {1 j; x% q% A% n  A. H
  4. *! I6 d- z% g( B6 X# X5 G$ g, z
  5. * brief  EDMA3 Test Application6 ^& ]& z+ U; ]7 q+ V5 T& B
  6. *
    $ e- P/ H$ j: d# J
  7. *   This file contains EDMA3 Test code.
    & R& E) P5 \* @8 t( ?$ d
  8. *( a' J# r" C3 e: g( L7 J* ?9 T
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( U- h  i+ _, d3 H$ G8 o1 A: m
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    9 n, t* f; X$ L4 J& t
  11. *         TO CHANGE.- y1 M* _5 X9 y% D! F0 J6 \2 f+ s
  12. *( _) Q; ?) l+ y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( u1 B$ T' P7 b2 u# K8 m
  14. *
      e. g6 _+ h# E4 X, u9 d6 L, M/ i  [
  15. * This program is free software; you can redistribute it and/or
    8 ?% c! t' D/ Y" _4 L
  16. * modify it under the terms of the GNU General Public License as
    % f$ E5 p- v; ^4 a& V
  17. * published by the Free Software Foundation version 2.6 n3 w. v$ O- k9 ?1 i0 c8 a0 i
  18. *2 b1 u' W: r. X' _2 j
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ g* I" w' @4 o" F! F( S$ i! u
  20. * kind, whether express or implied; without even the implied warranty! ~$ L7 q& `/ V; |, S2 x. _
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the1 t; z, e' x8 I* S" V9 v5 w7 k
  22. * GNU General Public License for more details.
    * x( N7 V, n: Z# @3 d$ h
  23. */; |. }  _) a5 f, m% b& I

  24. : y9 h9 o4 @, P* z; R
  25. #include <linux/module.h>
    ' d5 v( t4 n  O9 w, ]
  26. #include <linux/init.h>
    ; F" q  F8 X2 G
  27. #include <linux/errno.h>4 Q* x+ k' ^  j
  28. #include <linux/types.h>
    . T. j4 R0 j; p  P7 g* `; C
  29. #include <linux/interrupt.h>7 X  O7 r  {! a5 y! N( n- [1 Z
  30. #include <asm/io.h>
    + H1 H4 W% [' U, D7 A; j! z
  31. #include <linux/moduleparam.h>/ c0 L2 C- n8 t1 j2 @/ J/ X
  32. #include <linux/sysctl.h>
    & i1 K- K3 M* r7 E$ B% n
  33. #include <linux/mm.h>3 \$ @+ z" c3 |, I- l1 k: D) _% A2 p
  34. #include <linux/dma-mapping.h>4 O" L& \- b( x2 Q+ `

  35. , b& K( R  X0 v* e+ |2 {
  36. #include <mach/memory.h>
    % g  V; u' v% z7 Z& e: I( s! U9 u
  37. #include <mach/hardware.h>2 q6 f7 b0 C# D$ i- Q
  38. #include <mach/irqs.h>: E; Z* X9 u- d
  39. #include <asm/hardware/edma.h>/ R6 h6 `) K7 G- `: o
  40. ; N, b. V7 |9 \7 M
  41. #undef EDMA3_DEBUG( j% j. g4 x6 G" e: G1 y+ o
  42. /*#define EDMA3_DEBUG*/
    0 q+ l9 n* q" e! ?/ X
  43. 0 R$ S" C6 o( G+ }
  44. #ifdef EDMA3_DEBUG& V* g, u8 T# x9 x; O/ ]
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" }( b$ w. x" O( o; P& k- y  Y  P8 z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    : A' g% {$ f9 n! T  z  c+ ~' j
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) A8 X9 c$ C* I* G$ b1 J" W( v8 p
  48. #else
    - a+ Z* k' Y* Q/ m: g
  49. #define DMA_PRINTK( x... )- ?9 I( e& E6 s% r
  50. #define DMA_FN_IN6 K+ B% x. p$ o$ ]* t/ Y
  51. #define DMA_FN_OUT
    7 Y; s0 u$ D* O8 Z0 L# v9 u
  52. #endif
    $ ?) d% Z; `; ~% q- F3 A

  53. 6 S1 |3 w( k: M$ `# l4 I
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . l5 H6 S- R- t: ]8 t# J0 ]/ Y; q
  55. #define STATIC_SHIFT                3
    / L# i. F0 C8 X* A
  56. #define TCINTEN_SHIFT               20# h5 R$ Y* Z5 e
  57. #define ITCINTEN_SHIFT              211 K: z; `4 g/ F9 K  n' r; Z
  58. #define TCCHEN_SHIFT                22
    3 K$ ^* |) m* s/ x# D8 V, X) \  ^
  59. #define ITCCHEN_SHIFT               233 K6 L6 I- T6 `( ]% \

  60. & a. d9 `: [' S. |! ^% ?
  61. static volatile int irqraised1 = 0;
    . E# K6 J% Q/ ?* R, _' Q
  62. static volatile int irqraised2 = 0;
    9 _) Y0 j1 I* u( ~5 f
  63. * N' S8 {" A+ S# H; y. Y" y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 E- x& R. A+ {/ ?+ s  |: H
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ F* I1 f9 j; @8 ?/ _4 l; ?2 l
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! R/ D( l' t" Y& m  O  n

  67. 7 K4 R  I& E, ?; F# m$ @! k8 B
  68. dma_addr_t dmaphyssrc1 = 0;6 U& k9 N: v, L: N/ J. z" f
  69. dma_addr_t dmaphyssrc2 = 0;9 _8 ^, a2 R6 {3 q( b
  70. dma_addr_t dmaphysdest1 = 0;) y+ x  h/ O6 R8 K
  71. dma_addr_t dmaphysdest2 = 0;
    - g. {; W, \. f6 _: i2 h
  72. 1 y1 {- q# @, o+ g9 T* B1 N6 u! f
  73. char *dmabufsrc1 = NULL;
    , u9 [5 l; b+ \  @4 W' H6 J
  74. char *dmabufsrc2 = NULL;
    # P" Q' w" k5 ]
  75. char *dmabufdest1 = NULL;9 `7 l; a9 B. F7 ~2 c9 h) z# M
  76. char *dmabufdest2 = NULL;/ c9 j2 o2 o9 y9 n: L/ z

  77. 4 ]! U  a3 r/ h+ ?
  78. static int acnt = 512;
    ; `; }- E8 T' Y* m& o  R0 L
  79. static int bcnt = 8;  L$ t9 E! Z% R1 u1 P
  80. static int ccnt = 8;$ [! k2 l/ y6 A  d) V

  81. & l# V# [* s; e% s/ e
  82. module_param(acnt, int, S_IRUGO);
    * ~! ?. `9 o2 L
  83. module_param(bcnt, int, S_IRUGO);5 A. Y7 J7 Z* u2 ?0 S
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! B5 K! v& I* m- w# q3 I  \
" G6 a: [' |2 r6 Q# {6 b9 u      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# B. @: O; z: K, W. {# v) tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! {  g( m1 g# C" v" o+ l
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 @) e  W" \2 k
; y" K5 b- U3 b. _! `

6 d4 J+ X6 ~% z! w+ n# x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-9 15:20 , Processed in 0.047343 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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