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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 I8 X% X1 f2 V, B! C' E% w
  1. [code]EDMA sample test application
    8 @- a# F3 G' \$ W; s9 i% K
  2. /*
    6 ^! f# v9 O4 K, u* k6 a
  3. * edma_test.c
    - P* e( n% p: m0 V% R' a2 Y
  4. *
    , e6 p) n" R# M, |. z
  5. * brief  EDMA3 Test Application1 W9 p" T# m3 O  v7 P
  6. *
    5 T6 e; z7 M3 b( o8 Q) I( R
  7. *   This file contains EDMA3 Test code.6 c, q: `" X  @% \9 Z1 h! Y
  8. *
    3 G5 z6 D/ t+ o  g
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. R1 x' q0 b4 o$ y! R7 ?& V
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; n" p$ }9 ?; k* t9 K3 N- g9 E' P3 F* R! I
  11. *         TO CHANGE.
    ) I& F# e9 u6 L, A5 {9 x
  12. *
    9 d0 b9 e/ @/ D* Z5 d6 F5 x
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 ^, S; y6 T1 }. F0 }4 x
  14. */ G2 L3 t+ P* W
  15. * This program is free software; you can redistribute it and/or/ A; k+ u6 r: W9 g
  16. * modify it under the terms of the GNU General Public License as
    $ E; @6 z1 h2 d5 I" @1 l
  17. * published by the Free Software Foundation version 2.# Q3 Q& A1 q7 z! A$ Q
  18. *
    ; m, c; U4 U6 p# o) U
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 I' e- X* J* f4 d
  20. * kind, whether express or implied; without even the implied warranty0 V+ }; E- |7 A2 x  ?
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) M- X2 n+ X$ F3 ?
  22. * GNU General Public License for more details.# W$ C0 r+ u/ H* _2 v' E1 v1 I
  23. */$ j4 y/ l( g% M& ~- S! z- ?  A

  24. # c1 d( }& q$ R8 R1 @
  25. #include <linux/module.h>3 R% B) q' N( c
  26. #include <linux/init.h>/ \2 \; w, w0 i+ p8 b
  27. #include <linux/errno.h>% N- d: H) O5 `# u' P, [
  28. #include <linux/types.h>7 L( o- a+ P# Y4 c1 @5 ?" F
  29. #include <linux/interrupt.h>
    8 i7 c* X$ Z& O2 J  Z
  30. #include <asm/io.h>  k" z+ U) f' m) j. k6 Z
  31. #include <linux/moduleparam.h>3 X9 v3 {6 S" o% D+ Z( a! Z% H
  32. #include <linux/sysctl.h>
    8 Q( N3 a; [4 \* a5 _& O
  33. #include <linux/mm.h>
    * }8 e* C2 i3 W0 g: J8 {
  34. #include <linux/dma-mapping.h>
    0 P- a' m2 B6 i2 m0 l
  35. # X( D$ w3 D' h' ^% ]7 {$ B
  36. #include <mach/memory.h>
    , K# L/ p* @: a9 W, h: u
  37. #include <mach/hardware.h>
    # B6 ]% _( r9 s- f( R8 l4 [: P( P
  38. #include <mach/irqs.h>
      Z" p- e+ H3 Z$ _
  39. #include <asm/hardware/edma.h>
    3 `6 a. I. [# l) E0 _, c8 ^3 v
  40.   z+ s* e4 H# \0 n1 n2 s  b
  41. #undef EDMA3_DEBUG
    6 [' ^. I( _/ q  v2 x* G+ j7 a
  42. /*#define EDMA3_DEBUG*/
    - H& |  u/ Z0 j: G1 b
  43. 1 V2 \7 q% L% L- g; M
  44. #ifdef EDMA3_DEBUG
    / [" G% ?" F; h, h  W- E* W4 S
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ W# F% }  Y) K" m
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)  |7 R4 C) q3 G
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    " x+ t0 K/ x: p1 I* J7 {
  48. #else1 }8 Z$ S9 j# s% d7 @! k8 n! L, Q
  49. #define DMA_PRINTK( x... )
    % d: \2 r' G8 L: `4 H! R8 J
  50. #define DMA_FN_IN$ w8 h" a! x( u1 _4 _
  51. #define DMA_FN_OUT: f4 g5 l3 F6 \* i
  52. #endif) X: s. a7 x4 q- y% M9 o, a

  53. 5 ^  \& i  z$ O- I8 X# ]8 i  N9 K
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): l$ U: h2 `- n. G! H+ L3 k
  55. #define STATIC_SHIFT                3
    ! b$ S$ W, L  G0 N# i
  56. #define TCINTEN_SHIFT               20+ r0 ^7 b0 o+ B3 a" O
  57. #define ITCINTEN_SHIFT              21
    7 A. O- A; J+ A, f8 m! m9 u5 A
  58. #define TCCHEN_SHIFT                22
    4 o) Z7 X7 v9 Z
  59. #define ITCCHEN_SHIFT               23
    1 H  u. E) e- q5 m. A- {! t) v

  60. ' @$ ^! Y9 e' U9 }
  61. static volatile int irqraised1 = 0;
    + ?7 T( z3 ?. z7 ~
  62. static volatile int irqraised2 = 0;, }3 ?6 j) T" C  ^! C7 D1 m2 F

  63. ' X' L; }- s* U& h8 p
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  @) U* z0 }6 R/ F4 `+ [" i( \& d) J
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & p9 e7 V% f9 ?* K- T2 h1 }; y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 K! @  S- l# n, D# d+ E2 L. D% J" D

  67. , I* V7 n: x7 R" P9 Q
  68. dma_addr_t dmaphyssrc1 = 0;
    & h, O+ @! M. T5 t- K! @
  69. dma_addr_t dmaphyssrc2 = 0;
    6 U. ?7 ^6 ?1 ]% c. ~
  70. dma_addr_t dmaphysdest1 = 0;; b& A8 i. Z' \3 y# u
  71. dma_addr_t dmaphysdest2 = 0;$ Y% V9 V/ F2 u( M3 f% J( g
  72. ; U* N# @# O+ Z0 I, F  Q
  73. char *dmabufsrc1 = NULL;
    8 C% q9 \$ P! n, B, ^5 ~8 Q* [6 s" L* J
  74. char *dmabufsrc2 = NULL;& M3 u. W; N; s3 F
  75. char *dmabufdest1 = NULL;
    * O6 s# k* ?" Z- i
  76. char *dmabufdest2 = NULL;% S( I% [2 a5 H5 J) |% z$ [8 w
  77. 9 Y2 v8 |  H+ e# \  T1 F
  78. static int acnt = 512;
    & A7 V& C) D. f4 N) @6 l! v
  79. static int bcnt = 8;
    ' g; ]  f7 ^$ E) U' ]
  80. static int ccnt = 8;, u; p+ h& E# ~# \: E% h
  81. + w: H/ E- z% P# ^0 D. ?: L
  82. module_param(acnt, int, S_IRUGO);8 c5 \: W/ B& H
  83. module_param(bcnt, int, S_IRUGO);
    ' \6 x( E1 [; z
  84. module_param(ccnt, int, S_IRUGO);
复制代码
1 I* S7 m0 N8 c% {9 ?2 Z
# ]% ]( o5 t  I7 V8 c
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ Y4 n8 E, k4 ?0 [  G, varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 v4 V) l/ L; @0 t( {) s     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% |/ U" k9 }1 j6 M3 C
% Z# n. T3 Q1 u4 `: h

5 |6 r" T( J9 h: @% g
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-14 15:35 , Processed in 0.040114 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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