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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 L$ I  v$ G5 ?. q, v- i  q- g
  1. [code]EDMA sample test application
    3 k, f( k; w) h# }5 ~" O& b
  2. /*+ d2 b4 m; Y, y7 i+ x, J  `: n
  3. * edma_test.c& K( _! Z$ \  {% p: ~% Z
  4. *$ I4 R1 a7 q5 q8 s
  5. * brief  EDMA3 Test Application" d/ k7 N, P" _& P
  6. *3 R3 k) {# l6 P2 }5 d8 m5 H
  7. *   This file contains EDMA3 Test code.
    ; r6 Y' K2 J+ s- A3 a' W
  8. *
    7 I. h( I) S/ j7 `+ g
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      t, I: F5 R- V* R
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    - H! n, @" n; N2 ?7 v! T* v
  11. *         TO CHANGE.
    4 x5 T' U* k$ T4 ~
  12. *
    ! Y3 Q. q8 B' D: f# S( X6 ~( S# j; U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* B+ ?1 g7 m$ s  }* ~
  14. *
    6 B6 R& o* h' `8 e/ U
  15. * This program is free software; you can redistribute it and/or
    / ]9 I+ r2 o0 b9 {( T# b; z0 V
  16. * modify it under the terms of the GNU General Public License as
    " G+ U  k0 m: S9 ]
  17. * published by the Free Software Foundation version 2.5 C: y1 g, n- q0 ~/ H
  18. *$ i% N. A. I3 I  h
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
      q- ?. g) U3 L" [  G
  20. * kind, whether express or implied; without even the implied warranty7 F, }: I# G, \, m8 e/ G
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1 \) P2 J9 C5 k) F! \' ^
  22. * GNU General Public License for more details.4 B3 s% T. d* _, b- `
  23. */3 i; `! D% x) [  O9 [

  24. ( J- P5 u" @8 {" w
  25. #include <linux/module.h>
    6 |$ Z# W% E4 s' `
  26. #include <linux/init.h>$ U1 n/ }' z8 w) U2 l" O, R
  27. #include <linux/errno.h>
    " F5 H, Z3 O+ r- B) f4 e
  28. #include <linux/types.h>
    ( e* f' ?/ [* w4 x  t0 u; M
  29. #include <linux/interrupt.h>& L2 A$ N0 x. |8 x, Q! h& R
  30. #include <asm/io.h>3 V, g6 f. A: Q3 F# _
  31. #include <linux/moduleparam.h>3 `/ b/ Z6 n& H& C. U6 w
  32. #include <linux/sysctl.h>! x4 f8 x1 y( K! x4 t' M+ B# s
  33. #include <linux/mm.h>
    , R: p% a" H% w
  34. #include <linux/dma-mapping.h>2 A3 J' ?4 C  x

  35. * t5 m$ d; \$ l9 ^( g
  36. #include <mach/memory.h>
    $ S. _! I  a9 Y$ C# I" W
  37. #include <mach/hardware.h>) `  n; L+ j# w- b# d- A3 g2 P0 ~
  38. #include <mach/irqs.h>
    - ^4 U/ V( I, D1 `/ U
  39. #include <asm/hardware/edma.h>, w- v4 K: K$ K3 L9 H; B" Z

  40. 0 p" @  N( a+ E
  41. #undef EDMA3_DEBUG
    5 {5 s8 ]. u1 x/ r
  42. /*#define EDMA3_DEBUG*/
    * E7 t4 _* S0 ?( N$ v$ H

  43. ' [( S2 X8 y8 A$ q$ B6 o# ?- y
  44. #ifdef EDMA3_DEBUG# p- }8 C* `1 h( ]7 {, g9 ]
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    : |# p) D: K/ o) g" v
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)  `1 F, f# p/ U8 W- }
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)  F& x" O& I7 t  a; o4 |" }" M
  48. #else  w# L7 S, A* X# y3 ?* m6 Q2 Q: N, a
  49. #define DMA_PRINTK( x... )
    9 \+ f0 B2 ?$ j
  50. #define DMA_FN_IN
    / V) h& \; ]4 i' g
  51. #define DMA_FN_OUT
    % w: B' f. {; T" {. F
  52. #endif6 ]6 o( K; M7 S) @4 V" O) P  T
  53. 6 A  x  o7 C) h& l6 A4 K% T
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)& Z. x2 B- o  w/ ]+ o* g8 Z$ _
  55. #define STATIC_SHIFT                3
    & c! N  N' N" ?( `
  56. #define TCINTEN_SHIFT               20
    ' T4 m1 J/ _# {& \5 N( }1 E
  57. #define ITCINTEN_SHIFT              21
    " f- c) X7 x$ X+ Z" \7 O) c6 W
  58. #define TCCHEN_SHIFT                22
    2 E7 T  Y" Z7 V& x$ F1 S, b
  59. #define ITCCHEN_SHIFT               23
    9 i6 r* J* P; n! U
  60. 9 D8 [5 J) b7 h. N6 V4 q' D
  61. static volatile int irqraised1 = 0;3 a) n' q6 ]3 A+ [3 t7 K- t
  62. static volatile int irqraised2 = 0;
    ; D) }8 ^# n8 W  P! }4 R' F( z
  63. 3 S: R: J2 F; l2 X- z2 W4 n1 |5 B
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 v4 y. Q8 M8 Y& ^6 M
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * B* M( F. p' a) y+ L
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      N  A$ v5 S3 O
  67. 1 f9 b0 [& y; v0 U8 m# C' T
  68. dma_addr_t dmaphyssrc1 = 0;5 a! @! n% V% H# h! `$ @( s" p
  69. dma_addr_t dmaphyssrc2 = 0;6 v6 z+ n- K1 h, M; L% F2 X) D" r
  70. dma_addr_t dmaphysdest1 = 0;
    2 K- T% F( x  y/ k
  71. dma_addr_t dmaphysdest2 = 0;* ^1 }* O: H: k5 X3 {
  72. , M" u. m7 B0 m( s, |4 y
  73. char *dmabufsrc1 = NULL;
    / t% d: I- p2 {6 Q
  74. char *dmabufsrc2 = NULL;& ^5 ?* f# _9 C0 Y4 o
  75. char *dmabufdest1 = NULL;
    6 S9 i5 ?  b" \
  76. char *dmabufdest2 = NULL;2 G% `& K5 f% T) x6 k
  77. : F9 Y8 x& c. i, F; X
  78. static int acnt = 512;
      P/ t; }9 \% e8 f1 i
  79. static int bcnt = 8;
    - I# u: ^# F2 ]7 c6 b
  80. static int ccnt = 8;
    1 h1 c. E0 f" k2 H

  81. * Y5 y! i# W, B9 O- [+ a, m
  82. module_param(acnt, int, S_IRUGO);5 a7 }3 t) N- T5 I7 A  I
  83. module_param(bcnt, int, S_IRUGO);1 |9 n; A3 \4 r# ~9 U! {8 O5 N
  84. module_param(ccnt, int, S_IRUGO);
复制代码
% |* C' t" @9 c5 Y3 D
" Q& A$ o: m+ e6 U6 F- o9 Z3 s+ @8 g
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: Z& D9 ?( K5 \2 \
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, @( Z( N6 o) t
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 I5 y* G0 y4 {! g# q
2 T8 E8 `0 K7 y+ Z
7 L+ s/ t+ h5 ^5 q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-18 19:43 , Processed in 0.042057 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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