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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 i' D9 b3 q7 O& {$ b6 j% Y2 ^1 U
  1. [code]EDMA sample test application
    5 P& t* t) |# Z, {5 H/ p
  2. /*
    $ B+ D' E( U, C7 F! \+ e$ Q
  3. * edma_test.c
    6 R# B* A' w6 F
  4. *: a& f9 E. K  }0 V& b3 M; j, Q+ m8 C% U6 {
  5. * brief  EDMA3 Test Application
    ; U) m& J) `; P2 H' T
  6. *( h# H7 X2 J9 f# a: O
  7. *   This file contains EDMA3 Test code.
    ) |( ]& M3 j( L% ^
  8. *2 G; t+ T, L$ k, y# k  a9 D4 _
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 ], Q7 O& X8 P0 n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 |( y" v2 P8 C/ b
  11. *         TO CHANGE.; k; X& L, i9 D  d' q
  12. *
    + [0 V& p$ l% X. U# b9 s' U, h
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " p+ ~& n- O' N, I
  14. *) f; k; Q1 D5 [! p) j5 @5 j$ R
  15. * This program is free software; you can redistribute it and/or. n9 o7 p7 U) C# t0 x0 S0 U
  16. * modify it under the terms of the GNU General Public License as
    " X/ R0 x  U/ \/ R" u
  17. * published by the Free Software Foundation version 2.
    ! i0 }! J/ D9 M
  18. *1 [$ k) _/ k" n7 C0 B  x
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 g& J7 }( C* Q% A' x
  20. * kind, whether express or implied; without even the implied warranty
    2 O; C. _2 |5 l% u
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 R5 t! m" ]7 K3 ]
  22. * GNU General Public License for more details.
    5 e. A/ F: T. e) V5 C' q  D2 ^  l
  23. */# q' g7 M) J* q: [3 b
  24. ( t# b4 X6 O7 ?! j+ l. U' U
  25. #include <linux/module.h>* ^5 i- s. T! f% u' L; @( ^+ r
  26. #include <linux/init.h>2 p! n$ I, ], M6 y
  27. #include <linux/errno.h>* N6 V+ [2 s- \( }9 x0 y, ~# p- U
  28. #include <linux/types.h>9 ^  t6 w; k% r  m3 e3 {
  29. #include <linux/interrupt.h>
    ( `0 N1 @) E7 o
  30. #include <asm/io.h>8 g7 z7 ^4 c& ]) }$ ?9 g
  31. #include <linux/moduleparam.h>/ M, G- q6 _# V6 @& a* f
  32. #include <linux/sysctl.h>
    4 t. O0 ~; q. M+ l  F/ _
  33. #include <linux/mm.h>- N2 h- @: N" o8 R) y" s$ C
  34. #include <linux/dma-mapping.h>
    + E% A/ ^- s2 ^: K4 ?/ m
  35. / E: u/ B4 k6 K4 R. K* M, C
  36. #include <mach/memory.h>( _4 ]/ S3 _  F  r/ J
  37. #include <mach/hardware.h>2 G7 F( {- t% i" Q
  38. #include <mach/irqs.h>
    8 R/ W2 @. f; Y7 D7 w2 m
  39. #include <asm/hardware/edma.h>
    9 k7 I  r) X; Y( M1 g+ ~2 W

  40.   H& j/ }% p% k6 p( `
  41. #undef EDMA3_DEBUG' H5 |6 q+ H! i( E7 H, k4 A
  42. /*#define EDMA3_DEBUG*/
    ( y; ^: [9 \& h$ u, }* ?% C0 O

  43. 4 z$ p- D8 q, n1 `; O3 |
  44. #ifdef EDMA3_DEBUG
      f$ n- [6 n3 c7 e
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' X- L( I. b; I: ?8 Z* n
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). U; i5 S/ Y) n, y4 h4 S
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); |$ V5 }2 B; Q- p0 Q
  48. #else
    + w) h! a; |& V3 W
  49. #define DMA_PRINTK( x... )
    4 g( o7 y. {, o
  50. #define DMA_FN_IN
    * ~! U3 _# i" D
  51. #define DMA_FN_OUT
    4 a5 D2 V/ v. a. |- b
  52. #endif
    & K, k" V( ?2 o) P# G
  53. 8 e$ l" d: F2 L& d" i- z& J
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    1 ?" ?, h/ v2 e8 c6 s& S  r
  55. #define STATIC_SHIFT                3; h# e4 v0 h, v5 B; s3 K: x
  56. #define TCINTEN_SHIFT               20
    % A& i+ s% p" g8 ^
  57. #define ITCINTEN_SHIFT              21
    ) r" k6 ]* f4 W# r  W6 [
  58. #define TCCHEN_SHIFT                22
    3 d2 @" N1 Y" g, J3 \+ {+ I' O9 D
  59. #define ITCCHEN_SHIFT               23  j# J3 W4 Z- d+ M

  60.   P1 D- w( U% @7 ]& E) }
  61. static volatile int irqraised1 = 0;
    # z2 f5 {0 U9 s' w# I$ W/ ]
  62. static volatile int irqraised2 = 0;
    * u" {8 O; M2 v* I/ i

  63. 6 D  {' ]: o8 F
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : P; B! L  ~% {0 y( d0 k* u
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ p* @8 i5 a5 z9 _& }7 Z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - |! E7 n1 N$ {& {
  67. ' D: f* T% @" k; Y
  68. dma_addr_t dmaphyssrc1 = 0;
    $ I% y; g' l/ U9 q
  69. dma_addr_t dmaphyssrc2 = 0;  A- \9 E6 z, v& J4 f( @
  70. dma_addr_t dmaphysdest1 = 0;
    0 a0 n7 _1 x! d8 ?6 e3 l
  71. dma_addr_t dmaphysdest2 = 0;
    ! _8 C, x, L" z' W

  72. ! U5 i, r+ c% C
  73. char *dmabufsrc1 = NULL;
    & ]1 Y2 M7 w  z' {2 d% X
  74. char *dmabufsrc2 = NULL;; ?$ _8 N& z; o+ z7 Y
  75. char *dmabufdest1 = NULL;
    6 I9 w/ o. H; M* [+ K2 Z, m0 {$ L
  76. char *dmabufdest2 = NULL;
    ' v8 {2 J4 s4 Q. |
  77.   |( F4 U, u8 H7 H4 m9 X5 ]
  78. static int acnt = 512;
    & H8 S: z5 t$ P& ]4 D
  79. static int bcnt = 8;  o$ Y  x, B& a
  80. static int ccnt = 8;
    " `+ G8 c. ?8 W$ |3 T% \4 i" O
  81. ; [" a9 P% `( F* K% I
  82. module_param(acnt, int, S_IRUGO);
    % C* [" a: a3 O8 ?) b+ W
  83. module_param(bcnt, int, S_IRUGO);
    1 K: T5 p" P" v2 ~  n- x3 l
  84. module_param(ccnt, int, S_IRUGO);
复制代码

0 y  L" |2 k+ H
1 x+ `( C: B8 n7 y4 _0 y* q      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& c7 U0 @5 U& E1 o) v/ z7 Aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, j/ R5 o+ @6 f$ h. _7 }) O     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% T" ^7 c$ N$ P( {0 n& Q
$ S  ]% l- M' t4 y  R
& E/ T3 r) q- `- N* b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-7 13:44 , Processed in 0.038340 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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