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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! Y% m( q! W7 J" |: r* a* x: o" u
  1. [code]EDMA sample test application
    3 Y! {( e0 `0 K, T
  2. /*
    ' h) E. K' _3 S1 `3 i& @
  3. * edma_test.c3 B' A6 d5 T- N! q! \) D
  4. *
    & y' G4 _1 y( [: D/ G
  5. * brief  EDMA3 Test Application2 A0 Q- N( [$ O* }/ @, x8 y
  6. *
    9 Y* f5 `6 z6 P  R4 G; ^8 j
  7. *   This file contains EDMA3 Test code.& P: a; a+ g8 C4 j, i: A' h9 |
  8. *
    / ?+ J: v! A& W8 O
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 c8 b  V' H$ g: E; N( T" L( Q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, ^3 H, X: N' G0 z! @8 T1 I+ c. j
  11. *         TO CHANGE.
    7 @6 t& d& K# S; Q; a
  12. *
    + H; b6 o8 ^, t- V; x% O! C
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( B; H* R( ?- m5 n% ]/ Z
  14. *2 ~) I2 z- R: Z- x
  15. * This program is free software; you can redistribute it and/or: R. g3 c3 j/ v! I
  16. * modify it under the terms of the GNU General Public License as! h0 W! P4 E3 G: T3 _& ^  |' k
  17. * published by the Free Software Foundation version 2.
    - z% a! T! W3 J1 U4 P
  18. *
    . V& W1 }, \3 G( _
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 u5 T2 v2 H; ~, T, V
  20. * kind, whether express or implied; without even the implied warranty
    4 _% q, b* M' x& h
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7 B; U- ]8 Y, T$ N$ L
  22. * GNU General Public License for more details.& a% v0 A- B# @) @2 x+ y4 b3 o
  23. */
    3 C1 w8 c& H& u5 |

  24. . f3 `1 ~- ~' C# @
  25. #include <linux/module.h>! q# s- H+ v: a2 p0 Y& j+ ~
  26. #include <linux/init.h>2 D3 R* E- s3 F
  27. #include <linux/errno.h>
    , n4 T5 ~9 k/ b, ]3 u: X- f! G) f' S
  28. #include <linux/types.h>1 X" @3 F! G5 k1 f9 H: G
  29. #include <linux/interrupt.h>( F6 |5 v8 h" @( a2 i- G: p
  30. #include <asm/io.h>: B+ j9 F* E2 u# e. x8 d" ^) V; ~  \
  31. #include <linux/moduleparam.h>
    6 t" a6 s7 H$ a! b. V% y$ L+ C( U
  32. #include <linux/sysctl.h>
    # B1 r0 C; i! ]7 O4 M! Y- I
  33. #include <linux/mm.h>
    / B2 ~: v4 Q1 X+ U. V  B' |& z* y3 W- R
  34. #include <linux/dma-mapping.h>1 f8 u# L/ i* f/ c1 h( r% `
  35. ( y% ^9 U" L: X6 p
  36. #include <mach/memory.h>
    ( T# D& P, u7 k# t4 _9 c4 D% C) `3 `
  37. #include <mach/hardware.h>8 j! X" U7 U3 p$ x4 C$ s
  38. #include <mach/irqs.h>
      O. {' _* m1 I! h9 K
  39. #include <asm/hardware/edma.h>
    * Z# [2 c) E( \$ F
  40. 4 Q+ b/ Y, K0 i4 f
  41. #undef EDMA3_DEBUG( [% S# b. @2 a0 C+ J9 u+ a
  42. /*#define EDMA3_DEBUG*/6 U3 G4 _2 ]: H

  43. 2 p4 C' E- I3 ~* b  p
  44. #ifdef EDMA3_DEBUG
    : d7 r! j/ E& H8 h) Q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 Z3 y* m7 @+ I- F
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( I1 W3 Q5 [6 {
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ W& f) r  f7 [7 J. c# y
  48. #else/ s5 l/ V7 b8 z" v8 j* w
  49. #define DMA_PRINTK( x... )# @' R$ k9 X4 E" x" N
  50. #define DMA_FN_IN. O( H& d( c+ \7 b3 {) t
  51. #define DMA_FN_OUT
    ; o, h) j+ e# Z# |5 d
  52. #endif2 C5 \& ]" |" G' N- z& m8 Q
  53. 7 U. Y( ]; M: i
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    0 V2 b/ N2 ?) o" `# D6 P0 Z
  55. #define STATIC_SHIFT                3
    % r+ @2 K0 P# a
  56. #define TCINTEN_SHIFT               20
    : V; E  G+ X& P& i. S/ ^
  57. #define ITCINTEN_SHIFT              21# K5 u- n! h3 c: u! ?! [
  58. #define TCCHEN_SHIFT                22" u. o) j% @" I: G  T% K  h' \
  59. #define ITCCHEN_SHIFT               23
    $ h& g: {5 H2 e( E: S
  60. - C3 z' r0 Q7 k% v+ m! D4 G2 n
  61. static volatile int irqraised1 = 0;6 w8 e* O$ g# W9 L; Z
  62. static volatile int irqraised2 = 0;" S$ B! w2 g2 \  z4 Z  c# V

  63. - Q; q. ]! X% ^% l& _9 t+ Q) {
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 m) h: ]2 z5 L7 @% p) p! i
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 \# f( m7 d9 l+ ~
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 p, p$ F# i+ O% {9 v* _

  67. : |) u9 X6 s% `
  68. dma_addr_t dmaphyssrc1 = 0;; k! C3 u; U4 r2 Z
  69. dma_addr_t dmaphyssrc2 = 0;
    6 T/ t) U$ e! a- V4 w
  70. dma_addr_t dmaphysdest1 = 0;
    + j/ X1 N% i& V( X
  71. dma_addr_t dmaphysdest2 = 0;
    $ L) L* J& G. w

  72. ! c: N8 \# m. d. w7 x
  73. char *dmabufsrc1 = NULL;4 \0 w; _) }2 C% m! ]1 Q1 l
  74. char *dmabufsrc2 = NULL;
    8 S0 c% _& e! ^7 C
  75. char *dmabufdest1 = NULL;% l7 |/ {% M* Z) X6 u& M
  76. char *dmabufdest2 = NULL;
    - `8 `! C& D0 d  Q: f/ H7 |* Q
  77. 8 r1 }- I( ?7 V% @4 {7 f' v
  78. static int acnt = 512;) C2 e: B3 C& D$ C
  79. static int bcnt = 8;
    . R; ]& d$ ^4 P( V# \% {3 `5 ^
  80. static int ccnt = 8;
    2 L( [& }1 b) Q: u$ ?; [; f

  81. " ~, y! h7 I- Y9 R& J0 D7 q
  82. module_param(acnt, int, S_IRUGO);' K4 d- c: z0 ?- P4 c( [# b3 o
  83. module_param(bcnt, int, S_IRUGO);
    & |1 F& ]7 j2 x
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 H. A4 L2 b1 O+ K" K6 z

! K  m: m! r' I, z  ]+ v" F, P" t/ P      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 l$ w$ a1 \9 x0 K: M# [. ~( o4 Rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 j+ n( k6 G- o. }; {7 F
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 E% p9 k4 |: K) }" _

* E! c) v( M+ V! [( }: F2 J5 n
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-16 13:58 , Processed in 0.040719 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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