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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" H1 b( {0 G( N/ t% P) f- a
  1. [code]EDMA sample test application
    / H5 @1 Z8 Z. y! U& |
  2. /*7 \6 S$ g) M) W9 O4 a
  3. * edma_test.c
    ) I3 f& J7 c( G. Q" q3 I
  4. *, i% x2 r, b9 T, C) e' O
  5. * brief  EDMA3 Test Application/ M( v: |: k( k+ b
  6. *+ P: \7 P% u% R( j
  7. *   This file contains EDMA3 Test code.
    7 _8 X. H! K6 o+ c0 F
  8. *
    2 c  H3 p/ P7 G9 U. E' Z) a
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 f7 l2 c/ s/ u5 v
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ u6 c* d" S6 p2 ~$ C
  11. *         TO CHANGE.) ]6 i* C, K5 S+ \/ W
  12. *  f2 Y; `: n" Y, i% O1 j$ d. u
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 a8 ~0 D" h" Z1 Y9 v! z1 P
  14. *$ \7 x3 V7 T  L
  15. * This program is free software; you can redistribute it and/or
    / p! G# D6 h: h; q$ A5 p1 k
  16. * modify it under the terms of the GNU General Public License as
    4 C/ v! S6 s# }3 ?! D% T$ H  K
  17. * published by the Free Software Foundation version 2.6 g' i- L: r+ z. u8 J9 B' j( u
  18. *6 B" e4 R1 ]. \/ K: w
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: C8 ?# z0 _3 F- M& i1 ?# {2 |4 T# m+ D
  20. * kind, whether express or implied; without even the implied warranty5 ?% e3 O- n* O. }
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2 |) j8 q6 \- x( J. P1 B
  22. * GNU General Public License for more details.
    " A( Q4 o% m' j& _( r: E
  23. */
    # X$ X0 E, E7 m" ]
  24. ! e) M) M/ ~* c8 W- Q
  25. #include <linux/module.h>8 t; o1 F3 s% K  f. f6 g
  26. #include <linux/init.h>* p" j  G3 ]; ]. c# D4 e2 b, S
  27. #include <linux/errno.h>  {7 ]' y/ T, l
  28. #include <linux/types.h>; h4 ?( h0 b5 e; F! k/ [# T
  29. #include <linux/interrupt.h>
    1 [1 f# q( {2 M5 t2 q
  30. #include <asm/io.h>" ?  [4 Z( a# Z- d9 G: f! z
  31. #include <linux/moduleparam.h>
    : p$ h( {$ Z: I
  32. #include <linux/sysctl.h>
    3 A9 |. O" u; _! y: n
  33. #include <linux/mm.h>
    6 U" T& g" d' D% r5 r3 c0 @
  34. #include <linux/dma-mapping.h>
    2 O" V% J# w( H/ P! d2 m! M* h

  35. 9 S3 x5 b: P: j7 G2 [- x7 D
  36. #include <mach/memory.h>
    ) k# U9 Z4 t& M
  37. #include <mach/hardware.h>9 `3 D" _" j  O7 K
  38. #include <mach/irqs.h>
    ! |9 s0 \9 F5 t6 ^- R
  39. #include <asm/hardware/edma.h>3 `4 o! Q& F0 b* h& d! N& s- X* x
  40. ' V4 i% w4 d! M2 |9 ^3 R
  41. #undef EDMA3_DEBUG
    . E( X2 D/ Q6 t; J" d
  42. /*#define EDMA3_DEBUG*/# F7 e2 ]4 m- A! c% T6 z

  43. 7 b5 Q: p4 p  ?* v7 T
  44. #ifdef EDMA3_DEBUG
    2 W9 w0 z8 D8 T2 z5 {* j- }: b, f
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 A+ d! u6 c6 x( D- V
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 a* l6 e, U& `1 P
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* B5 A/ X9 V' u' ?! ~
  48. #else: g  v' x& k. M- Y( L
  49. #define DMA_PRINTK( x... )
    3 w; H7 R% w% P, L1 X. {
  50. #define DMA_FN_IN% @# A( B, g9 e+ n& G
  51. #define DMA_FN_OUT
    & K4 }; ^7 o9 K2 T  g3 m
  52. #endif  f+ F. \4 g  }* s

  53.   z9 a3 m: r, E9 J- F
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    * n- c: D* A" {
  55. #define STATIC_SHIFT                3) b5 @% k$ b: J) ^2 k# F& q. z
  56. #define TCINTEN_SHIFT               20
    9 D8 N$ O! n. `% ~# B& J
  57. #define ITCINTEN_SHIFT              211 m( o5 f. `. H4 v, J" q
  58. #define TCCHEN_SHIFT                22
    3 K" S6 r, {1 h; @; H7 ^$ o( [
  59. #define ITCCHEN_SHIFT               23
    1 A0 o5 C4 [# C, A$ _+ s8 \& K1 v

  60. , a/ N8 E! p1 m8 _
  61. static volatile int irqraised1 = 0;7 d0 X3 f, W8 T9 G7 ?- j' A8 u3 j1 I6 L
  62. static volatile int irqraised2 = 0;
    6 A' e- e' {. q

  63.   l1 g8 u$ N2 J4 b) b; s
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 z% ^9 g" w6 F; l$ m4 e3 D
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& b4 G& W2 l( Y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : v0 g: t4 @/ r$ X+ n8 L

  67. 3 ^/ L5 O7 q, ~% `7 Q
  68. dma_addr_t dmaphyssrc1 = 0;" ?% h0 t5 c# _  t5 {( T# B1 m7 X
  69. dma_addr_t dmaphyssrc2 = 0;& O/ b7 q' b: U7 g
  70. dma_addr_t dmaphysdest1 = 0;5 K4 n; D4 b$ \5 ]$ p6 c5 C% ]9 Y
  71. dma_addr_t dmaphysdest2 = 0;
    $ H! i) }. A3 y4 ]2 \" J  s$ m6 W2 U

  72. ; U7 k# ]5 o$ g' V3 K
  73. char *dmabufsrc1 = NULL;8 [7 J) }" J: J- f$ W  I$ X
  74. char *dmabufsrc2 = NULL;7 P' i0 V7 J/ p" |+ z
  75. char *dmabufdest1 = NULL;
    ' G+ q. J9 F7 C! ^$ x2 \
  76. char *dmabufdest2 = NULL;
    2 b0 i/ s2 \# F; [( L7 o# ?: A, a
  77. ; h; b5 y4 u7 h$ K% [! j. x6 Q
  78. static int acnt = 512;3 q4 W: |5 ]) U3 x; [1 `' R
  79. static int bcnt = 8;2 b/ |# X. |! [4 ?; e( Y7 a+ T5 h
  80. static int ccnt = 8;
    0 j: K/ o" M; [3 f! u' L

  81. 0 h4 }2 _+ L" u9 T' ~: Q0 g: @2 K
  82. module_param(acnt, int, S_IRUGO);% M% c+ w) `" O; a% W+ i9 W
  83. module_param(bcnt, int, S_IRUGO);
    # ~( r) l( F7 e2 @9 c( R
  84. module_param(ccnt, int, S_IRUGO);
复制代码
4 J! r, Q7 _' B0 k
( k" a) q& s4 o
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" h! x8 h! E0 c2 C- h0 C; ^$ Karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 v% A1 a# R  Y% l9 `9 r, ]
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( M0 ^/ B- U/ o% h$ H& X! w

0 s( U/ J  C9 A- j0 m  g* P; L5 J. |; l) ^4 _
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-9-5 14:12 , Processed in 0.040939 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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