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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 o2 z: l" h( t: z/ O! N
  1. [code]EDMA sample test application9 `3 k' R( @. H0 [$ E
  2. /*
    $ k2 `$ d& w  H( ]0 J
  3. * edma_test.c6 S" M  B+ H% d  V& e
  4. *, A0 h9 ~; G4 y: `6 }7 K+ V/ N
  5. * brief  EDMA3 Test Application
    $ s4 l% J) `- ]  |
  6. *
    0 ~  E  J% y3 f0 h
  7. *   This file contains EDMA3 Test code.
    0 S! @! c$ q5 M1 E/ \% ~9 _1 N
  8. *) Q* ~+ T/ u# O4 \( Z+ b( F4 E2 b
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ z+ G# t5 ]/ W5 Z0 a) g0 Q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 K3 ]# u! l' F! |8 E
  11. *         TO CHANGE.
    $ j( r: a" a4 Q
  12. *3 E+ P% e3 a* i& y( R: ^
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& ?; ^/ ^# L- N3 i
  14. *& j4 G% w, Q$ M  d8 }$ U- L
  15. * This program is free software; you can redistribute it and/or0 U+ M6 x- z4 u
  16. * modify it under the terms of the GNU General Public License as
    & i- W1 b6 L, X2 {
  17. * published by the Free Software Foundation version 2.8 @, }5 {5 e( d* m- o, ^
  18. *
    7 b; R. x% d9 F3 h& e( V- F  d
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 c* }" F! g$ g* V6 D. U3 R( c
  20. * kind, whether express or implied; without even the implied warranty% m. h, W& n1 A( a) _! D% Q4 l
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the0 e  v. v# n4 f. S8 Z
  22. * GNU General Public License for more details.- @, o+ u* V' w, c! G  T. ?
  23. */, H6 g, T9 [0 |) e# V
  24. . A6 B5 c" r* B0 N
  25. #include <linux/module.h>
    . T9 L- c, k. G  w
  26. #include <linux/init.h>
    % `0 z( S/ @# i( f
  27. #include <linux/errno.h>
    # ?& T. F8 Z2 ^
  28. #include <linux/types.h>  c# V! J& Z) z. r4 U/ k3 l  z1 R
  29. #include <linux/interrupt.h>  E2 n! l9 K7 g8 W8 H1 ]
  30. #include <asm/io.h>
    + c; Q3 q. e# B3 X
  31. #include <linux/moduleparam.h>4 C9 [' [. a8 M; r+ C1 M. S5 d
  32. #include <linux/sysctl.h>! S$ |  ^* w/ }; T2 o
  33. #include <linux/mm.h>8 Z; g' l% u1 h
  34. #include <linux/dma-mapping.h>' c& |7 m+ a/ e  [) d+ [: R1 w+ N
  35. 9 a, x' k0 p# h0 R, h
  36. #include <mach/memory.h>4 g! ]) o) }! g, p# d6 V
  37. #include <mach/hardware.h>+ c! p7 ~( m+ S: K. v/ Q$ T9 l
  38. #include <mach/irqs.h>
    7 O9 X) J% p$ E" T
  39. #include <asm/hardware/edma.h>
    3 a' D2 g1 e! R
  40. : p- I  k  W% c% k$ i
  41. #undef EDMA3_DEBUG
    7 P+ p  T- |! j
  42. /*#define EDMA3_DEBUG*/
    : Z1 M# ]& c* ^7 p8 N

  43. , `" `) p6 a7 f) x* m4 k
  44. #ifdef EDMA3_DEBUG% @& C- \* q# s( t' ^
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 E9 t) A; K% [2 H0 p6 `- K
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 ~: z& r, C" y# p- d
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) P( c: i0 u. o/ ~
  48. #else9 K: _" d+ k$ w! L9 ~7 E
  49. #define DMA_PRINTK( x... ), V& ]& A' X3 p; P0 F. h: Q- f" r
  50. #define DMA_FN_IN
    # B# I4 O4 e% ?) H
  51. #define DMA_FN_OUT" I, S; s( G9 u
  52. #endif2 }0 M+ ?$ A: u( A7 z& F

  53. % U( _0 u; [6 k/ j
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)" t1 v  p+ k9 A5 R9 U# t5 \
  55. #define STATIC_SHIFT                3
    " F- i4 P& K( ?, V$ W9 l# `/ U
  56. #define TCINTEN_SHIFT               201 [6 t+ d: i% I' e& _6 C
  57. #define ITCINTEN_SHIFT              214 S% i3 V  b+ R$ f, W& ]# k* P
  58. #define TCCHEN_SHIFT                22$ F- X& c/ G+ I6 a. b8 Z
  59. #define ITCCHEN_SHIFT               23" t) K: g6 r: h3 W& \3 I; f
  60. 8 g) u6 g0 s  O9 j. y. J' `! d
  61. static volatile int irqraised1 = 0;
    9 s' J+ _- P' i" z3 ~
  62. static volatile int irqraised2 = 0;
    / r  \0 d' M  z3 \9 H$ E

  63. + m6 i; k2 ?5 i6 F9 j7 u3 @6 h
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 i' E% V% M( c+ ]3 Q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( C9 b) R0 e1 a6 M
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 J8 E5 R8 U1 Q$ ^. p% }5 ^/ [/ m

  67. + @$ F. z: s/ r" ^& N1 }! P
  68. dma_addr_t dmaphyssrc1 = 0;
    % H" r, f) F' i$ d( D9 V" ?
  69. dma_addr_t dmaphyssrc2 = 0;
    ( A. w/ i& t/ f
  70. dma_addr_t dmaphysdest1 = 0;
    & w% k5 f0 c( S, o
  71. dma_addr_t dmaphysdest2 = 0;1 y$ L7 T8 a8 ?) l0 n6 q

  72. ) F+ h/ e9 t6 u* O7 j
  73. char *dmabufsrc1 = NULL;
    + a$ u  n# t* P  s. z2 q/ W- J! i
  74. char *dmabufsrc2 = NULL;
    - b1 a0 Z5 m: a, ~  N
  75. char *dmabufdest1 = NULL;
    4 H! N( b' ~- g: {0 w0 J
  76. char *dmabufdest2 = NULL;( K9 x: S1 p# c1 v$ c

  77. , a9 I" d7 v+ A* ~3 J) |' P
  78. static int acnt = 512;
    7 O: p- @0 J' H: V3 M( ^, O- Z
  79. static int bcnt = 8;0 @7 O, I; Y5 L
  80. static int ccnt = 8;
    3 I' N% y! @" \) }$ \3 \# C6 ~
  81. + p( J. [" b! V3 O- S" B
  82. module_param(acnt, int, S_IRUGO);( V7 ~1 x; W- {% V1 c$ e
  83. module_param(bcnt, int, S_IRUGO);& {* C( h8 G8 O) Q% g: x
  84. module_param(ccnt, int, S_IRUGO);
复制代码
: H! x: }. s, \; G' H- ]2 H4 A+ [

2 Z+ ~4 \' p! e0 X, l! W      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 }, j, z" K" p: e
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/ ~; i/ U4 U* J5 u     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 q+ r. D( [( a5 E' ?9 n

0 u1 e$ s4 u& f9 `" a1 k
5 P. T& Q4 p9 U/ K
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-21 13:18 , Processed in 0.039704 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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