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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 m0 n. r) i9 s' J1 w- r
  1. [code]EDMA sample test application
    7 {7 o- v& o1 g3 D. x: G7 d
  2. /*
    ' o9 B1 f) F: ^4 {/ q
  3. * edma_test.c
    , x8 T8 O+ T* ~/ A1 q
  4. *
    ; K' f, U$ s! {5 j
  5. * brief  EDMA3 Test Application
    * R" l( E- E6 N% g* w
  6. *
    7 E3 Y% Z& ]7 [+ `+ t7 Z8 @- s
  7. *   This file contains EDMA3 Test code., U1 E- C. K& a) b3 m
  8. *; X2 ^' d- L3 F! T! y1 I
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    7 M5 ?; [/ N. }, n0 \* U! ?' V
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; ^# o% o0 P6 M" U& ]; F; W6 M0 u. k
  11. *         TO CHANGE.7 r0 v- ?, q0 Z4 a) ?4 o2 I8 ]
  12. *; F: _; F5 N+ k) S, c# I
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    9 ~* |$ ]7 m2 g6 G7 z
  14. *
    $ [" }* d$ v' m0 N( u
  15. * This program is free software; you can redistribute it and/or
    ( o. a$ Z- Q# v6 j
  16. * modify it under the terms of the GNU General Public License as8 V' d9 D' [; ~% |# h3 _* w. o
  17. * published by the Free Software Foundation version 2.: v+ n+ c8 k4 a3 `
  18. *: j9 b+ A8 ~% {0 Z% O
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 ~7 a6 A: C! A4 {9 T
  20. * kind, whether express or implied; without even the implied warranty
    ! T) H! F% _1 I- o, B; f
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      U  \2 p! E% ^
  22. * GNU General Public License for more details.
      O/ G! W/ ?' T' K
  23. */
    8 E, Z/ r6 q  k8 P1 l$ J& H

  24. " R$ K/ J) y5 ?8 S5 t$ V
  25. #include <linux/module.h>7 q0 l% \! g: m( u; B9 q
  26. #include <linux/init.h>
    2 A' J* ~7 Y5 r. `0 O+ z1 y
  27. #include <linux/errno.h>
    0 S+ R8 \% }" ?7 Z
  28. #include <linux/types.h>
    3 X* |: Q9 ?+ r- u# B
  29. #include <linux/interrupt.h>( j) Y, u, J: F) z
  30. #include <asm/io.h>. ]: j+ r8 y: @. g# [- U6 A, b, G3 T
  31. #include <linux/moduleparam.h>5 V, T' e2 c" }8 x! a) p& D1 u0 X
  32. #include <linux/sysctl.h>) ]7 B2 x( D4 K& L8 q' p8 V3 M
  33. #include <linux/mm.h>  H8 B$ P3 [% N0 U1 O5 t% t$ n1 v
  34. #include <linux/dma-mapping.h>
    ; _7 C. y: p: _. k2 H& ~
  35. 4 b. @! h1 z: H5 ]
  36. #include <mach/memory.h>3 W* r% W8 I; Z0 m
  37. #include <mach/hardware.h>' T/ e5 U" @! u$ h
  38. #include <mach/irqs.h>
    * P& m8 ^2 Y1 ~" r
  39. #include <asm/hardware/edma.h>
    ! p9 N: t# O8 \# t, r
  40. 2 @8 [2 S# z+ N  U' n
  41. #undef EDMA3_DEBUG/ t0 \# Z* K4 n& f" k
  42. /*#define EDMA3_DEBUG*/6 i/ m3 L2 U5 H6 L

  43.   }' t6 W8 h2 [4 l+ s( ?
  44. #ifdef EDMA3_DEBUG
    & H5 }: }+ R: p2 z" N
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    5 a8 a$ e! D6 X4 g" x- b. ^( I. h) A
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    * O" ]! [+ u7 g) w8 A  Q+ q( t' i
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + ?3 c6 U( A5 J( w/ z" y
  48. #else
    6 G+ C6 V% H4 h* j, }1 a0 L
  49. #define DMA_PRINTK( x... )
    & m3 q4 m, J; ^! c. }0 I" |  L5 n6 M
  50. #define DMA_FN_IN
    % s- \$ A2 H  W( v8 A/ y
  51. #define DMA_FN_OUT
    ! R( O0 Y' ?9 c% n" d* C9 Z! \0 m
  52. #endif
    3 p  W: M3 |: ?2 x4 e
  53. & X! [% U/ {. h! h5 c4 Z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    * \  h, h* H7 q- @5 _' v
  55. #define STATIC_SHIFT                3, Z5 Z: h$ C% f# L- w: ]0 A
  56. #define TCINTEN_SHIFT               201 A: p; s* `4 e( z6 i9 M
  57. #define ITCINTEN_SHIFT              21
    $ O5 R2 Y! D; \5 x
  58. #define TCCHEN_SHIFT                22$ u. \- Z  x- s, G" I5 Q
  59. #define ITCCHEN_SHIFT               23
    3 R. W1 f/ ]7 X& r. B

  60.   N, l+ p- Y( x: r
  61. static volatile int irqraised1 = 0;& B% i; X5 E. N! E& m
  62. static volatile int irqraised2 = 0;
    / ^+ O0 ^' j, H+ Y# O  e
  63.   c. V4 b" w0 y# Q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ ]: V2 ^- [$ D0 T
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- ], n- [) W: a. [) [( \1 h: D
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 |0 l7 u2 x" Q: d3 j* I
  67. 3 v8 F9 u. Q9 |4 w8 j/ I# h
  68. dma_addr_t dmaphyssrc1 = 0;
    6 S1 y& s1 p  k: T+ l0 S
  69. dma_addr_t dmaphyssrc2 = 0;
    5 H; U6 P, K2 O& A
  70. dma_addr_t dmaphysdest1 = 0;
    / g: i- s& A0 X
  71. dma_addr_t dmaphysdest2 = 0;+ u* R, _5 `$ k$ V0 i7 Z0 W
  72.   E( b4 S6 y6 v  n" T9 X' Q
  73. char *dmabufsrc1 = NULL;9 v0 v$ j0 b8 j+ E, Y) a
  74. char *dmabufsrc2 = NULL;( M- T& m5 V4 [) Z
  75. char *dmabufdest1 = NULL;4 P# }, {1 i) O! w: `
  76. char *dmabufdest2 = NULL;
    & F0 p: ]4 J2 S; @0 V
  77. 5 b+ ~6 f) h/ b3 x3 W0 E
  78. static int acnt = 512;
    ' F' G6 N% I( V$ j! T2 c7 c' w
  79. static int bcnt = 8;3 N5 X& m) q0 w. Q
  80. static int ccnt = 8;# S0 u; X) F. I% _( W
  81. . t3 [; D$ ]9 m; y( M, S5 t/ |7 \" p% r
  82. module_param(acnt, int, S_IRUGO);
    $ t7 `$ ~5 w, g& R/ U: M# H
  83. module_param(bcnt, int, S_IRUGO);
    + Q  A, \7 z; t
  84. module_param(ccnt, int, S_IRUGO);
复制代码

* c) [- `+ s+ c; H7 G6 m7 Y! p9 Z. W+ f$ z5 o. ?% x1 v
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 d3 g3 L. A$ [, S0 a) F7 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 Z# U; f* U/ [3 g, a$ W     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# J# B$ t- U! E' e3 ?% K5 b6 o3 F/ o+ [# R6 K* k
! H! V. x9 Z5 a" r8 V" X
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-12 16:35 , Processed in 0.039443 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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