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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( I7 m2 R% L0 I
  1. [code]EDMA sample test application' c& S! z; f$ n) A0 K
  2. /*# E" [5 a3 \* Y
  3. * edma_test.c
    + b# a5 j0 `: U! G- v
  4. *
    - s* |% a  ^7 V' W5 t' c
  5. * brief  EDMA3 Test Application
    2 v5 O$ |6 P2 \  `, ^% {
  6. *5 c: w. n% _+ z7 n% R5 @
  7. *   This file contains EDMA3 Test code.: J3 y7 F* `; O7 j/ k
  8. *
    5 t7 p) ~% R" B6 s# Q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    8 f3 d# @+ L  `, W
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 a$ j. G6 a/ G% A9 {' I+ D& E* H
  11. *         TO CHANGE." T. X7 ^8 }% D, j% m- }
  12. *
    . ?0 q) p4 H  V; [% y) E" z7 c$ e
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 [% L9 I  n7 w5 a) p
  14. *
    % M( p1 q6 d6 I6 r( i1 P6 ?& n9 F
  15. * This program is free software; you can redistribute it and/or
    ! l3 `& l* H. ~' M. ^* v6 X( V8 K
  16. * modify it under the terms of the GNU General Public License as" A$ t9 _( w; d' K
  17. * published by the Free Software Foundation version 2.; L" i( `3 Q* G- b: }
  18. *
    % z( o5 {+ A1 l' c: `( P
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ) x( G9 [2 q2 Q3 ?' E' r3 i
  20. * kind, whether express or implied; without even the implied warranty
    " A) r) t& U8 x. t6 \+ R( N! o
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the& N. L( m- z3 y3 `! Q; A+ m
  22. * GNU General Public License for more details." ?9 F8 o' i/ ^# ?& d! M. i  O! f( R; c
  23. */  @) V& n6 b7 i! g0 y( P

  24. & J( l  z! h7 Z% W3 o; g
  25. #include <linux/module.h>
    3 D. B* s0 S0 ?7 ]5 \
  26. #include <linux/init.h>6 A  X7 t) G; R' K$ P0 X$ K
  27. #include <linux/errno.h>- U; L& Q, ^  [  Q6 v4 L
  28. #include <linux/types.h>3 h9 F# p+ K& v" m
  29. #include <linux/interrupt.h>
    + ?. f6 k7 L+ a9 z3 j4 x( z! g0 ?
  30. #include <asm/io.h>+ _" y! R) i3 J4 i) r
  31. #include <linux/moduleparam.h>8 i& Z+ F' U' Y' x' r, b, J
  32. #include <linux/sysctl.h>3 I# f: u% ?! z8 f: {! e/ f
  33. #include <linux/mm.h>
    ( k0 K/ g" r' t/ ?+ W2 R
  34. #include <linux/dma-mapping.h>
    0 Z4 g: [" ~. F9 F4 y
  35. 8 w+ o( c; M; \# B* x; p1 q
  36. #include <mach/memory.h>2 G% H; w& Y# Z! U
  37. #include <mach/hardware.h>8 D9 E# }. \9 z& W/ w3 X, i
  38. #include <mach/irqs.h>( {$ p$ D9 w0 u7 \" B7 N# w+ T
  39. #include <asm/hardware/edma.h>; T, J* J* ~+ K# U
  40. - W# o$ O  F" N$ B
  41. #undef EDMA3_DEBUG- a. [/ s. q' |3 x. y8 `
  42. /*#define EDMA3_DEBUG*/( A/ `& ]* b! L# a6 p, O! l7 i* q

  43. ; {5 R5 o, {4 h' V+ N" `! y
  44. #ifdef EDMA3_DEBUG. L5 M: |; R; t" w, F+ `
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    6 X" i  \- f7 u( O2 W
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    , }( `4 i) G# t& v: O$ }# t
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ! i9 A5 V9 X- g9 w; s
  48. #else
      h/ h/ U2 I7 O+ u& ~
  49. #define DMA_PRINTK( x... ): w# M3 a) m& C; s2 A
  50. #define DMA_FN_IN+ j  [: m( Q) E
  51. #define DMA_FN_OUT
    3 e2 K- g! v& Z, f
  52. #endif
    4 T1 a" Z& A9 [0 c# Z% M4 `

  53. : A: F( J$ s: d  _7 Y6 X
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    0 H2 k. ~; V$ N1 m5 o6 f8 r4 m
  55. #define STATIC_SHIFT                3
    & M/ `1 h$ O5 D) j$ b2 A
  56. #define TCINTEN_SHIFT               20; M5 A- B+ D& _7 b" [
  57. #define ITCINTEN_SHIFT              21( y" Q5 f, i6 c- F/ e9 O' ]3 ?
  58. #define TCCHEN_SHIFT                22
    ( @3 d$ g, l1 a
  59. #define ITCCHEN_SHIFT               23+ x8 T  O2 c8 W1 R& C" {
  60. 2 w# [2 @0 p# x# `9 Y  b' j+ T
  61. static volatile int irqraised1 = 0;
    9 _6 M. b" w4 @) W8 e
  62. static volatile int irqraised2 = 0;
    ) r3 V% v- T, \& }. u# F# e8 B; L# g

  63. - q" l- N0 u) d; B
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) j/ G! R! C9 _( K
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* }* N* a+ `; \% m; @
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 L. f- t) S: Z6 o2 l# U1 |% h6 a
  67. ; d/ B" G7 E9 R$ j( a1 I1 v
  68. dma_addr_t dmaphyssrc1 = 0;  h, D! O% F! N! C
  69. dma_addr_t dmaphyssrc2 = 0;
    ; b' e0 o  c/ a* X8 }
  70. dma_addr_t dmaphysdest1 = 0;3 b2 n) C' e$ \: G: S6 s
  71. dma_addr_t dmaphysdest2 = 0;. L2 p1 L8 y" N* A
  72. 7 C. M" y2 p0 x  j+ v$ P
  73. char *dmabufsrc1 = NULL;
    " _  w+ z, F& J9 B# Z
  74. char *dmabufsrc2 = NULL;
    ) L+ N$ ]# z+ g+ b: E* O) s4 p
  75. char *dmabufdest1 = NULL;
    5 c9 p. G( G# j. B$ |$ B2 l
  76. char *dmabufdest2 = NULL;4 G- r" e% L1 j* J6 b& i
  77. 6 r. r/ u# h" {. _5 r# _
  78. static int acnt = 512;2 Y" g% W& {- x- |! s- K
  79. static int bcnt = 8;* t/ Z! a- s+ `. I' A' j* J% p2 D
  80. static int ccnt = 8;/ y0 ?% q8 P% T8 i
  81. ) Y& S* I. R6 I0 f0 ?( v4 E% t
  82. module_param(acnt, int, S_IRUGO);3 n0 z; S$ p2 F7 L4 L  @8 L
  83. module_param(bcnt, int, S_IRUGO);
    . K+ c$ N0 o- a7 o3 b" m
  84. module_param(ccnt, int, S_IRUGO);
复制代码
1 O3 Z0 q+ ]! F; x6 p

: @5 K, G) Z, e      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- d0 f! f' P6 k; Y  H& X; Oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ G+ ^9 q, G% q0 {% E8 j) r$ p
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。  \2 s% t' x( C% c$ N7 L
8 Y- k- q4 F9 ^1 Z0 b7 T
- Q, |8 i& _% [# @7 Y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-7 16:27 , Processed in 0.040701 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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