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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( K3 f& ^$ e% B1 e
  1. [code]EDMA sample test application4 w: x& W" D& Q0 R
  2. /*/ B! r& J: C  p8 s: A% T' ]: @% n
  3. * edma_test.c
    1 B: v3 j, h7 L+ D' Y6 T
  4. *
    , C. i! d* m* N* }0 D% D0 s
  5. * brief  EDMA3 Test Application
    $ ?3 ^4 u& `2 i* s. x  J  g
  6. *
    . n2 j3 J) `+ y5 }+ E$ z: ^
  7. *   This file contains EDMA3 Test code.
    & h, f6 K7 ^" z* }
  8. *; \, F4 f% G" K7 r! O& i0 g
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# u( v  D& H/ H' [" n6 k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ( o) X. w7 E" Y
  11. *         TO CHANGE.: d" Q% s( R# l# V* F1 J, F
  12. *% R" c9 v! \  [& e$ p* X( e/ A
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " f( |3 C: }% j5 [$ D
  14. *+ m& C. K$ ~7 o! Q
  15. * This program is free software; you can redistribute it and/or
    ( P2 n3 e/ h% M
  16. * modify it under the terms of the GNU General Public License as7 @+ c5 }9 Z7 B8 R' @  s/ s$ H
  17. * published by the Free Software Foundation version 2.8 O; `1 J' e: z. x2 C) U7 P
  18. *
    ! _% ~  \2 Q0 V1 R
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - g) j! C, I/ H& Z6 T9 L0 H8 U
  20. * kind, whether express or implied; without even the implied warranty+ `% s7 \% Q( b  P( w* O. I4 x
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the9 S* y+ S# X4 H9 G! v. c, F) G
  22. * GNU General Public License for more details.! X2 N4 w/ g2 W& A( ]
  23. */" _; B1 X6 L9 N0 Q+ x5 R; b6 _4 h

  24. . t9 N+ E' L2 z) E2 z+ `
  25. #include <linux/module.h>
    6 {" f. P6 ^- o% u+ y) e
  26. #include <linux/init.h>, L+ }0 y: i7 c2 i: c6 u
  27. #include <linux/errno.h>3 A3 a: F6 G8 q: e4 |
  28. #include <linux/types.h>% w6 H, d4 P# }7 X3 W4 s( R
  29. #include <linux/interrupt.h>
    1 D( |* T5 C" S2 C
  30. #include <asm/io.h>: L' S3 V- t$ s* p
  31. #include <linux/moduleparam.h>: Z( C( C0 F& x! k7 o
  32. #include <linux/sysctl.h>
    ; u) R5 d1 E( k3 W
  33. #include <linux/mm.h>
    , Q. a2 n) P$ B2 l0 _) ~
  34. #include <linux/dma-mapping.h>+ k3 `9 _5 z8 E+ _; C2 |9 T+ o3 o

  35. 3 |9 H6 p, Z6 H. ~% P& \; J4 q
  36. #include <mach/memory.h>
    9 D' h/ F+ U9 D' t0 C
  37. #include <mach/hardware.h>
    * X$ @/ o3 G: r. A6 L, n
  38. #include <mach/irqs.h>. s' [$ |+ G- P; _6 Z2 H
  39. #include <asm/hardware/edma.h>
    ' i" m1 }' K/ }3 O  h
  40. " v3 q3 |( m& u/ s5 o% ?  U8 |
  41. #undef EDMA3_DEBUG+ k  @  V1 g- O+ X) q* X7 `1 g
  42. /*#define EDMA3_DEBUG*/8 q! V- `! o6 W) L  D( u- J
  43. ' T2 F0 x' A" r9 c$ s3 s+ m+ F" ^" I
  44. #ifdef EDMA3_DEBUG
    . w. z3 E2 K4 E3 @4 }
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& A; [2 y9 Q% a/ T4 Z9 y: ?
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), [3 a; n; X# V
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! [2 w# d( G/ z& a& Z+ ?
  48. #else" k% [% K3 c' [! E( \0 ~
  49. #define DMA_PRINTK( x... ). G5 G- r  Z8 u, x- y4 _
  50. #define DMA_FN_IN2 y+ M* b& N8 V4 e* l# S  R3 Z- C
  51. #define DMA_FN_OUT
    7 Q& _0 r/ @( S1 V
  52. #endif
    9 V9 e3 @- Y' t
  53. 7 T. i, H4 W( c8 z( j
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    2 N* v% a2 c$ M4 n7 o1 u
  55. #define STATIC_SHIFT                3
    $ n5 D( r7 e+ P- K" B% F3 {* `
  56. #define TCINTEN_SHIFT               20
    6 m  K2 m: e. P( A& E
  57. #define ITCINTEN_SHIFT              21
    6 T3 y* `: ?, w9 X4 p
  58. #define TCCHEN_SHIFT                22) e; e% d% n4 ~# v0 d+ f/ A
  59. #define ITCCHEN_SHIFT               23
    . s) o7 t- ?) K7 }

  60. # N( }3 `- P9 o: j
  61. static volatile int irqraised1 = 0;# B# U* q: _- j& z1 w
  62. static volatile int irqraised2 = 0;3 q3 @: p/ z: [1 w+ a* k

  63. 5 D; @" b6 P2 T: D
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + y1 J; I5 x& h- h* e8 p  J
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% d2 H& \/ z! R- N# M, n
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 O, V% ?" e( _- P8 I

  67. 8 K- X4 O0 ^/ G$ [; e/ M
  68. dma_addr_t dmaphyssrc1 = 0;
    * W& K; i" Q! w/ A/ [
  69. dma_addr_t dmaphyssrc2 = 0;
    $ r; C3 h: h$ G" p" T
  70. dma_addr_t dmaphysdest1 = 0;
    3 b- d3 R; m! X3 G! s
  71. dma_addr_t dmaphysdest2 = 0;
    9 k4 o7 i& I+ a; v. X* ~! \  m
  72. + B, M* x( w3 U7 q; q
  73. char *dmabufsrc1 = NULL;8 l9 k% O1 X0 ~+ r* v3 E
  74. char *dmabufsrc2 = NULL;
    : e+ L5 H8 ~6 A
  75. char *dmabufdest1 = NULL;
    : e" O( K+ B) @6 W6 w: @* Z7 E* d* d
  76. char *dmabufdest2 = NULL;
    / q: l1 D: B. ^( o: |2 ?4 L4 N
  77. 2 j, U" x( G8 L9 o; O; d$ S' q* j
  78. static int acnt = 512;7 i) I3 ]& ?9 f9 R1 @
  79. static int bcnt = 8;
    - i$ \, h0 x8 v) n) f  X2 N4 H  ~
  80. static int ccnt = 8;2 O- y' D5 t% x2 ^3 E' o" i
  81. 5 S. @8 c" k  D. z; M3 p6 q
  82. module_param(acnt, int, S_IRUGO);2 ~4 z1 a& i/ P2 q+ O6 e: A/ i( b2 k
  83. module_param(bcnt, int, S_IRUGO);' h  y1 h& m+ I' S( J
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! i+ V, V; l' o, [, Y: L' U9 A1 `; Z; N
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 A3 C, K% x  z2 b# Q7 ]/ N9 Yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 J; N$ h5 C) Z" C4 D
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ V% m, g" K" K3 G$ Q* W

, \! O' w" R/ W; {2 K" j% E  z, k( V0 [9 K
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-18 03:49 , Processed in 0.039158 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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