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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: l) h3 L7 i  A" ]
  1. [code]EDMA sample test application6 R( h& y4 T4 {! W& }* W" O
  2. /*
    * W; J1 L9 T# e" C
  3. * edma_test.c) M4 j6 N, g7 K* E' [0 N. e2 O+ T
  4. *8 q9 i- K. c0 V. V( D4 m
  5. * brief  EDMA3 Test Application/ D2 c  E4 i; s. U1 z
  6. *
    . V# P2 G: F+ n
  7. *   This file contains EDMA3 Test code.1 v$ [6 \7 p4 O. F
  8. *7 |1 M( S/ S9 n* r- J* K( X
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  {8 t( G& R1 f4 d2 E
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 y! D8 [. y+ h% r/ V0 H
  11. *         TO CHANGE.
    + K7 C# e; t  X2 D. y" k
  12. *
    5 |1 r; @  Y1 o+ b1 _7 M; s! }4 \
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ; U# l5 b: |9 X- B2 X
  14. *2 T) q( {8 F% l1 a  ]6 F( |
  15. * This program is free software; you can redistribute it and/or
    : T& b/ y" s: D2 h8 z# I
  16. * modify it under the terms of the GNU General Public License as
    2 c$ `- m( o! l2 \; S3 P3 }
  17. * published by the Free Software Foundation version 2.: }. R/ |/ \  h5 ?- Y  `6 ]+ _: I
  18. *5 l# v! |# {4 v. z0 k0 S* g# `
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    0 V% v, E$ J- ]0 p( Z: W
  20. * kind, whether express or implied; without even the implied warranty$ \* G# J' E3 X, ^6 k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the+ }& P; v5 B- K- B$ f* R: E+ A
  22. * GNU General Public License for more details.
    ) Y% b) P6 K2 C
  23. */
    , p# |  B$ e/ b

  24. $ i' E; ^4 C9 i0 z2 }. J7 V. h3 B
  25. #include <linux/module.h>% K  s4 z1 n) q, a
  26. #include <linux/init.h>! N' J, y1 `5 `5 g+ }
  27. #include <linux/errno.h>
    / f* T9 w" U' X! U9 s- K
  28. #include <linux/types.h>
    8 L, g8 {* D. l$ \" H( F) J& ?
  29. #include <linux/interrupt.h>
    1 `5 f& q! |% w
  30. #include <asm/io.h>) v' ]( M( v0 f- F3 A* g1 O" U6 |9 w
  31. #include <linux/moduleparam.h># s8 D  ?4 D& O5 m$ D6 Z
  32. #include <linux/sysctl.h>
    : M) {7 r! O( ?9 K
  33. #include <linux/mm.h>. {$ p; H( g4 I+ i6 O" k
  34. #include <linux/dma-mapping.h>
    & M. d8 z7 I% o% w5 v

  35. - L1 f. [# A) ^5 v
  36. #include <mach/memory.h>0 `& u8 S0 B' U7 a5 ^
  37. #include <mach/hardware.h>/ m) U! t* L2 O; ~/ t: v$ B
  38. #include <mach/irqs.h>! T" I! k( L8 E) M4 N
  39. #include <asm/hardware/edma.h>
    # n8 [" [( }- z% Y  Z
  40. * ~- @" f+ b% Z) c
  41. #undef EDMA3_DEBUG4 u/ Y+ y5 T5 E$ H
  42. /*#define EDMA3_DEBUG*/
    2 D  w( ~8 P8 G# r

  43. # I# W& ]; D: ]; f9 Y
  44. #ifdef EDMA3_DEBUG
    ) O" u" s5 ]. i5 m* @9 x
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 y0 b# H. o/ I; }% s
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): z! _' U  c5 l+ N) a
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- f5 e$ N' F4 e. `
  48. #else
    ' b' ~# ]. P$ [( n8 u, _* Q
  49. #define DMA_PRINTK( x... )5 o' x% X  ^. {: s; L
  50. #define DMA_FN_IN
    # D# t! R7 {8 E. `5 P
  51. #define DMA_FN_OUT
    " B1 l: T3 f+ D
  52. #endif$ |( u  V$ d: R
  53. - G" o0 w3 j" C  e% Y7 N  H
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)' n9 G# H- g1 E2 f/ b( a( s: z
  55. #define STATIC_SHIFT                3
    ! ^1 L! k" V6 A. H
  56. #define TCINTEN_SHIFT               20. y0 q) D, S2 h+ ^, |
  57. #define ITCINTEN_SHIFT              21
    , ?# W# l" w7 O
  58. #define TCCHEN_SHIFT                22% m, R8 H9 T$ V8 P# l% t9 M
  59. #define ITCCHEN_SHIFT               236 @0 G  g& G8 z; \% [  t

  60. 6 @( T: z6 j+ F' j( o6 r6 S" U- d
  61. static volatile int irqraised1 = 0;* i2 s' o5 D" X5 }, i) g9 S% o# [
  62. static volatile int irqraised2 = 0;
    4 l7 \" F0 B: \! o
  63. ! w% j! f; Z$ g; i; N) J( [
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 N) w3 _, J6 c& ^7 X9 Z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 M* \+ y& Y$ f& t& ^/ M/ R
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, R. V* y; Z# Q3 \
  67. - f9 Z( I6 |8 X
  68. dma_addr_t dmaphyssrc1 = 0;$ [, p, ^) ~% _' \: n
  69. dma_addr_t dmaphyssrc2 = 0;; q$ k# @  ~/ r$ y* U* _* T' m
  70. dma_addr_t dmaphysdest1 = 0;1 g  c: e: O9 [( n/ t
  71. dma_addr_t dmaphysdest2 = 0;0 \+ B7 P1 _: p
  72. 1 g& L8 \  Z7 B1 z
  73. char *dmabufsrc1 = NULL;
    ) [4 E' [  R# e# X, a# M- l
  74. char *dmabufsrc2 = NULL;
    & b  I3 Y& X6 i8 p( |
  75. char *dmabufdest1 = NULL;. Z8 k1 H$ I% a1 M" ^& [" _
  76. char *dmabufdest2 = NULL;% y$ z2 t* X( U! L0 ]" N/ h) {
  77. $ X* j) Y8 \! y8 y1 g+ ^
  78. static int acnt = 512;$ c/ ~7 H2 x/ A; h* d# X
  79. static int bcnt = 8;$ x$ R/ U6 C3 {& e3 f
  80. static int ccnt = 8;
    - J8 l5 w) w* I) E& s0 t
  81. / E5 r* D0 }9 ]5 M( x( N8 g
  82. module_param(acnt, int, S_IRUGO);. R& @! b" c2 u- n0 N* ?6 l! b
  83. module_param(bcnt, int, S_IRUGO);
    + V  D) [3 N, g4 u( z
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( [- z1 }  x3 k# U" E, v. _9 ~8 f1 \& |
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' `7 ~0 I0 W2 G* R$ x
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 `% d5 m: k0 I
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) L6 N- `  w, w  Z

/ _5 g; f- j. a" z. G1 [; v# L$ h* a  y& ^  L6 K* c8 Q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-20 07:10 , Processed in 0.036888 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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