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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : }# w9 B+ ^# v5 t! M( L
  1. [code]EDMA sample test application
    & X' {* n  o' }: ~3 b) Z% R
  2. /*7 G0 q+ {' H  n3 U. p. `1 o/ v
  3. * edma_test.c& o5 v* O5 m0 ^8 A4 ?& H: F- l" O
  4. *9 ~  n- E+ z2 A/ Z
  5. * brief  EDMA3 Test Application
    ) U8 t; B6 |" ?9 k$ ]/ e% T; B
  6. *" l2 I8 f5 ~8 s4 y3 ?& M6 u
  7. *   This file contains EDMA3 Test code.
    4 }# l) l' o9 t. M$ [
  8. *7 b: m+ [+ e4 ?3 s" i4 Y& x
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 F% a1 A4 D& C" {/ \4 _9 h
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    # ~, E$ f+ b- d9 {
  11. *         TO CHANGE.2 J; O8 W7 Q/ G4 q% ^
  12. *
    8 f5 x; G) h6 m  v9 \! j
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 T3 P0 F' z3 {" }  b
  14. *, T; o7 f. J" b0 e: G! b6 Q
  15. * This program is free software; you can redistribute it and/or  y2 G) i: \1 @$ B  U3 A
  16. * modify it under the terms of the GNU General Public License as
    1 Y+ B2 Z7 N$ z& p( {; {
  17. * published by the Free Software Foundation version 2.
    % n6 \4 [4 S0 v7 z* r
  18. *
    & T: y+ k% s- x$ L4 r  D
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ' C: B3 W1 q7 K  M1 u$ _
  20. * kind, whether express or implied; without even the implied warranty8 e6 u% Z1 I9 ?3 m4 E- K: ^
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the& C0 u- }1 ^, v
  22. * GNU General Public License for more details.! l; }& N8 ^% G2 w* g* j& B
  23. */2 A9 O3 t! @# a% ]* K1 s) X. Q

  24. 3 u" b! f  V. Z
  25. #include <linux/module.h>
    5 \. V# U* H5 c8 P# P
  26. #include <linux/init.h>/ q5 o/ P# E/ _4 s( P1 m! z
  27. #include <linux/errno.h>
    ) x- o  {+ Y+ I$ ?- q
  28. #include <linux/types.h>; A  e1 @- y5 O& `
  29. #include <linux/interrupt.h># ~. f6 r. T. }
  30. #include <asm/io.h>. i( E. f; l( T: D0 v% h5 }1 F
  31. #include <linux/moduleparam.h>
      S  s, h% {% b; C
  32. #include <linux/sysctl.h>+ I7 z7 d2 e- g( _# ]
  33. #include <linux/mm.h>- }- n7 T9 J: e; c8 n  k
  34. #include <linux/dma-mapping.h>- u' S6 R$ Q4 W+ k% h3 t9 D, }
  35. - O% e# P# A4 j6 d0 k4 B3 m4 M7 [
  36. #include <mach/memory.h>
    8 U: i) }5 b" m# V; A) l( Z
  37. #include <mach/hardware.h>% Q" ?3 A5 J0 h" x
  38. #include <mach/irqs.h>  U1 g, e/ f5 _. G! ]4 F' r
  39. #include <asm/hardware/edma.h>  M2 p5 y0 g: \
  40. - M0 g$ }0 r. D9 H( O$ S/ e
  41. #undef EDMA3_DEBUG
    , n  O. a3 {5 C2 b6 i; O+ l( E
  42. /*#define EDMA3_DEBUG*/
    + y+ j3 A1 w" @! E0 u0 t6 v, J" k
  43. . c5 K' o8 O. G7 \6 u& g
  44. #ifdef EDMA3_DEBUG
    . @$ n4 t4 y' Z# |
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    4 @5 ^& j) \8 b3 o2 Q) Y8 P
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      F; b: }+ P) M( ^- `, F
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ; s9 I6 ?# @. r& t6 f
  48. #else4 z" L4 U: N% d: U2 L
  49. #define DMA_PRINTK( x... ), Z! H  F* p+ l* z. b' s
  50. #define DMA_FN_IN
    , Z% i% W- V1 f# A. M' N
  51. #define DMA_FN_OUT
    4 T% c6 t, ]: y. Z5 X6 u  v
  52. #endif
    9 s* X9 e; }# ?4 {2 s0 }$ w' d: g+ J

  53. 1 F1 o. t1 T0 B* p7 y* L
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  u* U% @$ ]  l+ l" r! o% S6 Q
  55. #define STATIC_SHIFT                3! G0 d# l9 @6 w% b  _9 w2 x
  56. #define TCINTEN_SHIFT               20
    ' m- a+ H. G! `2 w* O4 P0 K
  57. #define ITCINTEN_SHIFT              21
    / J  u% N! t" P7 \% X
  58. #define TCCHEN_SHIFT                22! Z1 {% c+ t) p9 t7 I+ I& N9 X
  59. #define ITCCHEN_SHIFT               23  [+ S" ^; d( Y4 r% T, G& F
  60. 0 H* _& I- K& R" K& M
  61. static volatile int irqraised1 = 0;# K1 c; ^9 O5 N
  62. static volatile int irqraised2 = 0;
    5 V# A7 l4 }, ~; N  t& N
  63. , B; Y9 U2 d1 r( c0 R, f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% \- R9 x" H$ o+ ~/ `- ]
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- j1 i* a( l) {$ ^, ?9 m
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 Q  [8 z0 B% f1 X/ q

  67. ) ?3 t/ l* o+ s* B+ b$ M
  68. dma_addr_t dmaphyssrc1 = 0;8 e1 u2 g  y0 v% ^
  69. dma_addr_t dmaphyssrc2 = 0;# G4 Y$ p- _& m8 g. c
  70. dma_addr_t dmaphysdest1 = 0;
    ! q. T. |0 T( Q' _6 w; o7 L
  71. dma_addr_t dmaphysdest2 = 0;2 O6 h( x( M; b3 ^" i5 ]
  72. 1 p" x; Z; v- e5 R3 C
  73. char *dmabufsrc1 = NULL;! f' c3 s6 g3 ], U9 S' t& I
  74. char *dmabufsrc2 = NULL;
    ! g% r6 y9 U; |- c
  75. char *dmabufdest1 = NULL;+ _, x" ]' [4 B# V4 T+ X
  76. char *dmabufdest2 = NULL;  v" |' a% }) r1 v* y+ k
  77. $ q' @" W! t5 M4 p- G
  78. static int acnt = 512;& B3 W, c7 J7 P( Q
  79. static int bcnt = 8;( l3 b. ~9 ?/ o' z- }1 Y
  80. static int ccnt = 8;$ |. N" v/ ^$ B4 I  f$ A

  81. * @# l) U* [/ f$ U( B3 K2 w/ T3 z
  82. module_param(acnt, int, S_IRUGO);4 k! |) ^/ m; {) f0 q# k$ v
  83. module_param(bcnt, int, S_IRUGO);; r% O# M, R$ s5 j
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: d; F, g/ \' k
: p5 K/ M$ @& x" b' ]      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: Z" p( }# }$ K# M3 ~6 ?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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 Y9 p; y% \& |* i5 I
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% K! A, C* |+ o) M) l7 K$ l( a) h

7 a$ b2 b& m7 s& O( [* }0 U4 T/ X& c+ ~- |
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-3 08:40 , Processed in 0.038929 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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