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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; D! ], j* R) C; P6 q: u1 g
  1. [code]EDMA sample test application
    8 O5 P: A  C3 w$ I
  2. /*! [4 e& ?* e& H6 F
  3. * edma_test.c9 T% ]  r& D$ a! a$ n
  4. *6 f7 X5 v# N2 M& j7 x5 Z6 i5 C9 q
  5. * brief  EDMA3 Test Application
      O1 t/ N0 F' L" n( X
  6. *$ V/ |2 _6 J2 C4 A
  7. *   This file contains EDMA3 Test code.. f. U8 z9 w6 g, X6 A, W
  8. *
    - Q( S* l  b! d( [6 L# Z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! V$ n/ s$ B; U: w# j& s
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 D; X# e" c% {3 v- q( {: y
  11. *         TO CHANGE.2 q: b9 H/ S1 N! \6 @/ D' H+ _
  12. *. {6 |. m/ u: H* M+ `9 c" e
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; r$ H; F; [' z0 O
  14. *
    & u( [. ^2 Z( ]# ]
  15. * This program is free software; you can redistribute it and/or
    2 G2 J2 a8 F" t8 k3 W" a
  16. * modify it under the terms of the GNU General Public License as
    # w  A* J7 I- U* }2 r1 n
  17. * published by the Free Software Foundation version 2.1 K: `" C- t! t
  18. *# `7 R# P) o. A  }3 k4 F$ g
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 z9 n" j6 f1 U; E* l
  20. * kind, whether express or implied; without even the implied warranty6 ]! q" v7 o  A: P
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the3 I. f( _# X( x3 }: @
  22. * GNU General Public License for more details.' e- R1 s- S# T8 z& R2 ^1 ~: P4 D
  23. */
    6 ^) ]5 [: S9 q( W: W, Z/ o0 d: Z2 G

  24. " F  p# z3 b- J" U& {9 q
  25. #include <linux/module.h>1 e9 N4 n6 z* A8 j; [5 G  T
  26. #include <linux/init.h>6 F1 u' I4 [8 t
  27. #include <linux/errno.h>5 V3 k6 W" J  ^% \/ A; F
  28. #include <linux/types.h>/ ]( e( J3 f- |: ?/ g- Q. g- \) u) f
  29. #include <linux/interrupt.h>* r7 A$ A& ?: F6 h4 M8 Z9 P) W
  30. #include <asm/io.h>
    5 o: L5 p* l8 i; \
  31. #include <linux/moduleparam.h>
    ; g. R: }8 c# Z) |0 |
  32. #include <linux/sysctl.h>
      h( O- l8 Y% d
  33. #include <linux/mm.h>% L8 G* k- R* u$ l: g2 u2 r
  34. #include <linux/dma-mapping.h>
    ; X. D( J% t) x: l! m" b
  35. 5 u/ K! b0 R, L: I8 ~% Q6 H# N
  36. #include <mach/memory.h>
    % B' k1 E) V9 \1 ^( _
  37. #include <mach/hardware.h>3 X6 _' |; H2 G6 x; L, j
  38. #include <mach/irqs.h>5 [. u" T7 Z2 R( ?9 |. L4 L) v
  39. #include <asm/hardware/edma.h>% ?- K% t, [/ z

  40. . L* u; @6 z4 `3 K$ A4 W, I
  41. #undef EDMA3_DEBUG
    0 x( I: o5 y% M! U0 N" B) d5 o
  42. /*#define EDMA3_DEBUG*/& B* E; v/ Q; e4 F; g: w% d' ^4 u
  43. ! {2 q8 @2 e; [/ R! ^; z
  44. #ifdef EDMA3_DEBUG# Z0 s1 s! V1 `% v9 ~
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    " \. u5 f8 K& i# i- a( @* Q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* |" w" j6 e7 ]" ~/ p& {
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( {/ h" u/ L) q3 U# q3 J" |# K
  48. #else) i5 k# i  C4 B. g& Q& }, r5 ^7 C' ]
  49. #define DMA_PRINTK( x... )+ w! z1 H1 H7 G! w6 P* C
  50. #define DMA_FN_IN
    1 _- U; x, i- |; I7 S  ^$ Z
  51. #define DMA_FN_OUT
    : n3 o( \& X; J! g/ U; I' u
  52. #endif1 u5 D3 |$ T$ h) v. F% k% f

  53. / e# Z, C9 a# B
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): a% J/ g. f3 Z/ u: g9 s9 @6 D* h
  55. #define STATIC_SHIFT                3
    $ r4 Z% M5 x  R; @
  56. #define TCINTEN_SHIFT               20
    & H( [: a- c+ J0 R
  57. #define ITCINTEN_SHIFT              21# X4 Z. B% U7 D4 o% J! m
  58. #define TCCHEN_SHIFT                22
    . K( S, \# J. d0 g! U
  59. #define ITCCHEN_SHIFT               23
    6 g" n$ {" Z- {3 o

  60. & i- g! d  e/ d, X& `0 C
  61. static volatile int irqraised1 = 0;/ P8 v) I' n* _4 G1 N
  62. static volatile int irqraised2 = 0;
    + U# d- A; u1 o/ [5 F
  63. ; o: ?8 X8 x# H/ X' I* ~
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " k1 h8 l+ j1 I( n* ^6 l8 c
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % A5 a8 W5 X2 T, h! d% w" ?
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 t1 F* p9 V; M% C+ U
  67. ( |: p  N- w3 j. j/ K/ c& h
  68. dma_addr_t dmaphyssrc1 = 0;
    . O/ ^3 ~  s3 P( M. x+ l
  69. dma_addr_t dmaphyssrc2 = 0;
    ; n9 f$ [% l) M0 I3 W
  70. dma_addr_t dmaphysdest1 = 0;, ?0 f1 N: C7 B- _
  71. dma_addr_t dmaphysdest2 = 0;. T0 L1 X; h: G/ l0 J

  72. + K. b9 Z( @+ {) }! l" [. w
  73. char *dmabufsrc1 = NULL;$ r8 e( S% t$ w4 o: _0 y
  74. char *dmabufsrc2 = NULL;
    7 i. ]  k8 a2 D! `+ w
  75. char *dmabufdest1 = NULL;
    + f  ^) I7 x, f( h5 z7 c6 Y
  76. char *dmabufdest2 = NULL;# W4 x& M7 w7 P* o" }- G9 I

  77. + ]" `, r3 U, W; G& E' v
  78. static int acnt = 512;
    ( q* B. ]. l$ e8 Y8 ^
  79. static int bcnt = 8;
      d9 _; g+ e4 K, v9 `
  80. static int ccnt = 8;' r- P$ o; v8 w

  81. : {3 m, q0 \8 q% b
  82. module_param(acnt, int, S_IRUGO);
    6 u% u& d6 |) R9 C9 k
  83. module_param(bcnt, int, S_IRUGO);
    % ?1 W8 o- P1 r% }3 ^
  84. module_param(ccnt, int, S_IRUGO);
复制代码

0 r0 ?$ ]* U$ u$ @8 e
: v( x# ?% ?7 e8 G      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% K# u) w$ ^# X
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" H2 J: J7 T( k  f4 L& ?  z     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 L: X8 ~, x# T& F" M3 N

& _8 N+ k+ U9 S- j9 C- u  C8 F+ E) z5 D1 B9 g' a
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-27 04:54 , Processed in 0.038878 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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