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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* s& G8 G4 y0 Y0 P1 p7 u# [
  1. [code]EDMA sample test application
    " v% [2 N4 Q) j' f" K) L
  2. /*3 k$ ^0 d6 w: d
  3. * edma_test.c
    4 O7 g8 z* w$ O# e2 x
  4. *% j  Z7 Q# W5 e: l/ Y9 T2 ~
  5. * brief  EDMA3 Test Application
    8 r0 h2 ]. x, a
  6. *
    ) y% ?' ?/ q9 Z! g) G1 q
  7. *   This file contains EDMA3 Test code.
    0 V/ Z' f6 x" d. J3 p3 O3 I* n
  8. *
    " D, e# _5 `  J% D  S
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    4 M8 {6 G9 @# C3 y; _. m
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' [+ l4 A4 E  @: G0 w5 E4 Z! |
  11. *         TO CHANGE.: E8 K! v9 r, `, B, @9 I
  12. *
    $ k0 s" d& h' I( A$ V, D' K* j2 h
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    4 k. I, K! l2 N: V$ ^, [  x3 m
  14. *6 V6 s) G% C4 D
  15. * This program is free software; you can redistribute it and/or
    * P+ r( f$ g0 h, ~4 x! D8 H
  16. * modify it under the terms of the GNU General Public License as! i( |0 a( V) V3 l5 d# M' s2 e
  17. * published by the Free Software Foundation version 2.
    2 J+ _! ^& E3 u0 h" u: D0 h2 `
  18. *
    + O9 W9 Q2 f- h' m& R; D
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any% q! t; B2 O- {( s' H
  20. * kind, whether express or implied; without even the implied warranty' }2 D5 K% @1 g! W6 s2 Y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) K$ n6 o: v4 K9 b5 W
  22. * GNU General Public License for more details.
    9 I5 V3 E8 Q. H
  23. */7 k  {  x" |; L

  24. 3 W/ Q; ^. \' y1 w5 G+ X& T
  25. #include <linux/module.h>
    % R, |( U) g3 R7 T
  26. #include <linux/init.h>% k' l; R2 m  [- Z; S5 s
  27. #include <linux/errno.h>
    $ I+ f3 u- x$ j7 T- ]
  28. #include <linux/types.h>1 G4 z* Y( l. W+ l9 c3 I. z. L) l
  29. #include <linux/interrupt.h>! f$ C0 V- h* }, f& _# [
  30. #include <asm/io.h>
    1 @4 |# w. K$ ?
  31. #include <linux/moduleparam.h>
    6 ^8 n7 U9 M5 J8 a% D
  32. #include <linux/sysctl.h>4 r# _% ?, A9 d- Y# R
  33. #include <linux/mm.h>2 c( W9 ~/ Q2 w5 p# c: T
  34. #include <linux/dma-mapping.h>  v0 c) A) j9 i3 k6 G, i( M
  35. 3 n7 x/ U6 K) |" T. \
  36. #include <mach/memory.h>3 A- W5 j8 V+ q/ n5 \: G
  37. #include <mach/hardware.h>
    1 p$ G& ?2 q3 a
  38. #include <mach/irqs.h>
    * V2 i' f  w5 D* z) ^7 s3 `2 s& G& u
  39. #include <asm/hardware/edma.h>
    . h' S0 ^0 H8 u& q1 ^8 t
  40. , c/ k0 e: B* Q
  41. #undef EDMA3_DEBUG; y" |- l7 X9 D& U0 k
  42. /*#define EDMA3_DEBUG*/3 C+ J3 W" k$ u2 d

  43. % D' P; [$ L/ M
  44. #ifdef EDMA3_DEBUG
      }' p2 W5 ?* n+ b( x
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ Y" l6 z$ _3 N4 b. X% @6 }7 X
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    - i2 c4 Z, e; A
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    0 M9 \1 J9 l# s* M1 j" a
  48. #else* W5 y1 H3 ^4 Q; t7 T8 J
  49. #define DMA_PRINTK( x... ); B( V6 P) c7 h& M
  50. #define DMA_FN_IN
    ( L- x; n4 V- [1 U2 ^; H
  51. #define DMA_FN_OUT7 g  _& s, n7 s; |) P
  52. #endif( v  |. V6 K$ e  b: N
  53. 9 I2 e( c+ c5 }  U7 C
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
      ], ^2 J' B: z6 P
  55. #define STATIC_SHIFT                3
    8 _3 ?7 ^4 q( ?
  56. #define TCINTEN_SHIFT               20. E4 r. i3 ^$ [, v
  57. #define ITCINTEN_SHIFT              212 W. o. R- K6 T. L8 u
  58. #define TCCHEN_SHIFT                22
    - R" ?" Q. h5 @$ P: e
  59. #define ITCCHEN_SHIFT               23
    ' Y0 a4 z3 |1 ?# y- y! g- r1 S( @4 _
  60. , P3 _! y8 ~2 S) c
  61. static volatile int irqraised1 = 0;2 J5 \4 ^/ w; F" {( W& Y: S% T8 p; }
  62. static volatile int irqraised2 = 0;6 p5 h5 F% \6 [  b1 R: q, }, \9 ]8 t

  63. $ C; ~! t, E- u6 A  C
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 S8 y& F! A- x7 T% T1 B
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + f, J4 S1 S' U4 [5 }
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & ~3 O- S, ~9 z- e3 {+ G( N6 b: c
  67. $ V5 `6 i1 i: ]. G$ r( c
  68. dma_addr_t dmaphyssrc1 = 0;
    " E/ k. g' X5 W; t! D/ [* J
  69. dma_addr_t dmaphyssrc2 = 0;
    7 x1 k+ g, t% V; Z! y3 y% m" o
  70. dma_addr_t dmaphysdest1 = 0;
    8 R, D% I& c/ ?0 m
  71. dma_addr_t dmaphysdest2 = 0;
    " o/ i/ \( |7 U8 _

  72. $ t3 `1 ^) b, {# V7 \% _: p1 x
  73. char *dmabufsrc1 = NULL;
    ) ]. c& @2 j4 J) E! f( [+ |, y# N
  74. char *dmabufsrc2 = NULL;7 @$ Z+ Z8 G. T' M' o# l4 r
  75. char *dmabufdest1 = NULL;
    % m; J. `8 A" y2 ?6 p! I6 T) u
  76. char *dmabufdest2 = NULL;
    ( \* g* r3 A. @

  77. 6 z5 M3 X0 h- N9 G
  78. static int acnt = 512;" ^4 B0 |2 ]1 h1 K3 f+ {
  79. static int bcnt = 8;
    # M& ]) {0 J! U6 E+ E& f7 H
  80. static int ccnt = 8;
    : ]: N6 a* `/ x4 @8 u8 e

  81. . i8 @  V2 J% }  J4 Q. c' `
  82. module_param(acnt, int, S_IRUGO);$ ~' `8 Q# @7 C8 K0 @' `
  83. module_param(bcnt, int, S_IRUGO);
    4 C2 ~; S* E% Z, `. u
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 g% _! R" w0 o7 k& R1 e+ ~8 m/ ?  z4 i: l& z: c3 P2 ^& @7 K/ ?
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 G& i: s) V% R5 D+ v
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: f3 [8 K/ P! [' J
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' q+ X, X+ q/ L9 ?

2 P/ }8 p9 y3 K0 V2 r" I8 O
; o) s. R( @1 w2 T$ d
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-19 02:14 , Processed in 0.041471 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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