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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' }0 D0 e; m' `& b) N; s8 \3 T; c, \
  1. [code]EDMA sample test application
    5 m. c( L- Y5 |* E& n6 P0 J
  2. /*
    + D! b) H" E% b2 ^" _1 k7 B
  3. * edma_test.c( L. T& t; N! T% Y& B
  4. *- @% P) z) w* e! k# X  o( G) ~
  5. * brief  EDMA3 Test Application1 B" ], m  J% G2 y5 W
  6. *
    % v: p( B& p  N
  7. *   This file contains EDMA3 Test code.% i' a& |8 j* @$ q! s7 }5 ?' U
  8. *
      L3 J, [0 K$ B
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( q4 s3 b1 a( M5 y& j0 Z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + _! _4 n  A: a! s6 T
  11. *         TO CHANGE., g3 K& D8 l2 R% Z% s: j0 C* V
  12. *
    7 Z: H. c1 I- s+ t. @* a
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    4 J& k; n$ N! v+ U5 j5 g5 y
  14. *
    / s) w( m1 D' d
  15. * This program is free software; you can redistribute it and/or1 q- t, q" ?% O
  16. * modify it under the terms of the GNU General Public License as
    : S8 T4 I# R5 M) S% ?
  17. * published by the Free Software Foundation version 2.
    " ]1 I4 }2 v$ f* c# N
  18. *( h: \: O/ y( b. U$ z0 A6 M
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 e* v! Z% w1 E5 h# G  `
  20. * kind, whether express or implied; without even the implied warranty
    , h& \  T6 d$ A/ W8 X
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3 M7 c' X2 d; O/ f, Z% S
  22. * GNU General Public License for more details.
    + ^4 }: Z5 g! i" _+ w/ K' R$ g
  23. */( |# c" `* n. C3 m- J' B# r
  24. $ y! [2 T+ J; j" T+ \1 V  n
  25. #include <linux/module.h>
    ' |6 t* Z- |% W
  26. #include <linux/init.h>
    : h; l$ ?  p' ~5 l
  27. #include <linux/errno.h>
    7 R6 R) h, y4 q+ ]9 ^% j4 N
  28. #include <linux/types.h>
    # H8 ~- m: F) ^4 V
  29. #include <linux/interrupt.h>9 G% M# D: F7 }# U( v
  30. #include <asm/io.h>
    ' f: ]  u  B9 |/ _/ C9 g
  31. #include <linux/moduleparam.h>
    . C% K( L( O' U( U& {7 C& ~- s: @/ O' s
  32. #include <linux/sysctl.h>
    4 T. a4 K+ k9 g" n2 z/ L4 ^
  33. #include <linux/mm.h>
    ) |4 v  M, b4 V2 {6 @* M$ R. |" X
  34. #include <linux/dma-mapping.h>; _* n: u, A' }1 x1 [$ m0 b

  35. ! k3 D' ]  Q5 ]* `: T  q, T
  36. #include <mach/memory.h>
    8 U) d) A- \$ j. ~, L' s
  37. #include <mach/hardware.h>9 V. }9 o) q" Y# _0 l3 w
  38. #include <mach/irqs.h>  U, d: h2 b" M# t' j, m, y' ~& V* [/ Y
  39. #include <asm/hardware/edma.h>
    8 ]$ [. f$ Y, `! R: }9 w5 h1 {6 O

  40. 0 Q( t# K. p4 X& w( J5 [
  41. #undef EDMA3_DEBUG$ Q; F$ i6 _' d1 B7 w8 N
  42. /*#define EDMA3_DEBUG*/
    , z7 E$ M: l3 C$ p9 T

  43. 1 e5 {9 Z4 v5 c) c) O6 w" s4 |5 |( A
  44. #ifdef EDMA3_DEBUG' I7 M3 t/ K1 f. E* H* z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    5 r6 d1 Y* e! S* K, r
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 }- W# P, n' F6 b
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 l7 A9 s' w5 {/ Q$ A* a
  48. #else( C4 p5 o& w2 v! h5 c4 S; A
  49. #define DMA_PRINTK( x... )5 i  f* L" p7 O: A, |
  50. #define DMA_FN_IN3 p3 @) n. E# ~
  51. #define DMA_FN_OUT
    " A6 Q6 j* O  k' B/ _, v! L
  52. #endif. Y3 X3 B% o; i

  53. 2 w! i, ~, s1 _  z, f  g, \
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . Y, f& I6 M# F3 s; ]4 J5 U
  55. #define STATIC_SHIFT                3- h8 Q4 U# A' e4 L6 H1 f7 Z# C+ Z
  56. #define TCINTEN_SHIFT               20% e: o0 Q& u- e, K' D
  57. #define ITCINTEN_SHIFT              21
    " r. l; M( i6 c3 m! q) O% e
  58. #define TCCHEN_SHIFT                22: A  K3 W% {% \' E
  59. #define ITCCHEN_SHIFT               23
    " |* P7 `+ z8 `$ K

  60. 5 v; V- Z' v+ Y2 ]
  61. static volatile int irqraised1 = 0;( C' o# h  b. Z9 t  L
  62. static volatile int irqraised2 = 0;1 g! k1 t9 o  }, M, b* j
  63. / E* r  w( M4 ?8 p. V
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 }! r% z+ T! X( ~* U& h9 R
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' p, k$ t. K5 U$ B/ r$ ^
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 h2 z$ ^1 _6 H$ {
  67. : E; @& \) e7 ^
  68. dma_addr_t dmaphyssrc1 = 0;
    + N; [6 ~( b& O$ E& e
  69. dma_addr_t dmaphyssrc2 = 0;2 r6 b" N; R& w9 @( D
  70. dma_addr_t dmaphysdest1 = 0;9 d# M/ N  [% m4 `/ G" Q; E3 B- _  @( m$ L
  71. dma_addr_t dmaphysdest2 = 0;4 H) D/ T3 ~/ C8 D2 h

  72. # E5 D; \+ B) H
  73. char *dmabufsrc1 = NULL;  o* ^, M6 }6 P0 I. O
  74. char *dmabufsrc2 = NULL;
    % ]2 T/ [1 l# W) Q% ~
  75. char *dmabufdest1 = NULL;
    9 n6 ]" U1 h& P  Z% J# }" q. ~
  76. char *dmabufdest2 = NULL;
    1 g' @+ h; p1 \9 M2 g  F
  77. 9 m% ]6 Y6 B8 M6 }
  78. static int acnt = 512;
    1 z4 g! o% U' B+ N: X% O  [  l
  79. static int bcnt = 8;/ o) [: i) t2 ]$ x; `; }
  80. static int ccnt = 8;
    0 T1 b  d4 R9 B- x, u( {7 w
  81. 9 m# f: y1 A5 R) b+ r
  82. module_param(acnt, int, S_IRUGO);
    " L( s2 d  t' Q. Q
  83. module_param(bcnt, int, S_IRUGO);9 e, r! f# w3 Y: {% T: B: B8 m
  84. module_param(ccnt, int, S_IRUGO);
复制代码

+ A& ~! O. l% S/ w" S1 Z2 g( m% ~8 i
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ Q& l% Q4 D) b5 I+ b0 L
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 ?% Q* ~1 O# R
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ G2 n8 y. ?$ Q8 h" M  Z1 s

9 Q( q  c7 i2 i
& H  w7 a+ Z& o5 t
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-22 23:48 , Processed in 0.039029 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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