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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 @9 s# \; @' `( L
  1. [code]EDMA sample test application4 z" X" I8 D9 ^2 r
  2. /*
    % C8 _- R3 J( O9 E: K% ~& i
  3. * edma_test.c
    ! D' _3 d: m' S6 b: K
  4. *
    3 _5 K2 I7 x2 |' w9 n& g
  5. * brief  EDMA3 Test Application
    - m) _3 A, Z' Z$ X
  6. *
    , H( o- v* h1 [  T4 D
  7. *   This file contains EDMA3 Test code.' b# X# G& Z, v7 g
  8. *
    8 E0 y1 F- k, r& v' O
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 a8 E  ^4 q: J6 r* H5 L6 s
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , Q" u9 T) Y5 O7 A% G: `
  11. *         TO CHANGE.( f3 b, N  r1 F7 A. y7 t9 j4 q3 f
  12. *
    9 a: b+ x1 w  Y% ^1 f
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: o/ B9 }8 f$ D3 P6 r3 u
  14. *
    5 V9 V1 R* |1 T$ ~9 z  i& [7 T
  15. * This program is free software; you can redistribute it and/or
    0 x. {: J4 {+ M1 M; u4 K
  16. * modify it under the terms of the GNU General Public License as
    2 o# |$ m% C* Z$ ?3 H7 B: J2 e
  17. * published by the Free Software Foundation version 2.) p. Y7 v, S; g8 E7 h
  18. *
    % j: {$ C5 ?* w6 i8 X! K4 L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 `8 e1 X0 K. @/ Z4 n
  20. * kind, whether express or implied; without even the implied warranty: R$ e+ O! o& B. g4 \  o
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the3 l6 L7 l3 f% d
  22. * GNU General Public License for more details.
    ; _% \" c  f$ x5 m, U
  23. */. v( T8 M* L9 `. _" E, d  E, [

  24. " _: p$ b' T" O' y/ }2 ]
  25. #include <linux/module.h>; t) ]( M5 y: F. n" E( `
  26. #include <linux/init.h>
    * F1 Y/ z4 y9 d; Y5 A8 L4 T* D
  27. #include <linux/errno.h>9 Y% G" }9 p0 [7 D) D9 U
  28. #include <linux/types.h>
    9 g6 u- |! N0 l
  29. #include <linux/interrupt.h>
    " k4 S( j; l+ R6 I
  30. #include <asm/io.h># ~1 |* h5 N/ L* H* g6 t, k
  31. #include <linux/moduleparam.h>
    # C2 E% j% O0 K$ M2 l' G8 _
  32. #include <linux/sysctl.h>
    7 X- X! Z$ e0 @: ?( b# H
  33. #include <linux/mm.h>" u6 |' [& W/ n* J9 T, t
  34. #include <linux/dma-mapping.h>
    ) P7 ^1 p/ \$ c' d/ t: A

  35. 8 w( n$ q) f% p
  36. #include <mach/memory.h>. u3 A. V+ z0 }# u
  37. #include <mach/hardware.h>
    ) ^, r: O6 f  ?! t  j8 W
  38. #include <mach/irqs.h>
    ! ~" |( Y! {' i9 Q' |
  39. #include <asm/hardware/edma.h>
    3 x. Y3 Z" G% r) t/ m

  40. # q; [! N' G7 v
  41. #undef EDMA3_DEBUG
    6 q/ L) y2 P* C1 U4 @+ {/ p
  42. /*#define EDMA3_DEBUG*/
    & z1 v4 ]4 I8 C

  43. ( T8 H8 C) J* ^+ L* i+ l( g) r
  44. #ifdef EDMA3_DEBUG
    " r: N' D! g/ f2 r3 \  h3 r. ]) k. I
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); t& r1 z: m6 z- m5 G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% f6 `3 d8 s6 _. F. ~* E& i
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 m' ^1 r0 P9 c) |
  48. #else
    / B  Y0 V6 S: L3 p9 w: F& I% _+ N; `: b
  49. #define DMA_PRINTK( x... )
    ; d1 p: `+ j0 \9 z2 B
  50. #define DMA_FN_IN7 n- P+ [8 C' t- t4 _! N( B1 G
  51. #define DMA_FN_OUT) B" O/ w6 G/ l. r% ~# `
  52. #endif
    1 V/ o* Y) I2 x! z2 M

  53. 9 D1 }; I% x, O0 g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)! |  {1 V/ [/ n
  55. #define STATIC_SHIFT                3
    0 p0 p! \! _$ Z5 E" }' b- d. k( D! u
  56. #define TCINTEN_SHIFT               20, i4 P" W0 G6 B. t' n
  57. #define ITCINTEN_SHIFT              21
    3 m' v$ Z: S5 w9 u0 M- g8 X7 x
  58. #define TCCHEN_SHIFT                227 L- p; d! y! g( X0 H2 S1 t. _
  59. #define ITCCHEN_SHIFT               23
    " a1 N/ N0 ^; s$ j, M% V$ g

  60. . F6 S+ b# p: v5 d
  61. static volatile int irqraised1 = 0;* Z0 u5 v/ G" w! W7 Z' Y8 @# Y
  62. static volatile int irqraised2 = 0;+ R5 k$ ^/ b# t3 g! j- H

  63. 9 b2 s' M3 r. n' f5 h, j! y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 i; c, B5 z+ j: g+ t
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 V0 p# Y( l2 s
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, L7 G3 }" B, \4 c: c3 K5 ~
  67. 1 X; v( `! Z. c9 [5 {
  68. dma_addr_t dmaphyssrc1 = 0;9 v: w3 O1 d) I( F$ k; H
  69. dma_addr_t dmaphyssrc2 = 0;4 j. q, w) k# @; Q
  70. dma_addr_t dmaphysdest1 = 0;
    : L+ @/ Y* [# n# r4 V* v
  71. dma_addr_t dmaphysdest2 = 0;- S# m3 ~( L( G

  72. : _% x1 Z/ r/ d$ f* v8 R( j9 h
  73. char *dmabufsrc1 = NULL;
    0 r7 p. W7 D9 t* w; z' g# M
  74. char *dmabufsrc2 = NULL;1 q7 v% J8 q) N; Z9 a6 }' i
  75. char *dmabufdest1 = NULL;
    & E- `  X$ F4 ~6 e9 {5 d
  76. char *dmabufdest2 = NULL;
      A7 U3 P) {% J8 S$ g  v- K" G9 O3 p

  77. 4 y0 q: y) L: @/ Q& V2 I
  78. static int acnt = 512;
    6 X( p9 v0 s: n6 M
  79. static int bcnt = 8;2 c$ Z  H  Y% j' O. W4 M& y0 m( N' F3 G
  80. static int ccnt = 8;4 y4 u1 Y2 U6 B2 F7 X8 i9 v
  81. " J" n6 L: _- J6 s, w; j
  82. module_param(acnt, int, S_IRUGO);
    1 h; s& G% k4 {% o) n) V; V
  83. module_param(bcnt, int, S_IRUGO);
    ' g8 C" n" L4 I$ B" n
  84. module_param(ccnt, int, S_IRUGO);
复制代码
$ B0 {: F3 ?  V; Q

# c0 w% t3 R# b! f4 w      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ P, u7 O1 F# Y' W0 n' S
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* x& m4 K  T, Z1 r/ s: q
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 t# [: V+ V$ [& G* e9 C

2 R2 H. R- J3 u6 g, u% C2 l% B5 m, ~% l( Z3 f6 y3 c
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-15 10:44 , Processed in 0.039232 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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