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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 m! N  U- g7 S6 R
  1. [code]EDMA sample test application
    / C$ _+ X3 l# o9 s# n4 p
  2. /*
    8 a% ?1 C6 D' ?: `/ z; Q
  3. * edma_test.c+ N+ B+ V8 N) g: D
  4. *3 J7 ]! k' i* J+ f4 Y3 d4 `  |' U
  5. * brief  EDMA3 Test Application; N  X; T2 O1 B' ~# }- z
  6. *
    ( V# W8 f3 J3 |3 R4 Q1 U0 [
  7. *   This file contains EDMA3 Test code.' r+ \( S: P- t; w
  8. *" k1 L9 a% ~3 f+ E
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    0 b$ U; C) ^' O: Y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 v0 i3 B% n9 u, A7 D
  11. *         TO CHANGE.7 ^; l9 \( }. G& f( w& V, h
  12. *
    & X; k; e* \& ]! `
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ( O$ D( b% S2 ^  j- V
  14. *
    1 M* l$ n. s) T  r% D
  15. * This program is free software; you can redistribute it and/or
    ! ^4 s* b# n( ^- E8 ^- w3 W/ }% b
  16. * modify it under the terms of the GNU General Public License as7 n) l/ O0 V& z6 g
  17. * published by the Free Software Foundation version 2.
    6 V9 u# |( L* J! w+ l; H  w
  18. *9 b0 H5 ]6 D3 x( ?/ [
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    2 u+ ]2 `& s" i  A: `' z: H
  20. * kind, whether express or implied; without even the implied warranty/ r6 C3 ^* {. P& p( @" M
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1 _6 U. ^( s1 n4 p5 x. G
  22. * GNU General Public License for more details." w5 ^" S0 u; V% U# r* \- q
  23. */% S6 K  U. D8 D
  24. ! V" W9 R$ V' X" p  l/ L
  25. #include <linux/module.h>) h1 ^8 c, I, S- ?
  26. #include <linux/init.h>
    6 V7 d$ e: _8 R4 v" K" O
  27. #include <linux/errno.h>
      `$ U5 C1 j4 E
  28. #include <linux/types.h>
    2 Z! I- A( K8 V4 O; y
  29. #include <linux/interrupt.h>
    , R( S" J; T# ]. ^/ |! K! r) F- b
  30. #include <asm/io.h>
    ; W* y& i* L9 s0 ^; `' i) s
  31. #include <linux/moduleparam.h>
    9 e5 T' q2 A( D8 B
  32. #include <linux/sysctl.h>
    - L  ?( O$ n8 x- }7 G" C
  33. #include <linux/mm.h>: F  o) U- g. Y- V7 V8 G0 u
  34. #include <linux/dma-mapping.h>
    & ]7 p) P; t& g& X; x; ], q
  35. # }) ^# w1 O0 \$ h. U
  36. #include <mach/memory.h>$ S9 W# B0 r' j  {7 S3 S
  37. #include <mach/hardware.h>! f' S% i4 F' c
  38. #include <mach/irqs.h>
    ' `* ~) d% E8 h; U/ Z
  39. #include <asm/hardware/edma.h>1 c" }1 p  O+ v- v9 s9 t

  40. # K% ]3 t8 X2 t# w: a
  41. #undef EDMA3_DEBUG
    / V0 B" l; ^" M" _
  42. /*#define EDMA3_DEBUG*/" \. @; P6 S3 \) h& U6 F9 c
  43. & G3 g% ]) K6 s1 n! G& t1 k
  44. #ifdef EDMA3_DEBUG% x! o1 ~" _6 V1 h9 J
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 G3 C1 i4 A  A( P) \. I  c6 d0 x
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( c/ p+ q3 v) A+ `! ?- [
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 i# h; r4 x6 f# {7 t$ L& j" c
  48. #else" x. J: _$ H- l
  49. #define DMA_PRINTK( x... )
    ) b1 G6 p3 q! x  i* Z! I- R6 m; o' O2 F: F
  50. #define DMA_FN_IN
    # K# x) N6 X- s/ |
  51. #define DMA_FN_OUT
      e/ b( z1 R: O2 J7 S9 r4 U6 E
  52. #endif
    6 l; v$ R. L. Y3 z2 c3 r" x
  53. 7 `  t* `3 K3 T3 n' P& W
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 n$ A/ z" N& H: J! G2 r
  55. #define STATIC_SHIFT                3( c6 d: f, K2 ]' G0 R
  56. #define TCINTEN_SHIFT               20
    " j: C* d: ]9 Q4 ^5 C9 h5 K
  57. #define ITCINTEN_SHIFT              21' X; M4 ?$ e! C; _6 x
  58. #define TCCHEN_SHIFT                22
    4 j7 P' w6 a+ \# m5 ?$ o
  59. #define ITCCHEN_SHIFT               23$ l1 y6 b8 _# ]' {  p# r+ z; M: P" L- r

  60. & e9 J8 I2 P, x
  61. static volatile int irqraised1 = 0;0 n2 |0 T% Z& w7 D: f
  62. static volatile int irqraised2 = 0;
    ; i' U+ `$ D2 ~2 [2 V

  63.   k& E4 s. R5 |$ Z  a6 W1 z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : R) k" J$ A& r0 q% S
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% l9 A6 T: a3 C' r1 }
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " {; W0 J, r* I

  67. 5 E' [' v. Y$ g9 m0 A0 p* e& y: |
  68. dma_addr_t dmaphyssrc1 = 0;
    ' T- U/ X7 j2 \' \' i
  69. dma_addr_t dmaphyssrc2 = 0;6 G0 O  V  W; J. ~' E- q7 \9 r3 J
  70. dma_addr_t dmaphysdest1 = 0;1 L6 d+ G9 @* Y6 @6 s, G% W8 a$ L
  71. dma_addr_t dmaphysdest2 = 0;) G5 |- ^# c) }, W2 \' p* m- ]
  72. ' P4 ^$ c" J) f# V5 `1 m2 S  r/ f
  73. char *dmabufsrc1 = NULL;: `' [$ \6 \3 O5 W) B* D* Z
  74. char *dmabufsrc2 = NULL;4 @1 @4 ~8 L3 D2 z6 j
  75. char *dmabufdest1 = NULL;- d7 D) z) F, N5 a* |6 `  q1 g
  76. char *dmabufdest2 = NULL;
    1 r% I" q( v( }/ \1 J6 z  D
  77. + f" b; L4 P: X0 L
  78. static int acnt = 512;
    . H2 R2 O! @3 ^* u4 a
  79. static int bcnt = 8;
    1 ?. [! O1 f3 T& y5 D
  80. static int ccnt = 8;
    ( V3 k# K1 }+ j5 t  ^: m
  81.   M2 k' C# C6 w' z( w
  82. module_param(acnt, int, S_IRUGO);" Q9 U7 g4 b( a, Q9 M
  83. module_param(bcnt, int, S_IRUGO);
    & Y8 ^5 f' a4 b& T1 ^3 m+ Y
  84. module_param(ccnt, int, S_IRUGO);
复制代码

' k- e6 _, u5 X) A7 l* a, o5 |* `# U+ R* G+ O
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 L( l+ }1 o4 Z4 S9 r& h0 o
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 J1 J4 d* [0 y; P     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# ]& y; X+ U! y7 l! m

0 @( b& h, n" H9 c' D- ?& T5 Y' b3 N" R9 S+ N
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-9-13 04:06 , Processed in 0.046659 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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