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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & `% B+ y7 l' Z, h
  1. [code]EDMA sample test application8 N  H$ ?* M/ n) y1 J- N! ]
  2. /*
    # \& u9 g, f* K' h* `7 o- k
  3. * edma_test.c
    ; t9 d) U9 m4 B3 g; y
  4. *
    : S% j+ s2 ^4 K- z
  5. * brief  EDMA3 Test Application
    1 y" \. Z3 ^, B
  6. *
    ) M, I" l& i* C( J" [" O" S
  7. *   This file contains EDMA3 Test code.; M- f4 L; C' G9 j! p- k
  8. *
    3 L5 X4 d  h6 F2 W' G% \
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ m  [) E( ]( M- e2 H& V
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 Y/ v: [- r* G* v' l: C: W0 n8 G
  11. *         TO CHANGE.$ i& [, p, `/ K6 U1 S4 l
  12. *
    & q9 w! m$ q! x( f3 s. L5 K7 G
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 j. M9 {8 d( \3 b4 S; w
  14. *
    + }) T1 U) [% d
  15. * This program is free software; you can redistribute it and/or' h4 z7 x1 y, X
  16. * modify it under the terms of the GNU General Public License as
    2 R2 b2 G$ ^; b$ e
  17. * published by the Free Software Foundation version 2.
    / D8 A2 J; y* `$ M) d6 }
  18. *
    ( F" @* r, U% E: `" u* d' Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    , H# H7 ?4 ?. O+ e
  20. * kind, whether express or implied; without even the implied warranty/ {# ?, J5 ?' [* U* `. m
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / i, ^; w# e3 @' r) {) A
  22. * GNU General Public License for more details.  Z9 n4 q6 m7 J+ u$ U
  23. */  M; n+ B/ e( x7 Z/ M) k5 C. A6 K7 p$ B

  24. $ @( W* H6 D! _% n3 B. [/ }
  25. #include <linux/module.h>
    ( R9 u3 s" J+ e  `
  26. #include <linux/init.h>5 O! H6 H) m! H+ `, J( b- @
  27. #include <linux/errno.h>
    7 I3 p8 F. }* a) Q) q
  28. #include <linux/types.h>
    " U7 w3 u; n" g7 D/ }! R
  29. #include <linux/interrupt.h>
    9 u5 p" q) H" i& X# Z( F
  30. #include <asm/io.h>
    7 M9 Y+ h/ B4 C* t4 e0 n
  31. #include <linux/moduleparam.h>$ g/ b/ U+ `5 s' }) s+ i
  32. #include <linux/sysctl.h>
    4 v7 E* ^4 {; W
  33. #include <linux/mm.h>0 X& Z% |2 a2 y- C6 L; F6 q) Q
  34. #include <linux/dma-mapping.h>
    4 s% e5 j9 G5 k+ C

  35. " t. A1 S" }$ J( i" x# C7 i
  36. #include <mach/memory.h>
    ) e4 C. b2 p1 j7 y
  37. #include <mach/hardware.h>
    2 M  w( u7 t. Q5 S, M
  38. #include <mach/irqs.h>: ?. Y& a( z( E- s
  39. #include <asm/hardware/edma.h>
    5 C" M9 b8 M" G) J% L* P' }

  40. * D( F& L) I" w1 ^4 B2 Y4 y3 _
  41. #undef EDMA3_DEBUG& U# L+ S; L9 G8 U
  42. /*#define EDMA3_DEBUG*/
    8 L  @* N  g& Y

  43. % U# E  F: h( Z6 G: b
  44. #ifdef EDMA3_DEBUG
    " o( q) ~( u6 J2 J4 L& z/ h
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    " e5 ?6 K2 L0 Y9 m* g
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; c5 P2 `- J6 Y* _+ ?/ h% C
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    * y3 g( |- }7 a
  48. #else
    0 E$ \; D* y$ e# c
  49. #define DMA_PRINTK( x... )4 p1 x/ U* ]" T) v) W& a0 M
  50. #define DMA_FN_IN5 t) o/ i0 v8 g4 u
  51. #define DMA_FN_OUT) K  I) I4 D7 N6 A2 Q
  52. #endif
    ( \4 O+ D$ I! ^. s
  53. $ E) D9 k" H, ]6 c# [, Z! ]
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( F$ Y" _; q' a7 J: g7 e  D$ Y2 \
  55. #define STATIC_SHIFT                3* s  j* }& ?) }- d
  56. #define TCINTEN_SHIFT               20
    $ U, c7 K: D) ]
  57. #define ITCINTEN_SHIFT              21  q% ?1 Q" n) ~: |4 N
  58. #define TCCHEN_SHIFT                22
    7 Y* P- ^  b0 s7 u/ ~/ |
  59. #define ITCCHEN_SHIFT               23* z- y9 h6 c( l+ h& l% _3 o% W
  60. ) b2 B" e/ X8 i! u
  61. static volatile int irqraised1 = 0;2 e7 I0 i3 p) E& {! u5 e
  62. static volatile int irqraised2 = 0;
    % s0 H& ]  `0 x& f* o7 ]4 j* S$ T7 \

  63. ( z8 D% ^5 [& Y* O& V- z- P
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% B' c3 S: g  Y8 U
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 |' J- s4 y2 d0 [) y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 C/ t/ t  v8 h& z

  67. ; I6 @1 ?6 F: }( ~( s
  68. dma_addr_t dmaphyssrc1 = 0;
    ) [0 ]0 i# C; Q) B
  69. dma_addr_t dmaphyssrc2 = 0;
    # \* w* J8 O7 `0 z8 N! G
  70. dma_addr_t dmaphysdest1 = 0;
    4 u( ~, k8 {0 c7 c5 E$ [
  71. dma_addr_t dmaphysdest2 = 0;" c7 m0 F: _8 ?' D( g4 U) |7 V, @

  72. 4 z: ?# O1 w$ x& H. j: O" p: {9 J1 P
  73. char *dmabufsrc1 = NULL;
    , b9 j5 f. g7 s' y1 j  o
  74. char *dmabufsrc2 = NULL;
    / |# c  O. U  k; t* e! M
  75. char *dmabufdest1 = NULL;
    5 H( I9 b  j7 }3 n
  76. char *dmabufdest2 = NULL;0 l2 m0 _6 H4 A
  77. , g) v$ R, [6 [' V1 v. I  j
  78. static int acnt = 512;
    1 r3 d0 S0 T( J$ c8 C1 l- d
  79. static int bcnt = 8;5 ]( ~. K; A/ J. F; V
  80. static int ccnt = 8;& a7 d6 D' T' P  C
  81. $ c! C! Y. h# ^+ i
  82. module_param(acnt, int, S_IRUGO);4 @) o2 W: v& M3 P( @' E8 [7 T7 i
  83. module_param(bcnt, int, S_IRUGO);
    ' w: w4 e. K; p
  84. module_param(ccnt, int, S_IRUGO);
复制代码
  }# Z. p# H/ _  _, B

5 ?" |+ l/ S1 p% W* S7 x4 v2 h      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 l1 E) e$ q8 X0 T3 Rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) o% `+ k! C4 y. l; x( c
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 Q  r( y& _' w; w2 O
  S- ~3 k+ B8 C2 I) |3 ?( p2 {
% m/ l: O( G2 w9 a9 Y& H
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-13 09:25 , Processed in 0.039962 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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