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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 |. I" b5 G2 P
  1. [code]EDMA sample test application8 b5 X9 X  S" \5 m
  2. /*1 g0 l' k9 r3 D, S2 }0 n# w$ i0 H
  3. * edma_test.c" l# l1 \$ W1 o5 r( N# n* ^
  4. *
      A* Z0 \5 W1 g, @2 {) C
  5. * brief  EDMA3 Test Application( J7 G% B* j( ]! d+ d1 H/ r
  6. *
    ; o1 \) Y+ [) q# N
  7. *   This file contains EDMA3 Test code.0 z3 d1 K4 L3 L, m
  8. *
    2 U- d" w; T1 k8 F
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    7 o' t4 H; Y, Y; G* V
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & s" ]. V1 C/ l/ A
  11. *         TO CHANGE.' d  ?8 {: _5 D. M; |
  12. *. U7 ?8 H" }' V  }# s: Z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ) T9 g7 `. c5 |$ W6 `% A0 `
  14. *# v1 Y5 }# q! w5 `
  15. * This program is free software; you can redistribute it and/or% G3 ~, E9 W) `! N
  16. * modify it under the terms of the GNU General Public License as4 i# w- o" e6 `+ s$ `. s+ a  t
  17. * published by the Free Software Foundation version 2.
    7 |3 W3 Q* u6 x) r. S
  18. */ Y2 m$ s- M* a. Z" v6 b2 U
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    : \" ~: ]% C& k: j- ~
  20. * kind, whether express or implied; without even the implied warranty' g# c7 O3 k8 V
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    " u6 S" [& T3 n) X% p; |* N2 b
  22. * GNU General Public License for more details.
    . b: V- E+ T  S. B9 n( |
  23. */% A' \) [9 u7 V6 T0 s* J

  24. ) l* T; l, _+ [% p6 X7 |) I
  25. #include <linux/module.h>
    / u8 E1 H' Y- t% ], k% O
  26. #include <linux/init.h>
    $ U- A( S  k5 g4 {, [% m9 q7 W+ v- G) j
  27. #include <linux/errno.h>
    : ?7 e2 x5 \5 D  B; G, U
  28. #include <linux/types.h>" J1 l1 N& b4 b
  29. #include <linux/interrupt.h>( C4 t" D4 M4 K% C9 x9 `0 k$ T
  30. #include <asm/io.h>* s9 ^# m9 |7 g9 h& N5 `3 P  X1 k
  31. #include <linux/moduleparam.h>. ], X3 N: @5 w( l; q2 g
  32. #include <linux/sysctl.h>* G/ K+ _0 I; S' w( P/ k
  33. #include <linux/mm.h>0 K! u1 e/ a4 B: E4 L
  34. #include <linux/dma-mapping.h>
    $ b7 H8 F5 ?2 z1 s8 Y
  35. $ E  M: o$ T/ L. i; w+ A
  36. #include <mach/memory.h>
    - H; h! F( |! z. L$ h0 j; S* |+ \
  37. #include <mach/hardware.h>' J- ?5 a. v* j% _
  38. #include <mach/irqs.h>
    % I5 a' U4 w8 A9 {, e& f  S
  39. #include <asm/hardware/edma.h>1 ~& ~+ k) E8 t
  40. ) |( E! L2 r  |; F5 Z& h
  41. #undef EDMA3_DEBUG
    ) O: \/ [2 ]# }$ K3 @3 A- ~
  42. /*#define EDMA3_DEBUG*/
    : ]* W* q5 J; ~( y" x

  43. - {$ }$ C, X6 W# m3 e
  44. #ifdef EDMA3_DEBUG7 ?( g3 d" d* j1 T9 Q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 t. V& }& N5 D
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ' m% T" f- ]7 F' \
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    . Q; d: h2 J& \( ?2 M
  48. #else
    ( E! ~9 D) l, B* {
  49. #define DMA_PRINTK( x... )
    ( m: u. {- S) g+ t
  50. #define DMA_FN_IN: k5 O7 p# A& V1 @3 ?7 @  m- N. o$ q
  51. #define DMA_FN_OUT
    . c; t4 S; ]! [1 K" N$ ]3 q/ a
  52. #endif
    ! u' u- V8 Q# q, R+ L0 U9 |' H
  53. 9 Y! w+ F9 l: ?: G$ N$ ?8 L
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " K; E' Q2 ~) B* V( D+ @7 m3 @5 ^
  55. #define STATIC_SHIFT                3
    ) v: ?# Z2 T; u$ m* a+ p* Z; K- G
  56. #define TCINTEN_SHIFT               20
    0 V% M6 I% s9 O: ~/ `
  57. #define ITCINTEN_SHIFT              21
    5 M- s' E) i3 T: y9 }6 q  ?$ F1 y
  58. #define TCCHEN_SHIFT                22
    . s' S1 o  x8 ~8 a' F: I0 x
  59. #define ITCCHEN_SHIFT               23
    , m* s' l& G8 U  w7 O9 |& O
  60. : K( P# X( q9 r# K2 R  o( O, [
  61. static volatile int irqraised1 = 0;
    3 A3 j2 Q2 w0 |- c
  62. static volatile int irqraised2 = 0;8 ~9 t& _4 Y* s$ O: F' }7 T( i" K

  63. 3 l; B  a; m" G2 K' t4 A( T7 I
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( ^5 u9 H& J0 t' `; C3 T: k& t
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) M# d/ l" [9 s& ?8 G
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  f3 {! Y) k: B8 r6 K6 `9 h
  67. ) @( T2 q3 ]) e
  68. dma_addr_t dmaphyssrc1 = 0;- B: c% R+ i3 @8 p
  69. dma_addr_t dmaphyssrc2 = 0;3 A) X% p- h1 a
  70. dma_addr_t dmaphysdest1 = 0;
    ! H* Y6 S. y$ H7 X
  71. dma_addr_t dmaphysdest2 = 0;
    $ M+ M& q; f3 k, L5 `  a4 s

  72. : f: D8 i8 f8 O2 `9 K
  73. char *dmabufsrc1 = NULL;$ a" c: n1 d: h) h$ B9 g+ M
  74. char *dmabufsrc2 = NULL;
    7 U( r7 n& J+ H3 T' A( \" l
  75. char *dmabufdest1 = NULL;
    " H; u, Y2 n1 ?+ E, A  u* D, \( j
  76. char *dmabufdest2 = NULL;
    # v( {3 B" w% v+ |2 W
  77. 1 D1 C7 B$ X6 R/ D
  78. static int acnt = 512;7 I$ V/ x! R' @* G" Y1 F  ?9 n
  79. static int bcnt = 8;
    6 D5 L- N5 U! p; g
  80. static int ccnt = 8;8 n' z8 _! r" |& T2 N, o

  81. 4 |* m0 e3 y/ |: I0 V+ D
  82. module_param(acnt, int, S_IRUGO);5 r8 P7 Z6 L; [/ x. N
  83. module_param(bcnt, int, S_IRUGO);9 G0 P1 m# }" X
  84. module_param(ccnt, int, S_IRUGO);
复制代码

, V9 O0 t0 e. C
; X6 U& }2 o1 P7 @  r      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' a0 e/ C! A, S6 T/ W
arm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, b, K4 K" B4 [* r" Y5 k0 n     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# K. j8 D3 w6 @5 \6 h3 E1 k4 P
: ?$ F" D+ o3 [4 k
3 O# ^; z. B6 n$ N, b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-16 18:53 , Processed in 0.039715 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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