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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : t; p% V/ N  |7 V  N
  1. [code]EDMA sample test application
    ; e; X6 l7 t& O1 b8 d" K
  2. /*+ ~4 x6 Y# E) p& c; J" P5 k/ s
  3. * edma_test.c
    4 H; }) u$ ~5 `; q
  4. *
    * ^& E# m) I) v
  5. * brief  EDMA3 Test Application1 h, {/ B+ P4 k% [
  6. *
    $ J+ f2 }% Q2 l; X! i- M+ g
  7. *   This file contains EDMA3 Test code.1 ~  ~* R( v( U6 u3 L6 o
  8. *. x8 Q! ^1 [6 ]4 L% \
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      n; \. X. b/ y1 V0 u) S+ y- w
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    : ?3 D: o; p- }" h
  11. *         TO CHANGE.
    " k8 e  f* K0 `) l
  12. *2 B  X4 Y7 v8 b5 P9 h) R! X- R  n
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ! C6 j% e* H$ E; O) ^7 [
  14. *
    9 f+ M) H/ d/ C5 h
  15. * This program is free software; you can redistribute it and/or( I+ S. o# B% c4 s( k2 B5 r
  16. * modify it under the terms of the GNU General Public License as: i# f) {( z6 `7 H& L9 N( X
  17. * published by the Free Software Foundation version 2./ r% C1 z( N; M2 }0 [, U6 V
  18. *
    " n; _$ x4 S! p9 I6 l
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 G4 Z4 b) i6 q# g  G) R1 i* m
  20. * kind, whether express or implied; without even the implied warranty
    5 `7 h: [) h! e/ g  p& ~
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5 s. P+ g" ^  G( X
  22. * GNU General Public License for more details.
    & c- s" |/ t# @& c& X) M& Q/ Y$ F
  23. */
    & u/ e! Y  k* q+ T3 S# _

  24. 7 y' Q3 O) P/ k. P- J+ y
  25. #include <linux/module.h>
    ; j# }2 l, c9 U) Y! U0 m' p0 K
  26. #include <linux/init.h>6 {9 z0 {, J1 ?* q2 X
  27. #include <linux/errno.h>
    + R4 Z0 N5 P5 u
  28. #include <linux/types.h>9 S5 X& G* j8 [4 C
  29. #include <linux/interrupt.h>
    2 C0 `) B1 T% _0 o3 d
  30. #include <asm/io.h>
    # V( Y. d8 }$ X6 V, P
  31. #include <linux/moduleparam.h>/ Z5 R  C7 S: l, R4 j  D
  32. #include <linux/sysctl.h>& e' q. V+ X2 O2 o) J
  33. #include <linux/mm.h>: d- I1 k8 k" ]7 |
  34. #include <linux/dma-mapping.h>
    ; e1 P0 x7 M1 A% k

  35. 4 {6 @  C$ R5 x
  36. #include <mach/memory.h># o0 `0 P! b7 J$ f* v. Y6 a( c
  37. #include <mach/hardware.h>8 T. r2 _1 B$ n6 ~: b2 j
  38. #include <mach/irqs.h>3 l- `# r7 y$ j( A
  39. #include <asm/hardware/edma.h>2 `/ F/ ]# T6 [- P' j4 T" F3 k
  40. : G: \8 d. K" ^( W9 B+ _
  41. #undef EDMA3_DEBUG
    ; K: _. R- }" A& H8 e  C7 r8 H
  42. /*#define EDMA3_DEBUG*/
    " b7 x, p+ s( E/ k+ Y
  43. 9 n/ i9 u: b$ O# b8 v: O
  44. #ifdef EDMA3_DEBUG
    ' R# R6 w% y3 P' g& h
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    5 M/ g# _: F% c  y$ w
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    , _( A  p! V# T: j2 j
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& e- e6 T+ }$ u
  48. #else: e' I$ b$ G; G1 e- Q- T2 F( M
  49. #define DMA_PRINTK( x... ): F' O! j7 ?- S# X5 c! X/ @
  50. #define DMA_FN_IN
    ( U& L( E7 p7 k' |9 J# e( Z
  51. #define DMA_FN_OUT
    ; i8 D" p' f* Y. `4 l7 `
  52. #endif1 @7 ^9 W" D& @/ z9 y4 F( M
  53. ; }$ @+ y2 [. ^; U1 w
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)* I6 r3 d5 v$ z" O% f
  55. #define STATIC_SHIFT                3
    : i& I& P$ p( R. ~+ s
  56. #define TCINTEN_SHIFT               20
    ! y0 e: Q8 @* N1 U0 u* [# e3 i
  57. #define ITCINTEN_SHIFT              210 V& }  Z$ C) P" D
  58. #define TCCHEN_SHIFT                221 D' Z. i. B& N( X$ f( @# d6 I+ U: r
  59. #define ITCCHEN_SHIFT               23# T3 H, c  c" q/ i) z, p& E5 W

  60. 6 d6 P: [1 t. U: o$ M
  61. static volatile int irqraised1 = 0;
    ) J# s& R" m; X+ w& [. n; x
  62. static volatile int irqraised2 = 0;
    : B" ?$ ~' Z  k! n4 y

  63.   d5 d1 d7 F$ g6 |( n1 c, J4 D
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 F) Q+ [# N/ E  ?; U; r
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, p4 X$ s" Y5 g4 i
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : i) _1 t; F: I1 X0 j, }8 O* _
  67. - V" b3 u( ]. e; d7 b- H. M
  68. dma_addr_t dmaphyssrc1 = 0;" x! T4 \/ |* \0 ]8 h
  69. dma_addr_t dmaphyssrc2 = 0;! R1 q! [) }% ^( T- ~' b
  70. dma_addr_t dmaphysdest1 = 0;8 p- q; Y" K# N2 ^6 {4 V
  71. dma_addr_t dmaphysdest2 = 0;
    * w7 }: w" P+ L0 l/ x1 p
  72. ; G" {- Q& p2 W1 H. e$ R7 r8 q
  73. char *dmabufsrc1 = NULL;  X4 A* T  x/ h$ V( ~# l
  74. char *dmabufsrc2 = NULL;
    * J. G5 T* [7 r! \& ^
  75. char *dmabufdest1 = NULL;3 K" ~8 f0 |. F  G$ B! s
  76. char *dmabufdest2 = NULL;
    ) o  @, D4 d- h7 C. x+ e9 P
  77. ( v0 p7 J" s: ^
  78. static int acnt = 512;
    6 {  I; q* y" C* \7 ?6 A
  79. static int bcnt = 8;
    ! G4 |1 y" V3 F# r8 B) L
  80. static int ccnt = 8;* U8 u3 Z4 Q) u5 u7 f) k- U0 [

  81. 7 \; S) e, |' W8 k. b6 G# B
  82. module_param(acnt, int, S_IRUGO);/ ^/ z7 E6 t9 c! X
  83. module_param(bcnt, int, S_IRUGO);! C! J8 X: C# _4 K3 m* E
  84. module_param(ccnt, int, S_IRUGO);
复制代码

" Z! U2 g$ t8 k. H! a7 a
* ^* k6 `- I/ c* h2 b      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; v1 B5 [9 N$ ^: {! v/ ~9 Q! r* [" c/ z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ e, J5 ]; W9 M# S
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! c" I3 K4 C* f
( X% {! m7 q. t  K+ g( l
8 g) G5 Y, B4 x% I
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-22 07:47 , Processed in 0.041087 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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