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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , |" p: h2 S, x& Z: p
  1. [code]EDMA sample test application
    + G" ~- W8 I$ ?6 f/ ?/ {% t# L
  2. /*
    0 P6 ?4 a' z& ^9 W1 ~- o( }( H" |3 A4 D
  3. * edma_test.c* p7 y8 U$ R2 L: t+ [
  4. *
    3 z2 _6 V4 ~8 k* F4 Y
  5. * brief  EDMA3 Test Application
    9 N6 Z! x. s1 X9 F6 V1 _+ M
  6. */ T" L% A( g6 ~
  7. *   This file contains EDMA3 Test code.
    , }; [8 n! `3 H) }. {" I
  8. *! ?0 K/ T. H. V: ^" K! o0 S! @$ a
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 K" E$ M' h, M6 n7 \: u  R) M: A
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    " o- A/ n: t2 u; s1 M3 y
  11. *         TO CHANGE.2 \5 d2 F; D: F" D# u5 W
  12. *0 I2 o- u- u" ?1 u" t9 B
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ; j% ~, g& @2 T5 c5 M( @& t- B
  14. *
    $ V+ f( F5 T% V5 |4 K" U+ N
  15. * This program is free software; you can redistribute it and/or
    " E( ]( g2 t) r8 Y7 H7 G
  16. * modify it under the terms of the GNU General Public License as
    # N; c; x; _. B
  17. * published by the Free Software Foundation version 2.* q  _( r5 h$ Z6 a
  18. *
    : G) D# h  V+ D# {. H# d' ^
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any* @! O/ D! ~) [+ u, [
  20. * kind, whether express or implied; without even the implied warranty
    3 j2 A1 i) |! s: w+ p# w1 C/ T
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the% [  Y  j0 e4 Z9 b. s' y
  22. * GNU General Public License for more details.8 F2 m0 {1 f; O. _& |
  23. */
    4 L3 e! f5 Z& [  b1 K2 D7 f
  24. * T/ Q& u& O! X' a
  25. #include <linux/module.h>
    , W0 q0 @8 ~  p, m' |. A+ _
  26. #include <linux/init.h>0 W2 j* h) [; Q* I9 ^3 G$ M& ^5 X/ _
  27. #include <linux/errno.h>
    ; v5 e, S4 N: g/ D1 y
  28. #include <linux/types.h>: S. b8 e  p5 w3 T0 l
  29. #include <linux/interrupt.h>/ o  \) |5 ^# G# Q$ C7 \4 H; t% y
  30. #include <asm/io.h>- f' B* k# }" Z  M
  31. #include <linux/moduleparam.h>- _) L9 z7 |( x# C" Z
  32. #include <linux/sysctl.h>/ }- _% Q1 f5 c" P0 `
  33. #include <linux/mm.h>3 b/ y* l( W6 Y% ]
  34. #include <linux/dma-mapping.h>
    5 A) ~  ^( |" D8 T: ^

  35. + z2 W4 T; [" G" W, C
  36. #include <mach/memory.h>3 O- p% t8 j0 J0 \  V
  37. #include <mach/hardware.h>
    0 H, @6 F& W. u* F4 d2 y
  38. #include <mach/irqs.h>3 U8 t- g5 X+ B" U2 m2 {, y0 a/ Z9 `
  39. #include <asm/hardware/edma.h>+ L4 H6 D7 ~; s) [2 B  i
  40. / v4 I- Q4 w& M! W5 l1 b. @
  41. #undef EDMA3_DEBUG/ P% v! H2 k5 W" J
  42. /*#define EDMA3_DEBUG*/: K+ Z3 ^5 {, {. P& b1 o% g- Q
  43. & Z6 s/ v3 Z+ j7 B1 u" Z2 B
  44. #ifdef EDMA3_DEBUG
    " O: P2 z3 e1 B! n0 v3 G
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# e" a/ `3 }7 s) d8 p
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & i0 t( k4 V$ q( S
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      G; D- a2 A( K1 N1 {8 a
  48. #else8 h/ L0 E: e# s  N+ P
  49. #define DMA_PRINTK( x... ), _+ c0 v4 Q9 r; Q  z) V. U
  50. #define DMA_FN_IN
    1 R2 v2 h0 Z, F2 Q! a( D
  51. #define DMA_FN_OUT$ G2 M  `7 E9 B( ?$ M) b
  52. #endif
    % ^: k! }9 C8 k( F

  53. ; }- M* ^5 l3 m# I5 I% c2 ~
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    - @2 z& @4 E3 @) K$ ?; [8 V) I9 h
  55. #define STATIC_SHIFT                34 t0 ?2 B& {' M6 _9 Q  f
  56. #define TCINTEN_SHIFT               200 X, r$ _+ y4 o% U$ l$ ^. |0 J
  57. #define ITCINTEN_SHIFT              21- V: @1 I: A( y$ a. {% g
  58. #define TCCHEN_SHIFT                22
    4 l4 i6 C$ g( Y  V$ Z9 k
  59. #define ITCCHEN_SHIFT               23+ c6 \; i7 }* G) v
  60. 2 B# V" K6 k+ A; G+ Q
  61. static volatile int irqraised1 = 0;" W1 g$ Y7 L6 N$ N( X3 c& @% w
  62. static volatile int irqraised2 = 0;. J  [% }+ ~9 P- a+ E

  63. 2 k* i4 e4 z- M* ~# ]' N
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ q& o1 Q& p0 f
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ q* v3 g- N' {0 e: t% q4 o
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # H  t8 A# d8 p8 u

  67. , e8 E  K7 @- C4 Q5 @
  68. dma_addr_t dmaphyssrc1 = 0;
    0 ?+ e+ t$ I. t+ e9 j
  69. dma_addr_t dmaphyssrc2 = 0;: Z! D. A7 |# p: Z
  70. dma_addr_t dmaphysdest1 = 0;9 p( ]9 s. c" K) a+ }
  71. dma_addr_t dmaphysdest2 = 0;
    + A6 r/ `; x3 _
  72. $ w# |- o6 O. m3 Q" y$ G
  73. char *dmabufsrc1 = NULL;
    0 W# ^) |* L4 p# `+ b$ T8 f
  74. char *dmabufsrc2 = NULL;* k6 |! {# m, b) s
  75. char *dmabufdest1 = NULL;. S2 \7 c4 ~" G' t! ^
  76. char *dmabufdest2 = NULL;
    8 C8 V  T2 ], S$ J+ ]& M0 k
  77. 0 [( i! k. {- F1 a: Z2 R
  78. static int acnt = 512;$ u+ ?" |/ u7 A- z. G/ t' H
  79. static int bcnt = 8;: a4 c  Q/ h3 |3 O# `1 e
  80. static int ccnt = 8;! [* b6 \/ w6 i; J

  81. / x$ H- q! S! f6 n* e  W9 M
  82. module_param(acnt, int, S_IRUGO);- [! z0 u( Q" M3 r
  83. module_param(bcnt, int, S_IRUGO);; l1 P0 G, @- J; r
  84. module_param(ccnt, int, S_IRUGO);
复制代码

7 c) a; z- s$ K# |/ c# I" m
% I6 B. R/ z, i! Q      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 p- p& I1 b7 u* H8 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% f/ x8 x' g4 y  E5 Y# }# T
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ J& w! Y; Z! Q- l7 j3 D- U" Q. R" _' i

! ?! I9 m2 \) s$ f* _
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-8 20:50 , Processed in 0.039340 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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