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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ G7 \& y5 ]) \; h, i; H8 a* D/ K
  1. [code]EDMA sample test application! N( o. e! H# \) W- S* S1 ~7 n3 i) o
  2. /*% L+ X2 X* f8 }9 U9 ?8 d- f
  3. * edma_test.c
    5 h$ A( ]- O9 Y2 T' `
  4. *
    8 L& p3 D+ k% m0 I
  5. * brief  EDMA3 Test Application
    5 |' K' q1 G  q3 b" ?/ v% B
  6. *
    ( N( Z* s3 S; L% [: h% ~
  7. *   This file contains EDMA3 Test code.
    / e& z4 ~: O; S3 A3 l, b  j
  8. *
    8 C$ Q9 S1 U5 c7 V9 S8 e& x
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ' v# J0 j0 [+ P, i" a3 I: P% w
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    . m- \/ j  K9 `! J( [5 P7 Z+ c
  11. *         TO CHANGE.1 Z2 S. B$ y5 h' r( z
  12. *4 p; T" P: V& C# B2 D3 J
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    9 U5 x1 t) @9 z
  14. *
    , j" h( ?7 b! H$ r, K3 b
  15. * This program is free software; you can redistribute it and/or( k( Q- f; O! H$ u) P7 d
  16. * modify it under the terms of the GNU General Public License as3 ~! r* E3 w/ N- n, g8 l
  17. * published by the Free Software Foundation version 2.
    2 u, M9 C4 v/ N# r0 w# p0 u
  18. *0 a% J. s& T% B
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    1 z. z9 u6 F6 |# R2 s# ], B3 b) O
  20. * kind, whether express or implied; without even the implied warranty
    8 U" O: P; O" c+ T
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the( v5 g) A" K+ k$ d
  22. * GNU General Public License for more details.
    1 ~/ y* W8 Z3 R" m
  23. */. m* T2 I" K/ p5 x
  24. " r" a1 I; ^) f) @7 R/ Z( d
  25. #include <linux/module.h>
    0 A8 W- W7 d4 E2 Q8 {" h
  26. #include <linux/init.h># H7 U: A1 `8 w4 U. @8 ], P
  27. #include <linux/errno.h>' i. t0 M- @" a4 Z8 X
  28. #include <linux/types.h>( }0 h$ s5 d, o2 ^) T0 I) m
  29. #include <linux/interrupt.h>
    8 P% W- O7 {7 Y# s7 o0 E3 x
  30. #include <asm/io.h>. H( m1 d9 t$ X1 T2 i( h. v6 j
  31. #include <linux/moduleparam.h>. `# }- {3 i& u. C# t6 [
  32. #include <linux/sysctl.h>
    5 K% Z+ u! s0 X
  33. #include <linux/mm.h>
    9 @+ f" l3 k. _6 x& X. B6 |
  34. #include <linux/dma-mapping.h>
    * w  u$ {: j1 C# o; p' A

  35. 0 R( g" U5 C) B
  36. #include <mach/memory.h>
    / S# @# }8 r% r! L1 _
  37. #include <mach/hardware.h>
    % O! W" P! A5 P: l5 T
  38. #include <mach/irqs.h>
    : e, ^: m8 h' u6 p7 ~) P
  39. #include <asm/hardware/edma.h>% P2 Q- d4 j9 M/ t

  40.   R. `/ j% d, a: `  U
  41. #undef EDMA3_DEBUG
    ; X2 M) W% Q5 S: T2 `6 q5 r% R
  42. /*#define EDMA3_DEBUG*/
    5 \: D* d3 |0 m$ V! F, D" T( u
  43. 1 _% \( T* q0 }
  44. #ifdef EDMA3_DEBUG
    $ C3 s% u4 P/ N, D2 u
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    : W- G) M* i) k2 b, x' {, g
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & q' P+ e3 Z. \, G. C
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      n$ l- n( e( d  H; S# D2 ]- e
  48. #else
    ; {+ J- R9 T5 I) l$ M
  49. #define DMA_PRINTK( x... )
    ' {9 k; G6 a1 ~* R5 z) ~
  50. #define DMA_FN_IN# d; \* b' S; ^' x1 ^& b7 V0 ?
  51. #define DMA_FN_OUT
    + l7 n: ~1 L* y* ?# _( F. h! g4 c
  52. #endif! s0 r& A$ Z% q" n+ X1 P) j, f

  53. + C- G$ Y& `$ g6 A8 e8 \' A
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    4 N# k6 [- {" J7 b( ~  J2 N
  55. #define STATIC_SHIFT                32 A$ U# n$ U, m. _
  56. #define TCINTEN_SHIFT               20
    * D* l- }4 J6 `0 V% c
  57. #define ITCINTEN_SHIFT              21
    : [5 W0 r  E) A1 H2 q8 b9 V0 u
  58. #define TCCHEN_SHIFT                22
    : d3 j9 @3 _' c9 ]
  59. #define ITCCHEN_SHIFT               234 S7 [% ]  I1 {  T! \

  60. $ {- p" a0 v. u# u
  61. static volatile int irqraised1 = 0;  K( i- V. U/ C' [- A  a  c
  62. static volatile int irqraised2 = 0;
    $ j5 o0 K5 q0 L- Q3 T, P
  63. 5 K+ X0 H3 y3 h  R
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      J: O( r4 o8 B: V( W8 g  a  q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      c# W" D# t; m5 G% M; z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) A+ |& `$ k5 s" l2 v4 f% [  O

  67. 6 R4 H& y( X7 N7 q5 N' V; u
  68. dma_addr_t dmaphyssrc1 = 0;
    0 h7 E' \4 X$ @2 c$ P# O% `7 W
  69. dma_addr_t dmaphyssrc2 = 0;7 P' d8 u8 Q# z% O+ g
  70. dma_addr_t dmaphysdest1 = 0;/ Z5 @) i5 }2 ^- c; _5 P! O4 `
  71. dma_addr_t dmaphysdest2 = 0;
    . T9 D) {/ Y1 b/ |1 I

  72. ! e  r2 w7 G0 @2 x/ s# w  K
  73. char *dmabufsrc1 = NULL;) R6 E5 i9 _0 T8 Z$ ~* [
  74. char *dmabufsrc2 = NULL;$ s7 Z8 v" V; P* m8 O9 Q5 B( R! U
  75. char *dmabufdest1 = NULL;
    * d# F& H9 J6 [$ J4 k
  76. char *dmabufdest2 = NULL;4 @& a7 t! i) R# z3 P% E
  77. - q' v6 [" ^; I1 |2 L/ o' u
  78. static int acnt = 512;1 W( Q4 ]" {6 N3 B( D7 l
  79. static int bcnt = 8;
    1 T8 I; s3 u, e  w9 \# X+ c
  80. static int ccnt = 8;  m* R4 e1 [) q' G0 ]! B% x

  81. ! ]0 A( L: Y) J9 w' p7 W  H. Y8 o
  82. module_param(acnt, int, S_IRUGO);- Q2 n: ]3 B* r& ]8 \+ R0 g$ i  h
  83. module_param(bcnt, int, S_IRUGO);
    3 P+ O' ?: \% }  @4 j
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 L: y* }1 v$ q. l; n/ U, T0 _2 s' @/ y4 l& J
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% W) V5 \/ Y% r9 M6 R* oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, f$ b. e4 `6 C     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; o2 f9 M. Y1 R3 s+ O" u5 |2 Y

2 f- ?( C- S5 P+ u: \/ c! D4 }' C$ ?  Y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-20 12:49 , Processed in 0.042978 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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