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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - P0 l* M& Q9 \/ T1 c& f5 f
  1. [code]EDMA sample test application! k5 B* w6 J6 |
  2. /*
    ) \5 ?9 d  |; }8 Q  ~
  3. * edma_test.c
    1 I! D& A$ n: b9 a) ]( n
  4. *% j$ I7 w( @9 d  t5 V
  5. * brief  EDMA3 Test Application
    5 t5 _  M1 L( s4 h3 X% T" Z
  6. *0 Y9 Y) q+ p! x
  7. *   This file contains EDMA3 Test code.
    * J# h9 C3 |1 k: `8 ]$ t' y) w, j" g
  8. */ l$ e6 G# P8 t1 g/ y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: _! z5 p, E& E1 _: p1 `# a! z* T
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; y0 ]6 l& k% W$ O0 b7 N4 ~
  11. *         TO CHANGE.
    & a+ q8 _  X. Z" C
  12. *8 [2 O1 a6 @- r2 x5 _' S
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    4 r4 T3 m# {% A
  14. *
    7 H- Q. |9 j3 }# B7 I
  15. * This program is free software; you can redistribute it and/or
    8 M8 \9 w4 c: w/ h7 w2 R( a
  16. * modify it under the terms of the GNU General Public License as
    " {; a: f4 a" p; p
  17. * published by the Free Software Foundation version 2.
    ' P# J0 G# o7 i; Y" M9 V8 h
  18. ** }/ C; l3 V/ c4 H
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 @* b$ B6 e6 J7 D
  20. * kind, whether express or implied; without even the implied warranty# @( X$ ?" W: L$ D! L
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % x6 h$ Y  M: F  T2 w, d
  22. * GNU General Public License for more details.' j% H- E8 T, b2 ]: {
  23. */
    8 h& \# d$ H( y+ n- E! H

  24. % ?, B! r) P( X1 [& N0 ^5 T
  25. #include <linux/module.h>& R3 d2 O' H2 e$ }! F% T. b
  26. #include <linux/init.h>2 q$ v* f& J4 Q# ^# S7 O
  27. #include <linux/errno.h>5 c) J2 u9 X. ^/ \/ P$ U
  28. #include <linux/types.h>
    $ _2 e7 S, T% G3 y( h; `" p
  29. #include <linux/interrupt.h>: X& s/ a- w  V
  30. #include <asm/io.h>( u; a( g' s# {* z
  31. #include <linux/moduleparam.h>9 E+ F8 n: u5 P" X4 F: D
  32. #include <linux/sysctl.h>+ L# ~' s  }8 F9 N6 ?1 T
  33. #include <linux/mm.h>
    9 D" l# H5 U4 B. l6 I4 K2 l# q
  34. #include <linux/dma-mapping.h>
    & A9 M2 Y- D0 I" E7 X/ p; T
  35. ! N2 O2 y! w+ T
  36. #include <mach/memory.h>
    ! A; G& X0 _* k: l9 T4 l  k
  37. #include <mach/hardware.h>
    1 O, Z0 }/ U2 A( v
  38. #include <mach/irqs.h>
    6 \0 X$ `6 @' j8 d6 F1 j# ~( S, W
  39. #include <asm/hardware/edma.h>
    ' J% N1 L2 R2 p% [
  40. 5 Q4 W4 T  l, C' e# e' ~2 @9 S
  41. #undef EDMA3_DEBUG: `! h  O/ |7 Z& a# D2 l3 s
  42. /*#define EDMA3_DEBUG*/
    3 x! i% b# `  }. _) X& Y

  43. 0 c% d: O& v! s$ a' Q. n: U
  44. #ifdef EDMA3_DEBUG
    9 x8 y+ j6 P7 I" N! V% q7 L
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    : i. u1 U5 C7 S7 e# _+ B
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! a# D- F( i) C& k* @/ U/ ]8 T+ N
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 C4 }. _, H( g! @0 `
  48. #else
    2 ?, q4 ^1 y1 r1 T
  49. #define DMA_PRINTK( x... ); I" f+ t% Y; S! u
  50. #define DMA_FN_IN
    7 \: q8 O2 p' L8 L+ a3 A4 K
  51. #define DMA_FN_OUT. D1 D! w" E( I! u1 n3 M- k! Y
  52. #endif1 W7 e! U( p& }; G, w* @
  53. % W, f5 H; H+ i0 O- Z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)$ y: j! l! b2 d8 m4 |
  55. #define STATIC_SHIFT                3
    8 V  |. O/ t+ j2 E" [; a7 Z
  56. #define TCINTEN_SHIFT               20
    + ?+ G+ G6 Z6 |- w' H# O) ?  h
  57. #define ITCINTEN_SHIFT              21' r! ^/ y9 z6 L9 Z. x' v
  58. #define TCCHEN_SHIFT                22
    / H0 L7 L0 c5 H, z
  59. #define ITCCHEN_SHIFT               23* N7 n; x0 y$ h* w5 v6 ~4 h
  60. " J$ x0 ^. C( l- P; h( S' r! N
  61. static volatile int irqraised1 = 0;
    2 u% S/ @4 l' {1 K9 G
  62. static volatile int irqraised2 = 0;
    ! t, p  C, g4 t/ D4 ~

  63. # B( W0 M' I$ {: ?
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& |) d$ W2 o4 s$ i
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  ?5 X. c- ?3 c" H) c+ {( f7 Q7 h
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) O" ?+ o" C0 p

  67. ) H/ y8 `4 g# b$ s1 m; `% X
  68. dma_addr_t dmaphyssrc1 = 0;# i, o6 f) c2 D) [. X
  69. dma_addr_t dmaphyssrc2 = 0;+ g% }+ E( W* \! s" \8 s
  70. dma_addr_t dmaphysdest1 = 0;' U) u+ V2 S& u
  71. dma_addr_t dmaphysdest2 = 0;
    / C1 i. c; t* q3 Y
  72. 7 k  ]! l  V5 i  G
  73. char *dmabufsrc1 = NULL;
    ; U5 E6 T3 }7 L: T1 d! I
  74. char *dmabufsrc2 = NULL;
    0 _- |6 U6 G$ x) l
  75. char *dmabufdest1 = NULL;  w& |" i; A, I$ ]3 O4 k0 h, \
  76. char *dmabufdest2 = NULL;
    + b" T  E7 F' Q$ A' \, a

  77.   [1 X, s# h/ n6 s% D5 Z% v
  78. static int acnt = 512;, S0 Z1 U" o; m% J/ \& ^! Q
  79. static int bcnt = 8;: b/ V4 N: _, C% ^
  80. static int ccnt = 8;% C" i. R* ?( G/ f5 y

  81. " P" t2 l& d) R# P
  82. module_param(acnt, int, S_IRUGO);
    ! _/ @9 }" g* [1 b
  83. module_param(bcnt, int, S_IRUGO);
    % u( {6 G, W) ?" q0 S1 Y7 W
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, Z- n' \) C/ S

! ?% B; p1 z! l5 x$ ?- v      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 D8 G! s+ \- j
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 Q3 Z" {' E' E  p4 Y: ?3 b, ^
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 W7 f9 n# w8 J
1 A( Z/ G0 u* B

/ O2 R$ z" E8 |9 s
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-19 14:25 , Processed in 0.038001 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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