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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 U6 [( `' U3 h2 z- R- N# |
  1. [code]EDMA sample test application, u, `' c# I9 e8 z2 o
  2. /*5 ~  R# P2 f: g% r% k
  3. * edma_test.c
    ; v' _# m0 b: j7 M
  4. *( N7 A' |  b2 U( k0 F4 }
  5. * brief  EDMA3 Test Application- d6 Y- ~) A! ^/ ?) _4 Y
  6. *
    . u* u3 B' ^- c: {! C
  7. *   This file contains EDMA3 Test code.
    1 G! J8 ^: a7 K
  8. *
    & S6 _4 U9 `: h, s  j: f7 w: o
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( }' U  Q& e! }" m. |5 O
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 p! _" d0 E* p0 `, u9 T
  11. *         TO CHANGE.' l+ E  t6 [/ Q6 g
  12. *
    : V3 {+ q: r& ]! T5 p9 h
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ) x8 p- \, `0 m$ V% q% a
  14. *# X1 F4 B2 B* }, e
  15. * This program is free software; you can redistribute it and/or5 p; C$ @" ?, R. C2 [. M
  16. * modify it under the terms of the GNU General Public License as
    + Z+ v0 L# x! n3 A. m# X
  17. * published by the Free Software Foundation version 2.
    ) H, @! g$ X4 K( e) V
  18. *
      T( X; @/ d) e6 ~5 I
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    5 `0 m2 M9 C" N0 p: m+ \8 r
  20. * kind, whether express or implied; without even the implied warranty5 |# e' n3 h! e: L% K8 A
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the+ c2 M9 o! |2 [" L, x' E& G9 ~
  22. * GNU General Public License for more details.0 e- N/ w6 t. l% Q
  23. */7 M7 A  h% y$ C7 L
  24. 1 n" t, D& `4 V$ y! K
  25. #include <linux/module.h>" z0 O: I+ L" F+ }
  26. #include <linux/init.h>" f0 S9 e( J0 Y+ ?  l' F
  27. #include <linux/errno.h>6 ?9 r, T, V- Y: a6 M, Z, a
  28. #include <linux/types.h>
    + a( B  _1 F7 S( A* D
  29. #include <linux/interrupt.h>
    * s1 R: N$ W% S2 e9 _
  30. #include <asm/io.h>% Q0 y+ }9 n: p( [! }  e0 @) ~
  31. #include <linux/moduleparam.h>" n9 D( b# A1 m+ g) z. _5 L
  32. #include <linux/sysctl.h>( |  ^7 T+ C9 O/ f8 g
  33. #include <linux/mm.h>
    1 u) l  D9 a% X5 i1 G5 b
  34. #include <linux/dma-mapping.h>; o! C/ O1 E' a% u" Z  ^

  35. 2 _0 E5 A/ q( `# ]1 P' s
  36. #include <mach/memory.h>
    + J! H* y3 o9 ~, I! U
  37. #include <mach/hardware.h>$ Q" b1 w9 Z' Z6 l6 F& R
  38. #include <mach/irqs.h>
    % B! k4 G: R3 J9 r) F) t0 o
  39. #include <asm/hardware/edma.h>$ S; m1 Z% i, W" f" s

  40. ( @7 g2 M  z: a4 a" [* i0 z( B6 }- _
  41. #undef EDMA3_DEBUG
    . }" a+ K' J6 P  J+ K0 R
  42. /*#define EDMA3_DEBUG*/* m7 s2 y- G7 ?0 {

  43. + Y1 T8 n% v" ~- d1 G1 v  h
  44. #ifdef EDMA3_DEBUG6 J8 m2 H+ F% E7 ?
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 x2 Z7 L6 f9 z( G6 X5 j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" J' c. W" y" L% }% _, ^) i+ v
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( o# I! y2 p0 M5 k
  48. #else/ K5 H' n6 E# D% G9 E, A
  49. #define DMA_PRINTK( x... ); d, Q3 L% }, d' F+ e# R
  50. #define DMA_FN_IN' {( s: O! o# B1 `( O% m
  51. #define DMA_FN_OUT
    + ^: ?8 v& a& Y7 O9 L# c! Q
  52. #endif
    2 z- {- r8 h+ x% J
  53. ) M" I" |$ O) b: C0 O
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    - S- d3 i! ~# R' P. U/ w
  55. #define STATIC_SHIFT                37 C" J- d2 w2 M' s. t
  56. #define TCINTEN_SHIFT               20
    3 o; k5 v# W" u: P2 S3 h4 [
  57. #define ITCINTEN_SHIFT              211 D# U' {2 {* J3 i9 B
  58. #define TCCHEN_SHIFT                22; r6 ]' X9 x* f% u6 s4 A/ ?, q3 T! B
  59. #define ITCCHEN_SHIFT               23
    8 X8 u3 v3 x9 R& }, i& h7 c
  60. 7 k; R' x& W2 j# S3 j9 z# ^
  61. static volatile int irqraised1 = 0;
    7 ?; O3 C8 p/ L' j; X
  62. static volatile int irqraised2 = 0;
    5 o, P; O2 a; ]6 W
  63. , f0 P) f* {9 ~0 J
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " b# Z8 c4 |3 Q# q0 ?
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( q. b) {! }% }. Y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 u9 s  f! q# k. [# G& |' \
  67. / W+ f* u+ y9 Q# {$ ]9 \! w& m( b
  68. dma_addr_t dmaphyssrc1 = 0;
    $ `( f- _  i8 C$ G
  69. dma_addr_t dmaphyssrc2 = 0;
    & `( V3 [% ~* O1 J! _
  70. dma_addr_t dmaphysdest1 = 0;, R3 g8 V5 ?/ S: t) s. k
  71. dma_addr_t dmaphysdest2 = 0;
    6 ^  Z: G+ {3 ?' h

  72. 9 W3 X/ A+ J# `/ F
  73. char *dmabufsrc1 = NULL;- R: }5 S! n, N. f
  74. char *dmabufsrc2 = NULL;8 A' a+ a- b1 d! o6 j) y& {* D# M
  75. char *dmabufdest1 = NULL;- Z! I4 j% X3 Q1 z
  76. char *dmabufdest2 = NULL;
    & q. R6 c7 j& c% h  S- J
  77. , V+ V# E# ]5 ]; O  V" ~
  78. static int acnt = 512;
    % s  p. C5 ]4 l7 o5 S
  79. static int bcnt = 8;
    / z! Q# I& J! o5 P
  80. static int ccnt = 8;
    7 ]- H7 {& h) p- F( f$ f

  81. : M( P% C0 @) q' b6 o2 \
  82. module_param(acnt, int, S_IRUGO);
    5 I0 [, G' {8 u# X3 m
  83. module_param(bcnt, int, S_IRUGO);( M. v' ^+ l/ S& g
  84. module_param(ccnt, int, S_IRUGO);
复制代码

0 w7 x( Z! h2 [) N$ e$ @
+ c# A6 h6 O& o      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 ?: y: a* Z, t
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& i0 f5 Z7 i! u1 A: b/ m$ }( P     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. H2 m* H, C- z$ p0 b' j
" o8 D: A5 E2 y" h" s! ?. \( t- N% h
& Q6 }# S, K- j/ }* z* K
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-26 10:14 , Processed in 0.040425 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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