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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 p! q* U7 ]+ t
  1. [code]EDMA sample test application
    ( x, x+ I1 s3 X* _# O' _
  2. /*
    2 J. Y- S* Z: w7 [+ ^; P& J1 H
  3. * edma_test.c$ v9 C" {6 x* p2 s
  4. *
    1 y' ]% P% @3 r" }  m
  5. * brief  EDMA3 Test Application
    7 y$ O" @" C) R& H' J3 z/ J2 y# I
  6. *0 [! W2 w  u4 f  k
  7. *   This file contains EDMA3 Test code.% W! w8 {0 c! \) m! I( D
  8. *
    + |5 O5 N; J* e* o
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ; N2 }* H6 ?8 V' z. i  [- v
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    : ~8 o: |3 g. I. W1 `# l4 H
  11. *         TO CHANGE.; d7 F+ R$ U. c  P+ v! C% R
  12. *$ V" t2 o- {; d; o; @- m- V$ P3 G
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& n( h9 {2 Z3 g
  14. *
    0 p3 J. i) Z1 f5 B0 D
  15. * This program is free software; you can redistribute it and/or9 C: A- U$ Z0 r
  16. * modify it under the terms of the GNU General Public License as) k8 I; T2 O) |1 Y. K7 N
  17. * published by the Free Software Foundation version 2.. A! @- S7 C7 g
  18. *
    6 Y0 Q! ]4 O* W1 A: ?3 `7 ^
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 n" B; d" I% U6 D' Y0 E
  20. * kind, whether express or implied; without even the implied warranty+ `# [2 v5 [) F) I( i
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the0 P; ^2 u1 }9 U3 L
  22. * GNU General Public License for more details.
    . ^; w& A. Z* A$ N0 v6 L, C
  23. */
    ' `; f% h5 [3 ~5 r

  24. ( `$ V" b+ r  o: G5 d) K
  25. #include <linux/module.h>
    5 Y, k! ^. a) G3 f
  26. #include <linux/init.h>
    $ r, I, d- Z  q9 b+ u: X# R$ V
  27. #include <linux/errno.h>/ s/ Y, r9 ?! J) u
  28. #include <linux/types.h>
    1 [! k2 z1 z+ g5 }+ B+ F, Y8 ^: G
  29. #include <linux/interrupt.h>; u8 f( Y* {3 W' k
  30. #include <asm/io.h>5 n3 u" s. s- M+ |1 P, i! d
  31. #include <linux/moduleparam.h>
    $ |5 ~# a9 ?/ h# ~
  32. #include <linux/sysctl.h>+ m3 T% k, Q6 }
  33. #include <linux/mm.h>
    ' `: R$ }- E+ U
  34. #include <linux/dma-mapping.h>
    % G( p3 p8 H* i  }

  35. & r- r3 D* d% }2 a% b2 ~
  36. #include <mach/memory.h>
    : J) F0 L( o$ m  W* p- k
  37. #include <mach/hardware.h>: C1 m4 b+ n/ l4 {
  38. #include <mach/irqs.h>
    - }; \& v7 r4 m7 e4 P
  39. #include <asm/hardware/edma.h>1 |% D1 \  T- e+ U0 D, o& X" ^

  40. . {  B, [' q! s# Q  G+ |
  41. #undef EDMA3_DEBUG
    2 j0 r8 F1 v% p  M
  42. /*#define EDMA3_DEBUG*/
    / A! ]/ b' P- @% L7 g

  43. 8 e$ W- F* y5 N
  44. #ifdef EDMA3_DEBUG' x0 }- X2 ]$ R, Y! N0 ]
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) }0 J. U: Q& o" O( ]
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ' O7 V1 |% b) [
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ }& `# `0 a& F5 V
  48. #else+ ]$ O/ N5 l  h! X. W4 x
  49. #define DMA_PRINTK( x... )0 ^2 n: K7 b/ }
  50. #define DMA_FN_IN5 @, ^9 F# L8 W1 X
  51. #define DMA_FN_OUT* F5 S8 _7 B% K2 ]
  52. #endif
    + i9 B9 ~( a$ V* U( r+ J
  53. ) d" p7 \3 X  k: f, Q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), U. q/ D4 Z/ X
  55. #define STATIC_SHIFT                3
    - {! s# a, g0 S. Y' D6 N& Q
  56. #define TCINTEN_SHIFT               20, t7 a3 b8 X- M
  57. #define ITCINTEN_SHIFT              21
    - s) N: `4 ?# i5 d. r
  58. #define TCCHEN_SHIFT                22/ u" Z/ `! R7 r6 t" y7 s$ s
  59. #define ITCCHEN_SHIFT               23
    " \: l( l) n: [/ s, O) R1 X
  60. 6 a- w. ]$ |. i+ l( ?% S
  61. static volatile int irqraised1 = 0;* U1 u* f& X% ^  f: C4 \6 N
  62. static volatile int irqraised2 = 0;
    ( V4 f  P+ Q  Z+ T$ p; B
  63. $ g$ t3 ]3 F; [
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, }* D% j" K8 g. l9 Z  _2 U
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) V$ n8 Q+ j# t( X3 Z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " a6 A2 x, J% U9 X
  67. 6 [6 ?, a8 s3 G+ P6 T
  68. dma_addr_t dmaphyssrc1 = 0;
    4 t9 e9 Y7 @# E
  69. dma_addr_t dmaphyssrc2 = 0;
    8 ]0 x/ ]- B6 {0 o- z3 r- N
  70. dma_addr_t dmaphysdest1 = 0;: q# \) Y% j6 n
  71. dma_addr_t dmaphysdest2 = 0;: K) f' b! s0 }7 `  _, r# X+ B

  72. % V" B# j  L( u( P9 ?8 \
  73. char *dmabufsrc1 = NULL;) k, Q. z: I7 o/ W: u6 K6 p0 \
  74. char *dmabufsrc2 = NULL;
    : E' c3 S. V! U8 r7 U+ J: F/ R5 V  `
  75. char *dmabufdest1 = NULL;
    3 O' g6 X$ k, n
  76. char *dmabufdest2 = NULL;, w" @6 i5 x$ o  O- p
  77. / P$ Q; W; P: N8 d2 j- p
  78. static int acnt = 512;' B  h! v2 r) o- P% V
  79. static int bcnt = 8;( j. C' E1 K- a- w( p/ {: K
  80. static int ccnt = 8;
    * f, V- `) i1 E- F* O6 m3 ?

  81. ' U/ o9 G2 n( r( L7 c' j
  82. module_param(acnt, int, S_IRUGO);
    4 q4 {$ u  P+ Y* g* I" _
  83. module_param(bcnt, int, S_IRUGO);
    $ `6 w* D/ L1 w) |0 C
  84. module_param(ccnt, int, S_IRUGO);
复制代码

+ D* |( E$ ~1 s* |0 I
# H- \3 m" t4 H/ o1 f/ d      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) z- x( _3 f) z$ `5 earm-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 I# j/ _  l# p- ^: a2 \
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ A9 h. e! \5 g$ M" Y/ B; X1 ~
9 c/ j. ^+ I  U, Y' L4 T7 Q& b
9 \9 o) |* k& L: h, q8 z0 e  D% m
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-6 17:10 , Processed in 0.038151 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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