OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! |5 v/ e, J, z  w/ N
  1. [code]EDMA sample test application
    8 L2 J3 ^( i3 g8 u. l! _4 X
  2. /*# F; N$ J) K; I( [2 T1 g5 F0 E% H  ~
  3. * edma_test.c! _! ]) c9 w; g  z2 i5 B
  4. *
    $ F4 g! ?& U+ C) L* M9 }+ R  R: U
  5. * brief  EDMA3 Test Application& p+ r4 S& p2 C& E/ z- c$ s2 x
  6. *
    + {: v  m( G8 i1 H0 q1 s
  7. *   This file contains EDMA3 Test code." u3 V0 ~: Y3 T( X. ^- v
  8. *
    ; A6 g6 R, O2 n
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 s( U, Y  G; h  }' ^3 b3 p
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: E' a% u6 H* U4 c" g0 Q" d
  11. *         TO CHANGE.
    ( N% b% v' G" J  Q* T( r4 `- ^
  12. *
    & ~9 R! ?7 c$ _  f4 L% P
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( {. a- t/ Y# G$ ]! a2 }" B
  14. *- h- Z# b$ b/ N* m+ v: T7 }  k
  15. * This program is free software; you can redistribute it and/or
    8 \. P, b& s  v1 {! g1 a# ~8 _
  16. * modify it under the terms of the GNU General Public License as
    ' {2 B( I; ?/ k0 Q# F3 U" D5 H$ h
  17. * published by the Free Software Foundation version 2.) s: u7 p( s) a! {. ~
  18. *& V: L1 @6 v- P7 ?
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 \/ ~; ?/ Z5 ^  Q* g5 g
  20. * kind, whether express or implied; without even the implied warranty
    5 {+ P2 B3 A) E# {- b2 T
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7 c# E" Z' Q) x$ f1 H4 R, }. q
  22. * GNU General Public License for more details.0 s  V8 ~$ s. c$ m5 K6 U
  23. */- f  E' t7 O$ K9 q  l  a
  24. / l- _9 V0 B! ?: q# j
  25. #include <linux/module.h>
    8 y9 Z# u" E9 o1 H) _$ r+ V4 s
  26. #include <linux/init.h>
    0 M9 _0 \! ]  h5 p
  27. #include <linux/errno.h>
    " q  T4 _9 T! f9 X( F
  28. #include <linux/types.h>8 z( z+ K  W, J% p2 ]: F" b+ n
  29. #include <linux/interrupt.h>
    + B4 I: O$ s% B1 e# j! o5 t
  30. #include <asm/io.h>
    # H* [) t7 _- J8 E: W
  31. #include <linux/moduleparam.h>; \! Q8 d! ~: P, l' w0 N6 p( b/ w
  32. #include <linux/sysctl.h>1 [- Q+ u) P5 E" F2 A
  33. #include <linux/mm.h>8 Q8 w: [% J0 m0 O! N* B9 F
  34. #include <linux/dma-mapping.h>
    1 j: i6 g0 K) M; _0 N
  35. 6 j! _+ B; Z) ?- X! v7 f  S: x
  36. #include <mach/memory.h>
    % ^) |5 D, h& Z) s3 q; ]- O4 t! Z. O
  37. #include <mach/hardware.h>
    ; P& `/ B% t! N6 v
  38. #include <mach/irqs.h>0 y% E1 p. D6 `2 w' s4 p, }
  39. #include <asm/hardware/edma.h>/ e" h) @1 }6 {% o
  40. - v: ~2 @# X' ^
  41. #undef EDMA3_DEBUG
    ! M% f: J, a% v0 E" }& s
  42. /*#define EDMA3_DEBUG*/8 @. _0 d' C( ?0 b; v! c

  43. : W  P1 x! {1 K! V' g
  44. #ifdef EDMA3_DEBUG/ Z7 w0 J2 h2 b" s! v4 L8 Q$ N
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    : }3 e* H' B$ A) ~1 T8 b
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    * g1 V" L: m. f! [& P
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 }5 P- \( h! Z) Z
  48. #else" u( U2 q% C4 S
  49. #define DMA_PRINTK( x... )
    4 A& q+ x0 f  ?5 y2 x, V. _
  50. #define DMA_FN_IN# R7 f% ~5 H: N1 C) r
  51. #define DMA_FN_OUT% [9 V  P+ I7 O5 `: j' _& W% p  m
  52. #endif
    ' |  u9 z' f$ z/ j& X8 f
  53. # u8 ?6 ^5 h# F4 h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    $ R: M5 p9 d8 C8 }, @* I/ `
  55. #define STATIC_SHIFT                3
    * z; c8 O4 Z9 H: ^- m' V: a. O- `
  56. #define TCINTEN_SHIFT               20
    * r# y3 C' z# i7 s
  57. #define ITCINTEN_SHIFT              212 d) f0 u3 ?# ^2 v
  58. #define TCCHEN_SHIFT                225 A% @  @% b. }/ ^' q) t: X' I& k
  59. #define ITCCHEN_SHIFT               23
    7 Q' `2 v3 _4 |7 N: r) s) r

  60. ( T9 H5 W; P4 `  W- b
  61. static volatile int irqraised1 = 0;
    % x, Z! ]0 ^8 @: S4 Z# H0 r3 f+ p
  62. static volatile int irqraised2 = 0;" {5 t+ z3 Q5 R4 [

  63. 1 Y& ~+ J- j3 s$ q1 @2 c( o3 h
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 ?, M  l9 L; B# @) H6 R$ d
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& \  I. N- b4 I/ j5 H& w5 e2 [  h
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - e1 [; Q+ B) B: h. R

  67. . V* |' z) S, B6 l4 h3 ^
  68. dma_addr_t dmaphyssrc1 = 0;6 Z% V$ B! O: A8 D7 B, `% D0 g
  69. dma_addr_t dmaphyssrc2 = 0;( f5 a! O2 e( w7 I! ]
  70. dma_addr_t dmaphysdest1 = 0;
    , \% P1 k6 S! _2 B; r+ I& {8 G) w
  71. dma_addr_t dmaphysdest2 = 0;: V+ J& l+ D# x' W+ ~- H
  72. 9 u" l; w& _. T" }. o
  73. char *dmabufsrc1 = NULL;/ I- {: D# h' k
  74. char *dmabufsrc2 = NULL;% T/ [7 y$ q$ D' r2 O; [" I
  75. char *dmabufdest1 = NULL;
    6 N+ J1 e- g' d- u) j6 r) E
  76. char *dmabufdest2 = NULL;
    7 k5 n  L( [6 K5 ?6 u3 Q
  77. 1 \5 L7 _( R0 q7 {
  78. static int acnt = 512;
    2 a7 n" P$ V( E7 \
  79. static int bcnt = 8;: c' v4 x( `' {0 z7 q/ J4 L
  80. static int ccnt = 8;
    - P. w% Y; r* g# V
  81. ) A) [, x3 e. h
  82. module_param(acnt, int, S_IRUGO);
    7 L2 z! k8 _( U8 F1 a) `
  83. module_param(bcnt, int, S_IRUGO);, F" O% ^1 L2 G. ~
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: t  x6 u8 a' S% z0 X/ E8 Z5 A  z9 }3 I- P, m2 v
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) g* ^8 ~  O% Garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" A% J' q# H9 U; {     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. j6 q* S# @  e9 E' z: _) O' W3 x: R+ Y' [4 x

( h+ n( x, s6 d' q) Q2 D  b& \6 ^
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-5 10:32 , Processed in 0.090964 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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