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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : Q( Q( H0 Y. [- _) |
  1. [code]EDMA sample test application3 [& ]* x" J- g, a7 R' h
  2. /*
      [; h2 ?% A5 {  H. ?
  3. * edma_test.c
    ' m  Y; O  {; `, n$ T( S! u
  4. *" s) I# Z" o& p
  5. * brief  EDMA3 Test Application& z; \5 e: v+ Z9 b; |3 m9 q
  6. *
    0 H- X+ H& A( V; q
  7. *   This file contains EDMA3 Test code.0 C6 y+ h: k- P% P( p& J
  8. *
    , s# M* v4 x" V8 \! W3 O4 @6 x
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, m& X; [, g. V6 o1 r- c; @
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) g0 N8 Z9 d3 e, U: s+ U& R
  11. *         TO CHANGE.
      E% P* ?. Z( s" {" N" t
  12. *
    , U% n: `; E3 s7 Q/ u
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    0 V" @, o, O% c( [( A
  14. *
    - q  [4 b( L. P3 @' w1 q
  15. * This program is free software; you can redistribute it and/or
    ) Q: C+ W# T+ a" W) N: q+ W
  16. * modify it under the terms of the GNU General Public License as
    1 Q( q; P* f9 q6 h
  17. * published by the Free Software Foundation version 2.6 C& s- D& ?4 Q' j& P0 w9 q2 b6 ^$ B
  18. *
    ( B8 L/ n/ l) x3 e8 H* x
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - U8 g) _5 F& C+ Z; J/ E
  20. * kind, whether express or implied; without even the implied warranty/ o- t& L) F" N, \; s- {0 E
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    $ P# n: K, ]' v( @7 x% e8 q( F, A
  22. * GNU General Public License for more details.
    7 h6 E2 s5 O" }% y% |
  23. */
    , L: ?. g  {" f' K; l* N& P: a

  24. ( B/ Y  b0 y7 s1 T7 m
  25. #include <linux/module.h>
    6 r7 x( k" e6 d( l) E7 d
  26. #include <linux/init.h>/ V6 q  U6 |$ d8 k/ H
  27. #include <linux/errno.h>9 I! ?( f1 v6 q. c0 N
  28. #include <linux/types.h>
    * R3 e# |! m) o( j0 I
  29. #include <linux/interrupt.h>; k7 {! b! \3 v$ f& a1 S9 W
  30. #include <asm/io.h>
    , a  L! E2 \  W- S
  31. #include <linux/moduleparam.h>+ a6 p" \& l! O. `# K6 J* O0 V9 C
  32. #include <linux/sysctl.h>
    9 Y$ F0 |+ w7 p( |
  33. #include <linux/mm.h>& \0 n, {1 q  m# N0 R
  34. #include <linux/dma-mapping.h>
    9 d. v: ~# @9 N/ }
  35. 1 `3 T7 l) W) w) N3 d1 T
  36. #include <mach/memory.h>
    , F2 l, v" o- r% R% p' v
  37. #include <mach/hardware.h>
    ! M8 c7 O# _. P2 c8 m9 F4 y' G
  38. #include <mach/irqs.h>
    8 s" |+ {3 S- Z5 m
  39. #include <asm/hardware/edma.h>
    & M  T0 N! d( ^# a2 v1 ?3 k
  40. ) q$ ?( J3 G5 u# g. g/ E
  41. #undef EDMA3_DEBUG  M0 ?+ j2 v* q. \# R
  42. /*#define EDMA3_DEBUG*/
    : c7 C# x* v- Q, p

  43. 1 n- R+ @& d6 `( _. P+ d
  44. #ifdef EDMA3_DEBUG
    . X% r' K9 G) G! |4 r, H
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# \  Q) c, Q1 I' [( U1 i# I
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 L1 l# s/ H0 ]$ G% x* t0 T; o
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    & u$ M* Z5 J) s! h1 t' L
  48. #else. }: J5 `+ |' W
  49. #define DMA_PRINTK( x... ). ]2 L$ [% N7 ^1 w, E+ [9 n
  50. #define DMA_FN_IN
    5 e. `  O1 Z! ]0 }6 h$ V
  51. #define DMA_FN_OUT
    * c" q3 {3 H. E- z# m
  52. #endif! C- g' d0 S9 Z9 y- Q' K8 f3 K3 z

  53. + I9 L2 K) }0 Z/ _3 ^: I
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    4 }0 O( }( X+ u
  55. #define STATIC_SHIFT                34 @" q3 [& J3 z  B+ H  E
  56. #define TCINTEN_SHIFT               20
    8 @3 B+ r% S( b. _7 y' E
  57. #define ITCINTEN_SHIFT              21& y  u( g5 M- w4 I
  58. #define TCCHEN_SHIFT                22. R2 Z5 x2 `  ?+ w+ j# L9 S' V+ R  Z2 t
  59. #define ITCCHEN_SHIFT               23( T$ @7 v8 n  N5 e( q+ J

  60. # t1 z/ j" B2 R0 q+ v" N
  61. static volatile int irqraised1 = 0;
    & w- s. G! M, e  q- m1 ^
  62. static volatile int irqraised2 = 0;
    " u, z* ~$ ^& F/ ?

  63. & \/ m5 {4 ?0 ?
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* A" J) t0 V8 s( T. p
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: M) j3 {$ k* a; G/ U7 ?
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! m& v3 B: v# l. t4 `2 A) G
  67. 7 Z+ A7 B$ T; S
  68. dma_addr_t dmaphyssrc1 = 0;
    , e- U: V+ U3 T6 A* A, _! ~
  69. dma_addr_t dmaphyssrc2 = 0;
    : J& d- Y/ N2 c3 y
  70. dma_addr_t dmaphysdest1 = 0;
      }9 X, C3 p; ]! u- e
  71. dma_addr_t dmaphysdest2 = 0;
    9 F% U, _* P; z) [) X
  72. , j6 O& `( c! P5 T* t
  73. char *dmabufsrc1 = NULL;1 l5 Z2 g4 ?/ ~5 A- D* R
  74. char *dmabufsrc2 = NULL;! ?! a  }" c% w( H  n0 @* h
  75. char *dmabufdest1 = NULL;
    % {3 L$ n3 V4 Q2 T! n/ b" l; \
  76. char *dmabufdest2 = NULL;
    8 r3 A. {. s% W! c7 }* W" Q
  77. / q: \! i( L( Z0 e# |. y# `8 \
  78. static int acnt = 512;2 Y3 ~8 h' i, C: E' @9 a
  79. static int bcnt = 8;* {$ s1 }* ?. j* @* w& @+ m, V) @
  80. static int ccnt = 8;7 w. j0 M- Y, o2 |* v

  81. % `- y, k& L% z" }2 L
  82. module_param(acnt, int, S_IRUGO);
    4 j3 K+ s1 X0 f7 |# H/ a/ k
  83. module_param(bcnt, int, S_IRUGO);  {( c2 Y& u  o; L. e+ a
  84. module_param(ccnt, int, S_IRUGO);
复制代码

8 r. o! F) t# [/ k" \7 N0 C$ l9 |
  W/ K- g: i4 u# [) ~5 |; H( r1 T) V0 j      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 {) v: n% i3 L  z( [9 ~- C
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# I/ b/ I6 H! C& R( b+ a# X3 t; q4 w
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 L) E9 ], w9 |
$ I  }( O3 \3 f; b

6 |2 B8 w; Q/ f/ Y3 Z  C/ `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-11 04:46 , Processed in 0.038995 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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