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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 \: Y2 a; k$ v
  1. [code]EDMA sample test application5 x" n$ @# A  ]- a8 b$ t2 s% W* E
  2. /*
    0 e: }1 C; K( T$ C7 W" ^) P
  3. * edma_test.c
    " B- W' p! y7 l* B; e0 L
  4. *
    9 R. {% V" V) B: B8 K$ T
  5. * brief  EDMA3 Test Application7 G0 J8 g7 U. W# n0 f6 E
  6. *
    ! \$ {6 ?5 K4 }' u4 j& L7 Y# n
  7. *   This file contains EDMA3 Test code.
    5 g4 K% F9 |/ ^. ?+ S6 |
  8. *
    ! Y, {* g' P! p: z, X8 X
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    & ]" j: M$ R7 ~- d
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. Q; {/ Y* {% e
  11. *         TO CHANGE.
    # e$ X$ a$ \9 g" ~9 s; O
  12. *# _  _, @+ Q* X
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ' @" Q4 v2 s+ s
  14. *& T1 W. X! b: }" [
  15. * This program is free software; you can redistribute it and/or" q2 x# F8 O3 q5 l, E% a
  16. * modify it under the terms of the GNU General Public License as' N: Y; z3 d8 B
  17. * published by the Free Software Foundation version 2.  c( |  H+ Y6 q" H: ?1 P7 k
  18. *
    ; f, W* Y1 ^4 Y' |6 F: L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 \" r. R5 M  c. G% C
  20. * kind, whether express or implied; without even the implied warranty; n& x" n' L5 N. d! n' Y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the0 s1 A- P4 i) g8 q& _4 O
  22. * GNU General Public License for more details.
    : k9 b+ e' Y" ?
  23. */
    , w" G; F* u4 K% G& ^* \
  24. 6 X5 _$ P) ]! D2 S' f& V
  25. #include <linux/module.h>
    7 i% Y6 i6 `4 s8 P4 ?4 V7 h. `9 X5 d
  26. #include <linux/init.h>% I4 \4 q0 t* q
  27. #include <linux/errno.h>7 n  s1 T$ S% M2 ?
  28. #include <linux/types.h>
    ' N7 Q. K: Z) @- W+ |3 X
  29. #include <linux/interrupt.h>  ]; \, A) O3 S. i
  30. #include <asm/io.h>
    ; u( G( a. u) X! H: ^
  31. #include <linux/moduleparam.h>. j: x0 o5 ]' t% G) S
  32. #include <linux/sysctl.h>
    5 `! {5 q  O( s, D  y9 t) O
  33. #include <linux/mm.h>
    , X3 o* J+ _* l# L0 {+ W6 N) O
  34. #include <linux/dma-mapping.h>
    , Z  O8 ]  I! T5 R# L

  35. * `+ _7 Z8 |* k; t: l3 e& Q% \* m/ h
  36. #include <mach/memory.h>3 X) M) ?! `7 M, Z/ a
  37. #include <mach/hardware.h>+ w* Y' {& j( f8 t" ^
  38. #include <mach/irqs.h>0 t3 }& p/ _( N8 m" r0 p
  39. #include <asm/hardware/edma.h>4 }3 @8 u% d7 `5 K" O3 T& j% [

  40. ; s1 m, R- u# @/ Y5 u
  41. #undef EDMA3_DEBUG
    7 G+ p: B8 h+ v% B1 q# n7 ^2 ]% A
  42. /*#define EDMA3_DEBUG*/' S2 K$ ?% G# ~% a  Y/ d- r
  43. $ P* f& w/ v* Z' ~0 _. E
  44. #ifdef EDMA3_DEBUG
    : _/ H/ O& K. w0 T+ Q) K9 e
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' G5 W" b/ I* w/ |' h' ]$ S
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). H; R. r4 W( ?2 w* Q6 ]
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) c4 L; v& X, v5 D+ C. n
  48. #else
    + z# `; m/ ~7 x! W
  49. #define DMA_PRINTK( x... )
    : O& F" C0 Z5 Q& d5 B& o3 }: P5 D
  50. #define DMA_FN_IN. @% e  C; A, C8 W3 v
  51. #define DMA_FN_OUT' ^% @  H! @" B
  52. #endif
    1 T  P3 U% q7 u# B2 O) g

  53.   H1 Y' G9 f( ^, }
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    6 J& j- G" G1 h+ ~' A
  55. #define STATIC_SHIFT                3" G$ n; U/ _" o0 A
  56. #define TCINTEN_SHIFT               20
    ' d" X: Q/ I1 I8 Q8 _, D) p8 d4 v
  57. #define ITCINTEN_SHIFT              217 T$ I, W7 i& P9 J  C% j
  58. #define TCCHEN_SHIFT                221 w+ A: g( ^8 \6 @0 {. o" U1 [, C
  59. #define ITCCHEN_SHIFT               234 [8 p* \7 O; g+ A. n& @- w/ }

  60. 3 i* t+ c7 I8 ]2 B# T6 Q
  61. static volatile int irqraised1 = 0;
    + i3 K0 M& V: k
  62. static volatile int irqraised2 = 0;
    . }* N! U# \: p0 h

  63. 2 e0 i: z$ f9 W% a* O# n3 x( S
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) k& C0 C' G0 `& m5 H; F
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; a2 i1 R/ c) G+ L
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' P8 `! h1 Q1 {) Z
  67. ' Q) ]4 N- W- ?, D
  68. dma_addr_t dmaphyssrc1 = 0;
    8 R$ y0 |+ f( P  P2 T. i
  69. dma_addr_t dmaphyssrc2 = 0;
    0 F3 d! P% w" |) U6 K8 E
  70. dma_addr_t dmaphysdest1 = 0;
    9 ^  G7 c9 i' Z& z4 q8 V& p
  71. dma_addr_t dmaphysdest2 = 0;6 b# `& J8 G2 O5 T9 V7 F* \' c
  72. 3 f3 _) [& ]  a; @0 r
  73. char *dmabufsrc1 = NULL;
    8 z- M) B1 d3 ~; E" ]' l( }% M
  74. char *dmabufsrc2 = NULL;
    : y% P  H8 \; j
  75. char *dmabufdest1 = NULL;
    % l/ o$ p- K* i- H
  76. char *dmabufdest2 = NULL;/ O" S; u/ D$ C
  77. , N5 \, t9 @" S/ w8 s
  78. static int acnt = 512;
    8 W+ j) _3 @. g7 t6 b1 s( ]1 g  W/ R
  79. static int bcnt = 8;
    0 g0 R+ ^6 X3 x: X4 ?% [, s
  80. static int ccnt = 8;
    3 L" c0 ?3 y4 m5 P8 }7 F' s
  81. 8 S9 I' y7 w2 m, u$ Y
  82. module_param(acnt, int, S_IRUGO);
    ( z' r" w+ ?' ~
  83. module_param(bcnt, int, S_IRUGO);
    3 G$ G6 G8 S& I$ U& C2 s& e; J
  84. module_param(ccnt, int, S_IRUGO);
复制代码
/ G8 E7 D1 T. f/ B

9 z5 l% O4 t5 u7 R, o      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 ?' @6 N. }4 Q  Z' F7 t$ f( w
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ l% O8 Q, j5 d9 O+ J
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, m5 l, R# J# H& }& ], R: @* d

8 |1 y! z5 k6 \: e8 ~7 E9 v  W( @5 q; w+ l+ ~; X
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-5 09:37 , Processed in 0.047374 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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