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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! q, ~7 [# @' G. U% H+ D& m
  1. [code]EDMA sample test application* @$ Y# I# H: ^- P9 w; l. _2 ~
  2. /*
    0 q2 k" k! V: y/ q5 R- z9 U8 g# T
  3. * edma_test.c; H; m1 ]" u6 b4 K) l
  4. *
    3 Z3 R4 w2 n) {& h; Q! f7 V6 f. A
  5. * brief  EDMA3 Test Application
    / `. e' K* b' e9 {9 K/ A& Q7 W6 m" C. ~- I
  6. */ P9 F/ E, E6 J5 u. Z: y1 H7 y
  7. *   This file contains EDMA3 Test code.$ g1 _/ F( r' r5 ?' ?
  8. *
    ! ~, ]2 L5 x$ O0 H' c* k
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) _! N+ ^: I  x2 ]- Y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    . M! \6 b/ k) z0 S+ s
  11. *         TO CHANGE.
    8 @+ b9 t- U1 h" N" A
  12. *. {5 T( h, s- g
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    - [2 y" r8 S/ W
  14. *2 z" }5 l# w  e+ |: {/ ]
  15. * This program is free software; you can redistribute it and/or
    : W" X0 o# Z+ W' n9 f3 ?( j3 U7 o) N
  16. * modify it under the terms of the GNU General Public License as  T, o. z* p: W
  17. * published by the Free Software Foundation version 2.2 R$ J6 n5 ~4 @5 r" p0 t7 C
  18. *
    2 j# e: j7 g& s5 V! r# B
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    0 `. C4 m3 G% `8 u0 E
  20. * kind, whether express or implied; without even the implied warranty
    " c% O; T5 z8 S/ _5 I
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ; M( Z* W7 y! [( h  R
  22. * GNU General Public License for more details.
    0 g7 X8 `, c2 g, ^* {1 L0 ?- p& p5 U
  23. */
    # ~5 ~9 D% y) k% m. E) N. g# p

  24. ' a8 g5 n1 p( v7 L0 T
  25. #include <linux/module.h>
    4 W' `0 ~0 Y. ~
  26. #include <linux/init.h>
    6 l  F# {# J  [
  27. #include <linux/errno.h>
    + E. ]* l% y- x  Z8 K
  28. #include <linux/types.h>
    * q9 I; ?6 i& @! U
  29. #include <linux/interrupt.h>
    $ [4 q, i% X+ a9 }
  30. #include <asm/io.h>
    6 v; \5 Z$ n4 K$ I  C* p
  31. #include <linux/moduleparam.h>2 ?  l4 N* _, z/ H. [3 H
  32. #include <linux/sysctl.h>
    ) M" N: ^: ?+ p, O
  33. #include <linux/mm.h>3 ?4 l- t. M6 R. |6 z7 P' t7 z
  34. #include <linux/dma-mapping.h>. m! v' z! X  R) E" I$ X

  35. ! r  s& i& k! @) ?7 K' W( x2 g
  36. #include <mach/memory.h>
    : X( _: R& j  V1 I! ?' o$ x
  37. #include <mach/hardware.h>
    ) w( j7 I/ H7 n6 N. j' G0 u  L
  38. #include <mach/irqs.h>$ m6 n/ y" j9 q* A8 a0 u# R4 V
  39. #include <asm/hardware/edma.h>, T% \; j! T- r* R# J
  40. " H: k+ o. l5 x" o
  41. #undef EDMA3_DEBUG4 a4 S/ j/ M: T7 C* n
  42. /*#define EDMA3_DEBUG*/- e  E7 ]. q& ^" Y' ?: R: F" Q7 j

  43. ; Z- I! |* d- [; F9 |$ N4 f* a- t  l
  44. #ifdef EDMA3_DEBUG
    2 D# P( Y" R6 L4 N* S% p* D
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 C- U/ p* j8 p' e: E) [3 r
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    1 Y% h+ t" \1 P' s6 W
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- B% J0 r$ g2 h9 w0 h4 }$ g! M
  48. #else& s0 \" o0 d/ a1 s' Y( e/ J* V
  49. #define DMA_PRINTK( x... )5 U  X9 N1 m: @' t
  50. #define DMA_FN_IN
    ; }# f& U' p; G/ `
  51. #define DMA_FN_OUT
    7 D; n; y$ i! J: D% R
  52. #endif- y) d; k! U4 m$ P* G* L' K

  53. % ^. g  j# H; Y7 {( j" j# K1 i
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    * `- l- j6 E1 |* y$ B- f
  55. #define STATIC_SHIFT                3
    ( }) p( v& O5 a# {$ L3 Z0 E
  56. #define TCINTEN_SHIFT               20) k. X" k" I# E/ B3 x% ]* k2 M0 G
  57. #define ITCINTEN_SHIFT              21
    . Q1 A* d2 C- Z- K
  58. #define TCCHEN_SHIFT                22
    ' f8 _( |* d9 y9 }4 a
  59. #define ITCCHEN_SHIFT               23
    . T$ i' z) D( ]( j1 J

  60. ! C& u7 d+ g; ], v
  61. static volatile int irqraised1 = 0;
    3 M& L! j; I. @2 c2 o
  62. static volatile int irqraised2 = 0;
    9 N  j% i& C. J3 `1 {. d
  63. , H( _* j! k  g
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * W9 z& }6 x& f- u0 O& b: Z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : @  T5 X! E  y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ h0 m3 W! U1 p  Y8 e
  67. 7 h7 k! B  ~, r% a1 p/ M
  68. dma_addr_t dmaphyssrc1 = 0;
    - i. }, [5 Z2 g1 P  ~
  69. dma_addr_t dmaphyssrc2 = 0;
    + g6 O" i5 e) q& R
  70. dma_addr_t dmaphysdest1 = 0;
    1 r/ U+ O& j( C
  71. dma_addr_t dmaphysdest2 = 0;
    ; C; F5 F. N5 a+ ^
  72. 1 V" L( ?6 ^7 \6 O
  73. char *dmabufsrc1 = NULL;4 L1 k: s' ?* _6 E2 k* d
  74. char *dmabufsrc2 = NULL;
    / A: l1 _2 `0 r5 Y& P. i) |2 ^
  75. char *dmabufdest1 = NULL;
    2 ~$ m' I( @3 D. Z5 C, h) U5 ^
  76. char *dmabufdest2 = NULL;
    " F, d8 D' O* X5 m* O

  77. . ~$ j/ r7 {4 X) ]3 D
  78. static int acnt = 512;; p: K1 M- X) z) n' I0 \1 B# X
  79. static int bcnt = 8;3 X! X) [! p) E: R$ A% u+ d. s
  80. static int ccnt = 8;* Z* ]9 D- i- a
  81.   f* J& g1 I* ~' K( \
  82. module_param(acnt, int, S_IRUGO);
    ' W  w- A2 b- `
  83. module_param(bcnt, int, S_IRUGO);6 F$ V. D, T  B  _' c# N
  84. module_param(ccnt, int, S_IRUGO);
复制代码

. Y1 N: K( X, \  ^. ~5 }" j3 F+ o8 H1 X  p  `9 W8 [
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' b7 u5 g6 B. Z, i
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 ^' K0 i* @/ L, M3 a     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ f0 Y' @4 w8 x% I5 S
5 c$ }8 q. f: r5 A& U( a

% r% f! X! _- Q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-5 02:20 , Processed in 0.039301 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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