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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 r, T( B9 _5 V) i
  1. [code]EDMA sample test application1 ?) {% q& u6 e: I1 h, L9 |
  2. /*
    8 P! E* y8 i, r2 X( @* Z% x
  3. * edma_test.c& W# f5 h; u) G+ c8 f
  4. *
    / }9 G' \- [, O( V+ h9 v
  5. * brief  EDMA3 Test Application
    2 c6 W3 Y. r# X, J: W# x
  6. *9 F' W& A- `$ M3 S
  7. *   This file contains EDMA3 Test code.
    2 b: f6 h# |% E9 L" w' c! H
  8. *4 o- Y( f2 ?9 Q! a' S: G4 `
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    . R: d! P/ N. D9 K
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 u) h) f) ~0 d; E; Y
  11. *         TO CHANGE.
    + n2 T$ t; g6 W5 w) n7 t; y8 i; [7 w
  12. *. M* l% ^% P% i. j& Y1 A& n# r
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 ]( D1 S. k0 c
  14. *
    , ?: m, @1 o6 U6 c4 K
  15. * This program is free software; you can redistribute it and/or
      u9 A) K1 g6 `% H
  16. * modify it under the terms of the GNU General Public License as
    # a. \' h! R- X# K1 L# x" A
  17. * published by the Free Software Foundation version 2.
    & k8 u6 S+ Y$ L# W2 t
  18. *
    * B6 a& n& L$ T$ L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    & w. M# E; F0 ?( A# p8 A' o
  20. * kind, whether express or implied; without even the implied warranty2 S) Y8 b1 [: e& h' g
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' h% j# @; n0 I5 s
  22. * GNU General Public License for more details.
    1 J/ X, B9 [+ m: m0 R0 V1 v
  23. */$ Z( O/ P+ Q9 `! ]' R
  24.   D( u% r) u( S: o
  25. #include <linux/module.h>0 [5 F% x. ?: H2 U
  26. #include <linux/init.h>. J& D5 G. d( c" S' O; f1 X  @
  27. #include <linux/errno.h>9 |1 P0 u1 r2 C8 E1 B( h; b2 ?
  28. #include <linux/types.h>$ u! O. g2 ^+ G  }4 ~
  29. #include <linux/interrupt.h>6 v0 @' P# A+ ]$ n5 _
  30. #include <asm/io.h>
    # s1 D7 p5 O6 _- G) G
  31. #include <linux/moduleparam.h>
    & k2 ]# U. C" ]
  32. #include <linux/sysctl.h>5 t9 L" x! `% M0 o, Y3 k* z( q. M
  33. #include <linux/mm.h>
    4 `% c% D6 L; h' I- V( }8 H
  34. #include <linux/dma-mapping.h>3 h  ?; D( e+ L' u; M' }5 _
  35. * k. z: W( P8 q' Y' l: R& b1 x
  36. #include <mach/memory.h>7 Y5 X% S/ X* B! C0 s/ {
  37. #include <mach/hardware.h>
    : `* a3 i# h& V. T
  38. #include <mach/irqs.h>" B& g' H+ ?* l, n( \$ T: x
  39. #include <asm/hardware/edma.h>5 R: k) }7 G! ?$ q: ?% q! W
  40. $ p( m6 C2 q6 D
  41. #undef EDMA3_DEBUG
    ( l4 @3 L0 i3 Z; P5 J& _
  42. /*#define EDMA3_DEBUG*/
    + A8 l1 j+ |9 D1 k& r, i

  43. ; p1 S, f% h  G0 d
  44. #ifdef EDMA3_DEBUG/ k: z" q3 x6 v* L: i' W9 I* D" L
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    / T+ P7 A; V1 m+ [
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- a& z! [; m+ S/ }- F- h
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + F7 J' T  O' T4 z& K
  48. #else# f/ H6 |0 r  I; P1 V
  49. #define DMA_PRINTK( x... )
    & D  ~7 }# J: o3 S
  50. #define DMA_FN_IN
    ' R. {! @: q5 @7 U9 T" ]
  51. #define DMA_FN_OUT
    7 T4 b1 O4 v# V; O+ ~' F# {
  52. #endif  ^0 F& L0 q# J$ C

  53. 3 U2 f) t6 a+ O, s! t/ f5 k5 W
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    % \( F' G8 e. Q( k
  55. #define STATIC_SHIFT                3
    7 S; \) d  \  Y" g
  56. #define TCINTEN_SHIFT               205 v8 T$ E3 ~9 z7 h8 ?0 m' N
  57. #define ITCINTEN_SHIFT              21
    % A4 n) z  g4 e) H: h$ [
  58. #define TCCHEN_SHIFT                22
    8 T0 y0 d6 h+ F
  59. #define ITCCHEN_SHIFT               23
    5 t2 g- ~1 m6 J2 L# g0 O* Y/ G5 P
  60. , g/ R& L6 C* T, ?) x! s, Z
  61. static volatile int irqraised1 = 0;
    ! C/ r( T* d3 [" d0 i
  62. static volatile int irqraised2 = 0;: x" }8 d! c! C
  63. , f& t* S* K. v* L$ W1 {: Y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* N& L, ~' @9 P" q$ `1 f
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ j( Z# f5 |7 t& h
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . }, E/ o5 C3 q; K
  67. ( L) ~. \/ G. f2 Q  K# u% t% e
  68. dma_addr_t dmaphyssrc1 = 0;
    6 p: e6 G& u1 A, u8 L
  69. dma_addr_t dmaphyssrc2 = 0;# w5 j( n/ [3 F8 A, g$ @
  70. dma_addr_t dmaphysdest1 = 0;
    - w9 K" F2 M( v# p  l) O
  71. dma_addr_t dmaphysdest2 = 0;3 ^8 e+ k7 u9 [7 R. R  Y: z1 {
  72. ' T# o; p! p% j. h  r) q
  73. char *dmabufsrc1 = NULL;
    ; j+ ]# s1 R4 K5 [0 C# p
  74. char *dmabufsrc2 = NULL;
    # b. M# f$ a" ?7 B5 e
  75. char *dmabufdest1 = NULL;& S9 K( \. Z5 ]9 j% D
  76. char *dmabufdest2 = NULL;8 L- g% P$ x( e( L, K
  77. & Z1 {  Z/ z* i; j8 j
  78. static int acnt = 512;" j9 ^( Q/ Q, s* @# s
  79. static int bcnt = 8;
    ' a/ P% M' d- e
  80. static int ccnt = 8;* v8 e8 Q* K3 p0 i
  81. 5 m6 ~6 u$ r: ^7 \& O: K- _$ T
  82. module_param(acnt, int, S_IRUGO);9 F' I$ G3 t$ w  u7 P+ }
  83. module_param(bcnt, int, S_IRUGO);
    & u* P. _. B7 K% f! ~5 ?0 @$ R
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! Y. M3 O! |1 v/ G. j$ u7 D* l( q# Z7 a
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& [4 s% Z4 Z/ F( f& A; z# x( Barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 d" h7 O$ f& B6 ^2 ?     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# @: W8 _9 O" k1 b9 m
! f7 a, i  m. @: Z" Q1 ^
7 I/ S. d; w4 N! Q3 i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-1 05:20 , Processed in 0.039115 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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