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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 y" p0 u" A$ C5 }& X+ J
  1. [code]EDMA sample test application+ [* j+ U1 S) U. j' K9 i
  2. /*
    - w0 L* C  C. X; ?! D" N- l
  3. * edma_test.c2 `" U- u- b# R5 R- S' d3 t
  4. *7 ~, r: B& y+ u) x( O! d' n
  5. * brief  EDMA3 Test Application: d( C+ q. G* K  F
  6. *1 V- ]* t+ S8 M6 c3 ], X8 P8 U. G
  7. *   This file contains EDMA3 Test code.' s5 j) k9 p' l1 Q
  8. ** n% |) P/ h3 \% b
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - p# J% ]& Y9 B- U6 x
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. G# x4 ~. }; |' \/ u2 q$ Y# p& o  K
  11. *         TO CHANGE.
    9 g9 N* |, U. _+ X/ x- x
  12. *! W9 @- R; I7 V% m+ t
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 T! `; K% o! q" ^" r* d
  14. *
      e. v, O/ B) Y7 O+ \
  15. * This program is free software; you can redistribute it and/or
    : s- o6 z; u" n5 X
  16. * modify it under the terms of the GNU General Public License as3 k3 m3 x' _8 \0 {! H# @) h
  17. * published by the Free Software Foundation version 2.
    * W& n7 H# _3 g! b/ u
  18. ** Y& h& v& W5 P; @
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    5 x# ?) u9 k- ~7 t
  20. * kind, whether express or implied; without even the implied warranty; n4 H% H- I9 b/ L
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the, [* Q5 M4 Q/ G% Q2 b
  22. * GNU General Public License for more details.  H* {+ ?9 @5 l
  23. */
    5 M, k4 ~2 p. R' B
  24. ) T" y% c2 T. s1 L
  25. #include <linux/module.h>
    . p/ `% O2 ]! G' f1 Z
  26. #include <linux/init.h>: z! Q( C6 c0 D- H! a" t
  27. #include <linux/errno.h>
    ; h9 Z% V+ L; t# z' [
  28. #include <linux/types.h>4 d( \0 o9 R! o8 J2 P6 L* ~
  29. #include <linux/interrupt.h>
      e# z# C5 p6 G, t# c5 U
  30. #include <asm/io.h>9 \  @7 F9 ]: @5 q
  31. #include <linux/moduleparam.h>- {8 w* G. J% O3 p: t* j$ ?
  32. #include <linux/sysctl.h>
    $ N3 @* \- S  a( B3 q% m
  33. #include <linux/mm.h>% y; X; c6 e) G
  34. #include <linux/dma-mapping.h>' w5 {6 @7 Y+ `  o' q1 O
  35. , G4 P1 T- M0 M% }* D
  36. #include <mach/memory.h>  F) }4 G$ N+ O& X& @5 Q- r4 o% o
  37. #include <mach/hardware.h>
    ( s6 M) B! \6 P( u' z& D  F
  38. #include <mach/irqs.h>
    * y3 C0 @- @/ o
  39. #include <asm/hardware/edma.h>
    $ G- U4 A8 T6 M
  40. 6 M1 O4 w: s6 b
  41. #undef EDMA3_DEBUG
    # U& R. ?5 Y0 ^2 V; @
  42. /*#define EDMA3_DEBUG*/3 M' |' p" E8 t) w- M
  43. % ~0 C% y) x4 c$ n$ E
  44. #ifdef EDMA3_DEBUG
    ' W) A# |1 L0 F/ g3 b. \, K+ E, V
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    " V0 N6 J( [+ `- E2 o
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% k8 l$ X! l  ?, Z' b7 y1 e& T: v
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' y- i; e  A& ?
  48. #else
    1 G7 s0 F) L& s  {$ E7 Q
  49. #define DMA_PRINTK( x... )
    4 V7 d* T  \' e# F
  50. #define DMA_FN_IN# P; w0 L  q5 c# f
  51. #define DMA_FN_OUT1 d/ G0 v% R$ @" D4 A. \* Y
  52. #endif
    6 B! p( Q& C7 Y

  53. ) A- ^! p; U0 Z. ?* n
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , e$ H9 z5 R% G
  55. #define STATIC_SHIFT                3
    7 u! z3 C, H, i4 q5 E% R
  56. #define TCINTEN_SHIFT               20
    2 [, y1 X9 A% \% {  H4 [9 y6 m( c. D
  57. #define ITCINTEN_SHIFT              21
    - ^4 L& [6 s6 N' M& w8 j& `
  58. #define TCCHEN_SHIFT                226 ?. D8 B. v- B
  59. #define ITCCHEN_SHIFT               23
    6 i; Q+ l1 N. f
  60. % K5 h1 E/ s  Y! Z
  61. static volatile int irqraised1 = 0;) Y: G5 o" ]( b/ I2 S
  62. static volatile int irqraised2 = 0;
    * h6 ]1 x' b6 Q0 R6 X
  63. 2 N& U" r  w8 L8 N' T, W5 i
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , @) z3 r  B: `: W/ ^7 t" U
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . @8 }  n( L* R6 e( h0 \4 |
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* Y4 Q- o, }4 x, A$ T

  67. $ @5 T" i: i. A; L0 X
  68. dma_addr_t dmaphyssrc1 = 0;6 l& F/ s9 z/ W
  69. dma_addr_t dmaphyssrc2 = 0;
    7 a, c& G, @1 E7 o9 O
  70. dma_addr_t dmaphysdest1 = 0;
    9 @: ~1 B, F  @; h4 G: [* d
  71. dma_addr_t dmaphysdest2 = 0;
    9 J! x8 K+ j0 L1 B% t' d3 k
  72. + {7 U" I- L$ S. D) [8 f
  73. char *dmabufsrc1 = NULL;' |6 z! v/ h5 Y* j
  74. char *dmabufsrc2 = NULL;" t" p# a  P$ `$ m- p, [' E
  75. char *dmabufdest1 = NULL;
    : h: I9 _" {1 L& c  d# d9 t
  76. char *dmabufdest2 = NULL;
    . W9 ~  u) Q/ T) e( y7 ~7 k) u! H; b
  77. 9 z6 f1 |& a# R! g2 ~
  78. static int acnt = 512;
    3 U) [( h" T) e" x% g: R
  79. static int bcnt = 8;0 `4 }% _( e( k7 }, @$ b4 z' h
  80. static int ccnt = 8;
    9 r6 M8 _" n( u/ g9 n8 p
  81. ' a" b% E5 P* @' B' Z. p' i
  82. module_param(acnt, int, S_IRUGO);
    ' u. o3 H# @2 S! k
  83. module_param(bcnt, int, S_IRUGO);; v7 d9 j+ b7 ~5 y$ B/ x1 [+ O
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 [) E  X4 ?* \7 _4 d& \9 D
& i1 L$ e& F0 U5 a; w! q; ~+ t      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 ]6 {+ e5 j9 q9 s% w$ r( B/ V. I  s
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' X$ `+ U  }$ `- O
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' z, a$ f& `- p' R( p5 I. I
9 }. r7 k7 G' t) F/ b: `4 a$ ]5 X; p: `5 N
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-8 19:05 , Processed in 0.044754 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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