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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 s" `( m# q" ], d6 ]8 U3 o, [
  1. [code]EDMA sample test application+ A0 B, m; Z2 i1 C1 H4 I
  2. /*
    5 y6 W' g) F0 {1 [- _
  3. * edma_test.c
    - [* ~& d" a9 m( f/ Z
  4. *5 g$ ]* @3 G2 K% |
  5. * brief  EDMA3 Test Application
    4 A: o, O  J% y
  6. *
    9 @- ~* k2 l3 J: A! I* c. o
  7. *   This file contains EDMA3 Test code.0 U" `* ^! G- Y$ l5 l# `+ B
  8. *& N( i, p; Z- ^8 z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ; \2 h$ I) S/ ~/ }
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + d2 ]9 T8 {$ G! q) P
  11. *         TO CHANGE.
    5 U6 ^0 `0 R+ R/ `8 \1 L: E; f" ^
  12. *
    3 H+ A6 x# u' r
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    5 A, @# z+ f  {' l! D
  14. *
    ( P- N3 k& J6 o& P! J
  15. * This program is free software; you can redistribute it and/or% z9 Y7 f' E1 i. N5 a
  16. * modify it under the terms of the GNU General Public License as
    ; U! I! y: g: v- Y" d
  17. * published by the Free Software Foundation version 2.9 Y( F+ J7 r, \' j9 Q# s
  18. *
    2 M8 h/ |- g) k$ ^1 V: X
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    * H  N; Q" ?, G7 ^2 Z
  20. * kind, whether express or implied; without even the implied warranty4 A* V3 }# E8 A4 z8 h
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7 q' H) e' c- t( [
  22. * GNU General Public License for more details.
    " ]# b* @/ N4 j. _2 \7 L" ~
  23. */( ]& U2 x+ ]% Z

  24. ( m. {- ?9 h' @- F; F5 K
  25. #include <linux/module.h>1 U& M+ h# }% u0 N6 Y
  26. #include <linux/init.h>
    7 E2 N$ j! g) f) d9 d5 K7 @- h
  27. #include <linux/errno.h>+ N, M0 R. r. J/ L6 g
  28. #include <linux/types.h>9 S) V+ Q$ w: N% |
  29. #include <linux/interrupt.h>
    4 M+ u9 i) e2 h+ H& q; `
  30. #include <asm/io.h>  q& m; i  l1 d) ~. _$ \: l
  31. #include <linux/moduleparam.h>* {( z3 |. d' S* l1 N9 K
  32. #include <linux/sysctl.h>
    $ U( z) x/ u, ]2 Z
  33. #include <linux/mm.h>4 m* G" M9 B* z3 e) L3 n* Z4 {
  34. #include <linux/dma-mapping.h>6 R. K4 f: x) x) A
  35. ; h/ Y& @% D; _9 A& m
  36. #include <mach/memory.h>
    ! r5 B- O2 J7 r5 b" A
  37. #include <mach/hardware.h>6 h/ U, O  A2 b9 s: S7 X$ H
  38. #include <mach/irqs.h>
    4 V" Q- O6 l6 h
  39. #include <asm/hardware/edma.h>
    0 H& i6 K6 L( L# U6 U6 H

  40. & @+ E* Z4 s& b# R
  41. #undef EDMA3_DEBUG: v% g$ Q( f; h' s
  42. /*#define EDMA3_DEBUG*/
    % m9 i: N1 j2 a# I$ t* X# o9 N

  43. 5 r; V  u( t1 v& o4 A7 C+ R$ L
  44. #ifdef EDMA3_DEBUG
    ! E7 {1 V" E8 N
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& {; |3 B/ P8 g; c+ P
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    4 D' O5 Y7 N  r4 ]
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' `/ `& a" p& z. G" O. ]7 `
  48. #else+ h  j) O: |1 v8 O& o. H
  49. #define DMA_PRINTK( x... )/ {. Z% Y* G- T7 w. |' K
  50. #define DMA_FN_IN
    ! ?% v: T! [# A3 n; Y3 I# {
  51. #define DMA_FN_OUT
    + a* G( E5 T8 ^1 p& A# j
  52. #endif
    4 y" y5 d* ^6 m. p) I3 x

  53. . D( r) a- }% N  A5 O/ q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    6 V/ R# A, _  e6 {  I" P; g7 S6 C  T
  55. #define STATIC_SHIFT                3' \6 q8 D* a" H) r& a( i
  56. #define TCINTEN_SHIFT               207 E  n0 t8 r% |+ g9 o: y
  57. #define ITCINTEN_SHIFT              218 J3 Y) X! M# J" {/ _7 F9 n. b
  58. #define TCCHEN_SHIFT                22
    : ^) G; K8 B, T+ H
  59. #define ITCCHEN_SHIFT               23% N/ P- I4 m* o3 G9 D6 b, R0 T. g
  60. 3 b0 t' Y* M6 s& L$ `' g" Z" S
  61. static volatile int irqraised1 = 0;
    / U' i, m; r* D) o1 S5 D
  62. static volatile int irqraised2 = 0;
    / z# n6 b$ L6 C* M- ~, n

  63. + `  k% m5 [! ]; z3 |3 i/ J6 c
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; A  d* D& k# B5 \* t- @4 Q4 r. r
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 D! I6 e7 Z. A4 B
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 ?0 D* ^3 m! m& _/ E6 e
  67. " e$ }# D. f7 Y3 ]( E3 T9 r+ Z1 h! C
  68. dma_addr_t dmaphyssrc1 = 0;6 m$ V9 i9 |* \; F8 ?! z, d9 s/ ^5 k
  69. dma_addr_t dmaphyssrc2 = 0;
    9 j0 D  a8 I; k8 ^+ Q& p) k9 u& Y* ~
  70. dma_addr_t dmaphysdest1 = 0;
    : _+ P: _6 X  y) T, d" q
  71. dma_addr_t dmaphysdest2 = 0;
    # L: R9 x, B/ F& P8 A+ q$ O
  72. " J- {# C, Y/ }9 d9 V9 ]$ M
  73. char *dmabufsrc1 = NULL;
    : R* [  B; N: x
  74. char *dmabufsrc2 = NULL;
      X1 R) x4 T. s0 ?
  75. char *dmabufdest1 = NULL;7 d7 x8 S* ~& l5 L
  76. char *dmabufdest2 = NULL;
    4 }# V: w- V* |/ U$ g
  77. 7 a- j# z8 I( \3 P0 M7 h! t% o9 v0 b
  78. static int acnt = 512;! r5 r3 `4 b4 G
  79. static int bcnt = 8;
    0 C. ]$ |6 N1 \& x+ e
  80. static int ccnt = 8;
    * u! g4 {1 Y* D7 [1 ?9 Y

  81. ) e) n# T" a! O% s: U
  82. module_param(acnt, int, S_IRUGO);: U4 t  [6 b$ G5 i8 H3 t/ t; u2 |$ A
  83. module_param(bcnt, int, S_IRUGO);
    9 _  @2 f7 v* j3 @
  84. module_param(ccnt, int, S_IRUGO);
复制代码
: E8 o" _; |# `4 N& j4 V

/ ^6 X' V, n# ?2 Z* O. e      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ Z' y6 K3 D, w! r! N3 c* }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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" B$ c5 [9 G/ U& z; E     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# N3 k3 L) Q% }) C6 K5 M9 W4 e7 Q+ ^# X1 m4 v* ~7 I

' F3 P8 W  A- N3 y) ~& n8 u
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-20 09:11 , Processed in 0.035859 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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