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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 L$ \  H& x1 B9 w
  1. [code]EDMA sample test application
    3 B( ]9 _. F6 w# ^* C: ~( M5 u3 G
  2. /*
    $ S  b) W# }3 `) m7 w9 ~
  3. * edma_test.c
    - P8 g7 h1 r1 h3 l  k* }% i/ a9 u
  4. *
    1 T0 v+ d/ I7 C# K  S" ?7 Q. K
  5. * brief  EDMA3 Test Application
    0 I$ L" h8 G# n9 @; B( d2 X" d# U
  6. *
    9 f* Y- }3 @% A7 w5 {  r
  7. *   This file contains EDMA3 Test code.
    + u. I( c" p- n
  8. *
    : \1 E2 V4 H- I# T+ N, n
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; i% @. h' _3 v6 y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( P: e5 @* G0 Z8 w4 R) f1 G
  11. *         TO CHANGE.
    4 ]% J2 m( ~6 w: ^
  12. *
    . S7 m- z+ H5 K; j( L
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ; }3 ~" J9 a3 R, q
  14. *
    ) w/ c4 [; |8 g1 L$ N( N3 ~
  15. * This program is free software; you can redistribute it and/or
    " k- G2 o. c& y5 n% M
  16. * modify it under the terms of the GNU General Public License as& O5 z/ R7 z/ {  R, d% a: K7 |
  17. * published by the Free Software Foundation version 2.0 @$ ?& c# F; y5 u  M* A5 Q0 `& y
  18. *6 A) [. Z/ ^; g3 H
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    7 u3 O. j- A% q! y
  20. * kind, whether express or implied; without even the implied warranty
    # L0 W% Z% ~& K
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0 B, H& k, J! Q* {% o# ^5 V
  22. * GNU General Public License for more details.
    ; n7 q" `2 D' @1 F
  23. */$ U: q: Y5 a7 C, g. f) N
  24. - D$ Q4 y4 }* P  a/ {
  25. #include <linux/module.h>7 ?0 G" s: k: M' C4 @7 Z, [) E
  26. #include <linux/init.h>
    ; ]( U6 K1 g: G) A
  27. #include <linux/errno.h>" _! s- j! E5 x' D5 ~" J' X: Y6 |
  28. #include <linux/types.h>
    : _  s' u5 L( p) G- }* G$ Q
  29. #include <linux/interrupt.h>; _3 g- M6 F& N  ?7 r2 N, Z$ B
  30. #include <asm/io.h>
    " s+ H: H* V4 f( b$ }
  31. #include <linux/moduleparam.h>
    6 G% T. i7 J( {# ~) A& J0 r9 E
  32. #include <linux/sysctl.h>
    & m, F* F. o( I6 G
  33. #include <linux/mm.h>2 X" L2 C0 r7 b7 a$ F! O
  34. #include <linux/dma-mapping.h>8 F  Z' ~' N, G5 a8 h. ]
  35. + P! U$ m3 H# N6 D- y" Y" j! l
  36. #include <mach/memory.h>9 D* B$ i! o) {# l) R
  37. #include <mach/hardware.h>% t  N: M1 Q6 L* l- H/ t
  38. #include <mach/irqs.h>) @5 i/ J) X3 N$ u+ s! y" v% J& R; Q
  39. #include <asm/hardware/edma.h>$ G9 J  {) w0 o- m5 m! r1 t5 M

  40.   r1 I$ D1 H$ v+ z  x
  41. #undef EDMA3_DEBUG1 X" B7 O- d, D0 a! E
  42. /*#define EDMA3_DEBUG*/
    & e2 A9 a! Y3 o2 y1 r4 R

  43. . l6 I2 r( ~* x3 t0 p" g0 x1 h
  44. #ifdef EDMA3_DEBUG
    / a- l% o7 j3 \9 a
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* W8 F, r5 C9 d* K* C" y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! a" a" t- ]: d- w
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 l$ o9 V4 R5 M9 E! o
  48. #else
    9 ]8 m; \" j* [! m/ p6 O; x
  49. #define DMA_PRINTK( x... )( c2 a0 a  Q% b; K3 B1 b
  50. #define DMA_FN_IN
    ( K# U7 a: e6 h6 V
  51. #define DMA_FN_OUT
    & O* Q6 N5 H7 U
  52. #endif
    4 }/ h7 q0 s% U' C7 o

  53. , J; R$ t( ?* a. W! ]' {+ {6 _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    / v# ]+ t# I8 @' m% ^3 {
  55. #define STATIC_SHIFT                3
    , C* e: {4 c" v( R; p8 N. N
  56. #define TCINTEN_SHIFT               20- |+ `+ r* e# `' v. d$ T) }" r
  57. #define ITCINTEN_SHIFT              21. [1 ^( m/ Y. L4 s  [
  58. #define TCCHEN_SHIFT                226 z! ]$ g, i7 V! y/ Z  b
  59. #define ITCCHEN_SHIFT               23
    ) b( A5 _% S+ a" D( N

  60. + H! u+ }3 g/ u2 h
  61. static volatile int irqraised1 = 0;
    # E$ d- a$ d$ e' F* |
  62. static volatile int irqraised2 = 0;% q& O( ?# J; ~
  63. , y' b" f- Q2 Z( Z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ n5 y! G, o( {" ?
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ n% x: d' g: }0 |* P2 X. ?
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 l: q8 e: I( d7 e3 Y

  67. 6 t" Q' u" O1 ]- _7 O' \# T( }
  68. dma_addr_t dmaphyssrc1 = 0;
    0 i0 T+ V* |- b
  69. dma_addr_t dmaphyssrc2 = 0;  t* U2 p" D9 j+ j/ r, g
  70. dma_addr_t dmaphysdest1 = 0;
    / i8 X0 A& p; _# ]6 t
  71. dma_addr_t dmaphysdest2 = 0;
    % L. k* L  @3 I; `* [

  72. : ?4 e$ X7 `5 O7 x8 _. h' @% M
  73. char *dmabufsrc1 = NULL;  U) p0 b4 Y2 \& c
  74. char *dmabufsrc2 = NULL;
    ! ]6 g% U. w  B0 n( T
  75. char *dmabufdest1 = NULL;
    + \! Q* d5 |: o' A
  76. char *dmabufdest2 = NULL;& X8 ]# o1 M9 {+ N- k5 ]& e0 {  M% o
  77. 8 a& p: n1 G1 h7 |4 G
  78. static int acnt = 512;
    ; H4 ^9 A, G# {# T8 m7 w
  79. static int bcnt = 8;
    5 z2 F$ X  N& C
  80. static int ccnt = 8;4 Q6 p' l3 n" o3 S* O; @6 s
  81. 9 L) G1 n, i2 D5 p
  82. module_param(acnt, int, S_IRUGO);
    ( o: a" P% {' ^1 K
  83. module_param(bcnt, int, S_IRUGO);
    ! j% _4 X! f  U# c4 G8 w4 B
  84. module_param(ccnt, int, S_IRUGO);
复制代码
% H5 W' f' X7 ^4 f
4 P! R1 s+ r: g1 g/ A: N  W, t
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 Q" c1 |4 H! A, ^6 D
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) q& }& }6 Y0 G
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ k( V1 ?2 ?( F( b3 D& d! P. W6 p! q1 t9 i

$ I8 n: \  z" J
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-24 02:13 , Processed in 0.055643 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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