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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # G! R- Y0 h6 L: U: o
  1. [code]EDMA sample test application
    + y7 K; a4 d  u6 B" U
  2. /*
    # f, n- [, B0 D5 e3 c
  3. * edma_test.c/ L- b- {. V0 E: t* i: B
  4. *
    ; z7 {# \) b' t. f. K7 T, W
  5. * brief  EDMA3 Test Application
    9 w# r+ V8 f: U+ Q
  6. *( L' d2 ?3 d4 R3 e" i( f5 w
  7. *   This file contains EDMA3 Test code.
    2 Z1 G2 b, t. J' \6 J
  8. *$ u3 l4 ^- R0 ^9 U. ]
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* a- V. u; Z' x7 \
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, z1 q/ e& A4 x4 ?! {- S3 G9 u
  11. *         TO CHANGE.
    - G+ D% ~6 m: e$ D8 B1 ^0 Z( j( `* n
  12. *
    $ D5 C5 N0 Z& X) h7 L! u
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % W! }4 B, Z7 U0 r; U# Q8 s7 k; S
  14. *
    ! m$ }5 x9 ]& D* O) R7 R
  15. * This program is free software; you can redistribute it and/or" o) d2 o: n( M1 {
  16. * modify it under the terms of the GNU General Public License as
    6 e: y" v3 O. r9 U
  17. * published by the Free Software Foundation version 2.2 X6 r9 B, }/ ^9 I' i8 K
  18. *
    6 ^. [1 K+ ^2 Z' @! {3 ^. Q# r
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 x4 J% V+ r% f$ J$ y7 g, ]7 N
  20. * kind, whether express or implied; without even the implied warranty* f0 R- k- P7 O2 q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the2 S5 R. {/ {8 [. u
  22. * GNU General Public License for more details.
    ( ?4 x  N; ]9 h
  23. */
    * n, {- o' H0 ]" ?2 e( u1 O4 D- s& n

  24. ! A7 r: {1 K6 \& X) f- y
  25. #include <linux/module.h>$ o+ j  H4 U( j4 c
  26. #include <linux/init.h>
    4 {: n: E; }2 I* I. F. s& E1 e
  27. #include <linux/errno.h>" f7 ?( y$ O& B) a
  28. #include <linux/types.h>  m5 O  v* K- A/ s
  29. #include <linux/interrupt.h>  o/ I: ?' i" Y4 F; G
  30. #include <asm/io.h>
    4 W) z' d) u" S  p3 s
  31. #include <linux/moduleparam.h>% [  D& R+ J# ~3 }
  32. #include <linux/sysctl.h>
    ) p0 j) u' J8 X: U& G* R: b/ {) n
  33. #include <linux/mm.h>
    ! ~$ p( v" [: q
  34. #include <linux/dma-mapping.h>
    ' Z5 U# O% `5 m# m& b' @
  35. . b5 n$ }; n$ Z% E1 C2 y
  36. #include <mach/memory.h>
    4 ~2 ^$ a( T' Q/ P
  37. #include <mach/hardware.h>6 _5 B7 C, ~4 _& w+ s" ~
  38. #include <mach/irqs.h>
    2 I+ F  g, e; C  x' S
  39. #include <asm/hardware/edma.h>
    5 L2 j* v. C: W! X3 ^' |8 z/ V( e, u1 A
  40. 7 ?: L9 ]. X% X0 W
  41. #undef EDMA3_DEBUG
    * x9 n8 O1 K! i% x& K
  42. /*#define EDMA3_DEBUG*/
    8 y9 @& I  x9 L. K& B0 ~: D
  43. ) c, H+ I7 I/ _0 y4 [5 n
  44. #ifdef EDMA3_DEBUG
    1 u" h% r" Q/ O
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( v4 Y0 m1 B7 E* _0 B* s; v& S
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    0 W. a( r& {* K
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ v  z# c( S5 s7 Q- r$ g: j8 R
  48. #else
    $ |0 o/ r* i8 ]8 h5 a  P
  49. #define DMA_PRINTK( x... )
    / N& }) z. {3 m+ w, E3 N- ?
  50. #define DMA_FN_IN* w6 P5 \, t  n8 n- Z6 j
  51. #define DMA_FN_OUT* U2 ~4 m1 P% y% ^( `: ^
  52. #endif2 R: y& o# M. [# U  a

  53. 2 j1 L# F, y; G3 B4 V
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ! d- ?& N: P) A: K: o
  55. #define STATIC_SHIFT                3
    , ~* I* {/ k% f" Q( X. h1 ^7 ~
  56. #define TCINTEN_SHIFT               20
    * J/ e& B) t2 I! x7 V. c& @) `
  57. #define ITCINTEN_SHIFT              21
      I% J! i7 i" Q1 M
  58. #define TCCHEN_SHIFT                22
    ; o2 l- O7 O* b
  59. #define ITCCHEN_SHIFT               23$ v# }0 T& F; g, Y+ H. L
  60. : Y" [1 [2 I$ {! z: _1 t
  61. static volatile int irqraised1 = 0;
    1 Q% m1 a8 U; E2 R
  62. static volatile int irqraised2 = 0;4 g: m2 w7 f/ y
  63. . E& j2 R% j% C8 i, E* x
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 g1 \3 `# A6 r' F) n
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! `! a! `/ _; {, M4 ?! @' T0 [# P
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 ^' S) j/ `% q! v
  67. ( q2 O: {6 |. ]* s+ H: o' A9 v
  68. dma_addr_t dmaphyssrc1 = 0;* R3 Y" D& Z; A1 `
  69. dma_addr_t dmaphyssrc2 = 0;
    5 }" D$ [) v5 r0 y
  70. dma_addr_t dmaphysdest1 = 0;
    # x6 E2 Q( w' |7 i' A7 [
  71. dma_addr_t dmaphysdest2 = 0;0 C4 ?) c; A" ?& X

  72. 1 r- N/ D+ J; X* f
  73. char *dmabufsrc1 = NULL;
    6 r7 N2 X$ N1 m  T/ Q
  74. char *dmabufsrc2 = NULL;% o5 q& V; ]: A9 h3 x
  75. char *dmabufdest1 = NULL;2 j/ Q0 u  \6 b3 _2 Y
  76. char *dmabufdest2 = NULL;
    1 G" J3 j* L! C4 ]" w  y
  77.   @6 n  I9 b/ _* P6 v0 P4 [4 q
  78. static int acnt = 512;/ w2 S. n" T9 f- ~
  79. static int bcnt = 8;  W' K9 W! i$ q# J
  80. static int ccnt = 8;
    ) r0 e- ?9 S8 b5 x  R3 P

  81. + [# h4 x$ p, x
  82. module_param(acnt, int, S_IRUGO);
    7 T# P( F8 e% @5 r' {
  83. module_param(bcnt, int, S_IRUGO);
    4 v( i2 c3 F( x0 ^! S
  84. module_param(ccnt, int, S_IRUGO);
复制代码

/ M5 o1 g2 }- \7 G1 F  \+ @
: p1 L" q+ L" M2 q& g- y      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 Z; Q3 c& ]9 J$ R( x' V7 P$ [
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# d+ e) o+ F8 x
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ L* _6 I( t0 K4 g( A  g0 n1 `
  n  M& v6 q5 ^" A7 d( ~8 v9 U/ F+ C; @" i& v. R
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-9 22:25 , Processed in 0.046862 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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