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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* s0 r1 k& g1 p  r2 I6 d
  1. [code]EDMA sample test application' O/ ~8 P4 I' A; k6 Y
  2. /*; s' T7 N# m- p+ j: k) M. l
  3. * edma_test.c, x4 R$ T- F' y. z( Q# G4 j
  4. *
    9 w- P/ F4 M0 q" |% b6 a" D) B3 v
  5. * brief  EDMA3 Test Application- R4 I/ H3 X: w9 O
  6. *
    , N1 n" \1 H7 A5 ^
  7. *   This file contains EDMA3 Test code.
    1 J1 ?6 w( J' _
  8. *
    & I, l1 F. u, Z( a" y! R
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  R9 G7 {7 V9 }( U' z* H
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , s. E& ~. e! i
  11. *         TO CHANGE." V5 a; E6 v+ Z- h- `! Z; u
  12. *6 y% n% g3 C% r0 h2 V
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ( ^" f, F' G; o8 u4 n- p
  14. *7 K9 n9 c, V9 D! |) _: W
  15. * This program is free software; you can redistribute it and/or
    % ^6 @1 Z9 L4 y2 W/ X1 m4 D
  16. * modify it under the terms of the GNU General Public License as
    . L6 d- f- ]/ {! a
  17. * published by the Free Software Foundation version 2.
    6 ]: S' J+ N: D3 J) g$ K" v. J
  18. *
    8 A9 [8 X, @* Q6 L4 l7 r) `
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 q2 p) f0 w1 G2 P8 q
  20. * kind, whether express or implied; without even the implied warranty4 M0 L4 [# k" u
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / c4 m' k; q- R7 B
  22. * GNU General Public License for more details.  d. x$ s. P2 v2 n. v  E
  23. */
    0 l4 V$ n3 ~- q* z+ j( d; V
  24. 0 v5 b4 s' R$ _( i) e. J  G
  25. #include <linux/module.h>( z5 _- k, |. H' A( |
  26. #include <linux/init.h>
    ! R* D$ E- |/ A
  27. #include <linux/errno.h>' h; j2 t% N  k
  28. #include <linux/types.h>
    7 r8 a* m3 H3 f  f1 f' i6 o' V7 P6 c
  29. #include <linux/interrupt.h>
    . a7 w7 G) @: _. r1 k
  30. #include <asm/io.h>
    8 U. t6 {) i$ E9 n: z
  31. #include <linux/moduleparam.h>' g4 q1 R; x0 C1 ^  p
  32. #include <linux/sysctl.h>
    , b1 z0 q& h$ h6 ]# Q8 h/ l. Q
  33. #include <linux/mm.h>
    ) T8 @# \. Q, m  B
  34. #include <linux/dma-mapping.h>& \. P. F0 U9 U( [& K  j

  35. $ O8 T1 d" x* f2 P# W, m9 ^  H
  36. #include <mach/memory.h>
    : Y) c0 E: Q# N& d2 w$ V0 g
  37. #include <mach/hardware.h>9 V. j- `, i) o+ X: K6 t( Z
  38. #include <mach/irqs.h>  J* i: B4 a# x" F/ b& U
  39. #include <asm/hardware/edma.h>, v6 l5 h  ~$ W# q/ T
  40. - ~- E& i, r2 G& U6 m
  41. #undef EDMA3_DEBUG; p' z  S$ a4 A% u2 d! _7 }/ S* \
  42. /*#define EDMA3_DEBUG*/! S. ~9 ?+ }% e2 h8 s/ e5 V
  43. 8 J6 q! j) z9 P2 S2 C% N  ~, n, i& z
  44. #ifdef EDMA3_DEBUG
    0 K) [+ [* s" y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% l& s$ T" q$ f& }
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 H) H$ }& d) S  `1 c3 N
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ' l. y9 P/ ~9 Y. n3 ~, k! M# L
  48. #else/ l: u& z" k/ Y/ c6 Q5 N, a+ F
  49. #define DMA_PRINTK( x... )
    $ M+ w8 X* o+ s- r* E# E$ E
  50. #define DMA_FN_IN
    ' P( r  B) j: m6 P5 o0 H$ c4 E
  51. #define DMA_FN_OUT
    ! k- `# h# x# W1 A/ M
  52. #endif
    7 m* e& b- Z2 \  c
  53. , O; t, S& p' ^  P
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    / j$ u; c) V4 ~) m& M
  55. #define STATIC_SHIFT                33 l) r2 Q6 u* j  g7 l
  56. #define TCINTEN_SHIFT               20( ^4 M1 A( O7 g4 @6 w3 e% I! `) X
  57. #define ITCINTEN_SHIFT              21
    9 c3 O& }7 p) e  |! y# g0 n9 @
  58. #define TCCHEN_SHIFT                22* g1 U5 }  j$ Q
  59. #define ITCCHEN_SHIFT               23! i5 Y" b/ }5 D9 u) m' B6 F
  60. : |! e& x2 l) i2 B
  61. static volatile int irqraised1 = 0;
    . P: f/ G7 r0 A" w4 f( p
  62. static volatile int irqraised2 = 0;
    ) H. n# r- x* P3 I
  63. ) s/ X; g* i" b" y+ k/ y4 w
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' ^9 r; F9 c/ D" J2 p
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % E2 K: J; c2 t, n( ~" ?3 a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 m, D& W8 |  n& H) R6 W
  67. 2 \, O: i0 ~4 h8 G" J# u$ p
  68. dma_addr_t dmaphyssrc1 = 0;
    0 A9 h) [% {: L# t: m; N
  69. dma_addr_t dmaphyssrc2 = 0;
    1 ^: u1 G9 \) d* I8 U, z
  70. dma_addr_t dmaphysdest1 = 0;
    2 b4 \8 `9 Z3 n7 t! [
  71. dma_addr_t dmaphysdest2 = 0;
    + K# T0 ?+ K, L& K6 j; u6 L
  72. 1 P9 R8 b1 K- e& U
  73. char *dmabufsrc1 = NULL;
    2 X6 A7 u( g, e! v7 t; @
  74. char *dmabufsrc2 = NULL;
    * n- f5 Z1 I5 }
  75. char *dmabufdest1 = NULL;
    . g/ p( r9 E/ [9 f* ^" p  [
  76. char *dmabufdest2 = NULL;: R8 r# K6 C4 Q! `
  77. 7 B/ c8 F# j/ Y; c
  78. static int acnt = 512;5 B0 b, e' I& c# D
  79. static int bcnt = 8;9 T+ e; @) A/ s8 E3 Z. X; c
  80. static int ccnt = 8;
    2 Y% B4 ?6 T. p; O5 f, r2 z

  81. & |$ {' w6 @* D" j
  82. module_param(acnt, int, S_IRUGO);
    " |! ^; v* x/ f
  83. module_param(bcnt, int, S_IRUGO);
    8 r( |$ U. \3 `, n7 M
  84. module_param(ccnt, int, S_IRUGO);
复制代码
& q* d+ T7 r% l1 [! B  f3 c8 l

" B5 s6 @+ v& ~0 H/ |8 e+ |      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 w& R6 r; V3 D
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, t; R4 L9 i1 H6 y2 ?  T$ y! I# q     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 H% z) U- ^4 H: V
# E: f) i5 E! @7 D+ d

: D: m9 d, ~. b0 D) P6 M5 c
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-17 16:19 , Processed in 0.038333 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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