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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 p# q* R8 D* I5 y) F; S
  1. [code]EDMA sample test application
    % l! c  P' Y+ E1 O' u5 x4 e
  2. /*
    : j# r! G* e# n) _5 g: Y0 u) P8 C: w
  3. * edma_test.c) Q/ A- A0 l0 V4 C! |, T
  4. *  c( K: n% `. O) ~- Q7 ^6 i
  5. * brief  EDMA3 Test Application1 X* A2 `& _1 j. J
  6. *. V7 T( g( ]4 P8 C# n) Z" B
  7. *   This file contains EDMA3 Test code.
    % w2 W# T8 o: t5 {. k- c
  8. *
    # U+ s, ^0 s" o' Z. M3 a
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 A) a6 x% D/ {6 Z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! m% e: X, J, s0 K
  11. *         TO CHANGE.
    4 R& P* w7 G2 z% A
  12. *! W) F$ P! P' ?; @. G
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ Q# A5 ?6 O3 T0 G. ?1 {8 f/ O
  14. *5 k9 [& I# j# ?2 w/ R/ o
  15. * This program is free software; you can redistribute it and/or
    ' c; \, e' O+ S- `; R3 g5 Y
  16. * modify it under the terms of the GNU General Public License as0 J$ e" D% w5 _
  17. * published by the Free Software Foundation version 2.  y8 @4 y% k: C7 e
  18. *
    / U* N; [. ?& H0 w& z3 P3 E4 A
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - f) C% W) t" r& T1 ?
  20. * kind, whether express or implied; without even the implied warranty. ^5 E8 }2 P4 h7 ~/ [6 T: C3 d( s
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the3 ?( U& h3 E9 p  F' P; ]
  22. * GNU General Public License for more details.7 n& ^# ?5 j4 w7 {: B
  23. */
    , {7 O$ p5 b# u. w3 Y4 m

  24. + `& [9 U1 L. Q
  25. #include <linux/module.h>0 g1 V: x7 d7 h4 Y; c
  26. #include <linux/init.h>
    1 \2 g' \/ b4 c/ z  x$ L
  27. #include <linux/errno.h>' q' Q- C" M/ Y; r+ g
  28. #include <linux/types.h>. G7 h- J0 P. p+ |- h
  29. #include <linux/interrupt.h>$ [% `4 j+ Z2 I4 t8 I3 e8 w/ C" b
  30. #include <asm/io.h>
    9 ?/ w: P: e' [1 d
  31. #include <linux/moduleparam.h>- C  a" h/ y& m6 q6 K
  32. #include <linux/sysctl.h>
    - K1 j+ H: x$ y4 I2 [7 h
  33. #include <linux/mm.h>3 L( A( A7 r2 P" s  ^" O& R
  34. #include <linux/dma-mapping.h>
    ( i% x% m& J5 I: z+ Q
  35. 4 h2 l+ R, C# |0 D. q# w
  36. #include <mach/memory.h>( E7 h7 y% a, B$ F# |( d7 j( E
  37. #include <mach/hardware.h>
    / J4 d% Y. E- t/ @. c1 g+ f
  38. #include <mach/irqs.h>" d& E2 w2 R' R, Q, f" I; |. w, a
  39. #include <asm/hardware/edma.h>
    8 C3 B8 b: {1 x, w

  40. + j  D! s+ q" y. S7 x1 m3 T, O
  41. #undef EDMA3_DEBUG
    ' l. A  n! R1 J4 g4 j( @# ?1 K( D! y
  42. /*#define EDMA3_DEBUG*/& Y6 h! z. e$ b) X3 Y3 V9 b( w

  43. : X* j9 J8 v0 v0 l4 t  O
  44. #ifdef EDMA3_DEBUG) e& H% @+ ]) i+ X; {8 N
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    " M9 @% u' J+ U' D
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    6 l0 X* r1 X% m
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 r: ?0 ?# @3 Y+ i
  48. #else
    ) Y& F3 J: X0 b- G6 v0 R
  49. #define DMA_PRINTK( x... ): w1 N9 }. K6 `  K1 [9 x+ Z+ e0 D
  50. #define DMA_FN_IN
    / O' T* e  h/ F  {0 x; G- I
  51. #define DMA_FN_OUT
    ! r0 ~$ V- e  E& W7 ]: B
  52. #endif/ U  G! ?- P, s7 z0 R6 Y

  53. ) {' r2 z/ A$ Z! ~: F( C
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)* x2 c4 p/ g. w0 y) c1 f7 i. }
  55. #define STATIC_SHIFT                31 _$ Z; S+ J: w9 V- r( l
  56. #define TCINTEN_SHIFT               20* Z" ~# [! R1 [" z
  57. #define ITCINTEN_SHIFT              21* R/ l8 A  T: X( V  b- f1 }0 t  a: h% M
  58. #define TCCHEN_SHIFT                224 I) ]$ j7 j6 r" @/ h/ W2 o5 u
  59. #define ITCCHEN_SHIFT               23
    % |( j, x  z6 r7 f7 o) a2 s
  60. ; J+ Q* x# ?0 c/ S/ a7 t/ ^
  61. static volatile int irqraised1 = 0;
    ! }' C1 i/ M, J& t3 j% `9 _
  62. static volatile int irqraised2 = 0;
    . y: ^9 N( c# p* N

  63. 9 r6 y9 i9 c$ ^" @
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - o  w: x, l; W# z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: W9 L9 m$ \; z1 z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& C3 m. R1 r! r2 l! _
  67. 1 q+ q3 N6 [2 U; Y# H9 H
  68. dma_addr_t dmaphyssrc1 = 0;
    1 s( e. T& S3 g- P7 }3 y
  69. dma_addr_t dmaphyssrc2 = 0;
    : A  [3 g, A; h, @" x$ i! H9 l' G2 k
  70. dma_addr_t dmaphysdest1 = 0;
    + {0 ~: I  M" f5 e
  71. dma_addr_t dmaphysdest2 = 0;
    & T) a6 x8 h! Y% I, S

  72. - O2 H8 l+ A8 |' ?( n
  73. char *dmabufsrc1 = NULL;
    4 ?, k+ E+ d* @( v: K
  74. char *dmabufsrc2 = NULL;1 c* S0 ~" Y0 I
  75. char *dmabufdest1 = NULL;
    * ?: C7 p5 M3 |8 \/ P, c! }/ E6 |; j
  76. char *dmabufdest2 = NULL;+ a" l8 m4 k( {* m

  77. $ f, X) u  J$ F7 H% p
  78. static int acnt = 512;
    ' S$ }- H+ v- G+ L# x9 T9 v
  79. static int bcnt = 8;
    + d8 R: Y5 ?5 Y5 G: D, g
  80. static int ccnt = 8;! U: \' R* H" t& F

  81. , U% y2 J2 B; I: |' r6 r% ~$ Q, ~
  82. module_param(acnt, int, S_IRUGO);
    - y( x5 M8 o/ s( W
  83. module_param(bcnt, int, S_IRUGO);
    + u/ V9 R, ~8 B/ w  y
  84. module_param(ccnt, int, S_IRUGO);
复制代码

7 n1 G3 T4 e: z* m/ f. ~! ^8 a# W$ t. f- k0 |
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" ~5 W9 t6 @, W& M  L+ O- Y% ?
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: M; F/ R6 b# N; A     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% D; p; d3 S- b( ^! u
+ o! A# _$ X% o: a6 v" N5 T5 I, d% f4 B; g& I) R7 o' a
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-14 18:38 , Processed in 0.040167 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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