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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# r2 y- V5 C* [9 x5 Y
  1. [code]EDMA sample test application
    . b) `1 ]% m$ `' w# _
  2. /*! O) q- D. x7 ?- h( g9 x
  3. * edma_test.c4 y* E8 S$ V% x8 `) r% ?* \" n
  4. *& t1 }# S" j( x* ?; i
  5. * brief  EDMA3 Test Application
      k6 Z- r% W7 e" b6 v) d  U
  6. *
    " A. s( A# f- c
  7. *   This file contains EDMA3 Test code.
    / a: a7 S$ t$ X) E$ ^- n3 s
  8. *, I) n; q5 r7 V# I( ^
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( Y" b8 f+ v5 A+ Q# C" u4 K+ E+ ^
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" v7 k8 [  ]* i/ j' o, o6 g
  11. *         TO CHANGE.* \+ X% d. k/ b* Y2 G- z1 Q
  12. *
    ! D/ J, s( h" X6 R" Y+ z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 ^% R8 S. r  x; j) z
  14. *. M7 }/ N$ w+ p% h9 M' g2 K0 V
  15. * This program is free software; you can redistribute it and/or: I, K0 \, _, U& W- Z. g) E7 o  B
  16. * modify it under the terms of the GNU General Public License as
    ! A! ^/ S& T: C5 N  J; g
  17. * published by the Free Software Foundation version 2.+ g, Q$ E$ E) {+ Q- m; M, t, x- ^
  18. *
    # Q% l# @8 h5 d9 r3 z% L/ s8 x
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - ]( Z5 ]0 ]: ~8 O8 a8 j2 M9 P
  20. * kind, whether express or implied; without even the implied warranty
    $ j( o5 P# R1 i. d' A. U
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & s/ ?+ ?6 E* X! S
  22. * GNU General Public License for more details.8 R: L1 }* y* h! M7 `0 k4 w0 y' V1 h' F
  23. */
    4 f  v5 D9 a0 b

  24. ( o2 I8 D$ x$ [4 I
  25. #include <linux/module.h>
    0 H( r5 d+ L5 s; v
  26. #include <linux/init.h>8 |, b' j3 X; ^6 E
  27. #include <linux/errno.h>
    - C& n$ k- o% n: Y
  28. #include <linux/types.h>& l' [. q  k* K: b2 L6 s: {$ v
  29. #include <linux/interrupt.h>3 ]# [" s1 a+ k1 O( V' u0 q
  30. #include <asm/io.h>/ @; H0 b5 G  J
  31. #include <linux/moduleparam.h>
      L, I  \; U! O& A! H- }6 ^
  32. #include <linux/sysctl.h>5 `# u) \5 l0 c) S
  33. #include <linux/mm.h>
    ; E% l% ?: N, M8 b# W( B+ W
  34. #include <linux/dma-mapping.h>
    : {; k( ~# @1 D6 z& N: [3 o- [
  35. 2 ?% V6 k3 Z: d4 V# @
  36. #include <mach/memory.h>
    ; Q4 S+ I; I* D' a+ m
  37. #include <mach/hardware.h>
    & V1 `, G, r. @8 a
  38. #include <mach/irqs.h>
    0 v! I9 ?2 H8 d4 v: t
  39. #include <asm/hardware/edma.h>
    - C2 S/ K) p% X( G
  40. 8 y: s! p( x0 i* R  C
  41. #undef EDMA3_DEBUG
    : ~; v, e! o9 @. R/ P  t2 t
  42. /*#define EDMA3_DEBUG*/& r# n( J8 Z3 y" L" l. g/ i/ a4 s% W: b% b
  43. 8 g% k8 h6 _4 h$ s3 [
  44. #ifdef EDMA3_DEBUG7 t: _: z& @& ]5 D& `9 g
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ ?3 t0 L( H. o/ f' M
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* X1 P) q/ j' W9 B6 ^- C) H6 Q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    3 P! l" p" P+ Q5 Z# K
  48. #else
    1 u6 t% A/ {$ l6 V
  49. #define DMA_PRINTK( x... )8 Y' @! |, Z( q# M- }5 D
  50. #define DMA_FN_IN
    ; _: h( H6 v# ~! w  ]; v
  51. #define DMA_FN_OUT
    ( |2 a6 P- s( s- [+ I
  52. #endif! M: D3 z/ ]! k* ^  Z9 V* j2 n1 }

  53. & t$ u+ R% M+ F1 P7 q& B
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    6 l" h: e0 A  G- t. g1 }+ z: T" [
  55. #define STATIC_SHIFT                3
    + \. V: V5 U  }  z+ {1 e: c, {
  56. #define TCINTEN_SHIFT               20
    + O! j0 j3 w* ~
  57. #define ITCINTEN_SHIFT              21, ], I- X: K/ i
  58. #define TCCHEN_SHIFT                223 X" `5 K* v) A$ ~$ c$ ]
  59. #define ITCCHEN_SHIFT               232 V4 X3 j7 d* K( u8 }9 `

  60. ' \2 S% ^7 b- L6 y2 o! ]5 |
  61. static volatile int irqraised1 = 0;& A+ T1 g; Q( U$ c! K, r6 {
  62. static volatile int irqraised2 = 0;% I) h$ k6 B7 O2 I1 X

  63. / r% R% R4 z  I" \8 O+ i
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) s- q3 H# K" r
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + `/ J& P- A  \  d" t8 O2 N- F
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & T! d( @/ \( T. o
  67. $ f% S/ y8 H0 q* |% \
  68. dma_addr_t dmaphyssrc1 = 0;
    ) p& k% g  y5 @  F7 T* o1 a
  69. dma_addr_t dmaphyssrc2 = 0;
    ) _& c! s: ~# T" Y9 P9 \
  70. dma_addr_t dmaphysdest1 = 0;
    ; p. k8 R" @7 V, c/ J) n+ U' i
  71. dma_addr_t dmaphysdest2 = 0;
    6 \# ]! y6 K9 X9 S
  72. ; z% b+ Z8 r% @. H0 v
  73. char *dmabufsrc1 = NULL;
    1 s& f* A5 t1 o0 C# q  Z
  74. char *dmabufsrc2 = NULL;
      q) V* @: G4 k* N- e2 C
  75. char *dmabufdest1 = NULL;
    : U6 L: ?1 t0 G
  76. char *dmabufdest2 = NULL;. K# ~$ i# B1 {( l3 p  F  y
  77. 2 \! G. y( C! M
  78. static int acnt = 512;
    , l* Z) g$ j7 ?0 u" Z+ G1 X, y" B
  79. static int bcnt = 8;
    4 G) ]! ]% i0 R7 v0 v1 B, _
  80. static int ccnt = 8;4 a9 S$ F1 ^( ?5 Y- [2 Z$ l! U

  81. : T3 u7 J+ Z+ d& Y: O4 P' V
  82. module_param(acnt, int, S_IRUGO);0 K" y: {6 d; U8 d: w6 p) }) N4 n
  83. module_param(bcnt, int, S_IRUGO);
    . }0 e% R, C' d; F# ?- Z
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 P9 `  S$ F$ V& O. v2 t% X6 z1 k: v- N) |' ]; E! ^( d& E
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& s* a, I* y* u
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* ^3 R; O3 E8 {. z" Y1 Z9 b; l
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( f1 V, _  g, F1 m

2 \- p0 X3 w( I3 E8 R$ u  z- e$ M9 ~+ k2 V
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-12 07:47 , Processed in 0.042250 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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