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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, Y  v7 E8 F- Z) c) ?% L
  1. [code]EDMA sample test application9 `& e! F$ Q, N1 H. t7 j, t5 E
  2. /*
    ) C3 M2 P& O  r" L7 d  ?
  3. * edma_test.c
    - b( f4 p& W: d
  4. *' E6 G3 C, |5 o" u0 s0 |
  5. * brief  EDMA3 Test Application$ r/ n( |7 t4 p6 O4 B
  6. *
    ; p+ D; P( z8 H9 Y
  7. *   This file contains EDMA3 Test code.  Y1 v" H" R/ |  s& j  z# ^- g
  8. *
    ( P$ Q2 E7 W0 |! {7 J
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) S, l1 U9 Y; x0 h7 i
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    3 B9 }! W0 X; C" n/ I0 A
  11. *         TO CHANGE.
    - E1 F- w! W: C+ F* R$ u4 {
  12. *5 e$ t/ W  p$ C: J2 `5 a
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    0 C( G+ i+ s6 C2 m* E- d/ s
  14. *
    ( m5 I! d- \( _$ F  s( E
  15. * This program is free software; you can redistribute it and/or" @- U, F* a# O
  16. * modify it under the terms of the GNU General Public License as
      N9 A, {4 e; o6 b/ l
  17. * published by the Free Software Foundation version 2.
    - C+ ?% Q  ?8 m! d
  18. ** D1 G2 L; g2 l/ V/ z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any! n) ^/ E6 g! ~! d' W1 j
  20. * kind, whether express or implied; without even the implied warranty
    & R& e3 J6 w$ W+ o. ]
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / D, t8 V6 v  r+ p& `
  22. * GNU General Public License for more details., A8 }, w+ m4 u3 [" z/ ^+ G' e  i+ Y7 ^
  23. */
    ! n6 k" K! u- X2 T9 C5 D
  24. ) m) p7 A# C- o0 c. H, E1 g( \
  25. #include <linux/module.h>
    8 [; H" [% x( e: M
  26. #include <linux/init.h>
    / k- I4 y: N8 u% P) O
  27. #include <linux/errno.h>
    3 G& F6 T2 ?2 x, k' n. D  n
  28. #include <linux/types.h>
    # y& F' K$ ^6 \/ @+ M
  29. #include <linux/interrupt.h>
    , n9 [7 r% s# N# F
  30. #include <asm/io.h>7 L- m3 H2 A* @6 S
  31. #include <linux/moduleparam.h>! d" e9 I) u1 t
  32. #include <linux/sysctl.h>
    4 g. u7 D, o3 o3 V
  33. #include <linux/mm.h>
    9 v4 |$ C' S2 u3 M4 P; J: l% y4 W
  34. #include <linux/dma-mapping.h>
    - y* T, M0 a" e4 J9 D- b

  35. 3 L/ [$ o5 j( r+ F. o2 u
  36. #include <mach/memory.h>1 u5 V4 L: O3 O+ D. f& ]+ R5 ?
  37. #include <mach/hardware.h>1 x0 T5 o! e1 A
  38. #include <mach/irqs.h>0 [  ~, v- `1 A. @/ ?5 {/ j. m
  39. #include <asm/hardware/edma.h>
    * h0 a# V3 L  L' y6 f

  40. 1 j! q, j2 G: O2 C
  41. #undef EDMA3_DEBUG0 b/ t* V3 O( e5 N: N5 T% ^9 F6 n
  42. /*#define EDMA3_DEBUG*/4 p; K8 m/ q, x. G; Q1 H- n3 `, e

  43. 7 ?: \8 M( A( k3 D7 B
  44. #ifdef EDMA3_DEBUG% c- ]& \) H. t- W+ f: ?. x- A
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    5 L, s0 H+ S' z- Q( K6 [
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; a5 g8 y5 ?. H! K. C* i0 ]
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). a5 r; ~0 x  J* K( f9 y
  48. #else
    ' ~5 X( E1 W" X1 V4 x: n6 _
  49. #define DMA_PRINTK( x... ): V3 I9 O9 {+ i; R
  50. #define DMA_FN_IN/ ]* l7 ]6 v3 J- G4 d
  51. #define DMA_FN_OUT- Y: T+ [1 s, q9 L2 T2 X" n
  52. #endif2 l3 ?; k1 d% P, p2 ^" ?

  53. % a7 x4 M$ e8 h7 ]/ m
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    5 P; r7 t2 A& p4 d+ |6 h/ X7 `; @
  55. #define STATIC_SHIFT                37 O% K9 Z, b3 I# Z. l& o3 }
  56. #define TCINTEN_SHIFT               202 P! E) P- p2 d5 C
  57. #define ITCINTEN_SHIFT              21
    " O  B# I0 f- S( F2 v! X8 m
  58. #define TCCHEN_SHIFT                22
    8 k! C9 P: t% h( ?# s. p" k
  59. #define ITCCHEN_SHIFT               23
    1 r9 U) `0 w' q! s" ]& y

  60. " Q# k8 D! i; W5 Z/ r
  61. static volatile int irqraised1 = 0;
    1 w# a( S8 N* p8 C
  62. static volatile int irqraised2 = 0;
      E+ K5 d- Y4 o4 K. `0 j

  63. 7 [& l* X& r: F' _1 q7 M$ [
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 O. Q+ |$ q7 c% q! c; ?
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- V2 m" q' N! N
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. Q# i8 \& s* `8 B! f! X
  67. 8 T7 C- A% Y6 J* o
  68. dma_addr_t dmaphyssrc1 = 0;4 f3 T' K6 F, ?
  69. dma_addr_t dmaphyssrc2 = 0;
    . c$ Z7 J5 c2 y; ^  g
  70. dma_addr_t dmaphysdest1 = 0;/ R7 H( W) ^( S5 G2 z+ M1 J
  71. dma_addr_t dmaphysdest2 = 0;
      C6 I, S' a; n5 q) C

  72. 7 ?4 Q1 W: ~7 J6 s4 @3 W, P& Z' V
  73. char *dmabufsrc1 = NULL;/ I' @1 `( t& E% a0 H3 ~- l8 p
  74. char *dmabufsrc2 = NULL;
    ) A  K/ K. G7 R! a* I! A' ^5 S6 a
  75. char *dmabufdest1 = NULL;( R6 u4 N0 g* z
  76. char *dmabufdest2 = NULL;2 [' F2 ~" g% x" c, b& i8 H  z
  77. ) @2 u' q9 b) R/ ]
  78. static int acnt = 512;' \) D3 }& D) b. E
  79. static int bcnt = 8;( d) ?3 ]+ s9 s% K0 [: U. F: u
  80. static int ccnt = 8;" w; M0 x7 N) P

  81. , f+ W* J% L3 x  Q
  82. module_param(acnt, int, S_IRUGO);% J- k. k5 z# K6 ?. p! D: b
  83. module_param(bcnt, int, S_IRUGO);
    8 y" C+ e9 [5 r2 _$ w6 C9 O6 _6 }. s' l
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, H% b# _( N% \. D; r0 L* A2 @

$ \5 Y$ G6 V3 p. [& U) v) X      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 Y8 }0 V% E- n; V
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 Y, i2 E# R! G, u3 m/ f8 N
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, R" K) I% E8 _6 ^# x- `0 G% c: `0 a
$ |5 s2 s5 ~9 O8 k' \* @8 q: U
3 c5 H8 F' f) Q! R
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-15 23:39 , Processed in 0.040361 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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