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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) M; Y6 C  s! t! ?: E/ i% L
  1. [code]EDMA sample test application
    * |/ |# j; v  z% ~
  2. /*' @) d4 _' H- z
  3. * edma_test.c! D# ?4 ?4 e* S8 d0 S
  4. *
    7 s, J6 x$ U) f8 T( f; L
  5. * brief  EDMA3 Test Application+ S  ~0 q3 M: E% m
  6. *" G& R; i' J' L: i; Y9 \: J& v
  7. *   This file contains EDMA3 Test code.. z0 `+ B! Q* b; Q+ f
  8. *
    8 G" p7 T- r; d8 R7 O& j
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: N( S# @8 ?0 k% p3 h9 J
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 p8 X) \$ h! ~; c  r
  11. *         TO CHANGE.
    - Y2 M5 v8 U, J) z
  12. *4 U; H# w* M) C, [
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 ?2 o$ [0 u0 H& X$ v7 |
  14. *. O! |2 V4 W2 d6 O9 o( U: C
  15. * This program is free software; you can redistribute it and/or
    " \4 Q6 j( E4 u; X; `1 r
  16. * modify it under the terms of the GNU General Public License as
    ! x* `6 ~+ b" H
  17. * published by the Free Software Foundation version 2.
    " Q7 }* M7 P+ A+ q) f" y
  18. *
    3 h0 M2 ?7 N3 a6 u
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 ]4 g  T. s9 _$ d- z4 T! d6 b
  20. * kind, whether express or implied; without even the implied warranty
    ) p0 I0 Z  j6 x: R
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - y' c7 {; k$ a6 R
  22. * GNU General Public License for more details.
    ' _' V2 O# j  j5 Q3 l  T' E7 K* |
  23. */' W4 x, n+ L! f7 D% X

  24. 4 T, E$ d4 u, w7 y; x: V
  25. #include <linux/module.h>3 `1 K$ l+ o1 q1 B- h
  26. #include <linux/init.h>( d0 x+ [* B3 \& K
  27. #include <linux/errno.h>/ \; l# n& E2 c2 N
  28. #include <linux/types.h>
    ( r9 q  [. n# E2 _) S6 ?9 N9 p
  29. #include <linux/interrupt.h>- O. ^( ~+ ~& y( ]1 p) Q; {0 ?
  30. #include <asm/io.h>
    & \. y: D6 @$ n
  31. #include <linux/moduleparam.h>0 ]( |9 W" X, C) w, [; p
  32. #include <linux/sysctl.h>
    ' @4 f4 M0 }7 K0 T. y, p
  33. #include <linux/mm.h>2 _5 ]3 M5 [+ L& n# t
  34. #include <linux/dma-mapping.h>2 Z2 K& w( Q7 L/ A3 w& B
  35. 9 V& e7 a! {& h3 n9 A4 Q* N' }" {
  36. #include <mach/memory.h>
    ' W0 D9 \2 w' H6 d
  37. #include <mach/hardware.h>, C, d+ g4 L+ @, S
  38. #include <mach/irqs.h>
    8 ]4 }; K" U2 P2 n4 W4 N3 v
  39. #include <asm/hardware/edma.h>
    1 m& t6 G1 X' C
  40. : l* S. u; H" x; S- Q
  41. #undef EDMA3_DEBUG
    - P: J; |, j5 @+ _. M% s" s
  42. /*#define EDMA3_DEBUG*/
    ' I+ m/ z" M. B4 y% m

  43. % K* t/ M- L' s% B1 Q% n
  44. #ifdef EDMA3_DEBUG5 p8 p+ ^8 K# ?$ ~1 x
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - H( q6 q6 H5 @0 `/ L3 _9 J6 O" n4 Z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    $ }6 Q$ z. C  k6 S
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( C9 \9 ^1 N% U* H6 T3 W/ Z7 x
  48. #else* e4 }" Z; [" g2 u7 V. L3 t
  49. #define DMA_PRINTK( x... )
    7 ]+ s% N& u# F5 ]0 Z4 S1 t
  50. #define DMA_FN_IN
    ' D3 A" C6 n! p
  51. #define DMA_FN_OUT0 E% j" m, @2 T- `4 Z) R( ~  P) c
  52. #endif( ^# u+ ?6 w" K# f
  53. 1 p" T( d# K# v* X( ?+ i
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)/ g$ {7 \4 U/ P" t
  55. #define STATIC_SHIFT                3
    ; Z6 _; Q( j" s1 k
  56. #define TCINTEN_SHIFT               20
    ' |8 O& V+ L+ y& V& [* O) K9 f
  57. #define ITCINTEN_SHIFT              21
    % V( _! g5 R( J" D# j
  58. #define TCCHEN_SHIFT                22' J4 O( I+ `3 G0 a) F/ I& b" e7 ?
  59. #define ITCCHEN_SHIFT               237 e* B$ r  O/ e% ]

  60. 9 c  S( J" e; H3 [
  61. static volatile int irqraised1 = 0;. m/ i2 K2 A2 R6 e5 S1 A- ~
  62. static volatile int irqraised2 = 0;* U3 F, D% }* U7 @

  63. 6 C4 T6 W) }1 v1 _
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! [8 v! j" o; i1 X' W& o) p& ^' x
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " a4 H' S* V. w
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      I- L) z) g5 c9 [, a9 _- A

  67. # O# J! M/ i) \1 l+ S' K
  68. dma_addr_t dmaphyssrc1 = 0;
    . W! d( h$ s; R
  69. dma_addr_t dmaphyssrc2 = 0;
    - O+ H* T, x2 [' f" }3 l2 F
  70. dma_addr_t dmaphysdest1 = 0;
    7 N" g; m# Q2 _( Y
  71. dma_addr_t dmaphysdest2 = 0;
    & X3 {# \& M: |1 ?9 p) T  Z

  72. 6 `7 x- ], a- R$ e6 d$ |1 S
  73. char *dmabufsrc1 = NULL;% {. O0 R4 z/ E5 p7 X3 O! \7 t
  74. char *dmabufsrc2 = NULL;
    + {/ R5 x) O) ^% |7 ?# A
  75. char *dmabufdest1 = NULL;* t6 V7 w6 N; y4 x5 L* M6 \3 }% O
  76. char *dmabufdest2 = NULL;
    ! E9 e& I" r2 b6 M0 o, M3 D
  77. : l& u+ W2 _) r8 j/ U4 N
  78. static int acnt = 512;, K% m# W; s/ ]8 Z" w" K, p
  79. static int bcnt = 8;9 Z6 Z1 u. _( P  @8 x  I, J  {
  80. static int ccnt = 8;
    2 O# g4 D- @' V; c) R2 f( h0 m

  81. ( U& I# g, _3 ^( O
  82. module_param(acnt, int, S_IRUGO);
    ; c6 P! G. J' M1 N9 ]+ D/ }0 M
  83. module_param(bcnt, int, S_IRUGO);
    : J; E" D. b8 y+ ~7 O
  84. module_param(ccnt, int, S_IRUGO);
复制代码

# S3 z9 a0 F  m
  ]: u& M- g  |- d4 L  }- ]/ }7 t      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" u+ y7 \$ ^) L( u! |. m
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 y8 {% ?, H0 s4 x
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" Z5 S- a! p0 ~0 K# c

/ r( E  g4 `7 v( e' \" R7 z9 U: P# A& Q4 A
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-12 06:58 , Processed in 0.048251 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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