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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 T& A( e; t. m  w  Z+ x
  1. [code]EDMA sample test application  Z7 Q- \4 b" W' d- U' c, n1 k
  2. /*
      A. x0 K% z! o! J' b
  3. * edma_test.c0 N- U. J. K3 v
  4. *$ i6 F/ U0 J( f2 d# g" X2 N
  5. * brief  EDMA3 Test Application2 w0 Q/ K7 R6 q3 P
  6. *
    ( Z. U" x4 w( g1 U" i, t
  7. *   This file contains EDMA3 Test code.
    # R: u9 d" D! N/ C4 x6 z
  8. *
    ' i. [) G5 S0 X
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * H3 }- R8 [+ Q* S
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 [  Z1 w* C" w; `
  11. *         TO CHANGE.
      m2 ^/ u3 a: x* X  \
  12. *3 \2 z3 d+ U& R" R
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 ?3 t, L# Q% O; y6 M
  14. *
    + |! g* r6 z. Z0 Z! |
  15. * This program is free software; you can redistribute it and/or
    % \3 m/ p) ?* C  u! w
  16. * modify it under the terms of the GNU General Public License as0 t* Q: u, P1 X, a3 D
  17. * published by the Free Software Foundation version 2.( f; I; b" W& J) ^1 m
  18. *$ d" T% [8 v4 O: v" D5 c8 z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    % K) P2 g" w) [
  20. * kind, whether express or implied; without even the implied warranty
    % p8 d" p1 m, T/ r" ]
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the9 b  L" g) F* G) W+ c- N
  22. * GNU General Public License for more details.* L+ j7 x( E/ K, R
  23. */
    ! h6 g2 _  I5 P7 S% S; Q

  24. # W* {( g; T; w. {- F6 C
  25. #include <linux/module.h>
    5 ]* _  }4 Z0 \# n# t& }" P
  26. #include <linux/init.h>
    & a7 H- M' O8 |6 G. l
  27. #include <linux/errno.h>; ~3 x- }5 r/ L5 f, ^
  28. #include <linux/types.h>
    6 E+ x- k+ s# [( ?8 H$ D
  29. #include <linux/interrupt.h>2 Y" ?4 A# H- i
  30. #include <asm/io.h>6 X5 C: s; |& O
  31. #include <linux/moduleparam.h>' }- S* O! j- i3 y! q
  32. #include <linux/sysctl.h>
    3 p& P* A0 v( X2 ]* J0 f1 I( ]
  33. #include <linux/mm.h>
    . n$ p8 ]5 `% d9 O# x4 q
  34. #include <linux/dma-mapping.h>  I" u& s$ ~) C+ Y' C5 ^

  35. # D8 R. U. E( z6 O  H
  36. #include <mach/memory.h>: [  o. V" s! V% F
  37. #include <mach/hardware.h>
    ! f* f- q2 g6 I5 c2 M9 b3 a
  38. #include <mach/irqs.h>4 W& V' ^" c2 l# M7 }. S# g* ~, t, @! |
  39. #include <asm/hardware/edma.h>
    " c7 z" R; t2 C" |) T; j6 k0 i. t2 {0 o

  40. 6 R  z7 W$ q5 ]2 ^3 _2 d
  41. #undef EDMA3_DEBUG+ Z( h8 I* ?" a% N: A2 V
  42. /*#define EDMA3_DEBUG*/- J: L: e6 E9 v5 E
  43. + Y0 Y1 R9 J' T3 S3 l2 t) ~
  44. #ifdef EDMA3_DEBUG. f4 g  a; \' w! p/ i; S; I
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! D8 W7 Y, E% q) g/ r: Q( k
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ J# l/ E  E% Z- Z+ B0 a" W" [: J  _
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , S% f4 |) g& W" v
  48. #else0 y) M5 U3 r# p% i! S& O
  49. #define DMA_PRINTK( x... )
    ! E0 ]% i- t" ?! i8 w  M. [" c
  50. #define DMA_FN_IN
    5 h6 a; r+ c/ I$ e
  51. #define DMA_FN_OUT3 u) j0 z/ `* X( O. V  T
  52. #endif+ P" ^! }$ Z  W( l1 u2 U$ ]1 D
  53. # \4 U6 c1 ^& q" y, |, ]9 |
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ! }1 K9 U! J( W0 r
  55. #define STATIC_SHIFT                3: n  D& D/ ^6 Z( Q; A6 @
  56. #define TCINTEN_SHIFT               20
    9 o& E) L" Z2 L' g2 f+ `# `8 D* I
  57. #define ITCINTEN_SHIFT              21. I4 `* z+ h1 T9 ?+ U# e
  58. #define TCCHEN_SHIFT                22
    " k, @* b; [9 _( c
  59. #define ITCCHEN_SHIFT               23
    $ x5 w# a& q- c5 D. ~$ g! Y
  60. 3 M# h3 `* x- s/ Z" O- {% Y8 f
  61. static volatile int irqraised1 = 0;
    # B8 K# f  F% w% R2 Q
  62. static volatile int irqraised2 = 0;1 P9 C4 C: R  r0 Y" v7 @7 m& z
  63. ) \  b& |% B( O* I- S# I. b8 K$ c" t
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) X$ u: H# @- {
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / U" Q( e; }2 \8 h4 \& G! r
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, r+ W  l% m+ U7 w
  67. . j  q! I8 p! k
  68. dma_addr_t dmaphyssrc1 = 0;
    , A7 [' O6 C( {6 e* _6 ~! R7 M
  69. dma_addr_t dmaphyssrc2 = 0;: ~, }2 I# s# [
  70. dma_addr_t dmaphysdest1 = 0;
    8 [9 Q# u9 X8 |9 R+ G8 H
  71. dma_addr_t dmaphysdest2 = 0;
    8 S$ C  }) {5 e$ P

  72. 0 Y, o% |% j& a; J+ m
  73. char *dmabufsrc1 = NULL;9 `8 w, E0 M" E
  74. char *dmabufsrc2 = NULL;% @" Y, `' o/ D8 _
  75. char *dmabufdest1 = NULL;3 S4 N' Y; n0 ?- I8 N
  76. char *dmabufdest2 = NULL;3 W' l. \' d9 D# t# q+ n$ [

  77. 1 K. J/ i$ u+ ]( b, a0 y
  78. static int acnt = 512;4 S1 t: n+ Q" l) L0 Z; ]3 N6 S
  79. static int bcnt = 8;. b$ Y9 C, ~, U/ _9 N/ Q
  80. static int ccnt = 8;
    ( w: n& v6 m) a

  81. ) I: ~: @' w. V% Z) o/ S5 l) d3 Q
  82. module_param(acnt, int, S_IRUGO);; x5 O6 o* V* T* h
  83. module_param(bcnt, int, S_IRUGO);) J+ o$ n) v3 T% P0 t# N* }
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  Z2 z' F, J/ m0 o4 L6 T
: j! {1 S. m, B2 Z1 n# ]; N7 U      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) F9 O# M9 i' K+ i6 a3 O) darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 b+ s9 j- ~$ m3 y' S
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 l! v% R9 a3 [% r6 e" o8 a
2 ?2 c7 C0 u) z( v1 v1 {+ C

! z4 D! l2 s2 e6 ~, K0 G/ L
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-9 04:59 , Processed in 0.039485 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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