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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 @0 s; ?' O/ x/ s  F
  1. [code]EDMA sample test application
    , w8 U- A% w% B" r, P/ T
  2. /*9 g0 |8 ~/ H, V
  3. * edma_test.c# ~6 {% T5 x0 r$ t5 Z' p
  4. *2 @$ y' Y0 N- x
  5. * brief  EDMA3 Test Application8 f* q4 g* l: i- c1 O$ E5 f" B9 @( U
  6. *
    ! g& u3 X2 [# G& u9 G! m
  7. *   This file contains EDMA3 Test code.
    , n# D* u# ]9 {3 h
  8. *
    / j: P0 G8 X  j! y, }  J
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# }; A- s8 Q2 t; J! w3 x* Q" g) y. f
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    " j1 g+ f3 m. K6 v( t8 N; D6 p
  11. *         TO CHANGE.
    $ N# ~0 }3 d$ f9 I6 u
  12. *
    ! n, o- `: R) W, Z# `9 ^
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % R+ \; q/ M& H! b* f
  14. *
    6 m5 F5 L2 f  \2 L  {
  15. * This program is free software; you can redistribute it and/or
    # _5 K. u; b; G4 S- K
  16. * modify it under the terms of the GNU General Public License as; c: h+ i, D8 H- N8 _
  17. * published by the Free Software Foundation version 2.
    * a- C, T- ]6 Y- [6 E, h1 C
  18. *
    5 ~$ p) S8 v& I2 a8 S+ L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    : _1 |3 [8 }% W. K; ~8 K6 ]# Q2 b
  20. * kind, whether express or implied; without even the implied warranty
    0 C$ u# k" M: c' ?+ Z1 s
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 Y# J9 f7 B; @! o
  22. * GNU General Public License for more details.
    4 J- t. M. H# L) J3 e4 s4 }
  23. */
    " |: w/ e# Q- l4 x9 d( B9 l

  24.   o" |, |" n, G
  25. #include <linux/module.h>
    ' }8 Y4 _# ~! A$ c
  26. #include <linux/init.h>
    $ V( H/ i2 o' r; N2 }
  27. #include <linux/errno.h>
    ( l- K# @, Z' z: W7 }- i+ [& t
  28. #include <linux/types.h>( T8 i( l5 m' T( b- x$ B3 B
  29. #include <linux/interrupt.h># E5 e* z7 ^! ~3 i
  30. #include <asm/io.h>1 d4 h# q1 _: }4 a: ^& ]- C- M! Z
  31. #include <linux/moduleparam.h>  O: @% h8 S: C+ K  f
  32. #include <linux/sysctl.h>2 M# A2 j' C4 p3 j
  33. #include <linux/mm.h>/ l) D( c+ d- h
  34. #include <linux/dma-mapping.h>
    5 }8 v; z9 f+ Y" ?

  35. 6 L. e+ j. j$ e  Y# e. i
  36. #include <mach/memory.h>
    - J  w/ q: {& x& h' f
  37. #include <mach/hardware.h>" Y8 X# D5 _' M+ n) t
  38. #include <mach/irqs.h>
    " w: Z$ b+ D+ S  w% y+ L$ ?
  39. #include <asm/hardware/edma.h>9 L( }* c  f5 D

  40. ) `) {% e" X, n2 ~4 H4 a' O
  41. #undef EDMA3_DEBUG; R" O: ]& e: W" x0 D
  42. /*#define EDMA3_DEBUG*/4 j6 M+ t: K3 N+ v. X6 Q

  43. 1 G0 }6 J2 I1 t6 o
  44. #ifdef EDMA3_DEBUG
    # f, n$ H! z6 H: l
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' I9 u$ N% S2 \+ B2 g$ y9 T
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    0 C. |& p1 d" c  e  [9 E0 E4 e
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( s1 `, b6 [* T, M: p
  48. #else: [; {7 j* u! y- H" d
  49. #define DMA_PRINTK( x... )& E' z+ b1 k1 S4 o! g
  50. #define DMA_FN_IN; b" t& N! r4 f
  51. #define DMA_FN_OUT8 S6 q; Y+ [' {" s. h0 A3 A$ e
  52. #endif
    0 d) d. J+ A' i1 D1 v, {! }% K

  53. 5 }1 `2 I. }% K' v7 l" Y- \
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ' k( m. d. Q8 K% ~
  55. #define STATIC_SHIFT                3
    & p7 I+ n3 C; v! c
  56. #define TCINTEN_SHIFT               20
    ; O+ X) v% `- Q( R0 A" c5 B8 v, n
  57. #define ITCINTEN_SHIFT              21
    2 Y- B$ z. ?' ~2 `' H
  58. #define TCCHEN_SHIFT                22
    / J. U- o  ^7 n' }( M6 O' l
  59. #define ITCCHEN_SHIFT               23
    4 q$ c: w6 t, G$ ?

  60. & U$ i2 }6 D" l, j. z0 K, o
  61. static volatile int irqraised1 = 0;
    # A# |$ J  ^( A+ c
  62. static volatile int irqraised2 = 0;
    ! f/ f) k8 U3 A" k

  63. 8 H2 H; r6 v+ f( S# t$ P
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + d, E* B8 Y8 |: K7 }3 P
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 A! t8 }4 ^: r" A6 K2 N
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / H  z8 b# N# A; D  s
  67. 7 M" ^. {& p1 w0 J; D& l
  68. dma_addr_t dmaphyssrc1 = 0;$ m( Z9 X1 k0 V4 u
  69. dma_addr_t dmaphyssrc2 = 0;
    2 Q/ Z" `+ R, a! y
  70. dma_addr_t dmaphysdest1 = 0;
    1 {( I- S3 w4 Y& p, f
  71. dma_addr_t dmaphysdest2 = 0;
    4 t2 i) c5 j8 [3 |0 ]

  72. 4 o+ j+ X5 I! W9 }
  73. char *dmabufsrc1 = NULL;
    3 e; [$ {6 F! a' e# Y- [
  74. char *dmabufsrc2 = NULL;
    " T! u  C% j) K" l9 z+ V
  75. char *dmabufdest1 = NULL;
    $ y5 C/ {  o  B- M1 v
  76. char *dmabufdest2 = NULL;& \& h/ C7 T% F' ^3 n
  77. 0 v; o" M, X. J" b5 E2 n0 r& p, T" f
  78. static int acnt = 512;% r  [  `/ I! Q! z# y9 |# Y
  79. static int bcnt = 8;6 R( T4 b& {! s( U0 v  i( j
  80. static int ccnt = 8;* P7 v0 l1 U& y; u3 c" S5 ]5 g

  81. / b7 F; w# t* Q9 {, v
  82. module_param(acnt, int, S_IRUGO);
    2 [9 S* v: E5 L) j
  83. module_param(bcnt, int, S_IRUGO);
    ; k- D4 [3 q/ m$ Z
  84. module_param(ccnt, int, S_IRUGO);
复制代码
% W' x6 D) }, K5 Y' }' d! S' e7 v

2 C" H2 Q8 X3 P( j! e      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 ^  v3 s# v$ ^' W5 M' g- Rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ Z4 s# W3 e4 W
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 n8 m( [& y- c5 T" M0 a+ d, k( J* t  A

- C! o& y6 ~) \" R6 Q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-3 21:44 , Processed in 0.043138 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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