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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 k7 i% N- C" @. u
  1. [code]EDMA sample test application
    , p9 B4 w. ]0 p! G3 S. L
  2. /*( m4 x3 u9 T4 m
  3. * edma_test.c2 `/ q& u; ~! I. Q* B) y
  4. *
    ' s: z8 d. c) q" V  J3 |7 n7 W4 B
  5. * brief  EDMA3 Test Application
    3 o8 i1 S$ f3 ^2 V& s+ u, L4 o
  6. *
    ) S0 w, K! N* M$ H4 A
  7. *   This file contains EDMA3 Test code.
    . }0 k+ \2 o4 u0 Q- `, F' {; |
  8. *
      W; F1 O4 a$ Q8 U/ h
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    3 u( b' U8 S  k5 P7 x: E
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 t/ R7 |% I9 n& Y
  11. *         TO CHANGE.0 |" q5 _5 L# [. ]8 d
  12. *
    0 s3 x  Q3 `) {% t% Q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    4 W3 ^0 R! N" M# @* \; {- r
  14. *
    % i" K$ {9 e7 `3 p! W7 P5 M% I
  15. * This program is free software; you can redistribute it and/or
    0 b) E" p: z: A* m
  16. * modify it under the terms of the GNU General Public License as
    ' F% F" y% m1 q  a! g
  17. * published by the Free Software Foundation version 2.8 T% W* m* ]* R+ ^4 l/ R4 F
  18. *5 o5 L8 F! @; j5 H* g
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any* H* o7 d, s: j/ P! H3 Y2 Y& [& N+ O
  20. * kind, whether express or implied; without even the implied warranty
    ; ]" x% N& }  O0 u3 }
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # g$ q8 S/ P1 m* f6 e
  22. * GNU General Public License for more details.
    8 g$ |3 l# R0 w* Y5 D
  23. */0 H7 y$ h2 `; ~& \( S% ]

  24. 9 U- `0 p3 D, C& C& y
  25. #include <linux/module.h>
    & u, s6 l& ?4 X. s1 L, c6 {2 i9 O
  26. #include <linux/init.h>
    : y; E$ H5 Q+ O! r7 p
  27. #include <linux/errno.h>. n) \( O, `& `9 g2 W6 C
  28. #include <linux/types.h># o! T/ Z3 V' t# n. j7 A% E
  29. #include <linux/interrupt.h>
    0 m/ u, [0 O' R4 N' H9 H
  30. #include <asm/io.h>
    ; F, ~5 T! q$ K0 y0 X/ L- Q; y
  31. #include <linux/moduleparam.h>  F& h" o; o: t: ^, k
  32. #include <linux/sysctl.h>
    ( [  q3 k0 }9 A* J, O& E# P% d: j
  33. #include <linux/mm.h>
    % ~3 G; K. e9 f0 \2 {
  34. #include <linux/dma-mapping.h>
    $ W# s$ r. F* K# k# w0 u
  35. 2 O( M/ M; I, E9 t0 X; U6 T
  36. #include <mach/memory.h>
    7 g7 F$ b$ M( B% J0 R' c2 [
  37. #include <mach/hardware.h>
    6 E5 ^- j) G9 Y: Z! x* j+ K3 W
  38. #include <mach/irqs.h>  d; O) M, r) K+ u# @
  39. #include <asm/hardware/edma.h>. n  q+ u* n- k2 e5 K
  40. ; o. V" a9 u: y# Z# r
  41. #undef EDMA3_DEBUG
    & G" s5 `7 E* I# F, h
  42. /*#define EDMA3_DEBUG*/- G/ _" t5 V. P+ i4 n3 o
  43. 7 s! K& p2 p/ H! k
  44. #ifdef EDMA3_DEBUG
    , Z! |8 O* t0 w9 n
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' {1 N5 Y' O" r/ f. U( V
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ j3 ^$ v1 r# `4 N- b- x- b
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    & d; c% U( Z- Q: i; w. j
  48. #else
    - C. E: C- J: h# x
  49. #define DMA_PRINTK( x... )
    $ A) g/ |: J5 W& `# F9 V' v
  50. #define DMA_FN_IN" P3 u. d7 |3 t8 v: X
  51. #define DMA_FN_OUT
    5 z" [, Z1 p1 z; f: }" K0 D3 w
  52. #endif
    8 A3 y, L# C- F4 b* ~7 X1 \( g
  53. 6 M* i# R3 w+ Q( N
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    * S% [- U; `; a% _9 U( Y3 n
  55. #define STATIC_SHIFT                3
    - ]0 Q$ V" ?( o; l/ o
  56. #define TCINTEN_SHIFT               207 X" `  [/ G0 S+ l) d) [
  57. #define ITCINTEN_SHIFT              210 A9 r4 d* X1 |5 `4 b7 F) Q
  58. #define TCCHEN_SHIFT                22: v6 U5 g' b' g3 T; F
  59. #define ITCCHEN_SHIFT               23
    ; U% N/ p1 e+ ~& L

  60. 4 q8 f6 S3 o+ O7 U" K
  61. static volatile int irqraised1 = 0;
    # p) K( ~6 L4 W* t' b
  62. static volatile int irqraised2 = 0;2 V3 u* r% J8 @& {
  63. : L- e9 Q, X6 w& a+ C, q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; K, y& G( _& H' ^
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 F6 H8 N; F$ D9 ?
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* ?9 L: I" W: F6 T
  67. 3 y; i5 b: ?6 k5 s! y2 @4 R
  68. dma_addr_t dmaphyssrc1 = 0;. u5 E3 {8 r& P9 j1 ~
  69. dma_addr_t dmaphyssrc2 = 0;
    ' g! h9 h5 N" A' u
  70. dma_addr_t dmaphysdest1 = 0;$ u7 D9 N& z8 D4 e
  71. dma_addr_t dmaphysdest2 = 0;! i! E' i- t! y6 C% Q

  72. / U- G: {# p0 h# L
  73. char *dmabufsrc1 = NULL;
    ! \# k- f' G( j7 j
  74. char *dmabufsrc2 = NULL;' h4 S3 W8 y2 u  H
  75. char *dmabufdest1 = NULL;
    ' E( x- D* m( y' t; I6 F! ~+ }
  76. char *dmabufdest2 = NULL;
    + E5 \5 f+ u8 q* e& F4 u

  77. % @# P8 t% r3 {( T9 ]/ {
  78. static int acnt = 512;: T2 A3 S5 s$ G* D6 _
  79. static int bcnt = 8;' w( x3 @! M" Z8 Y: ]1 R
  80. static int ccnt = 8;' z8 d6 v/ J9 f: x6 j; W4 c
  81. $ }, \; w0 b* C  V
  82. module_param(acnt, int, S_IRUGO);9 X6 e7 |% N+ X3 u& I
  83. module_param(bcnt, int, S_IRUGO);
    6 N2 N( y! E5 M4 u
  84. module_param(ccnt, int, S_IRUGO);
复制代码
! P) }4 v- |! Y2 H% x
! j) {& G6 X! |: W, q
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. Q3 }  S5 x* jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 J! S0 k" L3 D: ]7 e     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 T$ D( ?5 J, u" D. {: O8 X; \
4 ]8 I3 B+ v$ s- z" w9 T
$ J1 Q% V. g' c0 d$ F& U
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-8 01:05 , Processed in 0.038594 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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