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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 t) p* b( {1 E$ E  j
  1. [code]EDMA sample test application. L9 ?0 e4 m# t
  2. /*( P/ I4 l% M/ |9 ^3 @; k
  3. * edma_test.c" e4 K5 L0 m# e* K
  4. *
    + e* U$ c& G  ?( a* z
  5. * brief  EDMA3 Test Application8 R) ^* N3 U- W& v' d9 e: z# I. l
  6. *$ z) f  _* m0 L2 c; ]  i( h
  7. *   This file contains EDMA3 Test code.
    4 e) z& U* L- J- E. W
  8. *
    ) Z8 o! \. V/ a- B$ l
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - d: S  f6 a2 h3 \$ t+ ~  R" j
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    9 u& E3 \. ^6 t0 o( q. m& }
  11. *         TO CHANGE.
    8 B1 e, J6 g5 m& \3 G% N1 O& p
  12. *
    8 g: Q8 B( \  W* u* u! q/ l5 i
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    6 `, P6 `4 E' U6 r3 |! o$ F
  14. *, K- l! r9 {* Q; b
  15. * This program is free software; you can redistribute it and/or
    9 d: t$ ~1 ~  c
  16. * modify it under the terms of the GNU General Public License as) [/ y! Z' V1 ^' Y: M% _5 x5 N" |
  17. * published by the Free Software Foundation version 2.7 S, u  U& o: W; B! f
  18. *
    ( F+ L* L9 d+ S1 k! N3 Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ) B/ n4 E2 P5 y' a- v' `
  20. * kind, whether express or implied; without even the implied warranty5 A! U& [: @* r3 c# \* K% v
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    9 a& d$ a: U) u  y5 S2 b; X- Q) C' I: R
  22. * GNU General Public License for more details.
    8 e5 S7 j6 M6 ~! `& c
  23. */# R; l* m$ i* F% _
  24. $ \4 n! K  v  c% ~6 L7 M: X% b3 w3 l
  25. #include <linux/module.h>( X/ n; x0 V& u& X% A1 f7 @$ Q
  26. #include <linux/init.h>7 ]4 Y: J- l. O8 f9 U# S" C
  27. #include <linux/errno.h>  f4 M, k3 t5 r3 e& [/ S
  28. #include <linux/types.h>
    / j$ ?" B. ]# \& r1 O) r
  29. #include <linux/interrupt.h>
    1 e$ a* q- |0 {9 F2 P: a8 [! I0 k  v
  30. #include <asm/io.h>
    % E( f) S5 ?1 D/ r
  31. #include <linux/moduleparam.h>8 k1 d- O; O0 b0 ^: Y* j
  32. #include <linux/sysctl.h>
    5 l5 X; B$ y- G* Y
  33. #include <linux/mm.h>
      |3 S0 w" o& P& Y+ x& C4 C
  34. #include <linux/dma-mapping.h>* i; o- f/ R, O+ A9 V) P
  35. 1 \6 }. s! Y$ o$ W. W
  36. #include <mach/memory.h>
    . ~( j) I& z7 q5 F& M$ N; ]" B
  37. #include <mach/hardware.h>3 j8 _( n! R/ ?
  38. #include <mach/irqs.h>5 \9 o3 [$ \  [; p2 W5 U
  39. #include <asm/hardware/edma.h>
    ! F. g1 f' X. ^3 q5 n& A/ U
  40. . k/ G3 w, a  B) `) t7 c
  41. #undef EDMA3_DEBUG
    " _% v& a3 Q& d. I) b
  42. /*#define EDMA3_DEBUG*/8 G' A# q+ F' H( @

  43. 5 h$ m' u. ?( m( W* j1 i  K4 g
  44. #ifdef EDMA3_DEBUG" W) H5 s$ ~9 h( W0 i
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    , v1 a. b1 v; Y7 {/ U% S
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; r0 T" K' E. j3 D
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ d5 U1 w  |- ]6 q2 m5 k/ V! J
  48. #else
    $ k5 z4 n2 w0 F: W/ N& l/ d, K8 I
  49. #define DMA_PRINTK( x... )
    . ~7 T& J* S: ~6 q, `( X1 B2 q
  50. #define DMA_FN_IN* Z! g9 f7 R# h4 T3 q' ?
  51. #define DMA_FN_OUT
    ) Y) I3 b& j0 U8 Y' ^9 Y7 p
  52. #endif
    / J) N) [& t% Z) R" X5 I5 e
  53. 4 {: _0 T! W3 X; W) V0 j( w
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)5 J" v* K& u# M. b! U
  55. #define STATIC_SHIFT                35 V; t3 N5 i: u* B. z
  56. #define TCINTEN_SHIFT               201 ~2 e; g& \1 H4 ?8 M7 D
  57. #define ITCINTEN_SHIFT              21
    7 B6 v# b9 w7 E4 j2 J3 e
  58. #define TCCHEN_SHIFT                22
    2 a+ F; Q8 y2 ~0 f* ^! {
  59. #define ITCCHEN_SHIFT               23% E3 w$ [( S6 U+ S
  60. " Z2 X& V3 E: m' `, T& `
  61. static volatile int irqraised1 = 0;
    5 N! L; x5 B" [. I
  62. static volatile int irqraised2 = 0;' _& B! m4 M8 |$ e! y( ]/ u
  63. . d* ?4 u% e6 }: Q% B+ I& L
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 b2 _) H5 I  R5 R! n, `1 g
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ k: N. f* Q; ]( \
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  N* i$ s: s% K1 T

  67. 2 |  S. m9 M$ g9 n3 z4 q
  68. dma_addr_t dmaphyssrc1 = 0;
    + M  v3 ~$ z0 ]$ w
  69. dma_addr_t dmaphyssrc2 = 0;9 G7 _4 G+ c1 k: [6 l
  70. dma_addr_t dmaphysdest1 = 0;* h+ S  B  G2 C) U, p
  71. dma_addr_t dmaphysdest2 = 0;. H7 F6 I/ G. X: J5 Q. g: \) j9 H

  72. ) Y6 H, l1 g7 c4 K, Y2 n
  73. char *dmabufsrc1 = NULL;
    6 ?, g) e0 d7 O! G( j
  74. char *dmabufsrc2 = NULL;
    + p7 S2 Y1 |  ?3 t. N7 P# B
  75. char *dmabufdest1 = NULL;0 Q+ a1 ?- u! {  S
  76. char *dmabufdest2 = NULL;3 s* L0 q! [3 ^9 T% k2 m/ K7 x
  77. 8 \& z: D' i, a# X
  78. static int acnt = 512;
    3 R* e( c1 J9 u1 O! ~
  79. static int bcnt = 8;
    0 D. T, I' c# W
  80. static int ccnt = 8;
    / Z1 f0 l* t- x3 }: G2 F
  81. 0 X. y0 F# k7 |
  82. module_param(acnt, int, S_IRUGO);# w4 [6 V: e- E) Q$ B
  83. module_param(bcnt, int, S_IRUGO);
    / H/ `9 U8 `1 F1 b! P+ S
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 t- u) \* \' w- H9 T1 K

- Z8 M7 p5 V" n. ]      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ ~5 V% h! _' M4 r. b& J+ P0 f- t. ]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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% o6 v9 J" P6 V  p0 ?/ T( {$ b     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, X1 q' u( Y) O- h1 G
: }! v% j: X( @" K: t& `4 F. U

0 n1 U8 `& s% z4 j! x6 F8 m: v0 U
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-12 14:26 , Processed in 0.040514 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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