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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# A8 c+ P% j% o' l
  1. [code]EDMA sample test application1 t& q& t$ j4 [. k. f
  2. /*
    ' U0 B: o* n% Z: K& z* |5 V3 ]2 R
  3. * edma_test.c
    8 {5 V. s2 x5 o$ {2 z1 x
  4. *
    # }1 ^  ?/ s; z0 ]0 \5 ]0 J2 [
  5. * brief  EDMA3 Test Application
    - r6 G$ f9 O3 r7 h; }& N  ^; Y
  6. *
    0 Y% q8 D3 ?2 _( Y5 o& }
  7. *   This file contains EDMA3 Test code.
    & s* M! k, M2 O1 I3 \
  8. *
    2 e0 K! b7 M6 C3 I+ P
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * G7 p- W2 i2 g8 x" F: ^( z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ L2 M: i5 G2 P2 Q. f, x$ \
  11. *         TO CHANGE.7 [$ D5 V, T1 I" P2 X/ D: u
  12. *# S# b- d$ g5 J) `: g: b2 H5 R9 `
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    - Y) n3 t9 n9 @0 Q; H
  14. *# y  u  z9 J# y. f+ P+ D
  15. * This program is free software; you can redistribute it and/or
    , Q) T5 X5 g0 S1 g+ o9 A" @4 x9 q: j
  16. * modify it under the terms of the GNU General Public License as
    ; u; m6 L8 [2 ?& A3 w
  17. * published by the Free Software Foundation version 2.
    & k& _. K4 b) h8 r1 G/ T; n
  18. *
    % P2 T1 w' W$ A1 @. W9 `3 n
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    6 |! p/ I% @# w
  20. * kind, whether express or implied; without even the implied warranty
    ' O% K3 }5 W* Q' ~4 i
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! B1 ^' K% D0 X' ~( J
  22. * GNU General Public License for more details.4 O9 Y5 @/ f- w9 B
  23. */' o! X1 ]' s: a% Q

  24. 3 Q; j& [$ k- S, V( R/ m3 x/ @
  25. #include <linux/module.h>
    4 e/ V8 y4 N4 t. t
  26. #include <linux/init.h>, }1 D/ h, }* Q. Z9 J( H; d, M; {& m
  27. #include <linux/errno.h>9 o; ]& E* l& m1 E# F; k
  28. #include <linux/types.h>
    7 V9 ]2 J* u  \7 \3 O) r
  29. #include <linux/interrupt.h>
    " c+ K- c1 T/ p
  30. #include <asm/io.h>
    " H7 g; J% _% }6 F$ ~# `
  31. #include <linux/moduleparam.h>
    9 K* R, Y( d( E! X: }0 `
  32. #include <linux/sysctl.h>
    6 H: _- U3 o4 {4 A: @$ t4 d3 q
  33. #include <linux/mm.h>
    & [; K% _  r- S9 r* Y: h5 d
  34. #include <linux/dma-mapping.h>
    : p! ~+ w1 N: T+ V. |2 q

  35. $ R& P: y/ P8 ?6 d  C6 K: Q$ [. r( k
  36. #include <mach/memory.h>
    3 e& e$ J& L. R6 U' `# N* P
  37. #include <mach/hardware.h>
    2 x) b/ |  H" `  b, e  w, ]- j
  38. #include <mach/irqs.h>
    / s6 I; _8 }& H/ O( \
  39. #include <asm/hardware/edma.h>
    : Y5 @4 K5 B: H: J( P3 |
  40. 5 h( E7 F* `$ a/ R8 l. Q+ Z
  41. #undef EDMA3_DEBUG+ G/ f0 h1 y2 N# U! R9 Y
  42. /*#define EDMA3_DEBUG*/
    + [' Y* ]' ?, d2 c
  43. ! y1 O' k" u. ?# b- ?6 w
  44. #ifdef EDMA3_DEBUG; y6 Z# A; j7 T, {! }. T
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    # p' [1 ?0 U$ ]5 b; w( C
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 d9 G. \8 ?' y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 c# c" j( x& K7 |) e
  48. #else
    6 S9 {5 T* t6 |% l: l
  49. #define DMA_PRINTK( x... )
    ; `3 ]; X: O7 ^% s: J2 s9 e
  50. #define DMA_FN_IN
    4 @4 l! F- B3 @( E  {! k" I
  51. #define DMA_FN_OUT
    / o' s+ P# b9 Q% X# C% R* O
  52. #endif
    * [) e" V# @2 c# z5 m/ _$ c0 Y

  53. % |( r3 ]' \( q# t
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ! I1 w0 h9 G' ?6 K8 ?" z; d
  55. #define STATIC_SHIFT                33 K  H! r2 N1 f  q9 C
  56. #define TCINTEN_SHIFT               20
    6 h1 Y1 g4 g: A7 N
  57. #define ITCINTEN_SHIFT              21
    ( K+ M! P. ~! b4 e8 o
  58. #define TCCHEN_SHIFT                229 @+ G# E! M! L8 A
  59. #define ITCCHEN_SHIFT               23
    7 W# v& {# J; @0 g" p; n2 X) Y

  60. 4 B, ?1 H& Q; U3 f8 D* w( W4 X3 T* x
  61. static volatile int irqraised1 = 0;
    5 ~% g9 V/ x, Q) _
  62. static volatile int irqraised2 = 0;
    . g4 c# j* o5 q" o
  63. $ A" Y  X9 T' A6 Z+ t" O+ A/ d# p8 d
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # ]  N4 {0 F% Z+ q) I) a$ k7 n
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 w  j7 e$ v. n5 x
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - v$ ], U8 i7 f! m3 Z0 N

  67. 5 n6 c4 @) O: x4 ?- ^' Z
  68. dma_addr_t dmaphyssrc1 = 0;
    & s) c! t1 |3 W% m; D/ Q( m
  69. dma_addr_t dmaphyssrc2 = 0;
    7 @. N$ e# y9 u, }9 }
  70. dma_addr_t dmaphysdest1 = 0;
    % k6 X4 [7 F5 R! h
  71. dma_addr_t dmaphysdest2 = 0;1 _0 a% N0 p+ j6 V  k8 Q

  72. 2 S2 l! Y0 y% q" h% ^9 M* [
  73. char *dmabufsrc1 = NULL;
    + Z- ]0 `# q3 D5 z. L6 B
  74. char *dmabufsrc2 = NULL;& J% `' a/ C. M8 C; a0 f* F
  75. char *dmabufdest1 = NULL;+ f) r% y( M0 `" M0 f' L
  76. char *dmabufdest2 = NULL;
    & L) }% s7 S& a4 C/ m

  77. + e/ P  {1 e' i* V
  78. static int acnt = 512;7 e+ W" F% P$ m: z8 e
  79. static int bcnt = 8;
    1 E2 N1 j. h1 v5 m% `) I% b# E+ w: s
  80. static int ccnt = 8;+ C( h2 x$ C; H! w
  81. 7 H1 J5 @  P( M$ Q3 |
  82. module_param(acnt, int, S_IRUGO);
    5 l: {- ?) l7 R4 o8 g5 b5 t" X
  83. module_param(bcnt, int, S_IRUGO);2 N7 ]2 U- C, ^$ M6 M9 m' I
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  w8 w* p/ c: x. d% A' M: p  J( y2 [# V6 T0 r9 _
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# p: m7 n' A* g7 a+ {7 E, r7 aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 r6 Y/ k% ~' U( f     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' N, X! v9 I+ S
6 ]5 }. Z( N4 g  q
8 W& i5 h. @# d' w- Z- ^
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-23 19:10 , Processed in 0.043188 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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