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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % J0 \. o* P" a# B( P
  1. [code]EDMA sample test application
    2 I+ B( D& K, K( E7 ~0 R' G$ `" k
  2. /*
    % `; P7 M: K* ?1 u0 F: F
  3. * edma_test.c
    $ h  {( h- ^  C2 |) j3 B: z9 }9 F
  4. *( t5 M; A' o. D! w2 w
  5. * brief  EDMA3 Test Application& o7 M" h- t! B2 }) g% Q, V
  6. *
    ! M  ~4 {9 L2 q
  7. *   This file contains EDMA3 Test code.! h& O/ m5 L6 r# k
  8. *
    2 V! a8 t5 n! w& y$ N5 z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " ]7 V. C# t  R0 M) L6 ~
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 b; ?8 D( y; G8 \+ N1 C
  11. *         TO CHANGE.- G! [3 p$ Y/ s
  12. *
    ; {9 n5 _- g% g2 |6 i# n. U( |3 s
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    + B, _1 i# \; J
  14. *
    1 a6 k1 C- }& f0 i; R
  15. * This program is free software; you can redistribute it and/or3 K* n" `4 p$ Y; ^  d* C. r! m
  16. * modify it under the terms of the GNU General Public License as# T( P9 P0 L3 k" g, E% l. f& P
  17. * published by the Free Software Foundation version 2.* P4 L! {! q# I, n) M
  18. *
    , Z/ w, \' B. R& s& b
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    1 f2 E; X3 |! A0 L3 r1 }1 d1 M1 w% a
  20. * kind, whether express or implied; without even the implied warranty0 A5 j# }; P7 t1 N
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the& u+ r6 o! Z3 I6 T
  22. * GNU General Public License for more details.* C. ]5 K; h1 `8 h8 g" C1 I
  23. */
    9 d+ U) |4 \1 }% c# W
  24. * ]6 [& \9 K2 x& a
  25. #include <linux/module.h>
    ; S" v$ [6 a  K2 X% A
  26. #include <linux/init.h>% l9 Y& a% a4 x$ }8 Z& [
  27. #include <linux/errno.h>: m3 h2 s8 r4 L
  28. #include <linux/types.h>
    $ b% p" W1 S! ^  j8 x
  29. #include <linux/interrupt.h>
    3 Z# k, [+ B0 e
  30. #include <asm/io.h>4 g: l( Q( y  x) ~; j. Q2 A3 h. {
  31. #include <linux/moduleparam.h>8 b3 W7 h. f$ d# k
  32. #include <linux/sysctl.h>* ]2 c1 b1 W) q5 j1 D
  33. #include <linux/mm.h>
    9 W# v' m. ?) B- X
  34. #include <linux/dma-mapping.h>
    7 r) O% s, v0 c, ?
  35. ' @: L2 u" F9 b& J0 h
  36. #include <mach/memory.h>* j0 W  |. D. h/ R. H) ?7 |
  37. #include <mach/hardware.h>
    : N6 G( k# M- z4 @: d: m2 x
  38. #include <mach/irqs.h>7 Y7 Y0 G% G0 Y+ E+ K
  39. #include <asm/hardware/edma.h>8 R/ x6 P* B& g, X

  40. # i* v* G1 \5 D" m( A$ K
  41. #undef EDMA3_DEBUG/ b0 v" I$ {8 {6 E& j
  42. /*#define EDMA3_DEBUG*/
    / X: l. x( V6 g0 m

  43. 8 z7 a' T: n; n
  44. #ifdef EDMA3_DEBUG* X9 e9 Q2 a( o  {  P) X! e% e
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 ?* n4 U7 f  e( _) S
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      z( j7 k* ^) d4 M# B$ e9 I
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    2 N2 J3 m) @/ f9 m& Q2 C
  48. #else
    ' Q, C1 {; p+ I+ A. c# }% `+ J/ B
  49. #define DMA_PRINTK( x... )+ X. t1 G2 H' I  p5 ^
  50. #define DMA_FN_IN. a- W3 p* W- A9 R2 S- q+ F
  51. #define DMA_FN_OUT
    8 y9 G1 |+ r* z
  52. #endif
    * Y% h: e* M: }* Z# Y  U" q
  53. 2 N! @; |/ ^4 P5 N2 V: U" s6 K  P( h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    0 r2 X% q0 k, x) D+ ^  [
  55. #define STATIC_SHIFT                37 f; L( A4 @) Z6 p- {/ S
  56. #define TCINTEN_SHIFT               20, C- A* D+ q+ u% b- A3 @8 y
  57. #define ITCINTEN_SHIFT              21
    ! @) p9 E6 c4 _3 ~/ }
  58. #define TCCHEN_SHIFT                229 X8 h  v3 J% K, \+ ]6 t: r. K) V
  59. #define ITCCHEN_SHIFT               23
    3 y2 v) h' N/ ?4 _2 u- y% `- P
  60. 9 W! b, e6 ?& G% z! [
  61. static volatile int irqraised1 = 0;
    * L0 s  M0 J3 u3 J; B
  62. static volatile int irqraised2 = 0;4 Y- h* y# |2 J8 j

  63. 5 y/ s! a4 y2 v, i
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  m$ n) T' N2 s' T
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 `3 h7 m  ]1 `) v' S2 z. |
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" D( h1 i0 {# b" H

  67.   u3 U! X* W! {
  68. dma_addr_t dmaphyssrc1 = 0;! q2 o* n) F7 v2 J' N( C
  69. dma_addr_t dmaphyssrc2 = 0;
    # }8 ~8 U/ K. [! ~
  70. dma_addr_t dmaphysdest1 = 0;
    7 `2 U8 w1 v+ n# p# ?' e
  71. dma_addr_t dmaphysdest2 = 0;
    9 V4 h0 T; [/ P. w4 V. _% j" h2 L

  72. 1 H0 k3 j/ q" K3 o# I2 `
  73. char *dmabufsrc1 = NULL;, L4 g" Y+ A9 {- ~1 ^- o# o+ P& x
  74. char *dmabufsrc2 = NULL;( G/ W  {; L9 X8 h; j6 P9 T: I0 p
  75. char *dmabufdest1 = NULL;$ f# V8 Q2 N5 h% L$ t- m
  76. char *dmabufdest2 = NULL;
    2 [( X7 i& A6 {! z' g  ~
  77. : d$ @+ l* U0 ~* G; C' c) j# d
  78. static int acnt = 512;
    $ O# \- F9 ^# {- ~- D4 K" ^3 b2 l
  79. static int bcnt = 8;
    ! q5 E3 C# @1 S6 B3 S
  80. static int ccnt = 8;; q2 i; K. y* U3 t! I* v5 D
  81. # u' B( g3 e' z* H3 E
  82. module_param(acnt, int, S_IRUGO);! k9 [+ _, P1 z0 w
  83. module_param(bcnt, int, S_IRUGO);
    $ X, C- c8 ?* [
  84. module_param(ccnt, int, S_IRUGO);
复制代码
  D- \2 ]7 s* F6 h/ R1 S

2 B4 B5 e, y7 I" v: m0 q      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 z& C2 Z. h. R" R4 e* k3 f
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. m. b: w7 A4 W& b" O     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 m+ Q; V, ?1 _/ H: o
6 u( k8 B+ I. D0 r+ {) v. u5 T
9 Z# U  C" C: Q/ F
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-5 23:53 , Processed in 0.041467 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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