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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 @3 f! I& o) E- g
  1. [code]EDMA sample test application
    $ ^9 D5 Y# \# ]. u: p- S
  2. /*, p" K- s5 x% j1 _& K1 X$ `8 s
  3. * edma_test.c
    5 i6 ^7 X! U2 V) b7 k: R
  4. *
    0 X6 b9 L2 Y  ~
  5. * brief  EDMA3 Test Application
    0 f  _  W+ k6 W- g* F1 ]3 r1 H
  6. *0 B+ y; ?- A8 M, g, y  P
  7. *   This file contains EDMA3 Test code.
    7 g0 o% S3 Z: U, p1 O
  8. *4 z1 Y4 i" _; ~1 t$ s5 Y0 @
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: H2 z" v; x; [" Y0 r9 }1 l
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    - |5 B& K+ i3 k1 x( x
  11. *         TO CHANGE.
    # K8 [) v) e0 X, b
  12. *
    8 g# v8 R$ `$ |; U- H2 |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 c0 e4 c* {' W& O: j
  14. *. q& o/ o! X5 ^- p6 T) W2 J
  15. * This program is free software; you can redistribute it and/or
    . Y. e. O3 b: F0 L( U+ I& S
  16. * modify it under the terms of the GNU General Public License as& ~# u$ v- Q5 \
  17. * published by the Free Software Foundation version 2.- `- c) P! _% o' D' ]3 a2 \% h
  18. *
    ( }! E- \" h6 T+ P  A
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / {9 ~5 p+ }1 O) w# ^9 _3 ~) ], ]
  20. * kind, whether express or implied; without even the implied warranty
    0 t4 I6 N1 P! b: J: G
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the6 p  ^  E# A* q
  22. * GNU General Public License for more details.2 A$ v& l' Y+ j$ r
  23. */' }9 Z! G1 X: o/ m, R

  24. 2 C1 `" `$ T" q& ]
  25. #include <linux/module.h>
    / S6 |; ?8 y. L6 ^7 l( m  c( w
  26. #include <linux/init.h>
    + I( F! k( `- W
  27. #include <linux/errno.h>
    % A- q, t7 x/ u5 t/ b7 K$ [
  28. #include <linux/types.h>) ~- T7 ^/ e$ r1 [
  29. #include <linux/interrupt.h>2 d- Q2 w: g7 X& e
  30. #include <asm/io.h>, X0 X9 j" `% H0 w' N( m
  31. #include <linux/moduleparam.h>" X/ r5 K0 ?  l9 A
  32. #include <linux/sysctl.h>
    ! d" I4 }+ s- ^: w4 j5 n
  33. #include <linux/mm.h>
    0 O9 L: D6 ~5 z/ E" U( h( k
  34. #include <linux/dma-mapping.h>1 o1 U! C- w+ Z: t& o! F

  35. 6 ?5 d* F, ]3 H" c% v- r5 r5 M
  36. #include <mach/memory.h>
    $ I" {( Z7 C3 y0 r, L
  37. #include <mach/hardware.h>
    " e' y6 i  W" t1 t
  38. #include <mach/irqs.h>
    : b6 p0 y. {1 V: ~. b3 m- i
  39. #include <asm/hardware/edma.h>, s: V& |  Z  K; m) m1 @

  40. . f/ F! O3 t( N3 d
  41. #undef EDMA3_DEBUG  ]9 l; w" w0 x2 |7 S" X( F+ Q
  42. /*#define EDMA3_DEBUG*/% m0 E" V& H, u) w

  43. : L" X- ~7 p4 s4 b
  44. #ifdef EDMA3_DEBUG
    : ?' i2 r! ~; M" T7 s2 h# J
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)  }) }9 m2 C! P( {  N; S
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    , t8 Y0 U; Y# o- I3 ?. U
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ k5 w8 ?  w  U- n
  48. #else
      e/ K$ t$ M* o( O  Q* M6 q
  49. #define DMA_PRINTK( x... )7 b& k& i& f4 `* f7 Z- Q
  50. #define DMA_FN_IN0 y( ~( \0 j! N' I' f, ?+ |9 B
  51. #define DMA_FN_OUT
    ; ^1 k/ @! F% @6 b! p# y
  52. #endif
    0 j+ K& P& E( k& ^/ ?& @
  53. ' B7 k+ [; B2 H
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)% n0 \3 \  P7 v6 w4 |) v
  55. #define STATIC_SHIFT                34 I2 S" _9 n7 Q- z8 Q
  56. #define TCINTEN_SHIFT               20
    , `+ W; O! D/ t4 \* {
  57. #define ITCINTEN_SHIFT              21
    ! O3 t& b" D5 g
  58. #define TCCHEN_SHIFT                22
    " l$ [7 u- o* R6 W
  59. #define ITCCHEN_SHIFT               23
    9 s3 X8 _- R* o; W

  60. $ J( t+ p6 \4 p# ^( H+ S6 d
  61. static volatile int irqraised1 = 0;
    ! |  ^. G7 E7 Y# k# U, V. ]$ |1 u! Q
  62. static volatile int irqraised2 = 0;) U! [! i7 N  q' Y+ F6 G2 }

  63. $ V5 s5 {- U& N+ K- L
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 H! v! `+ s1 \1 p; P
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      J) r1 G: L  O2 Y! W
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ D5 v/ |' K1 I. ?' d* e' Z
  67. / y* e/ @6 i; |2 z% Z, v" ~. ^
  68. dma_addr_t dmaphyssrc1 = 0;5 W. y# `' g/ t
  69. dma_addr_t dmaphyssrc2 = 0;: G) n1 Q7 X& t
  70. dma_addr_t dmaphysdest1 = 0;- m* x8 w( y, q+ b% a4 ?
  71. dma_addr_t dmaphysdest2 = 0;- G4 _8 {; U& V+ C6 G9 \4 E

  72. ( D+ k+ \0 x6 z. c* i# i0 [0 E
  73. char *dmabufsrc1 = NULL;
    8 e6 E6 o" K9 k! ]( L
  74. char *dmabufsrc2 = NULL;3 k6 H5 m) h9 D, @; u' d2 H8 j* V3 G
  75. char *dmabufdest1 = NULL;
    4 m7 ?; L2 D- G5 R) E: \
  76. char *dmabufdest2 = NULL;
    ! a, q7 j" d, m. f- E( a6 x4 K

  77. ' R' S% r$ x! o+ `  j6 K
  78. static int acnt = 512;
    ' p' P* e0 M! z* d: {0 D4 O
  79. static int bcnt = 8;
    3 S/ |! v. z6 }
  80. static int ccnt = 8;
    , @. \; F9 g' P! O& Q( q8 j7 l) B

  81. - u' A3 D% q8 x( q1 @7 `' a
  82. module_param(acnt, int, S_IRUGO);
    / K' k, [7 ^7 |( o5 d: r& r
  83. module_param(bcnt, int, S_IRUGO);
    7 A: R/ m6 T2 ^4 N: a
  84. module_param(ccnt, int, S_IRUGO);
复制代码

2 @' h& o2 _9 v: _' i* t! m9 `* v* f2 |/ i; S) t" J5 x2 }
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 s4 g1 k$ b- Qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% S% Q% K. C/ R7 v) N) {/ c     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' @3 z" G- `4 j$ i4 A, ?0 G
3 I4 D/ I0 n8 j! c# M0 T  Y
0 @$ _* v. p/ Z' ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-2 10:30 , Processed in 0.082959 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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