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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 ]+ V; p. Y5 T* T
  1. [code]EDMA sample test application
    & t" Y7 r8 O) T
  2. /*
    8 e8 ~$ _" L1 |
  3. * edma_test.c
    3 l* M9 m) Y# g. J8 N
  4. *5 j4 r! g; {9 ~% Y9 w% @4 S
  5. * brief  EDMA3 Test Application
    2 ?6 V! V7 ?4 e5 e3 ~
  6. *
    6 S. V6 H) Y2 [- ?6 h! d. B
  7. *   This file contains EDMA3 Test code.& e9 y/ P$ j5 y5 E
  8. *
    & {# t' M# \, G' ?
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    8 c# i2 z9 S' b8 R+ j- p9 C( F
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    $ Z4 X0 K7 Q$ F% i
  11. *         TO CHANGE.
    * g1 A8 b5 }5 i- M( o9 u# M
  12. *
    8 n6 J' d2 D1 g8 ]) [3 o
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    - N8 [/ J5 y: d+ M5 V$ o
  14. *
    : A' J/ j: l3 q; ?, d( t
  15. * This program is free software; you can redistribute it and/or
    . b/ ]8 q; ^4 ]
  16. * modify it under the terms of the GNU General Public License as
    2 O) W* I: R# u* Y6 V- I# J
  17. * published by the Free Software Foundation version 2.
    * }+ d# I( O- }( |- P2 S
  18. *. X- A/ X# ], M3 P
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; K1 ~) c  t( {3 x; U% r
  20. * kind, whether express or implied; without even the implied warranty
    & ~. U) v) T9 S& }8 V( i% o
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    9 _! Q/ w! m. w) k
  22. * GNU General Public License for more details." x& p- `4 |/ J; U- v: J9 w
  23. */5 r+ E: ^1 R% l3 l
  24. 0 l! a3 ]  {& z/ B2 F4 }
  25. #include <linux/module.h>( {% R8 z8 N1 q& P
  26. #include <linux/init.h>4 z1 g4 {$ C7 I) ~1 h
  27. #include <linux/errno.h>& d( u! d! ~  X: ]( Y' K" n
  28. #include <linux/types.h>" i, o- c* c5 T# L
  29. #include <linux/interrupt.h>8 ~9 f" d6 h; r- Q# E: ]/ b
  30. #include <asm/io.h>
    & Z! D1 }4 e  m5 ^) d2 n  W
  31. #include <linux/moduleparam.h>) F  m) {( i6 w, I3 H
  32. #include <linux/sysctl.h>8 ?8 A2 S5 u6 b8 @3 [
  33. #include <linux/mm.h>
    - N6 W$ N- P' I  Z! q
  34. #include <linux/dma-mapping.h>
    : L/ j" B. U5 j) q
  35. " m, }4 A' k" c4 g
  36. #include <mach/memory.h>
    2 _( [' ^2 n# V# ~& _; n
  37. #include <mach/hardware.h>
    # P. \8 z" ?$ B: }/ M
  38. #include <mach/irqs.h>
    7 r# h) G3 I& U3 l
  39. #include <asm/hardware/edma.h>$ Z( h1 C* [* I/ p* J8 X! t

  40. & d. ^& Q  w$ c7 y' t( U
  41. #undef EDMA3_DEBUG8 K1 u' B8 W  \3 Y& ]
  42. /*#define EDMA3_DEBUG*/
    ' q+ r1 [; g7 v8 n- F
  43. , k' F3 n8 Z& d2 i. r6 _# Y) j
  44. #ifdef EDMA3_DEBUG0 Z  t+ G' C5 t4 S  n
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    8 \! a; Z! K% V2 e
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # _( C; B1 v+ M2 Q% E. [& f
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    0 p3 @# l& `8 d! P. Z3 h5 M) c, ]7 I6 [
  48. #else
    . h3 H9 j5 i/ Q9 b$ a; u1 B3 I
  49. #define DMA_PRINTK( x... )
    ; I( F& {9 S  w- R
  50. #define DMA_FN_IN
    9 q( w) e. z6 Q! ]( \/ p
  51. #define DMA_FN_OUT
    . [9 Q3 [9 K. ]
  52. #endif0 B' P. t% o  @) u, Y: @( q& @4 x3 F
  53. + z7 A3 Q$ Q3 @2 P% b! _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)1 `! Z. L+ Z; i$ Q
  55. #define STATIC_SHIFT                3
    . q( h, g# @1 t  F( S1 i% Z
  56. #define TCINTEN_SHIFT               20) K& I. M6 b# c! b+ p0 j& w
  57. #define ITCINTEN_SHIFT              21
    2 s7 {8 n" s$ ?" T0 O
  58. #define TCCHEN_SHIFT                22, Q& r1 z4 s) W& ]/ _! ~
  59. #define ITCCHEN_SHIFT               235 y* V* w' f7 L5 M3 j# P) _0 J% ]' F

  60. 6 s* _, U* y4 f/ m! p
  61. static volatile int irqraised1 = 0;
    0 S1 @+ F$ w. O8 c
  62. static volatile int irqraised2 = 0;
    9 L1 P7 r( u2 j' b- U$ A' J

  63. 4 }1 T. h; e9 w$ f, Q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + |; c+ N1 n4 @7 [9 d7 Y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( Q4 t& l5 q9 ^, o/ U
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 y2 e3 D% c" D9 V% h2 o+ h5 k
  67. - p0 V; U; ?2 O" ~' e6 U
  68. dma_addr_t dmaphyssrc1 = 0;
    . Y7 t1 H' L! h
  69. dma_addr_t dmaphyssrc2 = 0;
    " x1 t0 ^- J+ C
  70. dma_addr_t dmaphysdest1 = 0;
    - ?. a% o) m0 `7 H- L
  71. dma_addr_t dmaphysdest2 = 0;
    / v; I8 S4 A  K$ x/ j) C' A- i
  72. ( v7 {! g5 K# K5 t* p! \4 Y
  73. char *dmabufsrc1 = NULL;
    4 l% m* O/ I* w9 t6 R7 P8 [
  74. char *dmabufsrc2 = NULL;9 j' b; E# [) q1 V7 K+ {* S
  75. char *dmabufdest1 = NULL;/ {$ w  Z8 P0 C( ]) N
  76. char *dmabufdest2 = NULL;4 M9 i6 c2 y3 a. n
  77. ( Y9 h5 h' Z; |% }) u
  78. static int acnt = 512;
    3 ~0 T* i- J4 x+ k( _; H% x- y+ q
  79. static int bcnt = 8;$ |# B4 s' X3 T/ {5 I& d
  80. static int ccnt = 8;: E, Y5 Z; b1 N7 ~3 K
  81. : Q; r, p, B2 Y4 m0 e
  82. module_param(acnt, int, S_IRUGO);
    - p  h) N4 S# E9 o1 `- k2 B9 j
  83. module_param(bcnt, int, S_IRUGO);! C3 k2 }5 c% S: D5 n. [, q
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! R4 s% y  ?/ V! t4 B/ D9 g3 R0 |$ ]" _5 z5 G0 G. g' X
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 K+ {. }2 Q1 r$ 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& G& Q# M3 N8 o* T$ u
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 d# X% V( K: H, B* K
: Z6 q8 Z  w3 L1 p5 E9 y

9 o7 ]. \; E+ ^4 f0 V* ]1 ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-2 13:35 , Processed in 0.038115 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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