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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' u' F( h* C8 h$ J( |& |; x
  1. [code]EDMA sample test application# q3 J( F, h# |& j) G/ H
  2. /*9 V+ L. I& z3 j  |/ e6 v# D
  3. * edma_test.c6 n1 R0 E' h; C+ G
  4. *
    ( B; H2 O, S8 W& L! F
  5. * brief  EDMA3 Test Application5 u- R6 a% V1 h2 n
  6. *9 u$ @: z* s# f$ S7 O
  7. *   This file contains EDMA3 Test code.
    . |$ D9 B; l* X; n$ m
  8. *% P! D$ R: x5 g, P
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 W  G4 \8 {! x( P  f* `4 y) g
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: j5 c4 C; h5 {6 o1 c( {4 M, V; w
  11. *         TO CHANGE.
    3 h$ C3 t/ R: u0 h+ h& }% K' ^, R: T
  12. *$ P+ ]0 p, X/ s* O
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; k3 k" _# q) p: ~4 C
  14. *' z# I0 _0 p5 I8 `" y2 b( U
  15. * This program is free software; you can redistribute it and/or
    " y! z) z6 Z  K/ {( z) i
  16. * modify it under the terms of the GNU General Public License as
    ' |$ `! b7 _# c4 @7 y* J5 y5 l5 }
  17. * published by the Free Software Foundation version 2.' X3 }" k0 {# }! X/ y5 v
  18. *; b, B: k" ~7 a" \; i2 D5 J; o) I
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, V) `/ d" }- Y- ?7 p5 ?
  20. * kind, whether express or implied; without even the implied warranty
    + @( W7 Y2 E5 f" g6 \
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - M) [2 L) T9 ?% ?
  22. * GNU General Public License for more details.5 f! a2 Q+ ?6 o6 g2 s
  23. */
    $ N- @* [8 N* O( |  s  u
  24. 5 z" m; T3 B5 e9 ?. q3 B: S$ D  p
  25. #include <linux/module.h>
    $ f+ g# ^9 c) O7 d$ K0 @
  26. #include <linux/init.h>. h$ h/ C3 h+ Q( l/ ~( ~- a! [3 m
  27. #include <linux/errno.h>
    * n; x" s3 ?9 V" c
  28. #include <linux/types.h>0 p/ S, Q4 F- B; o
  29. #include <linux/interrupt.h>
    2 Q" H* E: l8 A1 z6 O" R
  30. #include <asm/io.h>8 l9 |  i! T; m- U
  31. #include <linux/moduleparam.h>  i# y9 X- }3 P/ z$ N
  32. #include <linux/sysctl.h>
    , x7 s& @8 Q! z3 Q! u
  33. #include <linux/mm.h>
    & I/ X) N5 \" F
  34. #include <linux/dma-mapping.h>
    $ d8 o0 ~+ J5 W* k
  35. 6 S9 \9 u' G% \: X3 K
  36. #include <mach/memory.h>  Y9 G4 [1 C* Y# q$ X# e
  37. #include <mach/hardware.h>
    % U. C, D' \+ F, _4 Y1 l6 `' Z
  38. #include <mach/irqs.h>' G  b! i* g5 o( K, f' m) W
  39. #include <asm/hardware/edma.h>
      H! `2 L* f9 j8 Y( t; P; C% A

  40. 7 q; e4 @9 Y+ n
  41. #undef EDMA3_DEBUG: S" N0 a6 `  d$ |. F; D
  42. /*#define EDMA3_DEBUG*/2 r6 I1 o% L3 P5 ~
  43. 0 f  V. C) l% }* e
  44. #ifdef EDMA3_DEBUG
    ! x9 `: ^; q9 v! F. g" p/ n
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ P5 h" U, @1 c; y) F0 }
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    0 X+ |: W/ S4 K- M5 I
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      |$ o: Y& b3 D+ C! J& q' x" h
  48. #else
    5 b% g1 M! L- |, p% Y
  49. #define DMA_PRINTK( x... )
    3 A/ }* u. R( q  `+ Q$ X, N3 ~5 V
  50. #define DMA_FN_IN
    2 z% A% W3 }- ~$ |2 y6 s' T
  51. #define DMA_FN_OUT+ I4 N4 _) Y, ]% x
  52. #endif) }4 [$ P5 K1 m5 Q3 g
  53. , p7 b) x9 i+ ]( c0 ~3 R! s
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 Q! U3 I  k$ y9 r- c; {3 H/ _
  55. #define STATIC_SHIFT                3! c! c1 d: S" Y4 u
  56. #define TCINTEN_SHIFT               20
      {: @: d' L9 y6 i2 i( u# o5 X+ u. b
  57. #define ITCINTEN_SHIFT              21
    8 \' k* D0 L, d
  58. #define TCCHEN_SHIFT                220 h/ q# o1 U8 ?9 R
  59. #define ITCCHEN_SHIFT               23
    . }8 T1 U; K5 @

  60. 5 q, t; O0 f- I( i1 O" M6 O+ S
  61. static volatile int irqraised1 = 0;- U/ P# L+ |/ f; z% }7 ^; q
  62. static volatile int irqraised2 = 0;
    9 U' y6 [; w) ]0 F( Y
  63. 6 ~* d( o4 S  H( A% Q0 C0 C
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 L  p  {3 z" `, ~9 H
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 w! R9 V) V: i5 y- I; o4 G6 K, ~9 W
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" @- A$ U9 r9 Q2 D

  67. 6 M% j" ~& S+ a8 N& f
  68. dma_addr_t dmaphyssrc1 = 0;
    9 a8 V8 d% u) d5 a
  69. dma_addr_t dmaphyssrc2 = 0;
    # \* ]0 P. V* {6 e* m& o: v
  70. dma_addr_t dmaphysdest1 = 0;
    " y; Q: E2 n  ]
  71. dma_addr_t dmaphysdest2 = 0;3 ^5 P5 W' n' Z/ m% V3 _) Z# U+ j5 L
  72. & F6 j, ^* ]( h3 y% c
  73. char *dmabufsrc1 = NULL;
    - ~* h$ H  E$ ~- S
  74. char *dmabufsrc2 = NULL;1 U+ u2 C% [* ^) u
  75. char *dmabufdest1 = NULL;; W% {9 [8 @4 x$ O4 s- M5 h! X: \
  76. char *dmabufdest2 = NULL;5 G) M7 h3 [, L. `
  77. ' c& P: t5 T/ _6 |' }
  78. static int acnt = 512;; n( z- m9 l4 z% C* `: a& n( c
  79. static int bcnt = 8;7 x9 U/ g! H2 m/ P# i' G* D0 ?
  80. static int ccnt = 8;
    0 A2 _3 |( v" E+ J

  81. / Y# N0 o# A  I( d$ [
  82. module_param(acnt, int, S_IRUGO);8 n5 x: d) G: ?! `, K- a& |
  83. module_param(bcnt, int, S_IRUGO);
    + [1 H% j. h# q. I' s  W
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( H' t+ t( }* f. ?3 o" m2 f  W0 m- t& L
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ V' D5 u2 U- i1 N% E" ]. a3 larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. V5 }6 e' {* O; Q  S8 Y/ a) c# f, ^     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 v+ C, Z) _1 u0 s/ V2 g* i
1 v$ Y4 b* @2 C0 i: T+ R; h& X6 L8 K8 R( b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-15 11:04 , Processed in 0.037551 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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