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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) ], h" ]' `" q$ K3 C$ ]1 D
  1. [code]EDMA sample test application$ \9 n8 v. n% t. I+ h9 z: N
  2. /*: f+ u% g" O+ ]7 ^
  3. * edma_test.c3 t% |: n/ ]2 @0 T. A: b0 ]
  4. *' q) e* K' J% m" {! S, Z% N) I
  5. * brief  EDMA3 Test Application5 e6 \% a4 T- V, ?4 g) S
  6. *' ~. A- O$ c$ |/ |' m/ r+ w2 y4 |
  7. *   This file contains EDMA3 Test code.
    2 w7 b' H8 T2 y
  8. *  S1 v4 h0 y/ L: O8 b9 V
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! i) l% G0 _- v0 S# X0 p8 \
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& Q) u3 {; n% c6 J
  11. *         TO CHANGE.
    % h0 n; |8 L$ r5 h. m
  12. *
    6 i, ?9 {6 v9 }8 p
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " f  i: n4 R8 A  C
  14. *
    $ c- f2 W8 C% k# ~% |/ F( X
  15. * This program is free software; you can redistribute it and/or( u: d  \% w' i5 {3 H4 x! l
  16. * modify it under the terms of the GNU General Public License as" J  L- {) N, U
  17. * published by the Free Software Foundation version 2.! }1 \2 b! h$ `+ D) {. h
  18. *
    * r4 W& E7 j3 Z. q/ _( @# E
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    0 J1 _! f" x* [2 n  Z
  20. * kind, whether express or implied; without even the implied warranty2 V8 ^- s" R/ i
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7 E1 d' C4 w: O& F; ~9 z; U
  22. * GNU General Public License for more details./ V  M* f- e# D1 `+ Z* T7 U
  23. */
    9 N2 a  q9 W* f; s8 y

  24.   M! Z7 h% Q! \% U
  25. #include <linux/module.h>5 q( w' ^" v6 D& H1 ]1 g5 q& [
  26. #include <linux/init.h>2 O- ^9 _, ?8 Y  P$ A) i% q
  27. #include <linux/errno.h>
    # h3 x: {- Q  H) h
  28. #include <linux/types.h>
    . n5 M9 _; s4 x$ |- V2 W& i
  29. #include <linux/interrupt.h>. @- H8 R: g/ @5 N$ l
  30. #include <asm/io.h>
    4 Q8 ^! c, K( E
  31. #include <linux/moduleparam.h>
    " C: v0 W. h6 @6 V; Y- a
  32. #include <linux/sysctl.h>  S) b$ A- U8 L) ~; x1 [
  33. #include <linux/mm.h>
    2 Z7 I. j5 h5 U! S) ^3 d
  34. #include <linux/dma-mapping.h>; T( Z; q8 W8 O/ N

  35. ! q4 Y, B1 f( T& Q
  36. #include <mach/memory.h>
    8 p& M8 p& U3 C( U
  37. #include <mach/hardware.h>" ?; S* I" j) S8 z
  38. #include <mach/irqs.h>( s9 G2 j& `4 D! ^# d- [7 E3 Z
  39. #include <asm/hardware/edma.h>
    / d; l; O% u# x1 {+ I

  40. 3 \  Y; o" ?/ L$ W9 S
  41. #undef EDMA3_DEBUG( [+ e; \1 o+ t* d  r3 L
  42. /*#define EDMA3_DEBUG*/
    ; Y+ S% K0 ?+ L% Y1 d
  43. 7 D6 }  i9 \& u7 b$ U  G; Y
  44. #ifdef EDMA3_DEBUG
    " I! Y& A  z. w; I7 y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    6 f% t. d! B7 Z4 X
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 W4 l3 \  b6 t7 t; k
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ C5 V1 \% `  j- Q, B* A% W1 E7 m
  48. #else. n$ @3 o& y; \& m; A0 S
  49. #define DMA_PRINTK( x... )5 {$ {8 j! J2 S% O7 K' C2 \: u6 p/ q+ J
  50. #define DMA_FN_IN
    $ w0 q$ y4 h: R
  51. #define DMA_FN_OUT8 g& G1 E* I% C7 L* A4 X
  52. #endif+ K5 f1 A  v7 j% q4 W
  53. 7 g  @: K! P1 o- D0 l
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; S- j; U; o$ V8 J' X
  55. #define STATIC_SHIFT                3" R1 _( a8 [% M; a1 B" {
  56. #define TCINTEN_SHIFT               20  t) f8 b% D# q9 s8 i1 Z
  57. #define ITCINTEN_SHIFT              215 j# S' f/ i' o; @! z
  58. #define TCCHEN_SHIFT                22. @& P8 e( P( a% s8 R
  59. #define ITCCHEN_SHIFT               23% |3 P! n) U" e9 l6 w

  60. 0 x/ C  x( s* @$ ~
  61. static volatile int irqraised1 = 0;$ ?7 j+ `7 Z" ]/ ?' l# j
  62. static volatile int irqraised2 = 0;
    0 L; u% |- S  B. I1 p/ q' M4 W6 H5 j

  63. 4 `. y+ [& F9 O- z7 A& B5 _2 _
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ b4 y7 ?) l5 e# w
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 m% \% q" V: j8 A2 @2 z- S
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( O3 X; B  S6 X) L

  67. 2 D' ~5 l6 E$ V+ a- @
  68. dma_addr_t dmaphyssrc1 = 0;) N" ~% K2 o, z; i4 G9 P" C4 G* A
  69. dma_addr_t dmaphyssrc2 = 0;# G. [5 v! k9 m8 }! J
  70. dma_addr_t dmaphysdest1 = 0;
    7 L7 s$ a- H) p3 |. Q
  71. dma_addr_t dmaphysdest2 = 0;
    9 N* f* Y+ K# P# ~" U
  72. 8 }& _" p. a) T" e9 e! |; G
  73. char *dmabufsrc1 = NULL;  C2 X" w& h+ Q
  74. char *dmabufsrc2 = NULL;! f5 [) N/ f% j3 y
  75. char *dmabufdest1 = NULL;7 t: Q1 d$ G3 @: }6 d! g3 Z
  76. char *dmabufdest2 = NULL;
    4 e8 k3 m% H3 s3 p, r' ]
  77. 6 A% R8 ?2 ]& j5 [$ h
  78. static int acnt = 512;
    # p% p+ R' p- z- x7 E7 r
  79. static int bcnt = 8;7 w" f& B+ p/ f' H9 o4 }
  80. static int ccnt = 8;5 v1 X" a. X) B6 e
  81. 6 l& ?# T& y  W) {; L
  82. module_param(acnt, int, S_IRUGO);
    * W8 }' P0 W5 Q# E& i. l7 B6 }
  83. module_param(bcnt, int, S_IRUGO);
    : h5 A; S" X% Z
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 m) \# t; }2 a% j* J' Q

" q& K, V4 H0 e6 Q/ M3 t      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 U/ k$ T- }0 m/ U) B
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 n$ h& D; h8 m9 L1 H; x- v     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) a' ^6 z& e% u. ~

* n1 S0 ?( y5 F5 k6 n9 `$ {4 f8 E/ ]; U. y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-1 04:54 , Processed in 0.046567 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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