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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; `  o9 }. X3 ^" A6 G9 L
  1. [code]EDMA sample test application- v1 x; l9 ^- M- Q" ~
  2. /*; v7 n' {7 s2 Q( v4 [3 V
  3. * edma_test.c
    ) c0 [" E9 H0 g( O" w0 N
  4. *6 Q: p. Q# w6 E+ w" Y4 A# {# i
  5. * brief  EDMA3 Test Application, @% k- [& @- e9 @: R
  6. *
    , c' m/ g3 @% T
  7. *   This file contains EDMA3 Test code.1 U; W9 Y. |) X3 ?8 w: j
  8. *
    % Q2 X, c3 R. r$ {( G
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! ?# t* ]0 w6 I  E9 }
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 {( y6 C/ N; S, |) w. I
  11. *         TO CHANGE.
    - p' k4 u0 i& K" F- O
  12. *
    $ h  ~/ n" S, y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 K; t3 ?3 Y/ Z5 h4 |5 D
  14. *% E8 J; B) S5 V! _9 }- L8 T
  15. * This program is free software; you can redistribute it and/or
    . C8 z8 \4 i  C) A% {( |
  16. * modify it under the terms of the GNU General Public License as
    $ X. c; p' ~, u% c: ]. ]. `
  17. * published by the Free Software Foundation version 2.
    , G, a; X. t# i
  18. *6 `4 `7 {( H8 Q5 _6 [
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    $ D$ q7 Q& ]- I* b
  20. * kind, whether express or implied; without even the implied warranty4 V/ U+ O) m1 J% j- X
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the, k$ j2 O2 I5 A& q5 V9 o& N
  22. * GNU General Public License for more details.  u- {) r# v) B( ^5 p7 k
  23. */' b, `2 B2 N( X/ b

  24. ' {) i5 ?" F% Y/ L$ F$ m6 P! i
  25. #include <linux/module.h>
    0 L0 X' p  M1 A  d8 q
  26. #include <linux/init.h>
    8 u# Y( Q# t7 A3 f; w9 V; b8 h
  27. #include <linux/errno.h>$ F, ^. d2 g7 y0 P( W) A) \
  28. #include <linux/types.h>
    1 l" ~! T9 O) Y/ @% N
  29. #include <linux/interrupt.h>
    3 v4 ^+ L8 i' d) H# C% m
  30. #include <asm/io.h>
    * \' Q4 i' J. ^3 c, H' T
  31. #include <linux/moduleparam.h>
    0 Q( g' h8 q* Q) U5 Y
  32. #include <linux/sysctl.h>$ y. u2 f: ], M2 e
  33. #include <linux/mm.h>2 ]! B* Q% P  h* U6 N3 E
  34. #include <linux/dma-mapping.h>
    ( o" `4 m! u4 g. r7 b# @

  35. 1 n- |. U# j% E1 E
  36. #include <mach/memory.h>5 l& h$ _! Q/ o) }6 ]) Y7 x$ @& x5 `/ {
  37. #include <mach/hardware.h>+ t0 V& ?  o1 \( Y) h& F7 a
  38. #include <mach/irqs.h>
    ! _2 j0 j* _8 ^: u! c
  39. #include <asm/hardware/edma.h>/ M+ g# }4 r; b$ a5 Y( p% o
  40. ; B* B# L* i, T2 h1 I4 B7 f
  41. #undef EDMA3_DEBUG
    . B5 T) J4 W6 D  u, g! F
  42. /*#define EDMA3_DEBUG*/
    9 R2 x/ t3 {" g; n4 }& `* e7 A, B

  43. ; C7 \  M& X2 b/ q0 ?7 @
  44. #ifdef EDMA3_DEBUG" q. b8 ?$ ?' U# ^6 ^5 q3 q. i
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& ^) }7 V& r3 ^# g3 L
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    - D$ Q1 ?# ^6 K. v5 G* V& B3 f
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    8 [# n7 G% H4 ]/ R+ p. M
  48. #else
    4 q! C4 M9 D' k
  49. #define DMA_PRINTK( x... )
    4 [8 S" b4 E% h' X$ _8 s6 L
  50. #define DMA_FN_IN. i% O4 f: _8 w; q: O
  51. #define DMA_FN_OUT
    " E; |# v: f9 {* `# H) i
  52. #endif: S! I  w: v4 g) ?

  53. ( z7 \5 |" v3 h7 z5 _, l
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 e1 d9 V4 ]  w' e+ J
  55. #define STATIC_SHIFT                3
    ( [  N5 e* _* ]% q" j0 g
  56. #define TCINTEN_SHIFT               20, e- N$ n4 g' x8 j+ r
  57. #define ITCINTEN_SHIFT              21! D8 b! F/ p+ I& I3 @
  58. #define TCCHEN_SHIFT                226 J( p/ h* A4 }2 C2 j) Q% P4 r
  59. #define ITCCHEN_SHIFT               23+ E0 w3 B( S: v. K" M2 X

  60. 0 |* O( T' {: R5 W
  61. static volatile int irqraised1 = 0;
    7 Y5 v6 g  V% T- B2 @3 N
  62. static volatile int irqraised2 = 0;2 }' J; h" {0 _% {3 K2 X/ W
  63. - `3 c6 f' n3 _: {2 I
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& m# i- U6 F+ R; K
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- G  @8 ]% G7 Y1 O, h
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( f/ I* T! h5 b. [1 x
  67. % x8 d  }* C3 f3 p3 [( x( r8 o
  68. dma_addr_t dmaphyssrc1 = 0;! {9 t8 g5 @! u/ X
  69. dma_addr_t dmaphyssrc2 = 0;
    : S5 l1 O4 M' `
  70. dma_addr_t dmaphysdest1 = 0;
    / P, K3 L  a9 b1 F
  71. dma_addr_t dmaphysdest2 = 0;* n( e$ Q9 i1 b; R, r
  72. ; Q5 Q5 Q) [* v
  73. char *dmabufsrc1 = NULL;! x: v% j2 K) ~5 k$ H
  74. char *dmabufsrc2 = NULL;
    - Z5 z7 E: r  B; k/ X- o, {
  75. char *dmabufdest1 = NULL;. W3 ^6 Y: Z: V- U# {: V
  76. char *dmabufdest2 = NULL;
    3 `) v  [9 Z, t

  77. + a) h' D9 n( S- R) c' z. I  ?6 P. O
  78. static int acnt = 512;
    : [" f7 s5 b7 i# j- X
  79. static int bcnt = 8;
    / [* t. _; J0 w
  80. static int ccnt = 8;  u% m/ Q- Z' s
  81. 0 x1 X. m/ D$ C# x9 m
  82. module_param(acnt, int, S_IRUGO);
    $ ^9 ]" t  V. F6 P8 C- _3 a
  83. module_param(bcnt, int, S_IRUGO);. S+ U- n2 w- g/ j- X2 T; d
  84. module_param(ccnt, int, S_IRUGO);
复制代码
7 ?  N& L1 J9 h6 q: e8 b2 _
3 m  j8 \+ B( k$ m/ z
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 x' a. b2 I( q5 _7 barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, l# U0 {7 x! i
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 m2 }/ ~. T; Y) O
5 O, T3 }5 Z6 u
: ^) b) O6 H$ _; N1 F; P
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-21 04:48 , Processed in 0.044638 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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