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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * i0 S( o) N" p2 ~5 k0 T
  1. [code]EDMA sample test application" ^6 G3 V$ y0 m
  2. /*; g/ n& H. X& N2 ^( Q7 ?% y
  3. * edma_test.c
    % U9 T7 o( e1 q
  4. *
    ( S; a) M6 i" g3 Y  b( U& l- n! J
  5. * brief  EDMA3 Test Application6 K3 A9 l, h2 }8 B/ `
  6. *: t5 Q5 n7 C1 i2 z
  7. *   This file contains EDMA3 Test code.: O$ U/ a! M' j8 w
  8. *
      X8 @; z' Q5 c& D! T( d) ~& k% j9 S  x
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      I. h  D) ~7 L+ D
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( L' B: v3 M  a7 |
  11. *         TO CHANGE.
    8 `* Z* R) _% J3 ]; `. Y
  12. *
    : |& @# F) y( x; @
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# i4 I( Z8 N/ {! R3 g% e
  14. *$ P3 ^" F# b" T! y4 B" P0 r0 h9 s
  15. * This program is free software; you can redistribute it and/or
      {' C; V+ S1 R0 ~* G6 F. S% r
  16. * modify it under the terms of the GNU General Public License as
    0 b" v, B6 p8 a- W- {
  17. * published by the Free Software Foundation version 2.( ]$ v+ S9 J2 X$ {& I. d
  18. *+ G4 v) ^, ~4 H% }* _
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, w+ p% N1 K& @/ Q! r
  20. * kind, whether express or implied; without even the implied warranty
    5 U; V  o# ?% {1 \, K* z& B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the: d  \, ^8 s, [6 d0 @
  22. * GNU General Public License for more details.
    ! c6 E0 T5 L1 X+ R
  23. */. M7 {3 s2 E7 {1 ]' Q
  24. 2 i+ [) N; P; j9 i3 F6 C
  25. #include <linux/module.h>
    / Y! l1 b7 [- T$ Q
  26. #include <linux/init.h>4 v* K5 s7 W5 v2 f/ C
  27. #include <linux/errno.h>
    9 a+ y: J+ R$ D) J  Z
  28. #include <linux/types.h>
    ( r1 u. y2 H+ P5 ?5 g; _
  29. #include <linux/interrupt.h>+ N2 D1 K0 ]' G" j8 h. c
  30. #include <asm/io.h>
    ) `% R6 {; q" \  Q, G# S
  31. #include <linux/moduleparam.h>, O/ z# ?  u: F( o$ t
  32. #include <linux/sysctl.h>2 s$ K+ O; x# X+ Z0 y3 n
  33. #include <linux/mm.h>( C1 {9 k4 X# B$ z& t/ m
  34. #include <linux/dma-mapping.h>5 R/ A4 L- l0 ]$ `5 `. w
  35. / a. n) J; D  J0 m5 Z
  36. #include <mach/memory.h>
    & e/ N3 |' a, s& e" I
  37. #include <mach/hardware.h>
    * ]" ?( J8 n1 w8 e
  38. #include <mach/irqs.h>" x0 J8 Z: _; b9 @
  39. #include <asm/hardware/edma.h>
    1 T: v6 k' |1 d1 I) @% C( Q% a
  40.   n9 P; }8 [; p2 A# M
  41. #undef EDMA3_DEBUG
    + c9 s( F7 I5 q! F0 L" M! R
  42. /*#define EDMA3_DEBUG*/- R0 H3 w4 A; u3 T2 b0 p

  43. 5 f: O) m; p9 N: F, X( r
  44. #ifdef EDMA3_DEBUG
    ! K. j- `5 X: }0 j% |
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 x' [% _# n  g( ~* G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 t4 `( ^4 e0 \6 h& W3 W
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ! H0 N$ g- B6 ]# I
  48. #else
    + `) W3 t& w' x( V8 F
  49. #define DMA_PRINTK( x... )
    7 `5 \( T- V- K6 n7 |) P* h
  50. #define DMA_FN_IN
    1 y1 F- E2 h6 c$ {" b
  51. #define DMA_FN_OUT$ Q  E/ W) M  B/ u+ ?
  52. #endif
    - `8 e: b% S. l, `0 P# k
  53. 8 R  b4 \, ]9 h7 W8 C
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)' X2 k" U. J* e
  55. #define STATIC_SHIFT                3
    3 H" x" y$ K  }( v9 x: q
  56. #define TCINTEN_SHIFT               20
    " I" W5 J( @: D2 a: D) Y2 {
  57. #define ITCINTEN_SHIFT              216 q2 I; Z$ A7 {# Q  z4 s
  58. #define TCCHEN_SHIFT                22# Q8 [  K2 M# X2 h6 l. A
  59. #define ITCCHEN_SHIFT               23
    ( e+ E" D0 N- }/ ?% u$ G
  60. 1 T1 V! d" M- o% ], u& A% V
  61. static volatile int irqraised1 = 0;
    ) Y4 _# q. ~; v) E; Z( g
  62. static volatile int irqraised2 = 0;/ ~" @* S" j! c! Z; b
  63. 8 J1 }' z3 E5 `' G
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) j& g) E' G' N" b5 D
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / T* ?! T7 j+ y4 S
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- T; C, S+ U' @: s7 P- b

  67. / d' v8 g$ A; b: y5 @
  68. dma_addr_t dmaphyssrc1 = 0;
    % V: ]0 ]- G! S; Y) }
  69. dma_addr_t dmaphyssrc2 = 0;
    8 t2 w( K' `7 j" k2 }! U
  70. dma_addr_t dmaphysdest1 = 0;
    7 P' B, S9 f9 g, s' L0 Q; c
  71. dma_addr_t dmaphysdest2 = 0;
    ; b% ^& A/ ^2 x& H5 L5 U1 b
  72. 2 @9 N2 \  S+ k+ e7 q7 Q' g
  73. char *dmabufsrc1 = NULL;  h* N% R) V- p# _: O. {* e+ P; x
  74. char *dmabufsrc2 = NULL;; n2 g* H% V( q/ X5 a, B$ h
  75. char *dmabufdest1 = NULL;# @6 U2 n) O+ U0 e# @5 G2 ^  i+ h
  76. char *dmabufdest2 = NULL;1 l# w; C0 W4 l+ N, f5 W. {% j
  77. 1 B6 m/ B0 n. Z# R
  78. static int acnt = 512;( P' n* x( L, R
  79. static int bcnt = 8;6 S9 t% g& Q1 C7 ]
  80. static int ccnt = 8;8 b) o3 \! r+ o; O% G: {+ r9 I

  81. 9 ^# u& A. S6 `3 d# i
  82. module_param(acnt, int, S_IRUGO);* \0 |+ k% |, u4 P7 w- R( L
  83. module_param(bcnt, int, S_IRUGO);
    " f" Z6 v+ L& W1 u; `
  84. module_param(ccnt, int, S_IRUGO);
复制代码

. v! i) P( C2 f' e9 M! }- ~7 J% G$ B1 V4 t" I; `
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' m; ?0 A* @# M8 Z* Q3 \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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 J& C# G& Z* k) k     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# ^8 E/ j6 G7 }) f! _. j" I" o4 I$ b, s& H) E  y$ X

$ a" X  \) s4 r' b$ ?4 B
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-16 21:32 , Processed in 0.038360 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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