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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % x, `& |3 S6 X7 L/ l( y; w, G) N
  1. [code]EDMA sample test application; B4 Z7 V; S: P  I" L) A; U8 ?# O
  2. /*3 [8 k9 h9 J' y1 g* J8 M* r
  3. * edma_test.c
    ' ]% F9 w  M8 c9 p8 G. d, @, x
  4. *
    & c% C! D' ~$ v9 c
  5. * brief  EDMA3 Test Application* M2 U  o6 \  g# Y# t( Q/ m* F. u
  6. *
    * Q! {5 S7 n' I2 k
  7. *   This file contains EDMA3 Test code.8 S! d! G* b( M' C; M2 A/ L
  8. *, y; o5 b* K( r& T* w1 i$ {# I
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ; K; q7 i. {" z6 p
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! a$ r* Q0 I$ {  K* _' y; E5 a5 m8 G: {
  11. *         TO CHANGE.8 C9 C, m( }7 U- N1 g: Y
  12. *
    & O7 T/ L  y7 Q) N
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    - D; C' V3 W/ m9 H8 B
  14. *
    - t! R5 \" I8 A
  15. * This program is free software; you can redistribute it and/or
    7 U1 E$ S: w+ C& ~& a$ g9 W7 v6 d
  16. * modify it under the terms of the GNU General Public License as
    , p' `. \: f1 N7 b8 m6 D" c
  17. * published by the Free Software Foundation version 2.
    / e, T' \4 f$ w2 o& I0 ?9 H4 n
  18. *
    " {, \8 e9 D2 f" x6 z4 m
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any. I3 [( l, C9 F6 m3 j
  20. * kind, whether express or implied; without even the implied warranty
    7 C8 g! o6 ~% |& l5 t
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the+ F: t. Q1 w3 M# h
  22. * GNU General Public License for more details.- b9 @; s) {  }
  23. */$ t7 N$ w( _6 ~( R+ I% |2 o

  24.   t# g( f  W9 `7 \  L4 u( r( n+ J
  25. #include <linux/module.h>
    % |8 D, q! O0 Q. s: z) W$ x
  26. #include <linux/init.h>: y8 l9 Q) f$ J4 i, M2 C1 |, V
  27. #include <linux/errno.h>
    3 s; u+ n( k) f3 W, D- }/ ?, a7 y
  28. #include <linux/types.h>2 p) G+ m, w  K4 t
  29. #include <linux/interrupt.h>3 ]' Y/ \# I# _. n6 ?3 D
  30. #include <asm/io.h>! O' P0 W: R( b. {
  31. #include <linux/moduleparam.h>; L9 f( `( g2 l6 ^/ A
  32. #include <linux/sysctl.h>' h1 W5 d9 k) B! K+ z. [! N% w4 e
  33. #include <linux/mm.h>
    $ N! Y' z* B% G
  34. #include <linux/dma-mapping.h>( F; T+ ~; Z  t3 W  E+ t; k

  35. # n3 c# b. Q0 Y) h5 B( F; s
  36. #include <mach/memory.h># v- p' f0 r. h- R9 w
  37. #include <mach/hardware.h>
    - v# b" s+ P2 N( j+ g# K
  38. #include <mach/irqs.h>4 B7 f, V7 F0 d! q; G- W
  39. #include <asm/hardware/edma.h>5 }8 {' ^4 Q& I/ U5 c
  40.   D+ |! C- B7 w2 O
  41. #undef EDMA3_DEBUG
    8 f# i: ^( r% s+ p+ b
  42. /*#define EDMA3_DEBUG*/
    - Y& w* m! R5 H
  43. + a7 ~3 ^" {7 N% j
  44. #ifdef EDMA3_DEBUG) h% M, s/ D* Q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). z4 V- u9 S  L1 L
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    % X+ G0 J1 u1 |% p+ u
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); o/ ~3 N( T' K- Z* D" |
  48. #else# O1 L/ G, ~/ o1 y6 v3 o- d$ L
  49. #define DMA_PRINTK( x... )
    6 _5 N# w( W1 ?/ _
  50. #define DMA_FN_IN
    , \; H* `- Q" k  W! A" o3 B" ?
  51. #define DMA_FN_OUT4 W7 `. G! F! S& k
  52. #endif) v7 n% [6 K2 Z6 a% U7 ^( n
  53. ! ~. W8 b* z  v
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 |. E: a$ B7 j6 l
  55. #define STATIC_SHIFT                3
      e& D9 A3 ?* @8 N
  56. #define TCINTEN_SHIFT               20* R: z' t( R4 e) b5 O7 H' M$ h! c
  57. #define ITCINTEN_SHIFT              21
    ; M9 O' k9 L$ m- {) K$ h1 @
  58. #define TCCHEN_SHIFT                22
    ) {" F8 p# Y8 l0 |
  59. #define ITCCHEN_SHIFT               23
    ; T$ t& P. O' m4 H: a+ [/ N% T6 }
  60. ; D7 M* s3 p9 v6 ^
  61. static volatile int irqraised1 = 0;0 Z) h1 O; P! N- V; ~& c
  62. static volatile int irqraised2 = 0;
    : ^/ Z9 Y, ?! t. A7 c/ p3 w

  63. , n+ T9 `3 t6 W+ n: L
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ z( n  }- D. u$ [* t6 X
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 m3 @1 D* o- m8 U0 D/ w7 C9 U3 s
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ R# v- _$ t* ^) a

  67. ; M. V$ ?7 k$ e, |+ E
  68. dma_addr_t dmaphyssrc1 = 0;
    ) X  [8 n5 W, {5 g/ Q  l7 B, P# n
  69. dma_addr_t dmaphyssrc2 = 0;
    ) U3 q  T( q1 k( }$ n
  70. dma_addr_t dmaphysdest1 = 0;
    4 I2 g+ z7 X0 g
  71. dma_addr_t dmaphysdest2 = 0;5 l+ W0 j' n0 q# T

  72. 7 C5 A+ q! A+ M2 Y! q( c4 Y8 D
  73. char *dmabufsrc1 = NULL;
    9 a7 s( X4 ^: F' G1 o
  74. char *dmabufsrc2 = NULL;* b& R1 x% ~1 |8 v( @1 j
  75. char *dmabufdest1 = NULL;  s3 Z/ L6 w2 h5 F
  76. char *dmabufdest2 = NULL;
    ' \  N$ A& [4 n- M/ S  f. ?6 R: V
  77. ! e  r' b. S; ?$ {* {9 t
  78. static int acnt = 512;
    " K# E; a( ^" p' A9 {) r. ]
  79. static int bcnt = 8;" K; d% n- y$ f  m9 |) ]! T6 [
  80. static int ccnt = 8;+ m! p1 X0 |5 j% v2 m/ i7 J, Q
  81. 5 M1 `  k3 R' w7 [6 v! j
  82. module_param(acnt, int, S_IRUGO);* P( p% _0 X3 v& B
  83. module_param(bcnt, int, S_IRUGO);
    : J/ {; A* S0 |0 r/ x- m- u
  84. module_param(ccnt, int, S_IRUGO);
复制代码

" |9 w- [7 y  v- s) W; C, m: |  K& {
/ F- |- i4 {( j      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) R9 b( E5 H& j0 z: Oarm-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# R9 f6 ]8 W9 B     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 J, l2 r# t6 h6 V$ W  Y- k0 L

* A$ X1 L- I- ]1 @0 Z2 [, G5 T2 S) X7 h1 d5 ]% t! T2 g8 Y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-6 16:01 , Processed in 0.040513 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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