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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 B7 j( X6 Z2 p; E$ g
  1. [code]EDMA sample test application: f: \, ~4 Q7 e! l0 M; o" D
  2. /*
    2 z$ G* I( ^* b% A" A6 O1 V
  3. * edma_test.c
    4 ?1 Z9 h" `' [3 P0 X. j
  4. *( P+ V  F1 `$ j9 C
  5. * brief  EDMA3 Test Application! _' B8 K8 d5 i$ m! i
  6. *. ?8 e, t/ V- ~+ q5 |% f
  7. *   This file contains EDMA3 Test code.2 C; }& M( N  N/ ^. X
  8. *9 a! c4 W; L2 X% v: \/ }- M
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    9 c2 B2 |5 _, v  y) j) y2 t" s+ q* P
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 l" B& \( X9 ~+ I
  11. *         TO CHANGE.
    : z# l3 ?9 G# T2 A
  12. *
    2 R6 W: X3 E. t8 I4 [( l4 ?
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- q. B. ?) y* A1 F
  14. *
    4 N# z8 N6 u3 l0 O! i
  15. * This program is free software; you can redistribute it and/or0 H2 X) g' B+ d1 S' Z. j
  16. * modify it under the terms of the GNU General Public License as+ }3 h6 P2 d: L8 j1 k6 P
  17. * published by the Free Software Foundation version 2." @2 ?. O+ E  X, O7 _/ j
  18. ** I; x+ Y4 S" f2 M$ {# G
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ; i4 P" Q& t. S/ H
  20. * kind, whether express or implied; without even the implied warranty! |9 @, Q; p, \, g
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. V6 Q, G7 z+ ]1 e9 y
  22. * GNU General Public License for more details.- {" w0 H" w; R( r
  23. */
    / p6 S! P, \0 Q: f  C9 ?" l
  24. % I( @& w( t) X9 Q+ C$ V
  25. #include <linux/module.h>* w* {: S* M* j4 V4 U* d" X8 _8 \
  26. #include <linux/init.h>
    ( P/ u* u3 H9 W7 u5 Y
  27. #include <linux/errno.h>( Y, h2 M" t: a$ F! _, Z9 S; P( r' c
  28. #include <linux/types.h>/ q5 i% c! |$ r: J
  29. #include <linux/interrupt.h>
    % A! E8 ~, u0 r: Z8 U0 x
  30. #include <asm/io.h>  U6 g6 H8 R& g# Q. \% q/ _
  31. #include <linux/moduleparam.h>
    0 N( [4 ~" I% F$ U' b0 h) Y( q9 A
  32. #include <linux/sysctl.h>
    , g8 ^) I8 g4 G6 c
  33. #include <linux/mm.h>& N1 e" q  \4 }+ G
  34. #include <linux/dma-mapping.h>" U( n) W: k  n. ^( y- R( C

  35. ( Y/ u  |+ `4 [! x* P: A
  36. #include <mach/memory.h>( q& N3 P) B) A
  37. #include <mach/hardware.h>
      T# M4 ]) ], Q: a
  38. #include <mach/irqs.h>
    9 H. @! y! [: D5 C
  39. #include <asm/hardware/edma.h>
    ' K2 }* z' U- r: a5 H4 S- ?
  40. 1 a& o  k( v4 W5 g
  41. #undef EDMA3_DEBUG+ c' Y& u' ?& ^3 E2 \# `
  42. /*#define EDMA3_DEBUG*/
    % H8 b4 ?) Q& e7 _0 G

  43. 1 t5 x8 ]5 T, M" D# y( J/ Y
  44. #ifdef EDMA3_DEBUG
    5 b# G. k. o8 n0 c0 N! O/ M% K: z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 c$ k0 r5 \2 d/ ~) R3 M2 L
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- ]% s. ~5 o) q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ( ?, ?, b3 O1 U5 w
  48. #else; E7 W, C: [, B
  49. #define DMA_PRINTK( x... )$ P1 K5 }# _' J7 J
  50. #define DMA_FN_IN& t( u2 D1 B6 B, V  s3 l0 i, g
  51. #define DMA_FN_OUT
    7 [' h4 b6 Y7 J. U/ X  x
  52. #endif5 Q. |- x; z! G. r
  53. 9 ^9 e% F+ x" R) K8 A! @/ a
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    0 j9 P$ X# [8 t  t
  55. #define STATIC_SHIFT                3
    9 M/ A% W% V* d, h- ?, e
  56. #define TCINTEN_SHIFT               20- C+ M( l$ [% `- y
  57. #define ITCINTEN_SHIFT              21
    $ |5 X' O& K4 q' I
  58. #define TCCHEN_SHIFT                22% m  Q: p7 c9 p" ^# ^8 g
  59. #define ITCCHEN_SHIFT               23
    $ I$ H% e4 T. z  _7 E6 P' d

  60. & }+ A" ~( R: x) J
  61. static volatile int irqraised1 = 0;- x& U, E' \. A1 Y8 ~. g8 q
  62. static volatile int irqraised2 = 0;1 T/ K2 ?/ e' p8 j- Z

  63. ) `5 u5 p2 _. a
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - X3 N# N! I5 y- p
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & U6 h- _  P5 p" M' g, w
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& M2 u0 b4 Z( M/ i

  67. ' d* g' l5 x5 @7 r* b
  68. dma_addr_t dmaphyssrc1 = 0;+ b* ?* U. B2 V
  69. dma_addr_t dmaphyssrc2 = 0;& Q- c' w  s" B) [! \. ~' \  U
  70. dma_addr_t dmaphysdest1 = 0;
    & F1 x0 C; z. i* h
  71. dma_addr_t dmaphysdest2 = 0;
    # _+ H% {* A" O. i5 i" R" `$ p9 R" j

  72. $ N) B* \% X0 D, q9 w* r9 s# V
  73. char *dmabufsrc1 = NULL;
    ' @. W2 @$ k! A
  74. char *dmabufsrc2 = NULL;
    ! H' f! y8 G' _1 M% t- d7 [* g
  75. char *dmabufdest1 = NULL;; ?( A! q, g; h. l' P
  76. char *dmabufdest2 = NULL;
    . z6 M9 J9 C  F- ?" E% ^" w. R& k

  77. - X% m2 H; I( T2 J$ f
  78. static int acnt = 512;
    0 ~7 p7 V. j" z, C
  79. static int bcnt = 8;8 K4 |1 {0 i/ U! `
  80. static int ccnt = 8;
    1 Q1 u6 E5 H( L" ~1 n9 }* I* u
  81. # l0 S. j# V: d2 }
  82. module_param(acnt, int, S_IRUGO);) w/ U* c1 \$ u/ l3 ]% [
  83. module_param(bcnt, int, S_IRUGO);
    8 v7 w/ K. D% j8 t
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 }. L/ s4 M5 S; Q* P9 ?: c8 m7 _6 u2 J( ]0 N* ]; W- y+ m
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* q1 q* G" n! }" f$ i2 Iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
  K7 {0 y5 g3 ?2 ]     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* Z2 D: X$ U3 f3 U
6 K) ^9 W. _; J
6 G7 z0 V- J4 O4 ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-7 17:29 , Processed in 0.040462 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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