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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " F9 ?# h: F9 W% o( J
  1. [code]EDMA sample test application
    4 Q7 f, E0 V7 q0 o, F8 U
  2. /*) S; Y5 o; x5 |- I% I
  3. * edma_test.c9 e5 I! c0 `9 @% u
  4. *& Z" R8 o8 }6 D% j" ]3 Q
  5. * brief  EDMA3 Test Application
    4 r. p& J- _+ ^& f
  6. *1 S  u0 {5 j0 A1 m
  7. *   This file contains EDMA3 Test code.' {* R1 a( u" S, j5 D
  8. *
    " C! H" B) J( t" p9 @
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      y" `+ @! f  w  k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    9 f! U/ Z  O% C2 O4 `: N2 z
  11. *         TO CHANGE.
    2 m. h" z# G( o
  12. *
    3 P8 T+ m1 B3 N5 F
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    6 ~3 K4 x' P1 @1 M, ]
  14. *! g3 ?5 t( z" q
  15. * This program is free software; you can redistribute it and/or( G" B) T  e0 p+ r' a
  16. * modify it under the terms of the GNU General Public License as3 r5 M6 l1 O( @4 ?
  17. * published by the Free Software Foundation version 2.# X+ @8 `6 Z) f
  18. *+ r6 d- r& i' g
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - m1 U5 B+ s7 [: t
  20. * kind, whether express or implied; without even the implied warranty
    ( u& W$ J' d, b. z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    " t9 r& T- A3 }2 f, g. W# a
  22. * GNU General Public License for more details.
    6 ]  b* H" A2 M# k, U1 X3 i
  23. */+ k, `- c; }( c0 g% _: Q
  24. 4 [. N$ x5 m& |; ^
  25. #include <linux/module.h>& [/ z9 c& w3 q" f5 Q' |/ ]$ X
  26. #include <linux/init.h>
    # ?/ B& ?) e3 N* I
  27. #include <linux/errno.h>( I/ G  R. M7 t$ d
  28. #include <linux/types.h>  k. T' p: L" c- E9 n/ `" b: W
  29. #include <linux/interrupt.h>
    % s4 X% e4 p2 z# C3 N# w! {$ N
  30. #include <asm/io.h>+ X* O5 b- ~0 H
  31. #include <linux/moduleparam.h>
    1 p6 }+ e, }2 ?, m! R
  32. #include <linux/sysctl.h>5 h7 U& o" g' s# j
  33. #include <linux/mm.h>& s- X( {' m& W5 c6 [
  34. #include <linux/dma-mapping.h>3 L5 z1 S$ ]& Y7 j

  35. + ]# F9 [- H3 c7 d, d3 _
  36. #include <mach/memory.h>) {) m/ t9 Q3 x. z+ |+ v7 ~7 R
  37. #include <mach/hardware.h>3 V* {0 t9 ?+ n0 `
  38. #include <mach/irqs.h>5 @7 Z0 K* g0 _2 i: @. V  u9 _
  39. #include <asm/hardware/edma.h>! E- z& D/ h6 o( B5 D

  40. " s0 R8 _, k; P( g2 T8 j$ z$ K
  41. #undef EDMA3_DEBUG) O8 N/ B2 _1 {% v7 ~  X8 g
  42. /*#define EDMA3_DEBUG*/
    - }$ i- s8 H6 f9 G4 P; ~

  43. 9 u7 i7 A: W* ]. ]; e5 O
  44. #ifdef EDMA3_DEBUG. Z8 y+ \/ D$ ~( K& U* b* [
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 D& Q5 T% s) ^0 r
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & `1 R& |4 Q/ z  c, I: |  J* h# D
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    / e5 u2 @& ~- e3 n
  48. #else/ w4 A$ g: |. T; S
  49. #define DMA_PRINTK( x... )
    9 ?. [0 O- L! h8 C
  50. #define DMA_FN_IN$ }, q* Y1 J6 u% K2 P
  51. #define DMA_FN_OUT0 N' @: T3 f5 @- U
  52. #endif+ i, O% N2 z- o# E% L/ N4 S
  53. ' V- l4 `  H% a
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    % ?9 v  h5 O; |: `; c$ h, u6 I
  55. #define STATIC_SHIFT                34 u4 ?/ g5 `0 u: }2 s
  56. #define TCINTEN_SHIFT               20& l7 b5 b9 p. O9 L
  57. #define ITCINTEN_SHIFT              213 n1 }) A3 J* k6 S! q! P
  58. #define TCCHEN_SHIFT                22. P1 J8 i: A) p% E" X4 ?  v
  59. #define ITCCHEN_SHIFT               233 S/ O. }3 R3 P1 u+ d2 K

  60. . ]7 h( b+ S0 v
  61. static volatile int irqraised1 = 0;  ?* S8 B4 T% W/ V/ n/ \% b
  62. static volatile int irqraised2 = 0;/ P* h/ J. j6 e

  63. 6 T' M' B' [  [3 A& X" }, t( }5 }* x% I
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( _3 E' y( l4 ~# {- f7 J! ~$ ?3 P/ L
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. q: T; T) _' i  |1 u1 V$ w1 |4 d
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 }9 s+ F* r$ W) @% T/ F
  67. / U2 e5 Y# L; U( u# f. G
  68. dma_addr_t dmaphyssrc1 = 0;
    + i. f9 x) @& Z
  69. dma_addr_t dmaphyssrc2 = 0;
    . s0 \7 w3 a! c8 i
  70. dma_addr_t dmaphysdest1 = 0;
    4 C- }- z7 D. }- J; C# T# y2 r- ]9 J! X5 j
  71. dma_addr_t dmaphysdest2 = 0;% F% K6 L6 P5 e9 w1 ^% F

  72. ' t" h2 K. c$ \1 g
  73. char *dmabufsrc1 = NULL;
    2 P( Q5 X# V3 w# B( q4 x% s
  74. char *dmabufsrc2 = NULL;' S+ r- |: T2 v) n: o( |
  75. char *dmabufdest1 = NULL;
    7 [# T" o9 n5 r8 _6 Z
  76. char *dmabufdest2 = NULL;
    & [* U0 O# [; ]
  77. % U1 Z0 |0 I; r" h. g
  78. static int acnt = 512;
    0 j6 C' l: Y9 {0 A; n
  79. static int bcnt = 8;
    / Z/ w3 S9 o! {" H+ `
  80. static int ccnt = 8;, `/ X$ q, J2 m5 R0 |: W
  81. 9 v" `; v' E$ u2 m& [: P
  82. module_param(acnt, int, S_IRUGO);
    7 B1 s5 Q) q" Q6 K" \6 V3 R1 g6 P
  83. module_param(bcnt, int, S_IRUGO);
    3 t" c3 U( a  Q& P) L
  84. module_param(ccnt, int, S_IRUGO);
复制代码

2 @; H2 R3 N* i5 q+ q8 e' H+ E) v& V! W) J0 C
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! L' {. F" Y, [8 w% u! zarm-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 F/ _1 L, M2 o4 j8 x     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ `* e( i0 r: V$ }5 \5 t% J3 @6 L; D2 R0 E$ i! e& I
$ x! o# _" E) G
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-4 17:20 , Processed in 0.039044 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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