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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 e. v  }0 i, w0 R' E1 S  y
  1. [code]EDMA sample test application
    7 ~3 N- \- V$ q  H" x% z+ d: s5 D
  2. /*: N! ?* ?& u7 j7 P6 [  F3 V/ \$ X
  3. * edma_test.c
    7 g& Y& p/ c/ ?
  4. *
    ( A; E  l: M2 C- L7 i) N7 i  L+ M. r
  5. * brief  EDMA3 Test Application
    1 Y4 x! o% p$ p/ Y& [( \
  6. *
    # ~- k$ e0 l9 O8 l5 G4 Q; G
  7. *   This file contains EDMA3 Test code.% f0 `' o6 ?- M3 J/ ]
  8. *8 u7 E) L  g, s  M3 Z  ~6 W0 W( r
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ {" Q, E, h0 P6 D& h
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT  h0 s8 f' A7 X+ W8 ~' l3 Z0 t7 I
  11. *         TO CHANGE., H" {5 j0 u4 F+ P- I: V
  12. *
    $ ~' D1 C- W2 s) p- _% a$ T/ H% l/ I
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ u  i& |" H7 Q2 w4 j2 W
  14. *3 o) ]6 A. t5 E- r" s
  15. * This program is free software; you can redistribute it and/or
    ( }% r% l& c7 g% h# }
  16. * modify it under the terms of the GNU General Public License as
      \& ]% w& W: f% S% w% z
  17. * published by the Free Software Foundation version 2.
    $ p4 P% L" d, u& {6 x$ R
  18. *
    * x+ B' C8 z. D- p
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any) p3 _# E3 D% P/ A. w" Q% }2 B- {
  20. * kind, whether express or implied; without even the implied warranty* I5 l5 `: \* C3 j# p
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' f- O! K: Y" [' L8 [# }
  22. * GNU General Public License for more details.* ]) A9 k6 E" F
  23. */
    / s+ N( w+ k: I6 `6 s6 n
  24. ! ~0 y$ G2 U1 d
  25. #include <linux/module.h>: o; b; m* t2 i3 o2 T; s0 r$ {
  26. #include <linux/init.h>
    ' G( |5 u8 k& Y, w# P
  27. #include <linux/errno.h>: A' v' ]: `+ v- ]+ R( @3 @
  28. #include <linux/types.h>
    ) n. S6 H8 P7 h  B: C$ L+ g
  29. #include <linux/interrupt.h>
    1 Q8 G8 s: J& [- N
  30. #include <asm/io.h>2 f6 f; A- e: w: j, d# o
  31. #include <linux/moduleparam.h>% U( ~6 z* [( U% |/ I+ ?* K/ u
  32. #include <linux/sysctl.h>
    % b0 f8 ^) U- U1 Y6 J  F
  33. #include <linux/mm.h>% q  g8 _& G; E( ^  }0 t  k
  34. #include <linux/dma-mapping.h>, n- W0 N* G2 h/ u0 O

  35. 8 l; P4 d3 t9 ?) I3 W9 d
  36. #include <mach/memory.h>$ t" m- D: ?- s* m- L9 x
  37. #include <mach/hardware.h># c" Q' F7 T3 f3 p' E: `6 {
  38. #include <mach/irqs.h>* Y3 w% C1 @  O
  39. #include <asm/hardware/edma.h>
    2 C0 i* [- E2 X6 X

  40. ( r; J8 f6 k8 o- Z- L
  41. #undef EDMA3_DEBUG$ i# Z1 H, g/ o# D
  42. /*#define EDMA3_DEBUG*/; B, I4 [5 b' [# z# W1 A4 a' m" f
  43. % _' ]/ N: K! ^, \7 X- i
  44. #ifdef EDMA3_DEBUG7 M2 Q% A8 x& V" m
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    & {2 Z" [) q1 m$ B& q% D
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    * H' `. R5 z1 l9 E
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    0 A1 O9 w8 ~, t& u1 q
  48. #else5 x1 }: G8 K) o1 [0 R: f9 n
  49. #define DMA_PRINTK( x... )
    " S0 x+ M/ @/ t' y- \
  50. #define DMA_FN_IN
    ' N0 ?$ x: ~) V% U: @
  51. #define DMA_FN_OUT
    5 i7 F% W" o. k$ o8 v$ k( L0 s$ r
  52. #endif
    / t( Z5 S$ O; e7 e- R7 O$ |9 N
  53. " G" r. J2 p. h0 f% J4 L5 s- S7 i
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)0 P* @! d! j- o
  55. #define STATIC_SHIFT                33 Q; w8 F; h$ h
  56. #define TCINTEN_SHIFT               202 X5 f. b# \" p* u2 j/ V& A( H  H) p" C! n
  57. #define ITCINTEN_SHIFT              21. e. H' y! @7 T. X+ ?! y; \
  58. #define TCCHEN_SHIFT                22
    ' B: q5 Y4 V6 L( O
  59. #define ITCCHEN_SHIFT               232 U9 ~8 q2 X4 P0 d

  60. + S( v0 `0 P  {, O) M& z! ?
  61. static volatile int irqraised1 = 0;- U* c* l- A( |1 }# O$ y
  62. static volatile int irqraised2 = 0;; Y- h0 M8 z1 x4 C2 w$ }
  63. ( L+ H6 P7 j% r' k' L
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( Z, u7 V( j3 F; q; p  b. R. s
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 ^2 S2 R8 O7 d" N
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * W7 G2 Z7 m7 l1 T1 _
  67. + ^& `6 e+ v$ ^* |7 \
  68. dma_addr_t dmaphyssrc1 = 0;3 X! B! D: y4 b+ j9 |* P: X
  69. dma_addr_t dmaphyssrc2 = 0;
    9 f* T, q' H/ P5 h
  70. dma_addr_t dmaphysdest1 = 0;
    * B2 u* G6 I, I7 s2 A- z
  71. dma_addr_t dmaphysdest2 = 0;
    & ?$ J( h- L6 d5 T8 r1 Y$ J' V
  72. $ g3 S6 ~- o: C  A
  73. char *dmabufsrc1 = NULL;5 \6 n) N& c) c6 S. ~! Z
  74. char *dmabufsrc2 = NULL;5 R! s4 m* n. R
  75. char *dmabufdest1 = NULL;
    ( X2 r. f! L. l* g
  76. char *dmabufdest2 = NULL;
    5 A% R% O: S3 u' D: T

  77. 5 o$ x* ~2 g: p9 y& A8 H# g8 Y/ n
  78. static int acnt = 512;# @9 v( Q  g5 S. [$ D: u
  79. static int bcnt = 8;1 G  q$ l( X8 l8 `: d; J
  80. static int ccnt = 8;
    ; t" t' e/ e, r6 i3 t+ c  l

  81. / R* o3 {) ]4 b) L& i  z; o
  82. module_param(acnt, int, S_IRUGO);
    $ E- k4 m$ u4 \. Q, y, \. n
  83. module_param(bcnt, int, S_IRUGO);
    ' M% R% u/ p6 U1 r+ f4 \
  84. module_param(ccnt, int, S_IRUGO);
复制代码
! K0 S* ^) M5 e& @' R
& W" g6 m0 n5 a
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% A( _, @' j  p- J! X, garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ _1 o( _! t% ^7 Q& O( Q
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 p5 _' B4 `3 M, F8 Y' Y
* x$ V/ b- w) g) {2 U& A2 M! ]4 R% n1 A+ k  ^1 g+ V
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-26 00:17 , Processed in 0.043877 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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