OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 I+ v6 Q2 \7 t1 L
  1. [code]EDMA sample test application
    - |1 h, O. p; R2 S
  2. /*
    5 c* k% `' K3 F; E
  3. * edma_test.c1 A+ T$ t9 u) i' K- F( R5 k
  4. *
    . ^: C/ M$ h! @' {7 _4 ^8 _
  5. * brief  EDMA3 Test Application1 b* W$ l( ^9 x, r
  6. *; _# _0 i5 I! ]/ H+ ?8 l8 c4 j
  7. *   This file contains EDMA3 Test code.
    . [) P! T8 \. _
  8. *
    6 d7 \) P( q! R' P4 @) W
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ; u. s+ g4 S1 f/ n( f- r5 z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ l2 O1 b$ S2 L8 f0 b/ E
  11. *         TO CHANGE.$ }9 O0 R- Q8 C
  12. *
    ) M+ o  O$ E9 `5 k+ |  I; f: m9 @1 Y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  A: j3 J  U# d: W
  14. *: B2 d6 }3 o: p2 |& I! c
  15. * This program is free software; you can redistribute it and/or
    , ~* D- b* A/ d9 g3 _/ j: u, e( _
  16. * modify it under the terms of the GNU General Public License as
    " b8 w6 s, w# _6 Y4 O3 ?2 ^
  17. * published by the Free Software Foundation version 2.3 g7 m* r, Z2 N' s$ q
  18. *& e9 j1 y" }' }
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any' ?0 Q4 a. c5 x7 S" z4 G
  20. * kind, whether express or implied; without even the implied warranty6 l- {  `7 w9 B: c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  l, K# v, }+ W+ i
  22. * GNU General Public License for more details.
    ) r: V3 g. y+ p  i" S  `
  23. */2 G8 N& l; O* ?1 A: m
  24. ) |) K! r$ x. o" |( R* s3 k
  25. #include <linux/module.h>1 E. d/ H! U0 Z2 b- B
  26. #include <linux/init.h>0 p& l- W# e+ W, U, T
  27. #include <linux/errno.h>
    0 E0 O' |+ m' C/ t: S
  28. #include <linux/types.h>0 J  H) _9 Z! ^! T* c* U2 l! @+ Z+ |
  29. #include <linux/interrupt.h>$ B/ A& S, ]- }$ c8 W. N/ G
  30. #include <asm/io.h>0 w8 q0 R, l" V/ Z: l, s4 X
  31. #include <linux/moduleparam.h>" K1 q' I3 Z% m! |8 a9 N& l
  32. #include <linux/sysctl.h>+ c9 ^0 U3 z3 n# f- L4 k
  33. #include <linux/mm.h>
      S* e9 u% r  m# s/ [
  34. #include <linux/dma-mapping.h>2 U. h0 Z2 i: _0 ^" G

  35. " Y# L4 H  r; s' d  |% a
  36. #include <mach/memory.h>8 ?& z; M# I" o$ F+ U! T
  37. #include <mach/hardware.h># `: G( Q+ w. n; j
  38. #include <mach/irqs.h>
    * N9 a; n0 C' q( C
  39. #include <asm/hardware/edma.h>$ A1 o/ V" a$ E  w1 ]
  40. # h; J6 {" B0 i# A
  41. #undef EDMA3_DEBUG( R; v% E/ o  V( m
  42. /*#define EDMA3_DEBUG*/5 n: Z8 r" U- g7 G

  43. 4 g+ V) I1 M8 o
  44. #ifdef EDMA3_DEBUG
    ; x  P6 Q- G, N, e$ O9 \; X3 [
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ i8 A( J+ S9 `6 X6 I+ |
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    9 _0 k7 C  Z. V- c/ g
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 X$ a9 {. T, T$ _* ^* h
  48. #else
    5 v" E- v; f: A" `
  49. #define DMA_PRINTK( x... )- ]& [4 h2 M9 V4 U. n; ], j( C" ?
  50. #define DMA_FN_IN
    ! C5 A" j+ t% x. t" o
  51. #define DMA_FN_OUT; F# [, W+ I, [9 L; d) k
  52. #endif7 k" K6 |) g% u- Y, Q1 w
  53.   d6 t$ Z+ N' A# q- V2 Z) E/ F
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    1 R1 L2 T; i4 b1 Q( s' a3 M
  55. #define STATIC_SHIFT                3% L5 u7 b5 K0 u! n8 {/ u: K
  56. #define TCINTEN_SHIFT               20: _0 y6 k) J  a4 k
  57. #define ITCINTEN_SHIFT              21
    3 B9 Y* d: n: a$ D; h( h
  58. #define TCCHEN_SHIFT                22
    ; z7 D# \: K" h) N2 B- h
  59. #define ITCCHEN_SHIFT               233 a1 K3 T4 u5 ~  C8 d6 Z
  60. 0 ?5 e( i% J+ O: f3 c& u5 h0 V) ~
  61. static volatile int irqraised1 = 0;7 I% N- [/ O( Q! }% v4 y) Q
  62. static volatile int irqraised2 = 0;9 m, \$ c% M- Z
  63. " O, E. ^' t) y' A
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 G8 Z$ G3 G- M$ J
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 X3 j2 o: S! c! r" k
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' H) D6 g/ j9 U

  67. ; L$ T; H- H5 i" R( ~3 a
  68. dma_addr_t dmaphyssrc1 = 0;% W+ M( N6 I, I) e/ {3 r
  69. dma_addr_t dmaphyssrc2 = 0;; D- a# N2 h3 s  `9 L. N
  70. dma_addr_t dmaphysdest1 = 0;
    & T/ [7 E  ]+ A, V3 h
  71. dma_addr_t dmaphysdest2 = 0;4 N9 f: p3 e/ Y8 ]: [

  72. 6 R% h4 u- h/ g; @  u# z
  73. char *dmabufsrc1 = NULL;
    - n7 T6 z8 [2 O1 E& `
  74. char *dmabufsrc2 = NULL;' M7 U- ]& f8 h7 S2 e( z4 k, T
  75. char *dmabufdest1 = NULL;! k1 h1 E7 X! g' K
  76. char *dmabufdest2 = NULL;; X, k- I+ G; K0 [3 [2 Q
  77. ) Z% o4 i! v' d$ H7 }
  78. static int acnt = 512;
    & \2 s2 G0 Y! H: {8 m- ?, s3 b: y+ ^
  79. static int bcnt = 8;
    3 `2 S$ U" V: R0 ^  j& O# m
  80. static int ccnt = 8;. q, ^' B1 X* s( Z0 J9 d  V
  81. ' `/ z# @) @; {
  82. module_param(acnt, int, S_IRUGO);5 C3 [, y' n9 d1 i/ K. a8 I/ ^' G
  83. module_param(bcnt, int, S_IRUGO);# J9 t% K- m/ g) V1 p
  84. module_param(ccnt, int, S_IRUGO);
复制代码
" N9 p. Q& U( X* f! W

8 K0 j  S* G# ?2 _: t& |2 B% S      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; @8 s: [+ r/ |- e3 y# P: M% farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 z% `, T" |) W5 u
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" Q3 `( L# R# L. ]
6 G6 Z) I6 _/ w2 G( w1 I. E! K4 m! v0 j* a9 M7 p7 s# d% U9 x& S. j# q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-4 07:20 , Processed in 0.039799 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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