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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; A1 V6 d* v/ p3 R' F5 g' C. l. y# _
  1. [code]EDMA sample test application
    - h7 ]7 R$ w0 v' B/ Z2 h1 E. a& P
  2. /*  S! N1 B- a( K1 x
  3. * edma_test.c
    9 X* r1 I3 M$ @  z- ]$ R
  4. *
    ; R, \1 o! M8 I; C- {$ ~( S7 S
  5. * brief  EDMA3 Test Application
    ! \, A  K5 K$ ~1 Q
  6. *8 L6 Y1 H9 Z  R& c9 n# b* X' y
  7. *   This file contains EDMA3 Test code.6 o! ?$ b0 f. C, r
  8. *
    5 ]4 p& W  e8 v, @/ w$ p0 c4 S
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. [1 p2 U$ a% |+ N6 c8 o% q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; R, `5 w4 M" z# g
  11. *         TO CHANGE.  x& Z! ~4 ]. L" _2 H3 @
  12. *5 H1 I, Q4 q; ^- L" }+ H
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# ]9 A( i* d# d$ G! S2 U: R: o: C
  14. *: h- `6 K) ~1 m5 }
  15. * This program is free software; you can redistribute it and/or
    ( W/ S6 e% b, n8 v* B) S( D/ y- Z
  16. * modify it under the terms of the GNU General Public License as
    ) L- W# _$ P9 L7 w0 @* |2 m
  17. * published by the Free Software Foundation version 2.$ c% i: f1 P  v! T; j
  18. *
      U9 O) T, Z. l# v7 ~& [, u
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 e$ B& g2 P& ?* b
  20. * kind, whether express or implied; without even the implied warranty
    , E0 _( X4 F8 v) w
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    , v& x+ C+ k3 e! A( c, }( G
  22. * GNU General Public License for more details.4 t: G. d1 Z8 o" Q$ S2 a
  23. */
    4 T- z$ w6 j/ y; B" Y7 C) w
  24. & H2 R" w) v+ i, r
  25. #include <linux/module.h>
    9 \2 ~( ~( h) D
  26. #include <linux/init.h>. Z  ^$ u' z! l8 y' Q
  27. #include <linux/errno.h>
    5 v5 V: |/ [. R  H( M+ q6 A
  28. #include <linux/types.h>
    6 v( R' [7 e- X% J% m& j( j
  29. #include <linux/interrupt.h>- b# Q/ N" n" L5 A, C. b
  30. #include <asm/io.h>/ v+ N+ G) r. F% U. q/ i# O0 C# h
  31. #include <linux/moduleparam.h>$ y" h: V* H9 s& J& U  `
  32. #include <linux/sysctl.h>
    % z) l" M1 @& \, n
  33. #include <linux/mm.h>
    " r; k4 B( s1 L0 |
  34. #include <linux/dma-mapping.h>
    & ^2 V. G% J- p; x& l
  35. : ?  f. E8 c+ ?. ^; O' \% q) }
  36. #include <mach/memory.h>
    $ P+ u4 r( a) d& \( Z5 @2 o
  37. #include <mach/hardware.h>) V' X8 ^" K" O! K6 S
  38. #include <mach/irqs.h>) O( k& F& T8 `# D$ B9 p2 l: L" w
  39. #include <asm/hardware/edma.h>
    8 J$ r; O  W' I$ }
  40. 4 V4 b$ V% |; k% W! C& h- v
  41. #undef EDMA3_DEBUG
    " m3 o& R6 O0 R, k/ G# S% w
  42. /*#define EDMA3_DEBUG*/" j' h2 c; |! {. M, Y: @

  43. + }9 N# m3 j% z2 |9 l
  44. #ifdef EDMA3_DEBUG1 O6 {2 S9 i: |- _
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 ]' Y, Y! x' ^5 |, [" l
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! r9 Q7 j* J% U) G' w) j
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). I- [3 U+ ~) k" I
  48. #else
    # W# t1 A* M- M; R1 E
  49. #define DMA_PRINTK( x... )* T! M' d6 Z) K9 k8 H/ r8 K1 ]' J4 ?
  50. #define DMA_FN_IN
    ) P" y! e2 Q5 V/ L) ?: l9 t/ {) i7 }
  51. #define DMA_FN_OUT. [1 n8 _* \, D
  52. #endif, F, b  r/ Z/ s, n% o  i9 x( h# Y
  53. % o" |7 B; T5 B0 M' Z7 c- o
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): g+ V0 H% q$ s$ i& U
  55. #define STATIC_SHIFT                3
    6 h$ `! I1 R" i0 @9 I. }5 B
  56. #define TCINTEN_SHIFT               20$ b) @6 Z. p. ^$ p
  57. #define ITCINTEN_SHIFT              21+ _" P. t' L8 f' ~$ b3 j$ A
  58. #define TCCHEN_SHIFT                22- e; K. \- Q3 X; E. {# K
  59. #define ITCCHEN_SHIFT               23
    % ^: w; Z" G. A" `. o' W: H5 E
  60. ! t# x9 ]7 Q* W; ~. c% b
  61. static volatile int irqraised1 = 0;
    7 z% O. N$ J$ K& O+ n8 a
  62. static volatile int irqraised2 = 0;
    9 W" Y5 q3 g: k' ?

  63. & i3 E2 ], o( U, B. a! d
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % T# h0 o7 i& A$ Y4 I$ b
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - j, ^- V9 j  ]
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 }8 a" `$ I1 X* T
  67. ( Y( T& m0 X1 d. t( g4 v
  68. dma_addr_t dmaphyssrc1 = 0;& f2 L5 d- y2 L" a$ J: L0 Y, j
  69. dma_addr_t dmaphyssrc2 = 0;
    : x, S4 T0 [  s& C( E$ P
  70. dma_addr_t dmaphysdest1 = 0;5 S3 P6 E2 {2 ]; ^/ [
  71. dma_addr_t dmaphysdest2 = 0;5 l: v& k, A" x+ H. I
  72.   s2 p. K8 ?5 N2 Y. o
  73. char *dmabufsrc1 = NULL;; [7 B7 \- d5 O8 N
  74. char *dmabufsrc2 = NULL;: {. I: h! ]* {/ ?: C" a
  75. char *dmabufdest1 = NULL;3 @0 S2 I  X# H- H, _0 K) ]* }5 G
  76. char *dmabufdest2 = NULL;
    + Q" I$ C" J5 A

  77.   ]2 P+ u2 G; F' s$ T3 C% r/ n0 l$ M
  78. static int acnt = 512;: c) B5 U$ @* r
  79. static int bcnt = 8;* Z4 S! \2 P& V; S8 s
  80. static int ccnt = 8;: o$ O4 ~2 f: D. `% Z
  81. 5 {' \8 `( d/ s, a" P6 l
  82. module_param(acnt, int, S_IRUGO);/ k1 q7 x/ k% X3 E/ E6 N& R
  83. module_param(bcnt, int, S_IRUGO);
    5 n; a& t7 B$ Q6 {0 }) f& V0 s
  84. module_param(ccnt, int, S_IRUGO);
复制代码
+ U5 B& G: m+ c( z0 T* F7 h# t0 P. ]# e. j: f
! O+ y* C: u! J
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ C4 l* B: i+ Z) Earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 Z1 u* O' R0 j' y
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% n) H. S" l) O. @
9 H0 y# U) H9 Y: ?" a: ]% [0 ?* l; `! V# i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-13 21:54 , Processed in 0.040260 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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