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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, ]4 E! f/ B; F! i& C: q" r
  1. [code]EDMA sample test application( A8 B: X% w* {" J. A  H, G; [
  2. /*
    1 R% A0 N! Q, y
  3. * edma_test.c
    / _- f' G; @  K! N& i( w0 y
  4. *: K4 g) u* D: e% S: U4 w! \, \
  5. * brief  EDMA3 Test Application, m" D2 ~5 \8 p$ J6 [
  6. *
    1 \: g) i9 q; r
  7. *   This file contains EDMA3 Test code.
    , t& d, C6 N9 w4 g
  8. *5 U. v8 H  }0 X+ X, e9 R0 L$ ^) r& ?: g
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 J& W* A/ x* H7 c: E9 K
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% e9 [( A' }" B+ P6 c, x( w! D( F
  11. *         TO CHANGE.  K  ]# K) `$ v; l5 K
  12. *
    7 B) H* C0 `+ X: d8 b7 N1 m
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    4 G( U  y) O( z% g
  14. *
    : K4 Z) S8 n* k) A8 G" @3 [; m
  15. * This program is free software; you can redistribute it and/or
    2 w4 a& E6 H, {9 N2 K7 j, ~( y
  16. * modify it under the terms of the GNU General Public License as
    3 O, b' ~/ m& T! l0 M5 G
  17. * published by the Free Software Foundation version 2.! ^7 h0 x. e& `6 F$ o
  18. *
    " c, F5 W7 V! j* V8 A* `6 t
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
      z7 l( I, B+ i4 I6 n  m: n$ G
  20. * kind, whether express or implied; without even the implied warranty
    ! T1 t- c9 ~" F" w6 I
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the7 J4 c7 z, o- f: \
  22. * GNU General Public License for more details.
    6 E3 O. y7 [  M) l! I
  23. */5 a5 n2 [) U; F9 e9 o
  24. & E7 Z3 m! g( z6 g0 t
  25. #include <linux/module.h>
    + ]# S$ X' ^4 ]! ^
  26. #include <linux/init.h>
      G, S# |& {# w; t
  27. #include <linux/errno.h>. k2 F; o7 ]6 {2 b9 ^
  28. #include <linux/types.h>+ O& }& P4 `4 c1 {3 U/ _
  29. #include <linux/interrupt.h>
    ; S- M' D4 t% E6 [% I; T; l
  30. #include <asm/io.h>0 _1 X+ ~$ `4 W( X9 g. l
  31. #include <linux/moduleparam.h>
    " p+ _$ ~) p* Z) S6 @0 C5 {
  32. #include <linux/sysctl.h>
    * q* f. i+ Z, m
  33. #include <linux/mm.h>9 w- h. E1 ^* P0 Z+ O3 x
  34. #include <linux/dma-mapping.h>: r+ S: W* i, N/ O' b) I

  35. ; u7 i' _' E/ h' S, w- `* ~  d7 y
  36. #include <mach/memory.h>
    3 o. ], z  M9 {  _! C5 p
  37. #include <mach/hardware.h>; _+ x/ R! }3 ?
  38. #include <mach/irqs.h>
    8 F" w# k3 Y2 d5 S8 g  R
  39. #include <asm/hardware/edma.h>7 W  s3 E5 d4 P/ ?4 n# |% L
  40. ' h3 \: c& U! p( y8 ~
  41. #undef EDMA3_DEBUG
    % f/ J% v; o8 N& d- {: U/ E4 m
  42. /*#define EDMA3_DEBUG*/
    5 E/ @5 K# Y5 q$ c' e

  43. , T) g  n8 k0 }: k
  44. #ifdef EDMA3_DEBUG' V! ~+ }& X* ~% g
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). x! s1 |" G: b" V
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    , {/ c" Y8 G+ R
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    # ^, D- T6 j% Y9 U# x3 E
  48. #else" g% _& `8 e5 N; U2 v
  49. #define DMA_PRINTK( x... )7 H) u  C; f3 H% ^, t2 e
  50. #define DMA_FN_IN
    * n! |/ T7 `1 h4 t
  51. #define DMA_FN_OUT9 T: W5 I& \; V6 S% C* n
  52. #endif
      O3 @# Q8 `! C! v" H2 m  Z
  53. % _! ~, C8 v4 n) C6 \2 V
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ Z1 |* _5 Z9 v/ m! x/ R- X
  55. #define STATIC_SHIFT                3
    ( x8 d% {9 ~9 b& Q' X7 q
  56. #define TCINTEN_SHIFT               200 v4 T& O3 T) q/ ^
  57. #define ITCINTEN_SHIFT              21* j# V9 L' J2 p1 v) b5 b; ?
  58. #define TCCHEN_SHIFT                22
      j0 h9 s) U: ~$ D
  59. #define ITCCHEN_SHIFT               23" D0 E% W. k$ {/ A  m  s* L
  60. % p2 C0 C. s9 ^0 J, D$ j
  61. static volatile int irqraised1 = 0;' m2 @5 G' V4 o+ x
  62. static volatile int irqraised2 = 0;) S2 J  Y7 `9 j

  63. 7 ~( B0 k* {9 F, q, g9 m- T9 c, W
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 {- x8 h3 s, t5 f+ T. v& q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , g/ @* X. ]6 @
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; P& x/ D; c5 \( X1 q; z

  67. ! Q" i% j- \  i! N
  68. dma_addr_t dmaphyssrc1 = 0;
    * R- ~9 h" ?2 S  B, o  d1 \
  69. dma_addr_t dmaphyssrc2 = 0;) E4 h5 h9 I/ x" h: p
  70. dma_addr_t dmaphysdest1 = 0;& k$ X, g5 _) m% x6 F3 O/ d+ _
  71. dma_addr_t dmaphysdest2 = 0;" Y( _7 r, ^. P6 s5 ~3 G

  72. . k! {- o0 d) M, u: i; T" e/ J" V
  73. char *dmabufsrc1 = NULL;
    , M5 _1 ]) `' x; k" Q: \
  74. char *dmabufsrc2 = NULL;
    ( Y  F0 c3 k7 `4 @8 y0 \+ ]
  75. char *dmabufdest1 = NULL;" z+ Q1 m3 ^: {! B. Y; |5 Y
  76. char *dmabufdest2 = NULL;- p) |9 M* R: ?" R' V- Z

  77. + v* _+ \7 A5 v6 ^) G. c/ O2 M
  78. static int acnt = 512;
    / A5 H5 k% J8 O& u/ s$ m- E6 h- R6 S
  79. static int bcnt = 8;
    , v1 x3 N0 g0 h) H
  80. static int ccnt = 8;
    + `, k0 S, X% m, J8 K/ u
  81. : h; l- L' D/ f- z' H
  82. module_param(acnt, int, S_IRUGO);/ l7 O4 [" e; Q& p# }1 n% h
  83. module_param(bcnt, int, S_IRUGO);
    2 Q. k4 A2 ?9 {: K
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, u; G3 w' \- {, L- n

5 ], p5 w6 M+ J, j9 ?      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 p$ o0 r0 X5 P0 \3 r$ 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& ^, r- w% t. [' @9 g' T" e+ R5 _- W( \
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- n4 f' h" |7 P( u

7 E2 a! u8 C8 k* i* i/ y- x
, U8 n* y1 d1 Y, u
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-28 02:45 , Processed in 0.041683 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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