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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - o, \* c8 K4 k; @
  1. [code]EDMA sample test application1 n/ G, {) w9 C, b( S/ U# t
  2. /*
    9 y$ J% `: k" ]6 P' K* b
  3. * edma_test.c
    4 v' @" E8 z0 ?" \5 z
  4. *
    $ s0 K$ f& b7 {- @' G- S- L
  5. * brief  EDMA3 Test Application8 d+ t( Q0 N( ?
  6. *
    0 K- {6 ~% J; \7 N5 h* u
  7. *   This file contains EDMA3 Test code./ e0 C0 b! R4 d; M0 y- Z# t8 w- _/ d$ S
  8. *5 v, K; S' ?. A& P0 [7 J/ ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 V1 S! b2 {/ V: [
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    9 B% o; R  z5 e: `
  11. *         TO CHANGE." v/ l" x$ h% j3 D" B! s7 R
  12. *1 A& ^! w, e* e3 U" W, v
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ e7 L5 v" N( t0 Z
  14. *5 D1 |. r5 m$ _0 _7 q3 v
  15. * This program is free software; you can redistribute it and/or/ T8 P0 X3 K3 z8 Y2 E4 q  }+ L
  16. * modify it under the terms of the GNU General Public License as
    4 C; M% m. e4 S5 s$ K' J
  17. * published by the Free Software Foundation version 2.
    - D+ b+ z4 c; l" P
  18. *
    0 V  n' k/ s0 b& ]( G7 O
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 e( `' {5 a' l9 a
  20. * kind, whether express or implied; without even the implied warranty* Y2 F& K, F! O2 r& s( M7 x2 @/ Z9 R" @- V
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the" c2 j5 L. H! g- h- C! }5 s8 l) ^
  22. * GNU General Public License for more details.8 h/ H. V' s; d( `
  23. */& c* h/ c7 r: B' s6 ~4 z

  24. 7 n% H7 i) y3 Y! ]
  25. #include <linux/module.h>% F/ {. m( q2 l. F" c3 H
  26. #include <linux/init.h>
    8 O# Y, S; u; I% i% ~* r; y
  27. #include <linux/errno.h>; h7 W$ u9 q( I* T$ T0 J: p
  28. #include <linux/types.h>
    / S( f" U; N% @3 z7 C4 w! o
  29. #include <linux/interrupt.h>  S6 \2 R1 s) X0 _* N
  30. #include <asm/io.h>
      v# L1 c' T" \2 ?9 a
  31. #include <linux/moduleparam.h>( e" }1 E( i* Z4 V
  32. #include <linux/sysctl.h>8 [: O! t& G8 x4 o# M) j7 m
  33. #include <linux/mm.h>
    . Z3 i9 P9 X- N, c% t
  34. #include <linux/dma-mapping.h>
    / N1 A: Y6 Z" q. P  A! `8 s3 g

  35. ) L( F" I6 Q% R. `
  36. #include <mach/memory.h>  V. ^, |. J+ ^( R. G% U2 e2 l
  37. #include <mach/hardware.h>& `) {. K4 P2 t( z6 ]$ I6 U( ^1 o
  38. #include <mach/irqs.h>
    & }- c5 V# j# k  p2 q3 H
  39. #include <asm/hardware/edma.h>
    5 M) L5 p8 m6 H' q) Y
  40.   V4 Z9 G  U+ B3 ?
  41. #undef EDMA3_DEBUG! x9 z/ U% D% ^7 o8 K
  42. /*#define EDMA3_DEBUG*/2 f" l& m5 A. l6 G' o( T
  43. ; s) }8 J; P- o' X
  44. #ifdef EDMA3_DEBUG
    / _9 t$ x. J* I
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 S: J9 y4 g! b# f* ~; P
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 j1 m) _- L) W+ b$ K
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" S$ Q4 }* A( O: H5 Z
  48. #else
    2 B# m+ M4 x9 v
  49. #define DMA_PRINTK( x... )
    0 W- F8 x7 g0 V; j
  50. #define DMA_FN_IN
    : X% |  @* g. P/ d: N( _0 v4 P
  51. #define DMA_FN_OUT
    " [' S8 H- Q  {" G7 _( S2 A
  52. #endif% z8 P0 N) W/ J
  53. 4 M& m1 n6 ^' q" Q9 x$ Q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 H  m0 ^/ [% c& F
  55. #define STATIC_SHIFT                3
    * X: @/ G; o8 S- R; I9 ^
  56. #define TCINTEN_SHIFT               20
    $ L0 b! V% j3 H- K' T+ s  i$ s: D
  57. #define ITCINTEN_SHIFT              21- Q7 f' p3 ^6 l- j2 h) \4 I& T
  58. #define TCCHEN_SHIFT                22, A0 h7 D+ S  ?: w7 @0 W# s
  59. #define ITCCHEN_SHIFT               23
      M# u5 h2 I$ X8 P2 ]$ T

  60. 4 g' ?' J, R& U. _' I
  61. static volatile int irqraised1 = 0;
    , Q" ^+ s7 z- T, y4 ^: C
  62. static volatile int irqraised2 = 0;
    7 U* S: T$ ]$ C
  63. + H- w) G  j; M. n
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - ^: c+ h0 S4 |+ M! z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 J9 ?( E" o3 ]& Z% g
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 p' e  g7 l) d, m" \
  67. . m9 Q( D/ E  X- l9 Y
  68. dma_addr_t dmaphyssrc1 = 0;. J& `3 v6 Q$ H
  69. dma_addr_t dmaphyssrc2 = 0;
    ( S8 g& u# o; U' i. s
  70. dma_addr_t dmaphysdest1 = 0;# g2 B& a- L) [1 ^! x) }1 ^1 Y( O
  71. dma_addr_t dmaphysdest2 = 0;; q0 W* _- d2 v7 G
  72.   {6 s, z% m" v3 a2 k
  73. char *dmabufsrc1 = NULL;
    , J! \3 g$ m5 Y
  74. char *dmabufsrc2 = NULL;/ U$ e- l/ a% W! Z
  75. char *dmabufdest1 = NULL;- H0 W0 G  r  I2 Q! M6 }2 N6 `
  76. char *dmabufdest2 = NULL;
    ; R0 e. Q# x6 C* P* l8 m

  77. 7 v- `" R( i0 C" e. C
  78. static int acnt = 512;, R: Q( R- O2 d6 u' A
  79. static int bcnt = 8;
    # Z9 d( N. e8 e( o" {& \
  80. static int ccnt = 8;
    9 M. a6 W2 z) Z/ i4 }1 o2 R+ b+ v

  81. $ J# R- O7 b9 g. m
  82. module_param(acnt, int, S_IRUGO);
    " ~8 S8 |8 g' b* `# j
  83. module_param(bcnt, int, S_IRUGO);4 H6 M; {- R+ g7 H
  84. module_param(ccnt, int, S_IRUGO);
复制代码
' Z! a; r; @# |0 a) U4 B5 f
) j4 D4 ~  w4 `/ o5 I; C0 d
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! r1 k9 I9 S. Z$ f" n* b! Warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( I$ r! D: M' b# |( J
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 ?6 m) Z' c3 h1 _8 @/ @

+ ~! V, F6 V4 U3 W1 f
8 N1 l1 S2 I( p3 `" o
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-5-20 01:43 , Processed in 0.044687 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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