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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + o# b: t' W. \% H' _$ a# m
  1. [code]EDMA sample test application
    ' H6 @% [6 J; ~0 @
  2. /*
    . _1 U$ ?* N  @& u1 g' r1 y
  3. * edma_test.c
    4 d) e7 p4 V* Z! d4 b: b
  4. *( W+ n. p3 p, F( D- `4 y, }5 C! I
  5. * brief  EDMA3 Test Application
    6 `7 O8 l8 E* A% f5 |: F/ P
  6. *+ B( {! q  f' ^  W
  7. *   This file contains EDMA3 Test code.
    3 P/ G$ M* r+ G1 H6 g# c9 a
  8. *) I. s# T: q" e$ ~+ p% Z  A
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# q8 K8 f7 z% S9 a% {2 M; [. l
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( v% N' o( |( w: q2 p( b
  11. *         TO CHANGE.
    / r% F8 u2 i, [4 c
  12. *
    0 i: x. C% n& s( w0 r1 G+ N2 }5 h
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 z/ F6 W% m6 A5 \# y
  14. *) Y% D( k% H8 g2 w
  15. * This program is free software; you can redistribute it and/or
    / ]. X( j: J2 w( F) T7 k: c% k+ ^+ z
  16. * modify it under the terms of the GNU General Public License as' C0 |& W& k2 O( q! N9 z% _- F: ^
  17. * published by the Free Software Foundation version 2.
    ! W6 F, [6 I. r8 j1 o0 ]
  18. *2 M7 K" A% A' _- J! r8 u
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  F8 w* a, ?" ?6 k# @+ c0 \) c
  20. * kind, whether express or implied; without even the implied warranty
    3 z: K8 M2 ~( P" g% K
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      @3 S- b1 `% f1 F, y' @- z
  22. * GNU General Public License for more details.8 H( V" v9 f. r: Z/ _
  23. */! J3 _$ ^5 E; r+ @& c% e
  24. 4 @! U1 w' |$ M2 o6 x+ x5 y
  25. #include <linux/module.h>6 _7 b' _6 ^1 V! ^. L
  26. #include <linux/init.h>8 E. @) j$ S4 A5 o+ u5 b
  27. #include <linux/errno.h>
    . c- f, A2 K) f0 q$ E
  28. #include <linux/types.h>
    9 z. N! A: h9 O  C
  29. #include <linux/interrupt.h>3 j- V( d- K1 g
  30. #include <asm/io.h>
    - ]9 t4 N: N' O) m3 @
  31. #include <linux/moduleparam.h>
    ; ~) V# L( {" x
  32. #include <linux/sysctl.h>
    0 f/ A# O6 ]6 r( h* g, M& v6 z: b
  33. #include <linux/mm.h>$ R2 ^' t9 L3 ^
  34. #include <linux/dma-mapping.h>
    2 f4 g& l3 h4 k& X5 Y4 o! {! d

  35. ( u1 {! R) i+ |8 u9 v4 e8 A" m
  36. #include <mach/memory.h>
    ! W0 W' S1 q. v% ]
  37. #include <mach/hardware.h>1 A& k' v! u) r" h( N+ I
  38. #include <mach/irqs.h>
    5 l' [: F! f3 |
  39. #include <asm/hardware/edma.h>
    % X' }, H9 x( W* L

  40. % i8 p* E6 m+ k/ l! b& `8 Y
  41. #undef EDMA3_DEBUG
    2 [1 P% m5 r! R& |0 P6 K( w( H" g. B
  42. /*#define EDMA3_DEBUG*/
    $ Q( ?/ O* x% i2 S; k+ Y
  43. & d( H1 U+ T% k+ v
  44. #ifdef EDMA3_DEBUG+ q/ h. E" T/ j+ N( ~" K- a
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    : M+ q: p3 n6 o# a0 Q) v
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& p8 S: D1 c9 W- ^' z% ^& T5 w; S  [
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    1 {0 N4 `& W4 P/ i& P5 \: D; |, @
  48. #else
    / F: a0 d/ s9 i
  49. #define DMA_PRINTK( x... )* c8 A* ]- E9 a$ i; h, K1 h3 q0 p
  50. #define DMA_FN_IN& W' w/ V6 H. s$ U( m' `9 p
  51. #define DMA_FN_OUT
    & u/ ?" I+ O0 u
  52. #endif, w* \  r. F7 h  P
  53. 6 f" G* h" a/ i" t; Z* R
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), S& B2 x8 H- e  o* H. N! r
  55. #define STATIC_SHIFT                3
    5 {8 n7 Q% u8 C+ o- h
  56. #define TCINTEN_SHIFT               20
    9 E0 }$ Y. e& ]( v
  57. #define ITCINTEN_SHIFT              219 w1 O) D2 P, _' P
  58. #define TCCHEN_SHIFT                22
    7 W- I6 l, x1 k  E* p
  59. #define ITCCHEN_SHIFT               23
    1 X2 c, n: r% J7 e9 n+ G

  60. 4 R9 O" b* T( G! k- v
  61. static volatile int irqraised1 = 0;6 O; r: V3 Z# z& K' r1 b
  62. static volatile int irqraised2 = 0;
    4 V& _; Y! b. t
  63. ! P' A: n  G/ L
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 `6 p& w& K( p. W7 C0 ~9 n- L3 U+ w" M# `4 r
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - @0 r0 b+ x  R+ m1 K
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # K& }) ^1 f" N5 q& c- e
  67. " |2 [( a( U$ ]: c1 J( q4 L+ W  L
  68. dma_addr_t dmaphyssrc1 = 0;
    8 ?2 X9 B4 l2 [3 H  P" P
  69. dma_addr_t dmaphyssrc2 = 0;" @- m% |. i' N3 ?2 @+ X
  70. dma_addr_t dmaphysdest1 = 0;+ v* z7 M1 J4 \- I" U
  71. dma_addr_t dmaphysdest2 = 0;
    " p. Z! v. M* s1 [

  72. " `4 Y0 t/ k2 w3 z9 R* K6 Y
  73. char *dmabufsrc1 = NULL;
    + q2 r2 [7 n' q# a) q
  74. char *dmabufsrc2 = NULL;
    , E, R# }% E, a( b4 M
  75. char *dmabufdest1 = NULL;
    4 `: K. H! J8 A/ u
  76. char *dmabufdest2 = NULL;& W% x/ l$ S8 S9 c) j$ b* C
  77. 7 W- ?/ B2 \% U; R
  78. static int acnt = 512;- n0 s1 K3 G5 b1 I7 i! a' _) e
  79. static int bcnt = 8;6 m6 m# y8 O1 j( ]; u+ B4 F
  80. static int ccnt = 8;9 x7 E/ i/ _; V  t0 q# ]$ a

  81. # G$ B# G! F) p
  82. module_param(acnt, int, S_IRUGO);
    * b  Z8 i4 U) X. @* @2 m% _
  83. module_param(bcnt, int, S_IRUGO);) A$ J% z" o; @$ x, _
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 {% G6 A) M0 G5 e. y* Z# m
3 k9 L& B6 [0 [& p/ M: Q* c, r6 V. b
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 @# C6 {: k5 p5 t* ~5 l. ?% h8 {+ K
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 x: z+ Y# V0 L2 A! f
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( q# l/ \) h% L6 y

4 f) y) H& D) l
4 ]- ?5 j  J# |/ U
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-4 15:18 , Processed in 0.048878 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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