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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( n6 z# N6 u8 d, F" i
  1. [code]EDMA sample test application
    5 ]2 E) f5 E9 s' U. K
  2. /*
    . ^. j* c! V- b" W! S! t- l3 ?
  3. * edma_test.c6 k2 k" `- Y* ~
  4. *. X& Y1 U  M. U- R. Y! y6 a
  5. * brief  EDMA3 Test Application. }6 U) i7 }* u1 |3 u3 i+ ?) j
  6. *+ r6 s- V  U7 B8 o/ P% |) i3 l+ s
  7. *   This file contains EDMA3 Test code.
    / i' X  D' v. U) q1 w- S5 f6 x
  8. *
    6 J) N" Q) U" D+ z, c4 L+ a7 ?- _
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ' E; ?2 G4 q# B/ x2 Y" F( N, T
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% i' t) f& P7 Q/ v# g7 ^
  11. *         TO CHANGE.
    7 ]$ s! j7 j& g
  12. *
    , f# @% n8 h- R, c! X
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    . I6 [2 N0 c" ~2 w' m
  14. *
    6 i; h, ^" }$ `4 e2 m
  15. * This program is free software; you can redistribute it and/or
    * N* f. c: T3 h, g4 [
  16. * modify it under the terms of the GNU General Public License as* g4 R1 Z  y1 _+ w, ?3 R# G/ v. T7 _
  17. * published by the Free Software Foundation version 2.) D) B5 N; m; O: I8 A+ p
  18. *" I/ W. e( \8 T) b, f
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 z% m/ T  h2 V: p6 K
  20. * kind, whether express or implied; without even the implied warranty' k6 K% T7 n8 @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 U- L3 E# h0 e8 R6 g. K& L& `
  22. * GNU General Public License for more details.4 ]8 |1 t1 H+ t/ u8 P
  23. */; r$ d' i6 r7 @# y( E
  24. ( D5 h* S8 E; v& r
  25. #include <linux/module.h>
    1 F8 o9 w' r. l6 ~8 h  F1 M" T
  26. #include <linux/init.h>/ O$ l, C; H: m. X! }. N
  27. #include <linux/errno.h>
    7 O& B0 z3 j, O4 r; _( K) d+ t
  28. #include <linux/types.h>7 w+ b" o" G0 J* E1 S
  29. #include <linux/interrupt.h>
    0 l* }/ Q. _4 ~( b* _
  30. #include <asm/io.h>
    + l5 @* r0 G# Y! C+ w5 R
  31. #include <linux/moduleparam.h>2 {  W6 ^& Y+ ^. ?1 ]( D4 s
  32. #include <linux/sysctl.h>7 t  r0 z9 W5 X0 z9 s9 k
  33. #include <linux/mm.h>: i- T. F2 C& d# b& m' `9 X
  34. #include <linux/dma-mapping.h>3 t7 |5 X, ]2 b$ D; x( U4 F

  35. & N/ P3 D1 j& ]% K" `- y6 ?9 n& X& p
  36. #include <mach/memory.h>
    * C* a% e9 n. u4 C7 r
  37. #include <mach/hardware.h>. ?; g8 ~) p: p5 U' h
  38. #include <mach/irqs.h>
    # z3 i- e- r4 l, ]0 C4 s0 R
  39. #include <asm/hardware/edma.h>. p1 ~& h" M0 Q

  40. ( v9 e3 O9 _$ l. ^
  41. #undef EDMA3_DEBUG$ V! a! t8 G% c0 o& @
  42. /*#define EDMA3_DEBUG*// t6 ^; o2 z1 X- s! x/ d- D$ V

  43. 2 G. y! E: R+ E; }
  44. #ifdef EDMA3_DEBUG
    2 z, Q5 ?& e( e
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
      }9 B0 q( Y; {3 z9 e. W8 L3 W/ p
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    * P" Q* q& T# {0 n) ~. h( g: C+ l
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    0 F: s6 F9 c0 |4 q* p+ ?
  48. #else" l* w4 ~* V1 {8 h+ F& Q$ K5 O
  49. #define DMA_PRINTK( x... )' K+ |$ ?/ o: @0 p
  50. #define DMA_FN_IN
    : ~( q, `+ v' J. l+ m
  51. #define DMA_FN_OUT, x  H) O: \' R. v- O
  52. #endif
    : V* c5 j; y6 a" o/ }8 ]! ~

  53. 3 ~& L. b! ~- N7 [+ J
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)' Q% ]2 ]8 P2 N- D9 K
  55. #define STATIC_SHIFT                3
    ! |/ A: E7 }0 _+ S) B
  56. #define TCINTEN_SHIFT               20( N/ Z) ?, M+ C5 t
  57. #define ITCINTEN_SHIFT              21
    ' y) g+ }  @  g+ r* ^) k
  58. #define TCCHEN_SHIFT                22) a. M* U% ~9 |8 N* z
  59. #define ITCCHEN_SHIFT               23
    , t( t0 h# L2 k5 Y

  60. . T. T" F( ~1 N# V8 P8 Q
  61. static volatile int irqraised1 = 0;8 y1 J) ]( z8 @
  62. static volatile int irqraised2 = 0;
    ; v& L1 P9 T" D' R4 Q2 G
  63. 6 K# c7 M* _7 w: q' Q" d
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 L, Y# Y5 E1 w7 @$ ?4 g3 C
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ U7 L6 u8 }( q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % P4 ?0 M  K/ d. Y# @

  67. 8 d! r0 `3 i0 @% L/ n
  68. dma_addr_t dmaphyssrc1 = 0;
    9 F, A0 W6 H) R: w$ {: O
  69. dma_addr_t dmaphyssrc2 = 0;
    : }: B9 ^5 t( s& ^1 w
  70. dma_addr_t dmaphysdest1 = 0;
    2 ^8 [( h& d6 C# ^$ Q
  71. dma_addr_t dmaphysdest2 = 0;: O" v- \! K% L- s

  72. 6 K0 I/ f, w: N# v0 l  k& q& A, L
  73. char *dmabufsrc1 = NULL;
    ) w; y4 p( n' ^* c; s
  74. char *dmabufsrc2 = NULL;
    7 F/ g' A( U% G: f' T# u- V9 f" [; \1 U
  75. char *dmabufdest1 = NULL;6 [+ z2 f1 V3 k3 x
  76. char *dmabufdest2 = NULL;% A7 s; U0 ^2 d4 {5 T' P. L( v. l
  77. 3 z0 o% I7 I; i8 Z2 V% e: o
  78. static int acnt = 512;! `% A' B1 q, Q; n4 E' W; f6 S3 W
  79. static int bcnt = 8;! ^3 @4 G: |: d7 D3 o
  80. static int ccnt = 8;
    6 E0 ~, @" ]' @
  81. ; N8 o0 ^: t( t: f" ^) }
  82. module_param(acnt, int, S_IRUGO);0 q% b8 \- A' K" [" b: @/ z; |: V! Z
  83. module_param(bcnt, int, S_IRUGO);
    7 j; C( r5 g; E" X( c9 `3 {$ g* J
  84. module_param(ccnt, int, S_IRUGO);
复制代码

9 }# H6 t" R1 }$ H2 q" \7 ?
/ U7 T, B. g4 ]' J$ z7 \      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* S3 Q0 z0 u/ m& H# c2 I9 p0 t8 @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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- a$ ]# U4 Z* e9 j) S+ d
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 H/ t: u4 X% o5 I

$ F7 T! v" Z- r, i4 V6 T: ~$ F5 z9 b' E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-8 19:46 , Processed in 0.039527 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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