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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 Q' P% S$ p# c- u6 Z! G9 y- E
  1. [code]EDMA sample test application
    . O0 ?# j+ F3 N, C* l, }6 j
  2. /*
    ; s( E& ^8 I& X+ W! T8 A) T
  3. * edma_test.c8 u2 G2 p$ g$ e7 P% g
  4. *
    " X# Q, w9 w* g2 \
  5. * brief  EDMA3 Test Application! O" }( R9 T. d  E
  6. *
    , l/ S# U* o0 b
  7. *   This file contains EDMA3 Test code.
    & x# @) ^2 e& ?, F, v) i
  8. *7 M: O4 u1 I* h* J9 S
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    4 u5 I, |! A: I9 n/ F5 U% R: I+ E
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ R2 ?9 Z/ {+ V$ U& `
  11. *         TO CHANGE.) T5 P) Z4 \( H3 }8 B) N$ y
  12. *: i8 [$ N3 @8 M2 J
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& f$ Y) y1 T4 F+ ^& p6 y9 y& J
  14. *2 J) r# f$ a) b: n" o
  15. * This program is free software; you can redistribute it and/or
    * v7 f6 C6 {% o% K1 i
  16. * modify it under the terms of the GNU General Public License as' }* m# ?, G" A; |" ]
  17. * published by the Free Software Foundation version 2.
    9 X0 f, o/ B& N
  18. *& M* W, n5 e& F- V
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    . ^3 |8 M* C- H& W' I/ j4 g3 ^# `* x
  20. * kind, whether express or implied; without even the implied warranty
      g4 W6 s) M8 B* ]
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the1 }" a. Q  E% z- O1 a
  22. * GNU General Public License for more details.
    " _0 x7 j9 B- G* |' L7 c
  23. */
    9 b9 Q% S: j) @

  24. # ]. n/ w0 j' E, u5 K$ c, i' l, B
  25. #include <linux/module.h>) p# o4 v3 v3 g* L1 e, s
  26. #include <linux/init.h>
    , L6 n/ ~* v7 C8 Q) K$ F
  27. #include <linux/errno.h>
    : U3 G3 r. n3 i, W% ^! H
  28. #include <linux/types.h>" l, p% M0 w& `& ?
  29. #include <linux/interrupt.h>  k1 K5 m$ t# `
  30. #include <asm/io.h>  ]: _" D) Q) r. X. W9 o
  31. #include <linux/moduleparam.h>
    $ k; G/ b# n- `. |4 {
  32. #include <linux/sysctl.h>
    / Q9 W1 ]8 e6 D: }; c
  33. #include <linux/mm.h>
    * S5 `6 \+ M; z7 ^1 B- c  K7 K
  34. #include <linux/dma-mapping.h>
    + T. w! o* f# g# a
  35. 7 g' Q+ w: s* H/ w: d( e+ l
  36. #include <mach/memory.h>
    $ m% k4 S- L- h
  37. #include <mach/hardware.h>, u8 z- G, M. @2 K' q/ H
  38. #include <mach/irqs.h>  o: R) B! V$ r+ W* Z
  39. #include <asm/hardware/edma.h>& I, J$ x0 O& W4 ^' n* x, }
  40. / D$ E$ K; p! u
  41. #undef EDMA3_DEBUG* c- Z2 c6 v1 r3 G/ G
  42. /*#define EDMA3_DEBUG*/" o. N! w# Z( B+ ^( M) }# O; q7 u
  43. : N( ~4 B& A$ a) \9 b8 r2 x
  44. #ifdef EDMA3_DEBUG
    3 A$ j: b5 z& w) C* {
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( {6 }7 n+ L: T+ c3 I5 h, \2 E
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 m9 f0 d9 s2 T
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)  C& s* z5 d& Y: v
  48. #else# K. N4 V% u1 G5 x
  49. #define DMA_PRINTK( x... )/ v$ \+ @/ N, H  j. b. ^9 J
  50. #define DMA_FN_IN
    9 c9 H) x5 J4 l) `9 S9 E
  51. #define DMA_FN_OUT6 s* S# j: x2 {. T8 d
  52. #endif
    # {+ i8 B2 t) ]  V$ q& k8 U
  53. " E$ y1 A3 Q; \" C; C3 \: X
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ y* Z" [4 Q2 F* T4 V3 j& N
  55. #define STATIC_SHIFT                3
    8 r5 f0 |+ }' d' v
  56. #define TCINTEN_SHIFT               20# M5 Z% u3 v9 F/ q
  57. #define ITCINTEN_SHIFT              218 ~' L0 E0 V+ V
  58. #define TCCHEN_SHIFT                22  V) {/ y/ ^8 _$ D! q
  59. #define ITCCHEN_SHIFT               23  l+ m+ j. g; k6 H0 B; h

  60. ' I( ^( U. F. x; q; {6 j6 k- r
  61. static volatile int irqraised1 = 0;
    5 I' I: Z( ?( ^7 C
  62. static volatile int irqraised2 = 0;* R: W; d7 y- ]  H
  63. : x4 z( D% W6 D: L9 n
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) f7 H6 J& ~; d5 F* C
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - c+ ?) x$ s6 S5 L2 ~
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 m& ?+ B5 f$ r+ B! T

  67. 3 c& N1 c4 u! u5 ~3 N* t
  68. dma_addr_t dmaphyssrc1 = 0;
    ' C) N: w0 D7 f, |+ I' R0 u
  69. dma_addr_t dmaphyssrc2 = 0;
    2 H6 S/ z8 A# i: r; N& ?# t
  70. dma_addr_t dmaphysdest1 = 0;& V3 m7 ^0 ^" _/ |" Q1 W3 w; _2 d
  71. dma_addr_t dmaphysdest2 = 0;
    7 G/ Z5 \$ `- t/ k- f4 o5 K6 d

  72. 7 Q4 z4 F( Q4 V; S) K: X# s1 v" j6 N( d
  73. char *dmabufsrc1 = NULL;0 }. k4 c- F0 j3 T& V& ?8 ~
  74. char *dmabufsrc2 = NULL;/ h8 Z0 O. d7 A  s  J
  75. char *dmabufdest1 = NULL;
    ) u5 p6 x' K7 _# K
  76. char *dmabufdest2 = NULL;1 c" k% y$ Q: S; v) \

  77. & w) f$ q  j4 @) k- z4 S" y+ F
  78. static int acnt = 512;
    8 h6 }9 i1 ]& Q7 Y' ]# [& d
  79. static int bcnt = 8;
    0 J) F  h% K; C3 W8 m: K
  80. static int ccnt = 8;
    # P# i2 A5 P+ S, a! R
  81. ' Q: e! |6 T- L/ i; j/ \
  82. module_param(acnt, int, S_IRUGO);) P2 }) s- P: F! T: k# j
  83. module_param(bcnt, int, S_IRUGO);8 _  c, Z/ O2 \# d  U
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% {) v+ B  ?$ x/ T% x  n( ^3 ~( ^2 \3 e  A5 v9 q) g* c# H4 i- N
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 V9 z1 P2 ^) Z5 e2 f/ a
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。  c. g& b6 X1 W* a
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 H- k. w& C& G) i6 t/ v6 y' \: u) C
% h; X$ @# {" L5 D

7 `5 q6 w' s2 H9 |, |4 f) Z  I8 z+ w4 o
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-16 01:32 , Processed in 0.038635 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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