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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " O, h- r- o( [
  1. [code]EDMA sample test application
    $ C' }, w* Q4 w+ S. g
  2. /*) }0 b* n8 Z6 @. ]
  3. * edma_test.c
    / T4 M& T% ?+ Z" d6 ~3 a* B7 V
  4. *$ |7 n8 g/ }. B, o
  5. * brief  EDMA3 Test Application, R7 S0 n9 x9 I' }" I! c: ^
  6. *5 v6 A0 P% o. D3 D0 G( I9 y5 V+ g
  7. *   This file contains EDMA3 Test code.' w8 f, y0 t6 ?  C9 Y
  8. *
    / S9 p' v. e0 k3 N% G, w
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ O3 d, P( Q- {9 u- _" z& i. W  f9 ?
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    2 p: u, r1 |: ]9 G& X- L- S
  11. *         TO CHANGE.
    : N+ }8 X, I: r
  12. *
    ; h, }9 Z5 N7 x1 g. S* E
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      A& ^1 f& g' a/ _% m' o
  14. *
    . c5 {0 \5 Q5 i4 h' Z
  15. * This program is free software; you can redistribute it and/or( S# ~/ H8 I! Z6 ], I( s" i9 T
  16. * modify it under the terms of the GNU General Public License as
    * Z8 d6 a  V; M, m7 @" `
  17. * published by the Free Software Foundation version 2.! h* Y, ^& Q3 w; m: l( a7 D. v
  18. *. U1 h" P$ V! A
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 h( a; _8 s4 }, j2 M. t
  20. * kind, whether express or implied; without even the implied warranty
    7 @; U- Y8 u; H: E" W1 a* y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' t: N  A$ ?# a- ?" Z$ }* K
  22. * GNU General Public License for more details.
    ' g( Y' W" E3 v- D+ d+ v- d* X
  23. */  T% F  i4 w* |4 n: U

  24. 3 F2 D) Q2 I1 n  T8 j: V
  25. #include <linux/module.h>
    4 n( S. E7 Y- F5 e: r* _
  26. #include <linux/init.h>- E) y- X: W7 M& I
  27. #include <linux/errno.h>. y) r: z/ h+ F# q6 N
  28. #include <linux/types.h>6 J2 @: z* j9 |6 Z: T# K3 Q
  29. #include <linux/interrupt.h>
    : m  }9 ^" \6 c" O4 Y' c
  30. #include <asm/io.h>
    7 |$ C- W( N8 v* W* O" X
  31. #include <linux/moduleparam.h>
    3 e9 P" b9 {* _' h2 E
  32. #include <linux/sysctl.h>* o) T" w) A7 }! |. i1 y. x
  33. #include <linux/mm.h>. j+ |4 U- B6 n# P4 z
  34. #include <linux/dma-mapping.h>
    ( _+ `/ Z, T  n9 D

  35. % W, B# a6 U2 V; j
  36. #include <mach/memory.h>
    6 ?* `3 B/ k4 Q* c3 @+ ]9 Y, `& T
  37. #include <mach/hardware.h>
    5 f, V* d. R2 r. n$ F
  38. #include <mach/irqs.h>5 B# e+ R2 U3 b0 A7 o$ [, m- G
  39. #include <asm/hardware/edma.h>! g' E% M3 m* X

  40. ( s/ |2 z0 |1 j
  41. #undef EDMA3_DEBUG  ]  u: l6 Y, R& T* E+ e; f+ f, c4 L
  42. /*#define EDMA3_DEBUG*/# N+ }; m/ M* i8 d: b8 U$ S

  43. 9 {- ]2 t( }  U5 A/ ]9 ~, U: j
  44. #ifdef EDMA3_DEBUG- G, o+ @/ i9 ?' K
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    * b& W7 O4 I' y) q$ F0 n0 Z4 d% \
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 {, Y4 O5 [2 k: k; e* R
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ X' S, }2 c1 [+ X
  48. #else
      k% F$ k4 e% X. E5 _: B9 l$ M* O$ o
  49. #define DMA_PRINTK( x... )( e1 K3 Q# s: E. K( ^' D
  50. #define DMA_FN_IN( J; x6 }% N/ ?
  51. #define DMA_FN_OUT
      t+ A9 K, f  g4 A7 K# G
  52. #endif
    ! m4 u0 M3 x! F+ N2 ~
  53. " }/ W2 p3 t! |4 j2 e
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    $ p8 r. G4 A/ q, J) D: C8 R
  55. #define STATIC_SHIFT                3
    + ?  U6 k0 E* \& c& I5 Y: l9 a4 c
  56. #define TCINTEN_SHIFT               208 _# _8 a! y% W2 ]9 B, L
  57. #define ITCINTEN_SHIFT              21
    8 T$ X7 s  @- G2 h
  58. #define TCCHEN_SHIFT                22# ]3 J) Z) ~; n2 U  i/ e+ Z2 V
  59. #define ITCCHEN_SHIFT               231 }" D5 F# ^' ?

  60. , o; W7 C( h7 z
  61. static volatile int irqraised1 = 0;
    7 W: S+ C0 u+ o; s
  62. static volatile int irqraised2 = 0;
    & u* V" G( h  ?7 l5 j, A

  63. 6 ?$ ^0 U* ~% L. H
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' x. P/ M5 w( F3 E* t* m
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& K* K$ T( G/ C. b" Y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * ?6 t' I- g3 f3 A2 ~0 _3 u
  67. ' O6 R0 @: m: b3 ?
  68. dma_addr_t dmaphyssrc1 = 0;3 G* b) C/ Z% e6 t) h' n, ?' S% l2 j; L
  69. dma_addr_t dmaphyssrc2 = 0;
    2 a' q( L% P+ i
  70. dma_addr_t dmaphysdest1 = 0;- E. G/ Q, z3 Q! b
  71. dma_addr_t dmaphysdest2 = 0;- ?5 `3 l2 d( {$ x- [

  72. 5 v  O  \2 r2 h" G, ?/ Z" ]6 q
  73. char *dmabufsrc1 = NULL;8 U2 ?; _/ J0 ~; S( \- P" @
  74. char *dmabufsrc2 = NULL;) T1 g! b" p* a( i2 _6 y: r
  75. char *dmabufdest1 = NULL;( V9 A! Z# I, i" \+ P
  76. char *dmabufdest2 = NULL;' S: ^3 w, o) P# x3 Y6 o
  77. " U% n, b. w# J6 O
  78. static int acnt = 512;2 H  @( ~) S9 y/ B, a/ ?" d
  79. static int bcnt = 8;
    ' I: R6 m" ?; n; y: v' h0 k+ z
  80. static int ccnt = 8;
    & E1 t. k) @2 A  S4 n0 S  F
  81. ; D- A' u" g- e! e: j8 O5 p
  82. module_param(acnt, int, S_IRUGO);" F2 W! f( x7 w, }
  83. module_param(bcnt, int, S_IRUGO);& k9 e+ k! M" q& g) }$ P1 `
  84. module_param(ccnt, int, S_IRUGO);
复制代码
! I$ X- C( C- t6 e, c
7 o* t0 ]7 h9 d) p
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: m7 h4 {; V( ^" Y7 t
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; S+ j3 W# t, a1 L# x
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" D3 `% J+ X' {3 `: }8 `
$ h* O. u8 D8 y& P/ h4 ~- d  u4 _
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-18 07:37 , Processed in 0.037791 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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