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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 W% e0 p: G: E3 T7 Z; h
  1. [code]EDMA sample test application  b6 Y: g7 E& Y
  2. /*
    ) N# ]! t" w4 P/ L; ^
  3. * edma_test.c/ ~! x( v9 J2 N3 `- p
  4. *1 g6 T& r1 T; r1 F) J: B
  5. * brief  EDMA3 Test Application- l" E! X' P1 t) e- j
  6. *; f6 J6 A& ~. W0 M0 c
  7. *   This file contains EDMA3 Test code.
    & R' b. Y$ m5 \8 F% w! l
  8. *
      H! W( s8 W; f" B9 k
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ' u8 d% x8 t/ [+ V# f/ o7 k0 w
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 E7 _- N0 j* s7 k, n
  11. *         TO CHANGE.
    8 j- v3 F! D% E4 a5 B1 }! S- j
  12. *
    0 y3 @0 U1 V. d$ K  t
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 K; j# \( d! u) s) C
  14. *
    7 K/ k* \' h! Z
  15. * This program is free software; you can redistribute it and/or
    % K7 a/ y6 k: m' `% e
  16. * modify it under the terms of the GNU General Public License as
    . ~. q" L. r3 U4 q. E, R9 X
  17. * published by the Free Software Foundation version 2.
    8 @) p- p, a8 ^. H4 v8 x, q$ |
  18. *
    ; |* s* V$ u( e7 j- U7 g5 v; D
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 c  n7 ~- w5 P& i5 Q) J, {+ P
  20. * kind, whether express or implied; without even the implied warranty
    3 B& t$ M; P0 ]  r) k7 S
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the0 A/ Z, r8 |3 s# L
  22. * GNU General Public License for more details.
    ; t% [8 O. j* W) ^8 G( f* s
  23. */2 p" e9 y/ E$ @3 O0 t  i3 T
  24. 8 W+ P! J' @! D# G- i
  25. #include <linux/module.h>4 G8 r1 U& I: ^
  26. #include <linux/init.h>2 r7 ~3 D, a$ G2 @$ ]( E/ p: j: I
  27. #include <linux/errno.h>- g# ?" d! b, y8 f2 T4 V9 G
  28. #include <linux/types.h>/ Q2 u3 z" M. h5 c
  29. #include <linux/interrupt.h>4 Z. Y( |! K% s& v& J8 v
  30. #include <asm/io.h>
    1 s! g. `  S! S4 P  n
  31. #include <linux/moduleparam.h>
    ' W% O7 p9 y0 J9 z- {! i1 N
  32. #include <linux/sysctl.h>
    - X% s) j( }, f/ w0 V; {5 i
  33. #include <linux/mm.h>
      p! R( a( p" V) K) V
  34. #include <linux/dma-mapping.h>
    , K9 s# [0 l' @3 _' \

  35. # C, O; F- g4 ?* ^
  36. #include <mach/memory.h>
    0 K' t8 |2 J0 q5 z! r
  37. #include <mach/hardware.h>
    * Q- A7 E6 F! X' Z/ P) c
  38. #include <mach/irqs.h>
    $ N7 T! Q% S$ k$ B0 [! @
  39. #include <asm/hardware/edma.h>
    , R! z; E5 N: d) C
  40. . V7 F2 T& K' H# ]* k  y3 D# ]+ b: @
  41. #undef EDMA3_DEBUG
    1 ]* L* P+ P9 ]1 ^. ~. C
  42. /*#define EDMA3_DEBUG*/, ~- P( F0 R- O/ P) c1 `

  43. * u% T! ~1 y! B. t# B  r8 q
  44. #ifdef EDMA3_DEBUG1 I) i" Z& p4 a
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& g; D, F; ^  h! Y6 \
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( x3 H0 C! E2 b$ E" \( C' U
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    # d; s1 k$ |. w# V& p" c3 \0 x/ C
  48. #else7 S2 Z' }+ R7 r. |2 v, h" a
  49. #define DMA_PRINTK( x... )
    ) \2 D6 {  O0 J" U/ L: ?
  50. #define DMA_FN_IN6 R, C" i2 ?- R7 Y( U% a  `
  51. #define DMA_FN_OUT
    : c% M, N' }- ^) Y
  52. #endif
    : j- S  G! @- f  ]6 V4 p) z
  53. ) y& ~" O- R5 K  v
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    9 b( X# K/ _# L! E1 @
  55. #define STATIC_SHIFT                3
    ! z" L5 b7 |$ u" n2 G' k
  56. #define TCINTEN_SHIFT               20
    ) k, O" E* x. V+ ~
  57. #define ITCINTEN_SHIFT              21
    ! d8 d+ b& G% B" d' b
  58. #define TCCHEN_SHIFT                22
    $ a# R5 G9 C2 Q
  59. #define ITCCHEN_SHIFT               23/ O; ~$ U- V) Y) O" I% R6 l& J

  60. ! v# {4 h# D  t5 Z" l
  61. static volatile int irqraised1 = 0;
    " L9 J" w3 g' N  D6 f0 |% j
  62. static volatile int irqraised2 = 0;
    9 F" j6 l- p# i" F8 D0 r7 I; a
  63.   P. u: `( e- }: i1 J4 I
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 E- h8 A5 m, k3 g% f* p
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; `; ]5 N" U9 L( D6 A
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 ^# T3 G' p9 w) V1 U
  67. $ Q4 d! O. ^7 h, ?/ q. Z4 K" i
  68. dma_addr_t dmaphyssrc1 = 0;" C6 D- n. b% [* u* W
  69. dma_addr_t dmaphyssrc2 = 0;
    2 Z6 C( Y" ]5 z/ d
  70. dma_addr_t dmaphysdest1 = 0;
    & y5 l3 O+ ^0 d5 G1 N( [
  71. dma_addr_t dmaphysdest2 = 0;/ w$ W( u, o) {5 b/ @. j- g1 h
  72. : C' H4 f8 k% q. S5 q8 q
  73. char *dmabufsrc1 = NULL;8 L9 X; h$ ]/ [. p4 B6 P0 k# P
  74. char *dmabufsrc2 = NULL;4 s$ ]$ O6 H& u% [- F8 i5 }
  75. char *dmabufdest1 = NULL;: n1 h& c; L; Z7 I4 [: @
  76. char *dmabufdest2 = NULL;2 c* r/ \1 k3 g1 [

  77. 4 k( o  G" j+ R$ M; [
  78. static int acnt = 512;
    + T: B+ G* ]1 |5 k. F+ x
  79. static int bcnt = 8;
    9 D4 `- [+ P# \9 j6 q% ?/ C
  80. static int ccnt = 8;
    8 D, ]) u0 u; w" V- z$ g5 ^

  81. 3 A  t* L  C- Y7 D8 h) q
  82. module_param(acnt, int, S_IRUGO);+ p$ {3 m( C: U6 ?+ d- f, C
  83. module_param(bcnt, int, S_IRUGO);, k: r  ?' K6 w# n2 V3 G4 l
  84. module_param(ccnt, int, S_IRUGO);
复制代码

' _* |! t! ?4 S  K0 B: d# R1 f" D
; ~# h7 Z% k( V; E( {6 V6 T      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ g7 U! ?( q# m0 P$ yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) n" t" m, W, O5 n2 H: D5 K6 m     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 }1 w# ?' Z9 k2 D

% t& h& |) }/ p4 n5 j) p/ t. {; ?8 P+ `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-14 15:19 , Processed in 0.069835 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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