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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * ~; Q2 O; L5 u( m
  1. [code]EDMA sample test application
    8 @  J7 N, n( R2 U
  2. /*
    * d( f7 |1 D8 Q2 B8 k6 [
  3. * edma_test.c& [' Q% A& n; \- ]' \
  4. *
    0 D& h7 [3 j3 O1 p
  5. * brief  EDMA3 Test Application
    * G6 _9 ]  k0 ~2 O& r$ m; w$ D& }
  6. *
      j  M4 `( f& F3 X7 J
  7. *   This file contains EDMA3 Test code.* u, W& C& P, C1 R2 l, o' L# Z
  8. *
    ; h; X2 }& B; I; `
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 Q' g1 o, `2 w" P
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 n: D  s/ _' Z
  11. *         TO CHANGE., X; ^  T" S2 Z! g6 Z/ C
  12. *# ^+ O" f: E" @1 P
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    2 D2 y0 s7 F) F  N5 I* y" h3 g
  14. *  v3 [# [2 X( z
  15. * This program is free software; you can redistribute it and/or
    # Y+ {: ]- j$ x8 W, H
  16. * modify it under the terms of the GNU General Public License as2 _2 u+ k( V+ w/ n  Z& `# R. P- y
  17. * published by the Free Software Foundation version 2.
    8 R7 K" B+ i- X, Z& @
  18. *
    % c; n( J0 m) |# Y& L2 G: ^* H
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any# `$ x4 d' Z0 C& B' T# h2 D
  20. * kind, whether express or implied; without even the implied warranty
    1 _% r0 o( X, i0 f3 Y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 t; y* H; p6 m+ g
  22. * GNU General Public License for more details.5 R3 U- b  }  |
  23. */
    : o; _7 X8 n9 F' h, ~: f8 B* _

  24. % M2 ~7 B, E. I6 L. X- p7 R- u
  25. #include <linux/module.h>
    : A; Z! q' ^3 S- Z. r1 Y
  26. #include <linux/init.h>
    - Z) M+ g9 x3 T& S! v
  27. #include <linux/errno.h>
    - K5 X! ~4 w" y/ @5 ]- S
  28. #include <linux/types.h>
    # e7 t: a' _& q  f0 U3 }
  29. #include <linux/interrupt.h>
    0 q3 W$ G5 ?+ Q. T
  30. #include <asm/io.h>
    : r! ^# A( K/ ^  L. K# ~4 t- e
  31. #include <linux/moduleparam.h>$ s' ^/ Z: d1 |. O
  32. #include <linux/sysctl.h>4 @) ^" s' ~" S
  33. #include <linux/mm.h>, ^$ s! v7 X! Q$ j8 y' [
  34. #include <linux/dma-mapping.h>, d/ w1 ?9 i6 Q3 z' }" z5 a# R

  35. : n6 N8 n: M; e7 Z7 u9 }$ v; Q
  36. #include <mach/memory.h>; t  n. t" F% I4 M2 {/ U+ i. w
  37. #include <mach/hardware.h>
      }3 b8 Q6 G# Y" M7 o3 U! c5 ?
  38. #include <mach/irqs.h>
    & X, B7 u6 [" u! [
  39. #include <asm/hardware/edma.h>2 D9 W" _/ M5 ?& t3 p; O, ^$ C

  40. 8 P- c; H/ T/ H  |3 A3 \8 e
  41. #undef EDMA3_DEBUG) g# O2 a$ ~+ M: \9 C' _8 B$ Z
  42. /*#define EDMA3_DEBUG*/( H5 L# B! P0 n
  43. 2 S8 f& y8 `/ n( N# \
  44. #ifdef EDMA3_DEBUG
    5 K+ C* z6 `4 z+ _* b- z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    5 t5 ^; H0 r* V4 h  w
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): d7 x, q% u9 B' F+ B  l) v) T4 V
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    8 c. d  B1 o; e( p
  48. #else
    ) P, D' W; A4 q3 l8 r
  49. #define DMA_PRINTK( x... )
    5 x, S6 @1 U7 f
  50. #define DMA_FN_IN
    , w9 T& e- F& L4 [4 q) T* A/ F
  51. #define DMA_FN_OUT3 K5 t7 o! j: \6 n6 p9 R0 N
  52. #endif
    . x7 S% e7 q+ j2 R0 U6 S" M

  53. 1 A' K% M8 A: J4 L
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 Y/ o( W+ `& b, P
  55. #define STATIC_SHIFT                3
    ; Z* K+ t3 K, p/ B+ f
  56. #define TCINTEN_SHIFT               20
    : h) _( _7 g. H% ?
  57. #define ITCINTEN_SHIFT              213 P5 N3 L+ H$ M1 u1 o- P3 j; T0 t
  58. #define TCCHEN_SHIFT                22. n* t2 h4 N5 \) _( S
  59. #define ITCCHEN_SHIFT               23
    7 b% [& U) C! K! y
  60. 3 \5 V- [  J! a' }5 ?
  61. static volatile int irqraised1 = 0;; W% N) @( i, C5 {* |
  62. static volatile int irqraised2 = 0;( @( E" Y5 @$ f

  63. - N( a7 D2 c5 J8 e: n4 ]$ k" c
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & d* A6 S( Z8 E
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! J( x/ O  z4 Q& _. P
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# b) R4 X. m: Z  Q& U

  67. 2 ^: w. e9 Q9 |, d( x* ^6 A
  68. dma_addr_t dmaphyssrc1 = 0;
    , u( e9 j, E; x' I* f- ?6 g
  69. dma_addr_t dmaphyssrc2 = 0;
    6 p! `, ?9 b5 e' B- M- s0 a
  70. dma_addr_t dmaphysdest1 = 0;' t! J5 ?, K+ V# ^
  71. dma_addr_t dmaphysdest2 = 0;
    . H% l1 q( u: ]* F# ?( H

  72. ' u2 z# Q. e+ {' q
  73. char *dmabufsrc1 = NULL;5 e! s' n+ s* f
  74. char *dmabufsrc2 = NULL;+ j9 k, T0 z" M" F
  75. char *dmabufdest1 = NULL;( @4 t5 J  B' t2 u& H& y
  76. char *dmabufdest2 = NULL;, S  g: J( a# ~

  77. 0 y, [% q- i0 S$ H' R* Z& m
  78. static int acnt = 512;
    1 ?) ?3 O; n0 W
  79. static int bcnt = 8;4 w) i5 y+ B% ?9 [. |( U
  80. static int ccnt = 8;
      ~  y' s4 v5 ?: s, u6 k* o

  81. ( G' g- J% G1 Q% h' i
  82. module_param(acnt, int, S_IRUGO);# u0 o; s8 t) k, F7 ~; j/ v
  83. module_param(bcnt, int, S_IRUGO);) M7 a$ |- l: A
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; I/ c' H: E; p2 h  Y& x
- G* X& Z3 R9 |9 Z  w' |! \
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ e9 [1 l. s" [4 }3 f/ varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- S# u" f5 c# P$ M     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ x3 V+ i" {: P; P
5 H3 V( ]3 o/ \- b, u% i4 x' h2 a; f* |) P7 l' |2 K
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-30 05:18 , Processed in 0.038513 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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