OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! i. s/ @; \' u) G
  1. [code]EDMA sample test application
    0 l6 o. ^0 M5 d6 d! N
  2. /*
    8 y1 W7 q, i1 j0 Z, l) q) \
  3. * edma_test.c3 d0 e- R5 O7 R
  4. *, a" [* O: x( m) V. L+ V
  5. * brief  EDMA3 Test Application
    : u% m5 {3 ~& K- K
  6. *2 r( H, O) H5 Z! d1 e- d+ h
  7. *   This file contains EDMA3 Test code.7 I9 X; R" W1 M6 R: k: }& y
  8. *; ^; N, e/ y' r9 s, A
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - p0 M$ q- T- D  z5 W( w
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 b6 {, \2 T+ M& Q1 `6 Y
  11. *         TO CHANGE.
    * r% ?3 J' p. V8 a  g
  12. *6 H- E4 n+ q" ^8 T
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  j! Z* t4 i1 n- \; A$ Z6 j
  14. *
    0 ^( [* W$ V# W* m% C5 k5 K' K
  15. * This program is free software; you can redistribute it and/or- j5 i4 h0 @0 h  v' ?6 r" s9 e
  16. * modify it under the terms of the GNU General Public License as, b) i  g; B' H" M9 c. ^
  17. * published by the Free Software Foundation version 2.
    $ z3 y' O( t2 q9 |2 y
  18. *
    7 s9 \# \3 w4 d' N  |  M- d8 {
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any" Z5 ^- z7 {9 b" Z( y$ P9 l, P2 n
  20. * kind, whether express or implied; without even the implied warranty3 ~8 ]+ i6 L( ]3 [7 F( Q/ l
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the6 f) v. P% h! \6 z6 B  n
  22. * GNU General Public License for more details.
    $ B, _, O8 L. E) D& _( Y
  23. */
    5 }1 m- Q& ]) H8 P% l2 R: U

  24. 4 v. J2 d& d! `; n
  25. #include <linux/module.h>  G' n- s. U% X% L
  26. #include <linux/init.h>1 [% R) u% @7 h% Z
  27. #include <linux/errno.h>( w1 I, X8 o: A/ a% n  p% k
  28. #include <linux/types.h>+ m0 O) ^9 t  h
  29. #include <linux/interrupt.h>2 J6 N1 X) A. W; p/ C
  30. #include <asm/io.h>! {# m/ Q0 }4 u5 K# s3 L  C; f
  31. #include <linux/moduleparam.h>
    2 _1 ?5 `% K1 ?8 @' s
  32. #include <linux/sysctl.h>
    ! \: ]* b1 x" @* z* f
  33. #include <linux/mm.h>
    5 C. n7 ^  H( \" f
  34. #include <linux/dma-mapping.h>
    : a/ a9 K# a. `7 J2 {) _2 l
  35.   _  d' |  N: h, x5 l  \
  36. #include <mach/memory.h>% h# J" l+ M& U
  37. #include <mach/hardware.h>$ E; w3 |0 Q' z' `# U& ^: f
  38. #include <mach/irqs.h>
    - Q( U* e0 N1 q7 k. u5 @% Q  N
  39. #include <asm/hardware/edma.h>
    5 V; V5 Q6 [6 c5 S: Y/ h% g3 }  ]4 e
  40. 8 T# T9 X# f3 F+ b
  41. #undef EDMA3_DEBUG
    ) L" X+ X7 E! ]5 A8 y
  42. /*#define EDMA3_DEBUG*/& d6 K, ]  n/ f* \$ H

  43. # i1 e8 j5 R4 U$ ?
  44. #ifdef EDMA3_DEBUG/ D6 L4 g) d% }8 e
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 x) U5 V4 P/ k2 I, N. b8 n. F$ A6 [
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" ^+ Z& E  i, d
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    " p/ B+ |# G% D- X' j- ~1 A$ Q
  48. #else3 g8 [: ?% x( F0 R% k
  49. #define DMA_PRINTK( x... )
    1 O; Q0 d: c. O# c1 E
  50. #define DMA_FN_IN
    6 v9 u0 L  f; ]$ S, `0 |( R4 E
  51. #define DMA_FN_OUT
    9 E% Z: I! U- X2 i1 i0 j
  52. #endif
    % Y4 e' m8 c# u$ f. |2 S1 q
  53. " t% g5 H7 X+ O6 A% X0 k6 e3 z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 x; s) p) O3 m# v, A, r
  55. #define STATIC_SHIFT                3( c5 h0 B8 U9 l( b; }
  56. #define TCINTEN_SHIFT               20! \$ Z& L& ^4 C& }/ U( W- C
  57. #define ITCINTEN_SHIFT              21
    / D/ M' m6 N: w, d! A5 Y9 K1 ?. A
  58. #define TCCHEN_SHIFT                22
    / p5 o- d6 l2 g1 o0 ]- m4 _
  59. #define ITCCHEN_SHIFT               23( z9 h' N& z8 V! F# ]

  60. 8 X  i9 |9 p8 b4 T, l' U
  61. static volatile int irqraised1 = 0;
    1 [' j% J& @0 t8 V( e' e" R; `
  62. static volatile int irqraised2 = 0;: M+ {8 }7 z3 a1 R# N- V
  63. ( x5 f1 g/ N/ t0 A  P% Q( t# @
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 E+ A) t8 _, ^( b
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 f, Y5 R6 G( q6 h; `' N
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 B' C* x# F3 {1 J5 n: H/ A
  67.   y' Q* Y* e% C4 T4 r
  68. dma_addr_t dmaphyssrc1 = 0;
    9 p0 V3 T$ x6 \* P- q% @: q
  69. dma_addr_t dmaphyssrc2 = 0;
      H$ h& F( C/ f, S" E
  70. dma_addr_t dmaphysdest1 = 0;
    ( s" r  B  u' ?+ _# _4 Y
  71. dma_addr_t dmaphysdest2 = 0;
    - b  o' [' \, z* t+ d) }6 O$ {
  72. 7 p4 G+ e& X5 v
  73. char *dmabufsrc1 = NULL;9 {% t1 G6 B; X1 N
  74. char *dmabufsrc2 = NULL;
    2 L7 J9 f5 ?% A9 m3 v
  75. char *dmabufdest1 = NULL;
    " V8 |$ f4 N( V* ~+ m$ w' U
  76. char *dmabufdest2 = NULL;; Q+ I1 W, c4 ~" H; z1 V
  77. 2 C/ M  d* A9 ?/ k+ B! ~0 p7 w
  78. static int acnt = 512;
    ( E4 M8 @0 [& I
  79. static int bcnt = 8;  X9 I1 h  L; R/ V5 P3 G: I: \7 i
  80. static int ccnt = 8;# C" R0 ]8 {, O, Q6 @, ^0 G2 H8 Y$ r/ G

  81. / V8 ?% Y9 D2 h3 ^' m" H0 }
  82. module_param(acnt, int, S_IRUGO);
    3 @7 C) T9 g: H7 r5 L0 g$ E% U
  83. module_param(bcnt, int, S_IRUGO);( {0 x) C4 t& c# o; E4 k/ Z, w2 B! ^
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  Z  Q6 C) ^" C9 L% e8 J/ J& u2 X( z
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& f2 j% @) j# N6 r) b4 N/ a, {
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ S: {6 h8 v9 ^& P6 l  Y  }     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ L7 @: ?* O, t2 j9 x! I6 q% A! f$ y" s* J
2 L7 G! A: D% M/ R# y9 d! x; o& U5 {: v+ k. J5 k
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-22 16:19 , Processed in 0.038843 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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