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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! p0 r5 D  T9 Z% X- L( k7 {+ t
  1. [code]EDMA sample test application
    1 \- V3 s' Z0 Y
  2. /*" m/ r: P1 u6 Y0 O* g2 ]2 c  c7 u
  3. * edma_test.c
    7 _! a4 V! G3 t
  4. *
    6 }! J1 }) J8 x
  5. * brief  EDMA3 Test Application
    1 x: u6 I8 @, P1 L
  6. *
    % g3 X& S3 Q% z0 O
  7. *   This file contains EDMA3 Test code.
    ( h( H7 v! H  d$ G: \' j
  8. *
    - v$ d1 Q8 f$ v& X( o
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- x# |* r  `4 s: @: x' T4 H
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 F0 G  O! D+ H+ h
  11. *         TO CHANGE.3 o0 J( l9 a9 ?% L8 y- Z3 u4 }4 w- `
  12. *
    5 u/ H) s" K" J2 ~
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 P, C8 T! W% Z3 |0 e, j4 U, I1 `
  14. *
    & e+ d+ z/ Y; G- T8 d, [
  15. * This program is free software; you can redistribute it and/or% g3 \9 S# x1 P* o; A! w# m
  16. * modify it under the terms of the GNU General Public License as
    9 v% ?, s( t6 h. W
  17. * published by the Free Software Foundation version 2.
    7 N) B; Z- k) C& a& A9 O! y& F' Z
  18. ** r7 {  o0 p6 }- @# }+ E4 m: }, Q" a) W7 }
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    & @- c$ q% c6 {  T/ p- K# |
  20. * kind, whether express or implied; without even the implied warranty
    0 Z& [0 T. i! l; ^5 F8 B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - a- y# n: _, x
  22. * GNU General Public License for more details.
    4 c% _6 S4 b8 [8 w
  23. */- b$ r. K( c& M& g

  24. 1 b) ?) W( c0 C: [6 P& B6 o' b
  25. #include <linux/module.h>
    7 ~: q. I0 a6 A' |3 d9 L) B
  26. #include <linux/init.h>
    2 X* T2 d7 v5 w7 @
  27. #include <linux/errno.h>
    4 k2 L! d1 E) ]6 r7 y# H. X
  28. #include <linux/types.h>; \7 ~  D/ Z' @
  29. #include <linux/interrupt.h>0 X' m* d; i& D2 Q
  30. #include <asm/io.h>6 q, G2 B0 ^# `: V' J7 _
  31. #include <linux/moduleparam.h>9 J  e9 c5 J) Q3 Z( S$ i: [4 A$ W
  32. #include <linux/sysctl.h>
    8 @4 A6 `7 E$ _4 Y
  33. #include <linux/mm.h>
      E, A/ Z4 X; l
  34. #include <linux/dma-mapping.h>
    & Y$ d; ]0 P1 p) f: n- Y% E
  35. + Y. M5 _1 \( j  M& u
  36. #include <mach/memory.h>
    ; D  e# A" C% u. h3 g
  37. #include <mach/hardware.h>
    * P6 m4 C  N$ z+ r# ^* E2 t4 q) d$ w
  38. #include <mach/irqs.h>9 q1 q9 i$ o" i
  39. #include <asm/hardware/edma.h>. F/ R! _9 S, n" H7 i; M

  40. , D$ |* W, P# c3 [2 D1 W
  41. #undef EDMA3_DEBUG
    ' [' c* t* O" e# `: p* d. w! n0 Q6 e, c
  42. /*#define EDMA3_DEBUG*/
    ! d+ a. `! B: ^" t) @: Y0 V2 {

  43. 8 t8 O" i  h0 T, m3 v
  44. #ifdef EDMA3_DEBUG+ t0 k1 a. p9 g: N, Q0 a) T
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    " L; z( \- @+ N9 Q! K+ z. Q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), x9 B, \" D8 o  [, k4 M
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)  i! o  |$ j- R; x4 Y4 W
  48. #else  i3 Y8 l3 E( F; l# o/ \, p0 h
  49. #define DMA_PRINTK( x... )
    2 Q2 P5 |2 `; c2 A7 ?
  50. #define DMA_FN_IN2 C! m* Z3 u' _7 M* p
  51. #define DMA_FN_OUT
    # X" h/ r& ^0 q0 b& p; Y
  52. #endif; E$ c8 w2 x. `3 D% [- d# {. g

  53. " [( L% s) }+ e# r5 R, w( m
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)) t: O2 ]+ k! Z
  55. #define STATIC_SHIFT                3
    + j9 Z4 H% A5 ]6 @
  56. #define TCINTEN_SHIFT               20" p' p' ~1 Z1 n7 R$ U8 t! @
  57. #define ITCINTEN_SHIFT              21: n+ O# r! K' {4 x
  58. #define TCCHEN_SHIFT                22
    . ?" C9 C0 T- b/ [/ w/ D
  59. #define ITCCHEN_SHIFT               23
    ; Q! E/ `- l. B' M1 B! W: V
  60. 0 Y0 \9 M% m. Q, a$ g/ k
  61. static volatile int irqraised1 = 0;! d; I- c3 I7 ?! \5 Z; O
  62. static volatile int irqraised2 = 0;
    0 e# Y  f& ^# V$ K
  63. ' H% s" p0 ?+ N# }- H- F
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . Z0 @- m( ?$ U6 m6 J
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 S: y# T+ B$ X* S% h+ Y) F
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + N9 N. M. z- m' f

  67. & `% F1 M$ v/ Q4 w! V1 z& P. \
  68. dma_addr_t dmaphyssrc1 = 0;
    * t: P8 D! C9 M; d" `$ J
  69. dma_addr_t dmaphyssrc2 = 0;! O- J! f) s: k9 l) N5 R
  70. dma_addr_t dmaphysdest1 = 0;. m4 ^# e2 p; `1 r* N
  71. dma_addr_t dmaphysdest2 = 0;  V$ _4 |$ G5 S6 a# j& q8 L9 A4 A

  72. , g' U& }+ C* [& X
  73. char *dmabufsrc1 = NULL;
    - R& E+ _  E: q  J+ Y
  74. char *dmabufsrc2 = NULL;, P% `0 u8 i) a& p5 B
  75. char *dmabufdest1 = NULL;* M+ e9 m+ R; n7 A$ @/ ~& D
  76. char *dmabufdest2 = NULL;
    , u) u5 i5 X4 y, K: J, A0 h
  77. - D# p1 u2 M8 K. Z( `4 V
  78. static int acnt = 512;
      {9 x) g% _/ k6 S" M0 T9 t
  79. static int bcnt = 8;* J$ T! ~$ y' y: O2 y# a
  80. static int ccnt = 8;2 t: d9 {3 U& \* }6 k* N, a3 x

  81. + N5 _, N* y8 H+ D" O; A
  82. module_param(acnt, int, S_IRUGO);
    ( ?1 C) V5 h7 l3 g" L
  83. module_param(bcnt, int, S_IRUGO);
    4 Y6 t$ n) L, L. i; Q
  84. module_param(ccnt, int, S_IRUGO);
复制代码
) `& Q5 z+ h. S5 ^) Q8 Z5 D3 q

% E# @; O# k1 }      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 b& h' A* s0 `4 w7 A5 u. [
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. o  ]; Q$ p# u" R( Y  S% Z
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ g& J% `! h% Z# E, G2 y

2 Z& v2 t( B1 [1 J/ D/ u, {
' b  L, J$ @! }/ S) t4 B
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-30 20:56 , Processed in 0.041932 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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