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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! z0 g+ x6 m& f
  1. [code]EDMA sample test application% S& K0 x: u1 O% L' R
  2. /*
    * R; B4 Q1 z$ @0 H
  3. * edma_test.c! J* u$ N( S" U1 P6 d
  4. *4 G7 h. z5 f# W( g9 G- U
  5. * brief  EDMA3 Test Application; s1 X. u* \, C/ d+ _
  6. *9 H0 v6 r+ }& `/ A, H
  7. *   This file contains EDMA3 Test code.1 U$ A/ g6 _2 F$ d: ~( `* ~. E; v( i
  8. *8 l) G* t  G2 z" N. c! n# B
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; c$ P* V: @6 [/ z) P/ _7 h
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    : o, Z$ h& h* D; n& i9 G
  11. *         TO CHANGE.! w% t2 J7 C0 o( B
  12. *
    9 ]3 O" c6 o2 S0 E6 s
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    2 A/ F" ]0 l" d1 U" `% P$ ]+ A
  14. *
    ' O0 S8 h: I" L5 R8 w3 b/ e
  15. * This program is free software; you can redistribute it and/or
      Q' ~; E" M, e+ u
  16. * modify it under the terms of the GNU General Public License as
    ) S  d0 x6 Q; w( C
  17. * published by the Free Software Foundation version 2.
    * j/ U6 V0 U1 a6 k+ j. `' g! s
  18. *
    2 o# B* o7 F3 e& ~$ \
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    7 S8 x" w: G9 n& N: \* ]
  20. * kind, whether express or implied; without even the implied warranty
    1 \, v: u' H* J; K) E: `! R
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the( W6 `6 t- h9 x# N0 K7 L
  22. * GNU General Public License for more details.9 Z+ K  V( r1 L1 z- v1 @2 @" J
  23. */- v$ U" ?3 o' E1 s4 r
  24. 9 q8 T5 `; B, ^7 U/ G
  25. #include <linux/module.h>, d5 F4 |' W) S$ b
  26. #include <linux/init.h>+ I& B2 x$ n4 [+ k% b+ D
  27. #include <linux/errno.h>" @9 [+ [0 _+ q, ~/ f' v% A
  28. #include <linux/types.h>7 V# g: u# w) Z) U4 b2 |7 c! ~: K
  29. #include <linux/interrupt.h>! I4 B7 Q5 G  {
  30. #include <asm/io.h>
      c% t- }/ m# [6 y
  31. #include <linux/moduleparam.h>
    6 N$ G* F2 k( u
  32. #include <linux/sysctl.h>
    : i& r! L2 W, c
  33. #include <linux/mm.h>& p) W0 g4 {7 R5 B7 P8 v6 ~
  34. #include <linux/dma-mapping.h># u' H6 ~( ^  W

  35. 6 i9 c; c  ]' }/ a$ A+ f( G1 K  z- o7 P
  36. #include <mach/memory.h>
    ) Y" B+ B7 O3 M5 O! ?; R) h
  37. #include <mach/hardware.h>; L' {4 W# W( ^9 W: i3 G& h
  38. #include <mach/irqs.h>1 o6 Y6 z' j. T/ Y, G' G; R% ]
  39. #include <asm/hardware/edma.h>
    & C7 \, R; z2 h5 j/ `" H& v
  40. ' l1 W$ x( {2 |1 u6 ~! \
  41. #undef EDMA3_DEBUG3 G* Z' d" m& O
  42. /*#define EDMA3_DEBUG*/* b) n( C- i) ^! ?" E, J) F

  43.   W$ L2 ?2 g# H' d
  44. #ifdef EDMA3_DEBUG5 F* Y% \# O9 T$ H4 T% S3 b
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- ]2 [9 @3 B9 K. F  h
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    4 e7 I9 d; Z5 i: e8 \* ~0 }/ d6 o  r
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 H0 ?( l5 G" o, O+ L
  48. #else
    $ c) R- ]% W% P" p% z2 f1 m
  49. #define DMA_PRINTK( x... )
    ! p7 Z2 b9 }, v  w: f
  50. #define DMA_FN_IN
    % T/ X7 G4 S) L. {4 r
  51. #define DMA_FN_OUT+ _  D- U( j0 Z9 `
  52. #endif
    6 T/ o2 o- a" Z7 g$ M& ^

  53. 4 t) y: _5 O- H& b
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)% c$ T, a% ]. d* g  M
  55. #define STATIC_SHIFT                3* A3 Z, J1 _9 y& c  b
  56. #define TCINTEN_SHIFT               20
    1 K9 y' d' l) U% j+ B8 w* {) Q
  57. #define ITCINTEN_SHIFT              21: D6 {' i0 V" N+ ]% b/ t2 V
  58. #define TCCHEN_SHIFT                22
    7 t. W- o% K5 e% q+ m4 d3 g
  59. #define ITCCHEN_SHIFT               23
    / q: s/ Q. z8 j6 w5 Q
  60. # L$ Q- \, j5 {0 V/ A* s) C3 R1 D
  61. static volatile int irqraised1 = 0;3 G" o% o! j: q2 r# ?
  62. static volatile int irqraised2 = 0;/ U7 i$ r. U1 t5 g7 D! j' D

  63. ( d; g0 c; E2 U" Q9 k; d3 @' A
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 ?- E/ b! P- _+ e
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( W2 ]# d7 |5 S2 m. [6 P" q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 V4 b+ H, O$ T8 n: x
  67. / |! t! A! ]3 m: g7 o# Z
  68. dma_addr_t dmaphyssrc1 = 0;
    % l* i" l2 }+ ~3 O) l" `, w
  69. dma_addr_t dmaphyssrc2 = 0;
    ! F; E' r" i4 R4 H$ ^+ |
  70. dma_addr_t dmaphysdest1 = 0;
    ! D4 }% }# [/ q% l' F
  71. dma_addr_t dmaphysdest2 = 0;
    $ A9 N% w0 y( o5 y' g+ y2 d- x

  72. & Q. U$ h* n. l& J8 [9 X
  73. char *dmabufsrc1 = NULL;$ V* Q+ o0 h# W! x' R' p
  74. char *dmabufsrc2 = NULL;# P1 f$ p  O$ V! i1 Z0 O
  75. char *dmabufdest1 = NULL;! u4 w+ J3 Q: }2 D% b
  76. char *dmabufdest2 = NULL;( t6 u5 b; O7 B: E: T
  77. ! ?6 U6 e4 H8 w
  78. static int acnt = 512;
    : _8 u1 H8 z( m- C
  79. static int bcnt = 8;
    ' u2 y" C* U$ q1 T( ?( I
  80. static int ccnt = 8;
    6 m, Y- o3 Y2 d0 {  u. I

  81. 0 H  T( W9 K+ r
  82. module_param(acnt, int, S_IRUGO);) {5 D7 \5 p5 V7 z7 X
  83. module_param(bcnt, int, S_IRUGO);
    5 S; f! M% o4 q  j
  84. module_param(ccnt, int, S_IRUGO);
复制代码
* ^7 z) A4 S+ ~9 j0 `) ]
! r! L  Y# ]& X4 P: u
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 ?3 M8 G7 ^$ B  Q# k+ E; C
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- b, `1 \  o; D1 K# h/ J6 N1 u. _     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ E& W2 S- e( o6 \; Y, K
  X' I- \$ e: _/ H
: o3 [- j+ Q3 J
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-20 00:31 , Processed in 0.038614 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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