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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( a2 ?" O+ R7 J5 U9 M! y  E
  1. [code]EDMA sample test application( [+ y, G! t* E) L. q& p
  2. /*/ x2 h8 {" q0 g0 _9 V: d. C( U
  3. * edma_test.c
    % [, r, m0 V: i$ m
  4. *
    8 H. \2 r# L8 z
  5. * brief  EDMA3 Test Application" c. }2 b: h7 n* y% @+ \
  6. *
    ( W6 m2 T$ w# E% t% q* {
  7. *   This file contains EDMA3 Test code.  b) P6 X- a+ r, T
  8. *) ~0 X5 l2 }& y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 p1 [0 P( n6 p" U0 @: C
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 d; u. B+ b3 @# [
  11. *         TO CHANGE.
    ! ~$ R  D- H! e1 u2 H( q6 w) h9 B
  12. *
    & d6 Z$ G) x' ?
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* ~+ `2 @! w( w9 ^2 ^( q  x0 T6 v
  14. *; o, g7 c& w  O5 K  a' V3 a$ D
  15. * This program is free software; you can redistribute it and/or
    % `, l5 v( v, H
  16. * modify it under the terms of the GNU General Public License as+ ?7 w! e  P5 d" G2 V, ~4 M7 o
  17. * published by the Free Software Foundation version 2.
    . v* q3 R$ ?$ H1 g5 ~
  18. *6 E) j2 G/ V' p9 O5 B- m+ N9 Y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    $ {: N$ v; |5 T( Q0 W! E
  20. * kind, whether express or implied; without even the implied warranty( W- G: [* B1 `
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * d, u( z& ]3 t; m$ P0 U, ~1 z
  22. * GNU General Public License for more details.
    9 g% |1 E! ~" t1 o+ O
  23. */9 Y- P; u7 B. f3 y* C

  24. 1 Y. g. q3 H2 [9 `
  25. #include <linux/module.h>  ]& Q) N+ S" f. j+ {2 z: r
  26. #include <linux/init.h>
    2 Q* l" N% F! J, e/ A+ Y
  27. #include <linux/errno.h>
    ' [& e/ x- N- o
  28. #include <linux/types.h>/ r' Y( ^; U/ o% v& I) u" _3 u
  29. #include <linux/interrupt.h>" I% `& I5 Z. I
  30. #include <asm/io.h>
    0 _* D2 x3 r% M5 _& z$ N4 P# G
  31. #include <linux/moduleparam.h>
    $ F" T. V; _3 c; P& s
  32. #include <linux/sysctl.h>( a0 g+ A6 d1 Q! I
  33. #include <linux/mm.h>
    6 {' `1 P- l7 ]6 c- Z$ J+ [
  34. #include <linux/dma-mapping.h>
    % s6 q# T* @$ L) I

  35. 3 d; J# Z4 h, M3 c* g- U" }, @% R! Q# J
  36. #include <mach/memory.h>
    * h6 r, n& @/ h3 \% }7 w
  37. #include <mach/hardware.h>
    7 K! X# d9 s+ g3 }
  38. #include <mach/irqs.h>8 [: N/ y% c2 X! B
  39. #include <asm/hardware/edma.h>
    * ?: _3 f0 n' J; B  }! O+ [
  40. 4 C( \9 ^  \5 {$ g3 D/ G  V' A! b' I
  41. #undef EDMA3_DEBUG
    / j3 g( l$ r: H! F
  42. /*#define EDMA3_DEBUG*/
    & F4 [. ?) [2 M: i$ O; Y& |- Z

  43. . \8 b$ W) ^8 h2 M% ?
  44. #ifdef EDMA3_DEBUG
    % H3 N) ^( \$ Q4 S
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 F: p# j! }- X! K; i$ I4 m
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      Z; X- X1 A; C- c2 d
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    8 E2 `4 r- y" O' }" r, |( ]9 r9 ~( f
  48. #else- t, W7 n" b, _0 {
  49. #define DMA_PRINTK( x... )
    / Q  |9 j2 ^+ n& q: P
  50. #define DMA_FN_IN' {( R* @$ w" T6 ~3 n) [" t2 J
  51. #define DMA_FN_OUT
    7 B* Z, x( Y, U" o" P; e" ~7 h
  52. #endif/ g& u. C( l5 |5 C5 A' o' U7 N7 @4 l5 h7 t

  53. ; P0 C; O" S% b/ L) A3 w3 n6 {% f
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): T5 |: H4 C3 T4 N  a, ^6 Y
  55. #define STATIC_SHIFT                3# C/ s$ {6 y8 ?
  56. #define TCINTEN_SHIFT               20
    2 h& R5 X6 n( r7 @- A8 ]
  57. #define ITCINTEN_SHIFT              218 K( [. T1 s: Y+ R+ b
  58. #define TCCHEN_SHIFT                226 C0 f2 R) l' k. Z! P. _& n4 `& X
  59. #define ITCCHEN_SHIFT               235 ?# N1 K7 @8 ~) s0 W: N

  60. $ Y- S: }; r9 k7 d- l" A
  61. static volatile int irqraised1 = 0;- d' O7 y1 k  O
  62. static volatile int irqraised2 = 0;3 X; O! O4 l7 r" ]6 h

  63. % q9 o7 z! i! ]' U4 Y3 M0 T! v( q3 x
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' v  i" p/ V2 V% v8 T1 a
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' ~1 F& X% \1 X( |
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ D8 H3 d- M. M
  67. 1 ^% V- W9 a2 Z) }
  68. dma_addr_t dmaphyssrc1 = 0;
    / C6 u5 ]+ Y  k* y
  69. dma_addr_t dmaphyssrc2 = 0;' K; r  B) G7 S+ {: P
  70. dma_addr_t dmaphysdest1 = 0;
    - t) n1 a" K/ [. `6 Y1 ^
  71. dma_addr_t dmaphysdest2 = 0;
    $ D3 \7 D$ ?  L; U

  72. ' D& c7 b# e+ _
  73. char *dmabufsrc1 = NULL;6 V7 L: ?: {# J( B; b9 w$ F2 h
  74. char *dmabufsrc2 = NULL;
    4 E: G$ c1 g5 O
  75. char *dmabufdest1 = NULL;5 w5 Y7 e) {( g/ ^* ]: B- F; m
  76. char *dmabufdest2 = NULL;, k4 N- y  _  Z" A
  77. 8 o9 V$ ?% C" n
  78. static int acnt = 512;
    % i: g8 W2 y' H6 x! v1 A7 y1 U
  79. static int bcnt = 8;2 R- F" G9 Y$ }, w
  80. static int ccnt = 8;4 S& I0 ?) {& ?! J; b4 E5 P( J0 [

  81. . g! f  o& \6 ], ~1 O6 r- N0 y! f( V
  82. module_param(acnt, int, S_IRUGO);1 _* [: w6 Z, X+ V$ p8 F$ q
  83. module_param(bcnt, int, S_IRUGO);0 I( |- |  B1 \" G# h1 Y: s* D9 j
  84. module_param(ccnt, int, S_IRUGO);
复制代码
# U( }! z% {. o3 K  \
) t) r# B: o  ?& k5 K# \/ U+ j: Y3 G
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ M- s% I9 R# l2 b2 t. N( {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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& e1 M+ v' U3 B3 B9 R
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
  O1 ?- X5 X! n6 I0 f7 l: L" F  t9 s. k

1 ^4 o) {- {3 Q0 {+ {
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-5 18:22 , Processed in 0.038849 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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