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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ @* n# t, w4 U) ~1 a  ~, E
  1. [code]EDMA sample test application
    1 _9 N- J& I" T2 }# f9 g4 L0 F
  2. /*$ d9 Z: O  k  t5 m0 U9 j. _
  3. * edma_test.c
    ( b" z7 S- |1 ~: k( k* O; Q' \0 Z
  4. *
    5 d1 X5 h: g" P- F6 F
  5. * brief  EDMA3 Test Application7 R. s# v* b* S, p; k
  6. *. F' a6 q6 N; Y3 _2 w
  7. *   This file contains EDMA3 Test code.
    / v1 L( \: [6 Z2 }8 W% u
  8. *! Q+ G, z5 K# F% D; t( f3 e1 i
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; O8 s6 n5 p& x3 _- G
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + u  V4 d3 \. e$ J  Z! C
  11. *         TO CHANGE.$ N6 r2 D/ s- Q1 x1 h8 _) a$ x
  12. *
    ) ?0 E$ w4 `  h% @5 }; U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    - e8 M( V9 f$ \
  14. *! w: }- b: ^7 a. x3 K4 y
  15. * This program is free software; you can redistribute it and/or
    0 e* x3 s& r# x! l/ D$ r
  16. * modify it under the terms of the GNU General Public License as& {: D( z+ R9 ]) f9 X' j* E
  17. * published by the Free Software Foundation version 2.
      s0 L1 l2 A% t  @! {# f8 q' q
  18. *
    : q  Y7 U; u0 m5 Y) p
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    : O% Q. D9 E  _7 y* m' X
  20. * kind, whether express or implied; without even the implied warranty
    & F6 j0 g: u9 g$ \# h
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ I9 q+ w& V+ [% `9 w$ O  b
  22. * GNU General Public License for more details.. z. Q- F" d/ C; r, F
  23. */
    . z3 C8 H" F/ A- D4 {
  24. . K; J: ?2 O1 Z% C  D/ N; N
  25. #include <linux/module.h>
    4 S$ v8 ^# d  P# H
  26. #include <linux/init.h>" E1 l* K8 q1 O" C: R
  27. #include <linux/errno.h>( |3 q* w0 Z6 d
  28. #include <linux/types.h>
    " Y1 E0 P/ ]# k  m5 i( d+ w
  29. #include <linux/interrupt.h>
    5 X# i5 u7 o* f' F. j2 q5 f
  30. #include <asm/io.h>
    0 _( W. F+ ]4 |
  31. #include <linux/moduleparam.h>
    6 J7 ~" \# S; R* ?
  32. #include <linux/sysctl.h>! T, l1 i" o  z# G
  33. #include <linux/mm.h>
    ; B8 |; K" K8 y" u9 S6 T- E
  34. #include <linux/dma-mapping.h>
    / Y) T+ N: Z$ z9 Y; T% ~0 l" ?

  35. 7 B5 [; }1 \; E* h
  36. #include <mach/memory.h>
    # h. Q' r2 u# ?7 Z5 \/ h
  37. #include <mach/hardware.h>, |6 x9 U6 D: E- [4 h
  38. #include <mach/irqs.h>  D% i9 F' H* _8 ?  f5 Q
  39. #include <asm/hardware/edma.h>
    ( G$ Y" `0 j% q5 Y) O
  40.   {2 o3 p+ J! X
  41. #undef EDMA3_DEBUG4 @- E$ W' w8 B1 f
  42. /*#define EDMA3_DEBUG*/* W& k( P" s& a: d  ~6 \

  43. & |& }6 A$ O, u" r
  44. #ifdef EDMA3_DEBUG
    3 n% v! h8 z4 b$ w* s. L
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# k$ o/ @4 `7 l$ w, {
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)  @* Z! h4 a" g# d* U. \
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    0 W/ z! Y# z3 |- X- j: F
  48. #else
    4 a& Z) D. D8 ~2 Y, r& U9 f
  49. #define DMA_PRINTK( x... )
    ! [* p. K$ c( c1 n/ K
  50. #define DMA_FN_IN4 v! a# \3 v/ X- u+ z
  51. #define DMA_FN_OUT$ f) E/ }1 X# @! d1 @4 q
  52. #endif
    3 h* v6 S- [" s0 z& d
  53. * `& K0 M  e* o! E
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)& q1 I# C; L# V) `2 q* t( E
  55. #define STATIC_SHIFT                3/ Q2 V, t* F7 v6 m. H% a& Q
  56. #define TCINTEN_SHIFT               20
    % A; w4 D+ ~2 I6 M5 ~2 ?3 {
  57. #define ITCINTEN_SHIFT              218 H4 R! V; o/ p0 b) G
  58. #define TCCHEN_SHIFT                22
    6 [8 Q( K; O+ p2 w, y5 B
  59. #define ITCCHEN_SHIFT               23
    2 Q" l# R$ N- w

  60. 3 v2 J. V) Z; d) q
  61. static volatile int irqraised1 = 0;
    ; T! t; c! p/ K) ?/ k
  62. static volatile int irqraised2 = 0;, J, H' r$ G' G. B% P
  63. / M4 v) x5 v7 y, z: z: l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # V: I! \3 d9 O* d, z& F
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 ~! r9 r& J  ]0 U% l& t# O
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 U* I# L' @) R" X' d$ m
  67. 0 w5 t. v, v" H+ p: R
  68. dma_addr_t dmaphyssrc1 = 0;/ l+ @" J( N/ z8 F8 f2 l
  69. dma_addr_t dmaphyssrc2 = 0;2 M4 Y& G0 y1 X, L) p
  70. dma_addr_t dmaphysdest1 = 0;
    3 v- C7 h4 u  a' I) |, E; X
  71. dma_addr_t dmaphysdest2 = 0;# O  |- Q! n! \5 e' u& ]6 y! r+ @

  72. . H6 a) y( J. F& i
  73. char *dmabufsrc1 = NULL;" n# X. {9 {6 L: r1 w- E
  74. char *dmabufsrc2 = NULL;3 }: d- H/ z$ P+ ^8 N6 W2 X- n
  75. char *dmabufdest1 = NULL;5 n  b; D" U' J6 k& }8 S) L2 h& N
  76. char *dmabufdest2 = NULL;
    $ n0 v) q, W4 z7 |4 n
  77. 3 q* W  S' Y; U; R3 e+ n
  78. static int acnt = 512;
    6 r7 X! a3 x0 b! }% a& ]
  79. static int bcnt = 8;9 X$ i9 c/ E7 \( V
  80. static int ccnt = 8;0 M2 W6 U& N& t5 F  s  g
  81. " @. v& H# o" R+ K6 |5 y9 d* |
  82. module_param(acnt, int, S_IRUGO);2 g% u) b  Z; V5 L7 d5 B$ s  M
  83. module_param(bcnt, int, S_IRUGO);
      ~% C, Q% T9 w( Q  t6 [
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 R9 _, B3 z1 ]: f
$ h% S) Y, ]/ }* y  r" s      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% x3 D) l- E; C4 e* _" n) i# _3 j5 J
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- ~5 n% [5 J+ X! ]1 y  K! }& l     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: L& f8 @+ b0 A5 ?& w! ^! o

% Z$ ]$ R( }& |/ B+ z& n% Q* T/ a  ^/ f7 e2 R. U# |" ?  P
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-17 02:03 , Processed in 0.127297 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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