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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; ^: ^* J9 |. z! f: O
  1. [code]EDMA sample test application
    3 U+ `1 Q6 v5 }% U
  2. /*
    ; B& R9 D9 m1 Y4 ]8 y$ }; |
  3. * edma_test.c
    $ j: X9 M/ Z8 o+ P
  4. */ ]- b6 ^# Y, C0 }( ?5 _2 Y
  5. * brief  EDMA3 Test Application4 H3 }6 U: F+ Z  H/ D
  6. *- Y; |) `" d6 Q: H3 B/ J
  7. *   This file contains EDMA3 Test code.
    6 p- u2 x  r! T/ [9 h) m$ Y5 J
  8. *: o  `5 Y% q  G5 e' q" v
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    2 Z$ |/ m; ~2 R, I
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( J+ V; c5 U- e! u
  11. *         TO CHANGE./ D1 L# \/ c  Y: H& P  ~8 X
  12. *
      s5 K, B. \, N) ]
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 v7 u- W9 u4 v! W* c1 w
  14. *
    9 e3 U1 c* X5 _- d" f
  15. * This program is free software; you can redistribute it and/or
    6 O0 g& A/ `. v0 f8 E! U* [6 n: s
  16. * modify it under the terms of the GNU General Public License as
    + ^; ^  S; g/ \2 q  ~
  17. * published by the Free Software Foundation version 2.( l7 D2 `; E1 e/ x# v1 L
  18. *
    9 w) z! E) y* s
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    % T3 F" C. }2 ^1 x% _6 \$ ~1 x+ H" r
  20. * kind, whether express or implied; without even the implied warranty' M4 M" H5 B, n" f! O' ^
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the( ?& z; T2 T; `9 B- T" D, [; @
  22. * GNU General Public License for more details.2 }% q* C. g/ o$ n9 B4 V8 n
  23. */
    $ u4 T+ s. E, K) W! X) J0 Y
  24. 0 d( g" A2 z" J2 q8 O* ^
  25. #include <linux/module.h>+ ~& }7 x( f* T& A; W
  26. #include <linux/init.h>" I4 L3 L  s: w- }
  27. #include <linux/errno.h>8 J# g$ ~( D# z
  28. #include <linux/types.h>
    ) ?4 _' `4 K: u% H, e8 f
  29. #include <linux/interrupt.h>, }; F) h. @5 }, e* Z% @
  30. #include <asm/io.h>
    % ~4 w) A, V: s& z/ L: ?
  31. #include <linux/moduleparam.h>* O( @1 t1 i! u6 D
  32. #include <linux/sysctl.h>
    3 N* c6 ~  _* Z; F! l( n
  33. #include <linux/mm.h>
    + F$ F8 z; y1 E+ w- {" k3 I
  34. #include <linux/dma-mapping.h>3 X0 L$ J5 H( n5 _
  35. ( E2 D  r# ]5 t! G5 H" Z$ {5 p
  36. #include <mach/memory.h>) t) c: A. o% D8 z
  37. #include <mach/hardware.h>
    ' M! O3 {5 q# x& ~
  38. #include <mach/irqs.h>
      L/ G+ F. h# K, O: r
  39. #include <asm/hardware/edma.h>
    ! f8 N8 O. t$ N0 U: `
  40. # M0 \* I$ d* ~- t" r) J8 K
  41. #undef EDMA3_DEBUG
    ; I7 W9 \. i9 u- ?
  42. /*#define EDMA3_DEBUG*/6 c1 n" W1 }0 n1 b# c2 t* o

  43. ( y( m& j% m  I+ a: e
  44. #ifdef EDMA3_DEBUG, U2 G$ ?+ x. s
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - Q" {9 x8 Y+ R, {
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 Y; n* D1 Y# Y$ a* J5 Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ Y/ c' S; n& o) a. }5 a. E
  48. #else
    - U4 E& E# e( H. H/ Y
  49. #define DMA_PRINTK( x... )
    0 m2 O$ g# s4 [: i
  50. #define DMA_FN_IN1 g- H( x, c8 ]; A; g* Y# o8 _
  51. #define DMA_FN_OUT; m  Q6 j6 B: ^2 C0 z6 T
  52. #endif
    % B4 Y; w0 v2 j2 o  F

  53. & q# G1 I: O1 s3 c, b/ U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    5 Y7 r- R% k. X3 ]7 a5 e# `3 o
  55. #define STATIC_SHIFT                3  Z5 s- J; ^  Y6 q) H4 i& u
  56. #define TCINTEN_SHIFT               20
    / R& K0 T( R5 n/ C% X
  57. #define ITCINTEN_SHIFT              21
    2 N, l, O' C8 p4 j9 S+ Z, L; J
  58. #define TCCHEN_SHIFT                22
    * g* Y) S4 j5 Z1 w) K4 J) H8 }4 y" j
  59. #define ITCCHEN_SHIFT               238 V1 W5 r# |% ]- U1 l4 z6 o
  60. 0 l  h' e9 H) e5 V- w# M0 `, c$ \
  61. static volatile int irqraised1 = 0;, |% |+ O( F; m' @" b
  62. static volatile int irqraised2 = 0;
    1 @6 U6 m% q1 }

  63. 5 @, G% ]1 h* `& u! E+ E# Z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 |0 e5 g3 G1 _* r/ [; m: ~
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( j4 Q0 K$ J! J
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, b. H% O6 J$ C/ W& R( g6 {/ F2 W

  67. : {9 G; A% t+ e9 u
  68. dma_addr_t dmaphyssrc1 = 0;
      V  K2 {  x' |0 |4 |! {9 h
  69. dma_addr_t dmaphyssrc2 = 0;
    $ `) d# ]' a3 z" ?+ ~& U  J
  70. dma_addr_t dmaphysdest1 = 0;9 ]7 X- A/ ]9 Q1 d5 U' j/ J
  71. dma_addr_t dmaphysdest2 = 0;4 Q9 o; `& `) N; }9 d! C" Y: n
  72. & E, W. U9 B3 ]! _: i* {
  73. char *dmabufsrc1 = NULL;
    3 r4 r, I% C' d" h( [4 k
  74. char *dmabufsrc2 = NULL;% F$ Q; ~1 S6 H5 L
  75. char *dmabufdest1 = NULL;
    7 a+ W% ~) @0 J" r9 W
  76. char *dmabufdest2 = NULL;2 l( p9 g( [4 }/ _' k1 \& V
  77. % a; G' B6 y5 v7 U5 e
  78. static int acnt = 512;
    # ?2 ~, V4 H* T: e( ^3 k
  79. static int bcnt = 8;% ]0 F$ F! [. |4 H6 I
  80. static int ccnt = 8;/ ]# d, S5 t8 h  J

  81. . I( u  d' ]+ _+ ~' o5 o% {* X
  82. module_param(acnt, int, S_IRUGO);
    5 A7 U( d  m& A( |; R* e5 _# Q$ r
  83. module_param(bcnt, int, S_IRUGO);0 X( l% a- ~7 W
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 [! E1 u) `# V
( x( ]  V, W' v
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) o" z- ?' Q# p8 z6 O( O: Warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; L' j! q" l& p( s. v' ]0 K     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* r& a* k' ^! C" C$ @
$ f# B( v( j  [/ L
4 l" a2 b# a$ X$ ~, e3 b$ N% C
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-12 21:55 , Processed in 0.040989 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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