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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* b  K; @6 L" ^/ B! ~
  1. [code]EDMA sample test application' n! I( h5 y7 J% W1 y
  2. /*; @& P& ?) K3 w/ Y' P* J1 ^9 P( S% E* M
  3. * edma_test.c5 j7 D" }' A/ b5 s4 `
  4. *
    $ d( C5 Z% T& }
  5. * brief  EDMA3 Test Application
      P3 i: X3 L* m% y; U2 b. F
  6. *
    , b5 W" N. j! }! A
  7. *   This file contains EDMA3 Test code.
    " i: M8 j+ g  O
  8. *
    " |/ J& [* L; h5 w$ J3 S
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 E$ w8 \, Q2 i  W8 T+ U# z% \
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; o2 w" _" W. Z5 Q* J* F9 |) d
  11. *         TO CHANGE.
    0 `0 ?9 T4 i) `: ?* S8 ]
  12. *
    & V6 m' k5 p& y/ |* D2 A
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 K7 V1 ^# d: J! J0 X) z
  14. *: S' I) s" v) S/ o8 x1 f
  15. * This program is free software; you can redistribute it and/or. k4 s7 d( r% {
  16. * modify it under the terms of the GNU General Public License as
    4 U! a6 N; x0 l" i; }/ a" D
  17. * published by the Free Software Foundation version 2.9 f, g" O$ z* f1 f: c6 G, `/ F4 Y0 V
  18. *
    # P: ?5 c7 D" ]( h0 J& ~  H5 o
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any' N& q/ M3 [) H/ g3 Y! p( Q, `
  20. * kind, whether express or implied; without even the implied warranty
    1 n8 b$ o2 Z5 t3 S; Y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      B) O+ y2 G) M; Z' x" D0 v
  22. * GNU General Public License for more details.
    3 h4 o$ i6 i+ f4 h1 c( g7 `; Q; v
  23. */
    - L9 z$ i6 N1 j: p. }  p* `, G+ ?
  24. ; k& B# {0 s0 y0 d9 U" `" _5 }
  25. #include <linux/module.h>
    4 H5 X. i* s+ ?# Y
  26. #include <linux/init.h>6 d3 a7 l* G' {) G/ I0 A3 R; a' E
  27. #include <linux/errno.h>
    8 m& R: A* T; k+ H$ R. ]2 {
  28. #include <linux/types.h>; S4 G2 r- d' I9 |& L- T9 V' t
  29. #include <linux/interrupt.h>5 }6 j* [1 n; H9 U. v3 R
  30. #include <asm/io.h>
    ; ^/ o( C0 \4 P; r6 h* ^. d
  31. #include <linux/moduleparam.h>
    5 M$ k) N/ e1 Q* k
  32. #include <linux/sysctl.h>
    ; K2 w- j" y0 m- ?- {" Z! k
  33. #include <linux/mm.h>
    2 e) Q. z( s2 ~: @( Z3 T, T, @
  34. #include <linux/dma-mapping.h>3 X" J8 _. }# q% J* [+ M) ?" l
  35. / Z! V' K0 ~, o/ r
  36. #include <mach/memory.h>2 C' \6 ]$ m) v6 A) R4 _
  37. #include <mach/hardware.h>9 }0 v# g; x$ J  ]: e
  38. #include <mach/irqs.h>2 j6 g( _4 |7 J$ M$ l, F. A6 D
  39. #include <asm/hardware/edma.h>0 F/ A+ W: U  j" C; R* E/ W

  40. + W. R. ]0 q2 M: \) ?* ?+ r0 |8 R5 ?
  41. #undef EDMA3_DEBUG
    1 C% e  Z) }& Y
  42. /*#define EDMA3_DEBUG*/- h& R, b3 [, T! S7 W+ M+ Q/ v

  43. . W, h, q5 ]* Q
  44. #ifdef EDMA3_DEBUG( U$ N6 \+ |) d- g, J0 F! p
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    / ^7 a: G4 h4 s6 o4 Y2 t
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 D* S' F7 ?& w2 d& p" u" K5 L7 G
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- H( b8 J6 W9 ^9 {% R7 L
  48. #else
    " q: @& n  f4 G! y8 X, i8 q
  49. #define DMA_PRINTK( x... )
    - u7 g( X/ W* b! L" b# s1 ~
  50. #define DMA_FN_IN+ y2 @& x9 [6 k" Z* p6 M
  51. #define DMA_FN_OUT2 N' l, G2 h6 t
  52. #endif2 \* Y. E; i5 c' o. _+ n

  53. ' s7 }1 q9 X9 T2 i1 S# g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)# Z/ Z  I- i) D
  55. #define STATIC_SHIFT                3
    7 e: r3 w$ T6 A! s8 ~, x5 Y
  56. #define TCINTEN_SHIFT               20
    1 g$ H; `6 ]( @! W2 p1 T
  57. #define ITCINTEN_SHIFT              21
    ) `- E$ U: X4 X5 @
  58. #define TCCHEN_SHIFT                22+ M! Z) D& e$ U1 s9 X" j
  59. #define ITCCHEN_SHIFT               239 W. t8 Y3 @3 Y8 ^1 @# O& A- G

  60. . q. k) |8 V# W# _; Y$ u/ i3 Y
  61. static volatile int irqraised1 = 0;+ }; O5 X. g6 O8 C6 U
  62. static volatile int irqraised2 = 0;
    - K: l5 F) T: d% V  _- ?

  63. , d2 f4 s% D. s2 [
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      J  I0 N  |2 v) }' x
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * I( N# z. Y2 B& K0 {8 U+ h
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' z* Y7 P4 K6 g+ a0 i1 W) w
  67. 8 l& K* S! e3 K  Q
  68. dma_addr_t dmaphyssrc1 = 0;
    0 r' B1 A# d: L/ B
  69. dma_addr_t dmaphyssrc2 = 0;
    ; n& p& @- v" W) q) i* h7 @, J
  70. dma_addr_t dmaphysdest1 = 0;
    ) ^8 B0 I1 r. P5 Q; q/ f! |
  71. dma_addr_t dmaphysdest2 = 0;
    , o& Q% A" c; r  v

  72. ; F! k8 K$ r( N( \0 ]/ i. X1 U; g/ y
  73. char *dmabufsrc1 = NULL;4 R2 D- g2 c% |  S% {, |) G& P
  74. char *dmabufsrc2 = NULL;
    4 E& I( x8 l8 u( k# E, P$ h
  75. char *dmabufdest1 = NULL;0 G! G4 R. h$ a+ J
  76. char *dmabufdest2 = NULL;; E' z+ v% W1 b0 z' s9 ~& z
  77. 8 z& ~/ H9 N, M( ]) I8 W8 I9 R
  78. static int acnt = 512;8 G/ F0 e3 u0 W; O8 D
  79. static int bcnt = 8;# J8 n1 R  @, i  F: K
  80. static int ccnt = 8;
    3 x' H( U' w$ i# a/ |7 N
  81. & ~0 q. \$ M9 o7 M! J3 G7 B- y
  82. module_param(acnt, int, S_IRUGO);% B& e* r$ m5 Y
  83. module_param(bcnt, int, S_IRUGO);' Z' W- b: t6 A3 _  R; Y1 w" _1 P1 u
  84. module_param(ccnt, int, S_IRUGO);
复制代码

; a5 Q) o/ _8 y! b5 n8 d' J
* p1 u( `0 W+ a: Q+ a+ F9 T' A. H      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 {/ g2 H3 }) 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; a0 M) l, W/ r
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( M4 ?) l) Q* C, O2 I; f5 J
4 I5 t+ f) t+ X: J: E  v0 G' y
0 ~) I+ ]$ \3 B1 d- x2 a
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-20 08:19 , Processed in 0.038633 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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