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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 J- c3 ~# b" E) q7 j: \
  1. [code]EDMA sample test application  S4 W2 i. D( m. \: u( j
  2. /*
    9 l! ^: P) C6 t
  3. * edma_test.c; e6 s  U% V" N  I
  4. ** p* {3 S. B) |
  5. * brief  EDMA3 Test Application  m5 K5 |! E$ A
  6. *
    . A8 w& H* C& l4 ?& {: R
  7. *   This file contains EDMA3 Test code.8 ?( O0 e4 d. ?. f" p$ ?
  8. *
    4 f  f" |& ?% i, i5 j. C3 D! L$ H
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 q% a: `0 B! X" R5 Q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    / c  f, Z/ V# @
  11. *         TO CHANGE.
    ! |1 q$ {5 X3 h# ~
  12. *  K8 P1 Q0 O! r& k, @5 @
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 J5 v1 c$ B& z! g: J
  14. *
    & ~) u- ]6 n+ y! I; Y& {7 i6 I
  15. * This program is free software; you can redistribute it and/or! v0 A$ l+ h5 C
  16. * modify it under the terms of the GNU General Public License as( K% s! L  k/ J" B& T. l
  17. * published by the Free Software Foundation version 2.
    4 d9 E& k% E" }4 G
  18. *! P* w# H( ?/ T& o8 m# f
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& k0 d7 g) V6 P: I
  20. * kind, whether express or implied; without even the implied warranty* b. S; o) U. H! `7 j
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the1 x- J' B) h1 ^! _# P
  22. * GNU General Public License for more details.4 X( k' P5 [  P  S  V# L0 Z4 P
  23. */
    7 J! a% S4 ?0 H
  24. ! u  U! p- f# r$ R, t
  25. #include <linux/module.h>1 e. I: M5 J# c1 N
  26. #include <linux/init.h>8 g2 i. J9 }2 l( X
  27. #include <linux/errno.h>
    0 u1 B' x4 N4 B7 V2 c+ \7 G* g
  28. #include <linux/types.h>* Y7 ]9 V& m2 A5 b& K$ v" w
  29. #include <linux/interrupt.h>
    7 `. Q3 ?: T9 _: f8 [
  30. #include <asm/io.h>4 ~# W$ M* A" u
  31. #include <linux/moduleparam.h>+ k; y# i  j- {% y/ ~
  32. #include <linux/sysctl.h>
    ' g6 z0 K, B# x) r
  33. #include <linux/mm.h>5 K) N/ h8 _$ `4 O
  34. #include <linux/dma-mapping.h>
    ; I( P0 g( `. q
  35. ! d# e" \- X: C- Y% m# w- `* S
  36. #include <mach/memory.h>
    0 X* {5 z4 ~$ o1 R! M
  37. #include <mach/hardware.h>% V7 R3 V$ R, k0 E
  38. #include <mach/irqs.h>$ L5 p6 ^4 e# p5 p0 u
  39. #include <asm/hardware/edma.h>5 d$ S; \$ L$ {/ z! X& o
  40. $ V6 }9 B- M/ R9 s" G8 U) e
  41. #undef EDMA3_DEBUG
    9 V/ K/ a/ i' x! i
  42. /*#define EDMA3_DEBUG*/
    : @9 f) t( e4 J

  43. ; p# H( u; C% p: l7 k
  44. #ifdef EDMA3_DEBUG
    4 Z! r7 U- p- P; P
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 D4 V& N5 D( P- G/ J" ~
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 `' Z; |& {- M. U+ {$ X
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( F; {' ^+ v, W* x
  48. #else
    3 I$ i6 R0 P0 i1 C
  49. #define DMA_PRINTK( x... )0 h  \7 |2 e. ^+ V! \; X  _
  50. #define DMA_FN_IN3 p. U$ b9 }+ v  G( D$ `5 Q
  51. #define DMA_FN_OUT
    4 f- O3 D, k/ ^7 Y* Y1 K9 i  D
  52. #endif
    . I' a+ G6 s; b! `2 j

  53. - W1 P8 l) B( j9 k# s2 E7 J
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 L5 x2 a, E3 O/ q% @5 D, q
  55. #define STATIC_SHIFT                3
    + n8 @7 u9 v( R, _" D
  56. #define TCINTEN_SHIFT               20+ ]# D' j! h1 j6 s
  57. #define ITCINTEN_SHIFT              21
      u4 b9 c; z- d* T, R, W% r
  58. #define TCCHEN_SHIFT                22
    2 `7 G9 k- X' ]/ P
  59. #define ITCCHEN_SHIFT               23
    * E/ o! T. t: }4 U! `7 H

  60. # H, f8 u: p1 M+ |' R5 h
  61. static volatile int irqraised1 = 0;1 t4 O3 v, v- Q, P) H
  62. static volatile int irqraised2 = 0;
    & s% t7 e) Z" M  f
  63. % g# [$ R. I4 U7 K' r
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , F4 m5 `" w0 b0 r
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 s0 @9 }0 o* c
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ I- i- I6 v; I: h
  67. ; @. j! e- [: y. ^
  68. dma_addr_t dmaphyssrc1 = 0;
    . v, D$ o: u3 C, O0 Q
  69. dma_addr_t dmaphyssrc2 = 0;
    ; J: q# s  r% w: s+ s- P
  70. dma_addr_t dmaphysdest1 = 0;. q; ]0 U- L3 A" H3 D% f# s- s$ d! V
  71. dma_addr_t dmaphysdest2 = 0;% W. ?* G2 R% Z; A- q: J
  72. / n" l8 c* V- y7 l6 o
  73. char *dmabufsrc1 = NULL;
    ; r4 }1 \0 i9 U) I( L6 Y) E  d
  74. char *dmabufsrc2 = NULL;
    3 p- L6 v) g: b8 J5 o
  75. char *dmabufdest1 = NULL;& R- p2 q9 @( P' I  g# k
  76. char *dmabufdest2 = NULL;
      S4 g* E4 P* d- b
  77. 7 O7 E' ~& {8 m; T3 J! @
  78. static int acnt = 512;
    3 m6 a" X' ?/ N6 U% F6 m4 V; E
  79. static int bcnt = 8;
      |- @7 L7 F, Q' r
  80. static int ccnt = 8;
    3 A3 C6 h9 m* w; Q
  81. / d, f- O) l& b1 f7 k  c
  82. module_param(acnt, int, S_IRUGO);1 W* q0 B* n. y% S9 @7 J* X) `
  83. module_param(bcnt, int, S_IRUGO);
    # A1 a- J. _3 O8 X2 M
  84. module_param(ccnt, int, S_IRUGO);
复制代码
! b  ]; R( W8 L- n% j

: }2 B5 `0 k  G5 E) h4 @& Q      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% N* A+ k( e( ]2 J* Marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 z$ X- Z- e+ U0 |! J2 g     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 r% E6 \, a3 D/ A" I* c
/ `- k, [: P- O) m& C
% c" J1 H/ G; T
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-29 01:08 , Processed in 0.048071 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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