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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 V8 v: T) Z+ y7 ^8 O
  1. [code]EDMA sample test application7 g9 r1 w: T3 v6 G; R
  2. /*5 g5 y9 t+ T) m% t
  3. * edma_test.c
    3 D9 d& Z  W3 a* t" p! Z& U
  4. *
    : I- }( W! W" B9 I) J
  5. * brief  EDMA3 Test Application/ W" h! P# X! ]- O- \. A
  6. *
    - i1 X8 f& w4 M* e; s" W6 Z' e
  7. *   This file contains EDMA3 Test code.* n$ F8 @' a3 V
  8. *
    1 c, e5 Q) I/ J$ f) W  s
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    3 E' e+ c2 j, @7 c. m3 W
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) \; a& N) D+ R/ s* p* \+ O
  11. *         TO CHANGE.
    6 Z/ ^+ Q% f! j# E: ], P
  12. *
    3 ]9 R+ p' Y" O7 H
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; V8 g) M. W; t4 Y
  14. *
    7 Y% b0 C) j6 z; G
  15. * This program is free software; you can redistribute it and/or
    * W1 F8 {7 O; u) _% C6 b
  16. * modify it under the terms of the GNU General Public License as
    7 Q$ z9 \' r% `) a$ u4 a2 \8 M: t
  17. * published by the Free Software Foundation version 2.8 m; N8 u' j" R9 z
  18. *+ m1 J% \0 m- H  D6 g6 z$ g0 _& P
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    * O/ Q; N9 s; r6 s$ k6 C
  20. * kind, whether express or implied; without even the implied warranty
    ( Z( h3 I6 {( T* Q2 E& z! {0 d
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the# A* N4 |  J5 J
  22. * GNU General Public License for more details.& U4 n. j* `) ~
  23. */
      L+ e" ^7 A0 J" F

  24. 1 ?( \4 Y; R$ h8 |0 \
  25. #include <linux/module.h>( \: N+ M3 a/ j4 S8 t) N
  26. #include <linux/init.h>5 Y- A! n& f: b7 A
  27. #include <linux/errno.h>: C( B0 c- S! O
  28. #include <linux/types.h>
    ! U; P; J) b5 d/ @: y% y/ s
  29. #include <linux/interrupt.h>$ d3 M9 N( F. J% v4 M
  30. #include <asm/io.h>/ p! W: j) `" Q( e3 b. B, {
  31. #include <linux/moduleparam.h>3 L  ^6 m7 Z$ Y# J& S
  32. #include <linux/sysctl.h>
    , M9 ]) H2 U# C; l$ Q$ ^
  33. #include <linux/mm.h>
    . W: T/ L9 S9 F7 }$ G( r5 f) v
  34. #include <linux/dma-mapping.h>
    0 U1 V! x( P+ g8 @
  35. 4 ?) [8 G9 J: N4 P2 E
  36. #include <mach/memory.h>1 J4 j; ], [/ c' L# g, |' `
  37. #include <mach/hardware.h>
    0 X6 V: U5 }$ h9 H( g- a
  38. #include <mach/irqs.h>" r1 X  {+ K+ m# E  b
  39. #include <asm/hardware/edma.h>
    ( u) y6 d3 w6 b3 \- D0 k9 K5 V
  40. ( Z: g9 ?/ {+ v" C
  41. #undef EDMA3_DEBUG- Q2 J( x) q4 }/ t- c9 {# n* F
  42. /*#define EDMA3_DEBUG*/
    . X9 Y4 _# ]3 ~

  43. 7 \, c: ?2 H) A. c; q% Z# L& n( A
  44. #ifdef EDMA3_DEBUG
    7 L5 ^9 ~3 E4 i1 e6 o8 ^
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    / v5 y1 ?2 G9 c3 P1 a6 M
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% ~, W) P( X/ V6 V1 f
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 k; ?5 W( ~5 s9 m3 P6 i
  48. #else
    : n- C0 B3 D. X: v2 a1 G& ^' n
  49. #define DMA_PRINTK( x... )
    $ {6 Q& r2 k! g+ k
  50. #define DMA_FN_IN
    ( z; F3 z* ]/ L+ p! ]2 W
  51. #define DMA_FN_OUT! T% D" g8 q. K# {  W
  52. #endif* F$ O7 H. S' P$ T8 p" J# X% s3 ]
  53. 1 B$ T% l7 ]" i+ U, }) w  J$ x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " H) J, q  z8 y; s
  55. #define STATIC_SHIFT                34 {8 \- ^' J8 J9 W% g  @, f
  56. #define TCINTEN_SHIFT               203 {  ]! N. m" C" m7 A' F# M
  57. #define ITCINTEN_SHIFT              21; I( L& D: Q! ~- P
  58. #define TCCHEN_SHIFT                22
    " r2 W# Z6 {0 _" ]! q
  59. #define ITCCHEN_SHIFT               23
    6 R% `$ O+ [  v2 O- Z2 U/ g

  60. 1 r  o. c4 B8 Z
  61. static volatile int irqraised1 = 0;
    8 w  o- b, Y: C* F
  62. static volatile int irqraised2 = 0;
    % z0 U8 h# o, v, U  c. `3 Q4 x

  63. $ Z# D" e9 E  u( r* o; x
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 ~* f2 Q% M! A. a$ |2 [: P
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " m$ V- \& e* v5 H8 V1 h
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: z: E+ V8 F, [* P7 U
  67. & X/ t) _  n% q& p
  68. dma_addr_t dmaphyssrc1 = 0;! f; K& r9 |# F% ?6 u  d3 ~! ]
  69. dma_addr_t dmaphyssrc2 = 0;
    / x: O2 R5 {. d
  70. dma_addr_t dmaphysdest1 = 0;" ]/ d, F. ?& ~1 |- j( k
  71. dma_addr_t dmaphysdest2 = 0;
    % V5 K, G# g; t% Q9 R) X* |

  72. . m! C2 Y% g( T) L4 N
  73. char *dmabufsrc1 = NULL;
    7 Q- q( V; k$ n4 T. M
  74. char *dmabufsrc2 = NULL;) @6 l3 ]' H# K$ G5 a, V: a
  75. char *dmabufdest1 = NULL;
      M( g. A, ^8 V$ {1 `  |! k' g
  76. char *dmabufdest2 = NULL;6 u. n  D1 F; ^% F# m/ ~4 q' W0 X

  77.   r" p2 a+ v$ \4 \
  78. static int acnt = 512;7 E2 E4 B3 r2 w3 k2 X0 n- ?( c! Y
  79. static int bcnt = 8;
    5 {2 [1 c8 {+ w) w: I
  80. static int ccnt = 8;. M7 |5 s# D0 I1 K" X
  81. 0 ?" h4 d0 ?' z# P
  82. module_param(acnt, int, S_IRUGO);  m7 T% z: W+ I6 L5 X
  83. module_param(bcnt, int, S_IRUGO);
    3 i. \# ]- c% c* k" i) L
  84. module_param(ccnt, int, S_IRUGO);
复制代码

& h) j- }& d& G# e8 n& C; L
9 M  W  W& E# n2 S& K7 j* Z- }8 W      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) r% o6 B- G, s, Z* S' U. Jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 V2 y' A$ F" O! L- f/ g$ _8 q9 ^
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. |% k" z" j6 a- T: `3 r

  G  l& m9 n, g3 N
. A/ W+ U2 K3 g
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-29 09:05 , Processed in 0.040193 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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