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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# ^( n9 o9 A, @  q
  1. [code]EDMA sample test application
    8 \) \# j7 L5 z' s
  2. /*+ f' X0 i7 t* ]% M6 p$ g- z
  3. * edma_test.c+ W. ?1 g- _  X" X( P5 V
  4. *4 b5 h% R" e/ {! W( G2 a! w
  5. * brief  EDMA3 Test Application/ v8 @* o5 A0 u$ o! T5 @
  6. *% _$ r& S7 ?; Q: f( o: e
  7. *   This file contains EDMA3 Test code.
    ! Y% R8 |% Y$ W% x4 I. v  o
  8. *
    + y9 f" _( b( h. L( R! l
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    9 [" t0 C/ W. `6 ~! G; @
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    0 R) f+ G# I4 W5 ?6 X
  11. *         TO CHANGE.; p0 k# z9 }6 z" X% u  F
  12. *! Q; B' E  R  c
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    7 d* e. u% o1 F
  14. *
    ) _. h  n8 Y" {: N, v7 ]
  15. * This program is free software; you can redistribute it and/or
    : l- M6 D. c3 Z  R) Y$ \6 W
  16. * modify it under the terms of the GNU General Public License as0 T; k+ j" {( o0 Q
  17. * published by the Free Software Foundation version 2.! b( j; m: `9 `2 W9 Z' @
  18. *
    ; C. U7 K8 F8 R% e2 b9 r
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 K+ @( u0 z/ [5 v
  20. * kind, whether express or implied; without even the implied warranty
    ; r' O. I1 `$ o& M. Q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7 c  `) }+ h) q
  22. * GNU General Public License for more details.9 z' _5 |' C4 H) a, H
  23. */
    ) q* L$ D- V3 V
  24. 4 O6 J$ C; s) s7 ^1 \; n
  25. #include <linux/module.h>
    ' H8 y( Y4 @8 k& n* j
  26. #include <linux/init.h>3 s, I' Q* R' s
  27. #include <linux/errno.h>. q2 ?" J" B/ m* g) C
  28. #include <linux/types.h>
    . I. _6 f3 n% o  I5 F, ]
  29. #include <linux/interrupt.h>
    ' }6 w) W8 w- t( |8 D& P
  30. #include <asm/io.h>
    7 _" g1 t! Y) R2 h. T
  31. #include <linux/moduleparam.h>0 i3 V5 m/ S: x- I2 K) w8 d
  32. #include <linux/sysctl.h>7 D. {! y* i- h; {
  33. #include <linux/mm.h>
    + r% _5 H6 o8 W+ M+ r8 i! J5 L5 a
  34. #include <linux/dma-mapping.h>
    5 K) }1 n( L$ [4 p

  35. , n+ l; [/ u$ ~0 c  x/ q) E
  36. #include <mach/memory.h>
    ' x. }+ k$ \" J0 E
  37. #include <mach/hardware.h>
    & j2 g# [8 t+ }& V) }& r3 s
  38. #include <mach/irqs.h>
    7 p' B" n$ ^; p0 O' t9 t1 a
  39. #include <asm/hardware/edma.h>. L  W% o& x8 U& S9 Z, S3 n
  40. 6 |  o, r- ]/ j' G5 y
  41. #undef EDMA3_DEBUG( Z) c1 k# _6 O% ]: c
  42. /*#define EDMA3_DEBUG*/$ O' f- b, x/ f5 I- g/ i4 p6 L- @

  43. * n& P& [$ |2 D5 }' g( f1 m& `& n
  44. #ifdef EDMA3_DEBUG
      o- d8 v! g# E) S7 ?. w+ Q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ {1 D0 {( [* ?; \/ B
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 n6 R/ k( [: k' t) E; M
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 w6 G, W2 ~' K% b" o7 W" W2 ~
  48. #else' p- M1 i, M- E$ `0 o
  49. #define DMA_PRINTK( x... )  `" N: m- d) F5 _4 M) d
  50. #define DMA_FN_IN& a. \1 o* B4 B
  51. #define DMA_FN_OUT. ]% |" n/ H$ y6 x" I% B2 m; [# n
  52. #endif
    $ a  c; ^" y( ?3 k- M
  53. 4 P- y9 m9 n1 z. x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    # ]0 \( e: k$ C1 h  Z( N) y' S
  55. #define STATIC_SHIFT                3$ L. g. o6 d8 m/ Q( R0 }9 [
  56. #define TCINTEN_SHIFT               20
    & I$ [% I4 ]4 \, h& t
  57. #define ITCINTEN_SHIFT              21: a; U6 l, Y1 g1 G9 x. U# Z, J1 X
  58. #define TCCHEN_SHIFT                220 X% n/ |- q7 `) H$ G
  59. #define ITCCHEN_SHIFT               23) p, J" A$ m* q0 E5 s# f) B

  60. 4 h# |9 A* w; R9 `# g1 T: V
  61. static volatile int irqraised1 = 0;
    7 ^. J7 @, R9 l5 J0 ^, c" Q
  62. static volatile int irqraised2 = 0;
    % S) m# y' {4 B0 ^6 _2 P, b

  63. # l0 ?8 X$ l' W$ t- I. W1 Q5 ~
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 R! D" ^. ?7 H4 [5 c, K. u
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 N- O) K, _! O
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 Z% A+ D: g* a( `4 B
  67. 0 r) {8 J2 M  b
  68. dma_addr_t dmaphyssrc1 = 0;/ [. D, \8 x  ~+ [
  69. dma_addr_t dmaphyssrc2 = 0;
    ; d( G3 V; v. M3 J8 F
  70. dma_addr_t dmaphysdest1 = 0;3 _/ @) O* j$ ]8 c
  71. dma_addr_t dmaphysdest2 = 0;
    2 s4 m# h) ^$ ?

  72.   r; a& a% g/ l; D& A# y
  73. char *dmabufsrc1 = NULL;- _8 e+ k# N5 O9 P
  74. char *dmabufsrc2 = NULL;
    , u2 Q& r% W0 g+ P5 j! Z" [
  75. char *dmabufdest1 = NULL;5 e. i1 M, {( v3 z
  76. char *dmabufdest2 = NULL;# b/ T& ~2 n$ \8 m( i
  77. 1 R+ r( D7 l' c2 w0 b, Z9 U3 A
  78. static int acnt = 512;
    , `: `; b  f+ j! r+ G4 Q4 y
  79. static int bcnt = 8;( f& N! @1 i+ e: I" Q* q) E
  80. static int ccnt = 8;" \3 n7 a& o6 l# C' o
  81. ( ], N4 f9 q5 i, o& y* l' q% t; D  Z
  82. module_param(acnt, int, S_IRUGO);) d5 N, L0 e2 K2 \
  83. module_param(bcnt, int, S_IRUGO);
    ; M$ u7 W5 K; p& W3 E- Z' Y
  84. module_param(ccnt, int, S_IRUGO);
复制代码
! Y$ G9 f. e0 Y! k8 B

6 A  {& U7 H+ F! Y  k; ~" i      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 u# X9 H5 @* z4 Carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ d3 {2 J6 t' |. x5 l8 T     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 |/ m! H4 I0 n2 ~: _. g
' `$ y0 P0 Z* t4 y

1 V' y5 F& @8 R7 U: U4 C/ A
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-6 17:58 , Processed in 0.044308 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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