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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - h# b- {4 }# h' ?$ F3 \
  1. [code]EDMA sample test application: ?# w$ @3 h& x: w
  2. /*
    1 X' `/ [4 w4 A0 l" I
  3. * edma_test.c( T1 i2 P, X4 c* G2 G
  4. *
    % Z; W& O% |( C8 ~
  5. * brief  EDMA3 Test Application0 U* q8 ~" Z' v8 I) d, V
  6. ** [* J4 \" t7 O0 x1 u4 U" L0 z
  7. *   This file contains EDMA3 Test code.# D5 M0 h2 ?9 x4 O, x
  8. *+ g4 w! i$ ]& e! {
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- _* o3 z/ ^( v' ^* k* B
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    2 d, D6 {* Z3 N+ T. h1 L: m3 v. |* a* I
  11. *         TO CHANGE./ s# V$ V( W4 B2 R- i! v, a
  12. *& x. _: Z8 F. g) @
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! ?0 H5 D5 k: S2 k% B3 Q
  14. *
    4 O0 U( n: |+ P5 T1 N
  15. * This program is free software; you can redistribute it and/or' i; U8 U' B+ Z+ e- S
  16. * modify it under the terms of the GNU General Public License as% W, [+ L8 v8 ~0 n
  17. * published by the Free Software Foundation version 2.
    + }' t6 L- g* e% G6 q; C" i/ a
  18. *
    0 O& c6 l0 ?# U, r# Z, G. n# s
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 j% f6 e+ U% F
  20. * kind, whether express or implied; without even the implied warranty, o, X0 R; @0 a) K# `3 m0 E
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the% i% e! v* h/ G
  22. * GNU General Public License for more details.- q, f! G! M) W6 ]( w* L
  23. */
    + h. j8 q: p. ], o1 y2 R
  24. # u& t& l: m3 [( i) Z2 N; }: I
  25. #include <linux/module.h>. A+ c  Y9 c" t0 J/ l2 c& V
  26. #include <linux/init.h>
    ( a, W  I( |6 ?1 B6 P6 L! L
  27. #include <linux/errno.h>
    7 z+ L3 l6 ~5 w" H
  28. #include <linux/types.h>
    3 @1 u6 y! q, S/ Y
  29. #include <linux/interrupt.h>
    0 u6 L/ f! `/ ]  r. ~' H
  30. #include <asm/io.h>
    ) R+ E' O9 T# o! L
  31. #include <linux/moduleparam.h>; _# A5 e! j, g) ~% X
  32. #include <linux/sysctl.h>1 a7 R3 m5 j3 _* r- Z% y& h
  33. #include <linux/mm.h>
    / j, v  u! x' R
  34. #include <linux/dma-mapping.h>
    " z; X  T' A& s5 r) P' r

  35. , R. s0 ]( L3 K& h8 m
  36. #include <mach/memory.h>
    ' W& U( g$ ?8 a8 W
  37. #include <mach/hardware.h>
    6 ~; F, {9 L( |; L3 B( U
  38. #include <mach/irqs.h>3 u/ l. G- ^) Z) w. t
  39. #include <asm/hardware/edma.h>% J: i7 O) E' p7 K
  40. $ f5 A+ d1 b: Z' @+ O6 S
  41. #undef EDMA3_DEBUG
    7 _& r3 G8 r9 b; N' K- X
  42. /*#define EDMA3_DEBUG*/
    ' ~2 s; r- z- k
  43. ) }7 `, {; `6 w# B- V4 J
  44. #ifdef EDMA3_DEBUG
    , j1 s( v4 ^, n  P' A
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 R. J  T. J9 [
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# ?; O# \8 ]# z7 k7 p# Q4 y1 q: H& \( \
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      ?1 e1 i- J' q9 F$ r
  48. #else
    / h1 W2 ^5 u: |* ]8 G
  49. #define DMA_PRINTK( x... )- x6 B% C0 V: N- K
  50. #define DMA_FN_IN  V+ x8 Q  P( R" c- _2 a
  51. #define DMA_FN_OUT
    / }/ j: J  I* x( [- a
  52. #endif
    , {" L5 w" M/ {( `- L" O$ O" e
  53.   z" g# U, A/ G$ ]/ J9 |
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)1 ~/ [4 J) ^- p2 M' s3 a
  55. #define STATIC_SHIFT                3
    , f; c6 r- B. S0 a+ Y4 n, P/ g
  56. #define TCINTEN_SHIFT               202 ?! n* U2 c; x5 W4 g
  57. #define ITCINTEN_SHIFT              21
    : I3 e4 Y4 Y' b; J
  58. #define TCCHEN_SHIFT                22
    " e5 F0 H! i  u
  59. #define ITCCHEN_SHIFT               23
    ' q# E' T1 r4 H9 r& u

  60. 4 p8 ], H1 h! \2 |; w. f7 }
  61. static volatile int irqraised1 = 0;) ]9 y# p' ~+ G3 Z: b
  62. static volatile int irqraised2 = 0;$ {- Y5 X0 N0 A  E+ q

  63. * [" D4 J( D$ @  z( o# F7 X0 j; J
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ u+ c/ g$ B& a* y  g% d8 j
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ f' X+ A' L/ T1 o2 u0 Q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( a7 i, J  c0 H3 O
  67. " z" P, h/ B, T
  68. dma_addr_t dmaphyssrc1 = 0;$ f! G' E; \4 k5 i9 a: s6 V4 ~
  69. dma_addr_t dmaphyssrc2 = 0;0 s1 \6 P/ c% P1 c' q7 v" j
  70. dma_addr_t dmaphysdest1 = 0;
    + U2 G6 ~1 z. L, p+ J" G) x
  71. dma_addr_t dmaphysdest2 = 0;# }! s) q0 t1 L5 ~, N) ?" p
  72. $ w* j3 v1 ?" O7 D
  73. char *dmabufsrc1 = NULL;2 f! b- M* k+ x2 Y
  74. char *dmabufsrc2 = NULL;
    5 U- F* I0 K# Q+ G/ w: I
  75. char *dmabufdest1 = NULL;
    % M9 m2 H. ^: }' {6 J9 J
  76. char *dmabufdest2 = NULL;
    % t7 H: n% X1 {8 i. F# f

  77. % g1 F, q  {0 |4 W: ~: K
  78. static int acnt = 512;+ ?7 P7 ^. [0 G3 \4 F, Q8 ^
  79. static int bcnt = 8;% H3 O. _' D, l) l
  80. static int ccnt = 8;& x0 B8 ?0 V& H, Q+ c- Z& `
  81. & i& }& A" @( j( ^, p& `" U
  82. module_param(acnt, int, S_IRUGO);
    # @4 P& j3 z) M/ n5 x/ L
  83. module_param(bcnt, int, S_IRUGO);
    1 p* P7 h6 ]7 c8 A# y  ~
  84. module_param(ccnt, int, S_IRUGO);
复制代码

2 e+ I1 d3 N$ u* o  s" E1 O( \1 d4 m7 B) F' L  Z2 ^. t% y: n
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 d+ u8 [7 j, r" e+ F! e( S
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' @3 j! L* e0 \' Y5 g' g3 V
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% _/ n3 I# P8 C3 D1 S7 h+ _
* y6 J) C/ T: K- T

0 X4 y  R6 O+ w: _* w
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-18 05:19 , Processed in 0.039423 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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