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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 q2 _" [3 [  N) x  R) p/ G
  1. [code]EDMA sample test application
    / u8 ~0 \  L: b* N, N
  2. /*
    / R  K8 U9 P& C
  3. * edma_test.c
    ; t& D" E6 m- V1 m0 R
  4. *
    " r& U4 B" @, N: H+ n+ n
  5. * brief  EDMA3 Test Application
    : n* {: |+ s, m3 s
  6. *
    2 ?1 E# q5 x/ d! h- }& J' n
  7. *   This file contains EDMA3 Test code.
    . F* H1 v" v) L+ F
  8. *) y  b2 d8 E! l' s$ ]3 Q: |: {: h
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 W) Q. j! \8 r2 ?( |0 a' e
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* b. g( k; a4 A" v
  11. *         TO CHANGE.
    9 S! h& Y. `  m+ N; i; Y' E
  12. *& D" A, {4 V! M
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& ^* u) I1 K  |6 }- m
  14. *& A2 Y# \7 G/ ?: N
  15. * This program is free software; you can redistribute it and/or
    # O8 j7 G; H# v3 X/ a2 J
  16. * modify it under the terms of the GNU General Public License as
    ' Y! ]0 U" m# x: U7 I# C' @
  17. * published by the Free Software Foundation version 2., }* F" {- r; A* H8 T
  18. *; s. k" k- U1 V) f: o. D5 a
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any! ~. F0 j6 Y$ {, k; m8 u  i
  20. * kind, whether express or implied; without even the implied warranty
    ; ]( r1 R. b2 ~( q0 r) o0 {% n9 g
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . X7 u& K( N" x4 @, Q/ j/ B
  22. * GNU General Public License for more details.
    " X! }! `. J1 }# H2 t" |
  23. */
    # _6 J  L) f6 C
  24. 2 V) F' ^; V. h" H0 C, l
  25. #include <linux/module.h>; d. j3 f! ^) m& C" d5 S
  26. #include <linux/init.h>( m; r# ^6 \5 f  P1 N9 D1 Q" f
  27. #include <linux/errno.h>
    1 H$ K7 S+ a  [% E4 a
  28. #include <linux/types.h>: y! j: b+ B8 @: x; Z
  29. #include <linux/interrupt.h>7 J- _" P8 H7 s: {
  30. #include <asm/io.h>/ W0 |1 e1 A& ]- ~
  31. #include <linux/moduleparam.h>- N  b) P9 V5 r, i
  32. #include <linux/sysctl.h>) ~" f# W4 l5 Q5 |
  33. #include <linux/mm.h>  a9 `4 c0 S& |" ^& O9 E
  34. #include <linux/dma-mapping.h>
    $ S0 B4 a: j! U* ^6 V

  35. ) F* o% K% ^2 t0 q0 S
  36. #include <mach/memory.h>3 B8 B8 R0 Q9 j4 J9 N7 X9 c
  37. #include <mach/hardware.h>
    9 j3 w$ l5 y- ~! S8 S/ R
  38. #include <mach/irqs.h>1 h4 V( ]# D4 n% b) S: t# v% ?
  39. #include <asm/hardware/edma.h>
    3 b6 w. Y7 p0 ~! f) N' e

  40. , \/ {' L" A. A: Y7 d* m) I
  41. #undef EDMA3_DEBUG4 l. Y  T; _. l
  42. /*#define EDMA3_DEBUG*/
    , @% X/ E- }1 O' u& n( o9 s
  43. ! j# `+ h- i$ o' A2 X9 Q* V
  44. #ifdef EDMA3_DEBUG
      D6 P( I9 m& T: R- r1 c
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    8 B4 b: F9 ?3 d- C% m
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 ?, S) |8 c( I- J& h* S
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! ]4 I9 C3 ~2 Z0 y3 g/ m' w3 q
  48. #else2 i2 x& \9 X" O  {
  49. #define DMA_PRINTK( x... )
    8 X4 L6 k2 A% L- b5 |! I- W' q: _
  50. #define DMA_FN_IN
    ' R( e$ l' `. v1 n
  51. #define DMA_FN_OUT
    5 u& m1 l" U0 m
  52. #endif
    . _9 \7 j( |+ H  _

  53. : g4 k% F+ R3 p" K* k  x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : }2 P" g; R9 w% `5 m: P
  55. #define STATIC_SHIFT                3/ o* n7 q) l, m& H; @
  56. #define TCINTEN_SHIFT               20
    4 p4 d* e! `3 [6 L4 b6 k
  57. #define ITCINTEN_SHIFT              21* i+ i' Z4 ?2 K4 k( b, u+ U  [
  58. #define TCCHEN_SHIFT                229 S' j5 _2 s- C
  59. #define ITCCHEN_SHIFT               23
    0 h0 K9 ]) F$ [8 ?

  60. ! G( T* f- w0 P. k6 z8 H; j! n
  61. static volatile int irqraised1 = 0;
    5 H$ e& _" i# w# X; g
  62. static volatile int irqraised2 = 0;$ T5 H! {8 r0 S6 c( G
  63. % a6 x& T4 w  t7 O' j
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- T/ W. V  d) c* @9 X, o+ a
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . @- P$ l5 C8 F! F% ?2 m9 `* W7 H* S
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * X. l3 L5 n6 e( j; {( ]: A

  67. $ V* |0 W) C$ n, r
  68. dma_addr_t dmaphyssrc1 = 0;
    0 D0 M+ B* i' G3 D+ _
  69. dma_addr_t dmaphyssrc2 = 0;* V: |& P- A8 T4 p. h9 W4 h; Z
  70. dma_addr_t dmaphysdest1 = 0;
    1 E; L  A9 z2 i
  71. dma_addr_t dmaphysdest2 = 0;4 ~4 ^- [0 a( Y: Y

  72. * g( Q" X$ E0 m! k
  73. char *dmabufsrc1 = NULL;8 p2 r2 N& I4 h7 S( J3 V
  74. char *dmabufsrc2 = NULL;$ k, [6 u0 h+ U6 |; g
  75. char *dmabufdest1 = NULL;
    + C: D. H/ p3 {0 H5 d; Y
  76. char *dmabufdest2 = NULL;
    ; N- O+ u" C2 G8 ]+ u& `

  77. * H7 ]2 a" G1 Z/ p3 u, v. ]: Z0 {# ~
  78. static int acnt = 512;0 ?6 x4 N4 @6 R/ I; [: N5 c/ q& r5 x
  79. static int bcnt = 8;' V: m- W, ~0 F: L: k& ?% V
  80. static int ccnt = 8;
    - F$ k  g: X$ l0 {! M) J
  81. 5 l: [( e4 o0 \, H. D: f* H
  82. module_param(acnt, int, S_IRUGO);
    ' A. B, {4 C& k) r! r( J
  83. module_param(bcnt, int, S_IRUGO);! \1 J$ |; n+ t" S
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! G: Y5 Q4 I) }! F1 n+ V3 Y+ _8 C8 X4 F' }2 n7 [
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 }$ h9 z4 O( D9 @& c- e) V2 c8 O
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 B% X2 j: b# U9 Z     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. ^* M3 T+ ~+ T' R* P* t

6 b9 L! d1 x# c, q
3 H( `. z3 v, W% F
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-31 11:09 , Processed in 0.045499 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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