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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 K3 U8 }; L5 ?* d! h; G, t3 v0 I
  1. [code]EDMA sample test application  U1 z& k  C+ k5 B% y3 D% x
  2. /*
    , C& M; P3 R/ [5 L! p
  3. * edma_test.c8 P3 u; o( ?, u2 |9 v' J0 K$ k) ?
  4. *' f/ D0 O( H& T7 O
  5. * brief  EDMA3 Test Application, J6 I. f: n; T" M  f4 I
  6. *
    : W) X* Z5 p) d  v: a$ i
  7. *   This file contains EDMA3 Test code.$ W2 Q& V  K- V2 o) ~" T3 b
  8. *
    5 s% I( \2 c& L7 r; R/ [2 o
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& ^) X7 X9 Z9 B
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: A$ A4 i/ S3 ~6 ^& g+ k
  11. *         TO CHANGE.
    % ]0 r4 H' x  x5 N% ~6 }: ^) J
  12. *
    6 p) w: E2 w/ B+ _7 N  Z  Z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" B* K# `& T4 I+ H1 f
  14. *
    8 J! L, C: X) a
  15. * This program is free software; you can redistribute it and/or/ M" F3 N5 X7 }$ ]# S/ @
  16. * modify it under the terms of the GNU General Public License as" c, K1 s3 r* g$ F
  17. * published by the Free Software Foundation version 2.+ e! G6 T( p" C# x1 M3 C) n- ]
  18. *
    1 E. b, @5 p- d$ ~8 f; {
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    $ Z; s* y& E! c  F; ~) B3 J" F
  20. * kind, whether express or implied; without even the implied warranty
    0 ^+ G; u, G9 T& @' a/ {7 C5 V
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    " m$ B1 e. V9 Q" U8 T1 _, O
  22. * GNU General Public License for more details.
    ( p' a  j( m" v5 C. l3 `9 l
  23. */7 n, s0 K* {6 r
  24. % X# d3 M5 J) A! e; S, d
  25. #include <linux/module.h>
      y7 T: l# L: _7 T& N
  26. #include <linux/init.h>9 }2 _% y* o4 b( L9 q8 M" x; H: R
  27. #include <linux/errno.h>6 Z! a6 M; F" i" c! m* J
  28. #include <linux/types.h>
    # N1 k+ f6 F7 G0 p
  29. #include <linux/interrupt.h>1 y( D, B: ~- B& d) y0 [( i
  30. #include <asm/io.h>
    7 h4 G# @, K8 V" ^3 U4 s7 k
  31. #include <linux/moduleparam.h>
    + n) c1 K$ ^" ^" P5 F6 C# S- y
  32. #include <linux/sysctl.h>
    4 M( C5 s8 l  s" T
  33. #include <linux/mm.h>5 }# ?; v$ ?8 ^- A
  34. #include <linux/dma-mapping.h>2 B, K5 m8 D0 Y7 U6 W

  35. 3 F) A: `2 A4 J9 q
  36. #include <mach/memory.h>1 f0 R; o" p& E# G4 H: g& H
  37. #include <mach/hardware.h>
    - `/ }2 ]" A8 ^6 V, F( S
  38. #include <mach/irqs.h>
    ( A" f5 X/ D# X1 d9 C2 R
  39. #include <asm/hardware/edma.h>
    ( q6 Q: m0 O: M5 p  i0 ?
  40. * w: ~' I6 S7 W3 ?0 d0 n
  41. #undef EDMA3_DEBUG; @' j" X, l: L* }3 S
  42. /*#define EDMA3_DEBUG*/
    + V) o  c1 y3 j. }6 P" B
  43. 3 K8 h6 o/ O: ]" [6 j5 i7 a( s" ^
  44. #ifdef EDMA3_DEBUG
    " V% C6 O; S4 }) U! p, V
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    $ L, f% k" Q# Y5 ~' r* E4 Y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 j) z& D  J+ K$ E+ S
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    4 v( v. ]3 @- j; X& i- U5 A
  48. #else- J+ e  Q, C* |
  49. #define DMA_PRINTK( x... )
    7 W; P7 E# a0 o7 T- b1 I4 t' b
  50. #define DMA_FN_IN
    7 r5 K; R7 ]8 v: K6 h
  51. #define DMA_FN_OUT7 M. P3 k0 B- S; D
  52. #endif: ~3 x* W+ r& J/ i+ C$ L; Q

  53. / [' A- @) c" N! ~5 }; o
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)) Q8 E8 I! q8 B; V
  55. #define STATIC_SHIFT                3+ U) ^' I3 `3 K4 E6 l, I' s
  56. #define TCINTEN_SHIFT               201 n" C; Q! n/ ]9 H0 [3 \
  57. #define ITCINTEN_SHIFT              21+ ^( G! l5 d: Z2 w1 g
  58. #define TCCHEN_SHIFT                22( }8 F8 Y" g- z: M8 D. B$ a
  59. #define ITCCHEN_SHIFT               23
    8 }8 k( l& l$ Y

  60.   B! b2 K+ g3 g% a3 C( [
  61. static volatile int irqraised1 = 0;! \& B, y( p8 z2 f1 Y; [: L. Z! f$ N
  62. static volatile int irqraised2 = 0;9 V* q1 d; z8 z" ^6 U
  63. ! u: ?  H& L1 S  N+ x& w  F
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( Y- Z9 c: y5 q1 M* o* d8 R7 A
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 u# W- [% e" B, y4 D5 v# S2 U1 H
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 {# H4 h; n4 ~0 h- r

  67. 1 W5 P, @7 c2 ]
  68. dma_addr_t dmaphyssrc1 = 0;
    4 m6 P: c  h% u" k$ o1 S
  69. dma_addr_t dmaphyssrc2 = 0;# ]; F+ T* m7 j. N4 M  D- S
  70. dma_addr_t dmaphysdest1 = 0;5 }' x6 O3 r/ q/ f7 s+ S
  71. dma_addr_t dmaphysdest2 = 0;% _' V' X; y# U

  72. ( q$ E! S* m- A5 Q- y; k: Q. J' ~
  73. char *dmabufsrc1 = NULL;6 Z2 M  z& d$ F, {7 u$ e: ^* ]
  74. char *dmabufsrc2 = NULL;' T0 l- U7 z# I* w! y" g6 U
  75. char *dmabufdest1 = NULL;
    & o* \0 O. B" _( t) J2 X
  76. char *dmabufdest2 = NULL;
    9 l+ u9 i3 e! Q. T- A

  77. 8 ]' K9 N2 o  f4 V9 K) n) y4 B0 c
  78. static int acnt = 512;; N( a$ I$ s7 L
  79. static int bcnt = 8;* h+ @* t- T: }1 m$ U, i
  80. static int ccnt = 8;% A3 R1 B+ d+ k/ u2 Q4 I
  81. 6 {3 D; T* q4 f1 l
  82. module_param(acnt, int, S_IRUGO);: {( b- Z& v. }
  83. module_param(bcnt, int, S_IRUGO);# r$ r; ~( S& d3 ?
  84. module_param(ccnt, int, S_IRUGO);
复制代码
" s. _4 m' U$ K' g
& f# X3 ]7 |5 Z5 u, g. z" s4 ^
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 f3 X2 T0 S1 H: \! s* O" Z: |$ {
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" \3 V# ]! p$ q3 b- w6 N
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" _0 |: S/ a! Q( D
9 S* I8 k) t! z5 [( \  p

' ]! S2 g2 l  ^/ f  U
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-31 20:10 , Processed in 0.035992 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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