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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- z7 Y( {" i. z6 k
  1. [code]EDMA sample test application
    " @7 k( X$ f' W0 E) I
  2. /*" ^5 z2 i1 _2 w$ e! @6 K+ `3 U
  3. * edma_test.c
    / u( h6 ~6 U9 R, ~/ E
  4. *2 i) {1 L& P5 r
  5. * brief  EDMA3 Test Application
    8 P- h; K# W. e  j% L4 _+ l5 g, {
  6. *# X: `1 \- [+ p- l) |5 r& p( T1 Q
  7. *   This file contains EDMA3 Test code.
    ' c5 y( K6 L& K* p& _
  8. *0 ]) h( o' k' y2 I5 v8 u+ S6 m
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' ?4 ?& J9 `% ~+ W2 W
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" l8 I& @5 W- t% j- B% C$ `+ S4 P  `
  11. *         TO CHANGE.5 v$ U1 ~4 C6 K9 A
  12. *
    4 D9 P; O  o2 e6 U' l- n
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- A" X0 F! B# c. e, v0 K6 R
  14. *. ?# m  d* O; L- r+ ^
  15. * This program is free software; you can redistribute it and/or# k; E5 {+ q. @3 A
  16. * modify it under the terms of the GNU General Public License as6 d+ N( S) H3 R; i% |) u& z+ ?9 I
  17. * published by the Free Software Foundation version 2.
    $ \% S+ V" G3 p
  18. *' t4 x! E8 ?  N
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: ^" L% P8 W7 ~
  20. * kind, whether express or implied; without even the implied warranty& Y" b) l; ?7 E$ K6 T# X
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . m* t+ \! r: H$ _9 z5 Q
  22. * GNU General Public License for more details.
    $ k' k5 f  F" f0 T6 t8 n* h' ]
  23. */4 ^$ b5 h* C, @

  24.   w& E# @* g. T
  25. #include <linux/module.h>; B. c" {; ~0 e) n0 ~$ B6 ?
  26. #include <linux/init.h>7 c) Y0 Y5 j: D" ]$ b/ v
  27. #include <linux/errno.h>
    & E* K( h# l6 ~4 p7 N3 }. {6 a' h
  28. #include <linux/types.h>
    8 t" {7 Y: b9 c- Q9 E6 V! S
  29. #include <linux/interrupt.h>; L1 a; B3 x4 ]! ]! J- T
  30. #include <asm/io.h>
    1 S4 H. H* B5 M% s, M
  31. #include <linux/moduleparam.h>
    / s" a* a/ ?  k
  32. #include <linux/sysctl.h>  |9 l5 J; H: o; ^7 N2 I* q- @- X
  33. #include <linux/mm.h>
    ' M+ V' t3 m2 I9 U5 s& ^
  34. #include <linux/dma-mapping.h>8 T* d- d  Z; R

  35. 0 \4 B! ^# D. O  B3 i  ?
  36. #include <mach/memory.h>& r% a' d* `3 w+ k5 h/ y2 }
  37. #include <mach/hardware.h>2 [2 w/ [1 g+ S7 S3 Y; t6 x! `
  38. #include <mach/irqs.h>
    $ M. ]( p6 C) z4 @% K
  39. #include <asm/hardware/edma.h>
    ! h* ^" X; [( }
  40. $ e( H% C6 n$ ~0 x) M" q1 @' Z
  41. #undef EDMA3_DEBUG# W5 \( t: ]1 x8 I
  42. /*#define EDMA3_DEBUG*/
      M! O9 M4 C! F, |" \, e6 ~/ T+ ?7 w
  43. : |3 ^) f0 D( q
  44. #ifdef EDMA3_DEBUG3 k5 N3 M' O3 ~1 D7 y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    " Q9 F; e' }1 C9 ^# K2 j% a
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ' w% g) Y  i  m, \" r# N2 J  X
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - P; _; J; ?$ h/ R- a% K& D
  48. #else) z* D% ]5 d: v2 ^
  49. #define DMA_PRINTK( x... )  C  O& T' L; i+ Q7 D, ]5 [
  50. #define DMA_FN_IN
    ! i/ ^# M" w3 F, J$ p* Y/ c
  51. #define DMA_FN_OUT+ }0 C# h$ P2 e' V; g6 l  E4 y
  52. #endif1 c9 J  u# s+ G3 d
  53. 8 r1 U: y& {' A+ T: w  P4 n5 |
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  s/ F6 B2 J. R4 `$ b0 v
  55. #define STATIC_SHIFT                3
    , T- `8 V" W. f; u$ Q/ E5 K) V7 l
  56. #define TCINTEN_SHIFT               20
      m- V$ ~6 T- q+ a; F5 ~8 j1 I5 b
  57. #define ITCINTEN_SHIFT              210 B* J- D0 P+ R! U
  58. #define TCCHEN_SHIFT                22
    1 _( d# o5 ~' m! \* n
  59. #define ITCCHEN_SHIFT               23) C  _% p1 ]6 \- s; X) X2 ~% i" C

  60. ( b0 U  q) q, I4 t6 N$ }- N& Q
  61. static volatile int irqraised1 = 0;
    : r$ S/ s& Y& |0 r% Q# Y
  62. static volatile int irqraised2 = 0;
    9 F# b7 ^1 p# P1 b8 a6 c
  63. " C' E5 k: k7 @! A9 K
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% K2 J0 ~$ o' V/ l
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# y) ?, \& N8 P9 h$ s+ ?0 X
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 L' C4 ~2 P0 Q" o

  67. * i' s7 T- r4 y& r
  68. dma_addr_t dmaphyssrc1 = 0;9 C: ^; b9 L" A2 u8 F% ~
  69. dma_addr_t dmaphyssrc2 = 0;! u% S8 _9 c) ]
  70. dma_addr_t dmaphysdest1 = 0;; ~& Y5 r5 X, D' E1 _/ B
  71. dma_addr_t dmaphysdest2 = 0;
    # {0 T! |1 U2 T- W; F: C2 f( W& ^
  72. 8 s1 j, R" l1 B8 r/ r% Q6 u! c4 A
  73. char *dmabufsrc1 = NULL;
    / ?, p% h1 N- d, K: G4 o. L
  74. char *dmabufsrc2 = NULL;
    ; p. o  }4 z$ q8 n. q( _
  75. char *dmabufdest1 = NULL;& z0 v4 f! e# O' y4 v
  76. char *dmabufdest2 = NULL;# i* O+ N1 x% V
  77. # {- ]0 l$ l% {1 h* ^" r
  78. static int acnt = 512;1 D( B- S5 @/ ^% {
  79. static int bcnt = 8;
    + S: Y% }: s1 m" `
  80. static int ccnt = 8;- }' K1 [8 ~1 I) j8 Y

  81. ' I" F+ |2 Q4 B$ b
  82. module_param(acnt, int, S_IRUGO);7 D2 N" T, g  x2 H; [5 B- Q
  83. module_param(bcnt, int, S_IRUGO);
    : z! P, U3 Y# W- K, Q& M
  84. module_param(ccnt, int, S_IRUGO);
复制代码

2 |) \+ i/ R8 O" B( g; O( _9 U+ s( D5 ~; ]: s! [  S) _. b
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 \5 O3 q7 h  Z' f6 @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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- O* d6 p, r8 J# `1 B5 u     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) z$ {% A+ @( n! j6 g$ y- o

" F$ K! W5 @  z4 Y, J# ~
$ l3 D0 M8 s; H$ K" W  Y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-25 23:53 , Processed in 0.050682 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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