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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 i# X, a! }* N6 u9 S
  1. [code]EDMA sample test application, B. `1 O$ R5 A9 \2 l; D
  2. /*
    & h6 o" C0 o: E" z( H
  3. * edma_test.c  J. W( f6 r8 \! j# d, z, A
  4. *7 p' R1 y$ ?) z9 t: L, ^
  5. * brief  EDMA3 Test Application% ?; ^, Q  ]2 L: y9 i. l1 o
  6. *
    - P5 D4 C1 [( G9 [  p" Y! U
  7. *   This file contains EDMA3 Test code.
    2 ~# ~. G. f6 Y8 a
  8. *
    ( i+ r4 k) D# @4 S) u+ h% A
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 p. j( U& _0 W+ Y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 y4 R. h9 \  N/ o1 L+ M
  11. *         TO CHANGE.% _  d- M/ z9 o) H- u4 g- Z% s
  12. *  q& K: K( C, C; B
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    + a# b7 |/ D* w% Q
  14. *
    % R9 }$ H1 N6 d: {! w
  15. * This program is free software; you can redistribute it and/or
    " ~: _( B) Y- }+ U% n% O# A
  16. * modify it under the terms of the GNU General Public License as
    9 ]4 z# n3 y) W$ ]
  17. * published by the Free Software Foundation version 2.2 ?& k) X; _2 l3 P: f2 @  n7 f4 D% H
  18. *
    + B7 S; Y  |. S& ~- U5 L/ Q! a
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 M0 C. v' o6 u$ g( ]
  20. * kind, whether express or implied; without even the implied warranty
    3 n3 ?1 j! b/ [7 G
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 _* f. q, H3 c  P
  22. * GNU General Public License for more details.
    + d% {( Q/ A, g
  23. */
    2 m# c  }- Q& ^: U
  24.   j! }2 a7 U& `; N
  25. #include <linux/module.h>7 N0 I* V; _, `9 R, n
  26. #include <linux/init.h>
    6 {7 H+ B) |0 o. R* h! C. ~( D
  27. #include <linux/errno.h>+ e$ m3 ^' F9 s$ s) @$ b0 m
  28. #include <linux/types.h>; Q. c+ \7 L2 K! c- y
  29. #include <linux/interrupt.h>7 i8 L% C) }: U8 b! b% I
  30. #include <asm/io.h>
    & _# |1 e+ S# j0 r$ L# P) k
  31. #include <linux/moduleparam.h>+ f* D' F5 E: Z: e& l- ~9 x9 K
  32. #include <linux/sysctl.h>) g9 F/ ^8 H7 x/ B# M
  33. #include <linux/mm.h>
    $ F! j3 [, `; u) c
  34. #include <linux/dma-mapping.h>
    6 `; J2 W. f3 Q+ t, \0 p

  35. 1 k4 A. F7 F& T) U6 J# O
  36. #include <mach/memory.h>. Q$ c, y. ~2 G3 ]# E! ]
  37. #include <mach/hardware.h>7 I! c' }- R% m4 m$ Q. q' A
  38. #include <mach/irqs.h>
    ) {6 Z" U$ U' `6 _/ ]
  39. #include <asm/hardware/edma.h>! p. k% `6 Q4 w& Y% e

  40. 7 ?/ F% }) e) U
  41. #undef EDMA3_DEBUG
    % l7 i$ e7 D! z6 \  }& ]0 Q4 k0 z
  42. /*#define EDMA3_DEBUG*/$ @6 h! L1 m6 E0 T' p' Z* k: N, q
  43. ( k* f5 a7 c- d! u( K
  44. #ifdef EDMA3_DEBUG
    1 A$ f/ ?) r* d- G. B4 J
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- n7 c6 C' g5 \9 d2 E
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)  m. i/ F, |, g) i7 |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)  |1 F- y0 z4 t# u% w
  48. #else
    5 ^" Q2 s" M( L  w- u- Z6 U
  49. #define DMA_PRINTK( x... )
    ' b+ X$ o& X4 M: N
  50. #define DMA_FN_IN7 d. z* M) ]* U7 I
  51. #define DMA_FN_OUT. Y, n. L$ @% i% l) X* ]
  52. #endif
    9 K$ h* N& e! v
  53. " I% l- w; l" o  d
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( y& a" T  w* C, h' [+ h
  55. #define STATIC_SHIFT                3% p& ^, a; y* b# K, ^4 F
  56. #define TCINTEN_SHIFT               20) N! z2 t  n# k3 _9 r& A
  57. #define ITCINTEN_SHIFT              21
    5 z* O4 _0 O6 V- N% N' ]% e" }5 Q
  58. #define TCCHEN_SHIFT                22
    8 b- j) F8 M2 Y! D! x
  59. #define ITCCHEN_SHIFT               23
    ) e9 A: F/ x9 p1 p7 \

  60. 3 k# ?/ ?% h  L/ z5 i2 _. s
  61. static volatile int irqraised1 = 0;
    4 X4 a" l4 r8 u) r+ E( R3 F
  62. static volatile int irqraised2 = 0;
    $ C( N* o: X7 S' X0 S' B
  63. 2 U4 P* X: ~% g8 P% o9 {
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! x+ W0 E3 a& \
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 R% Z( C* w) a2 f1 K
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      O$ p8 b6 r0 S, A- {+ A" Y
  67. - l* |  I  X$ W( N! `. B
  68. dma_addr_t dmaphyssrc1 = 0;7 k0 O- R* ~7 N9 s4 X
  69. dma_addr_t dmaphyssrc2 = 0;
    7 c& \4 r4 l# _0 _5 ?* |
  70. dma_addr_t dmaphysdest1 = 0;
    # a* s' v( J( v: I* Q
  71. dma_addr_t dmaphysdest2 = 0;' F7 t9 p, L3 L6 X
  72. ! U! k' p7 N2 C, X/ X- Y
  73. char *dmabufsrc1 = NULL;' l0 T: M+ Y4 m% T4 y" H9 X
  74. char *dmabufsrc2 = NULL;
    1 @5 @" |+ r+ D( F5 N, |( ?
  75. char *dmabufdest1 = NULL;
    3 A' C$ x' K6 W
  76. char *dmabufdest2 = NULL;
    5 Y7 }, x4 B) g: ~, \6 c& T
  77. ) {+ m% y2 H/ d7 k0 M6 T& E9 m6 K
  78. static int acnt = 512;
      g, }$ R, l, E( K) w
  79. static int bcnt = 8;. U1 ?$ @# ^) W* ^
  80. static int ccnt = 8;- Y6 Q6 ~$ K/ u

  81. : X& \5 t1 I4 ]9 S! T
  82. module_param(acnt, int, S_IRUGO);
    + \  c" w# T' c. G3 I
  83. module_param(bcnt, int, S_IRUGO);6 a6 T- A/ s! k5 d
  84. module_param(ccnt, int, S_IRUGO);
复制代码
+ E; L9 k" [" c4 q' M9 ]
- X$ f( S% t4 o7 |6 Z; r. A- H1 a
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- X/ r1 `5 V$ }  v) V$ Barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 Y: s9 v/ }* `: y     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; N: b" o) {6 C% ?" f6 Q
7 L8 ]2 h4 b& \4 u

% e  L3 z+ H5 V; g6 J* Y7 b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-9 02:20 , Processed in 0.036986 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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