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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* q9 F  J" P/ l6 B$ K: [
  1. [code]EDMA sample test application
    ; x/ n( t0 o5 S0 v3 k
  2. /*0 y7 M% {, {9 t! o9 i" F' e* H. D
  3. * edma_test.c9 v9 _0 {, a- K& J
  4. *
    & t: ]% R! t( n4 t8 [
  5. * brief  EDMA3 Test Application+ ]  g( n+ _+ P  \
  6. *, V' {6 j0 c4 W# r
  7. *   This file contains EDMA3 Test code.
    , e, _- i% i+ z* Y7 v) J! _
  8. *# ~* z% ^- ^* ~4 o+ f7 S8 G1 E
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) _. W6 s5 E# Y1 R, W
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    $ g# I4 y0 U) R8 p  c, |' [
  11. *         TO CHANGE.
    2 ^- y* }5 {/ |/ g$ |$ Q4 I8 O0 }- g
  12. *4 }2 K  F) `  g3 Z: X* w0 C/ F& r
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  N6 l9 ^* H; S
  14. *
    $ A3 b7 p7 u9 j. ?- u) \
  15. * This program is free software; you can redistribute it and/or# G2 s$ l0 Z5 f3 g& }# H
  16. * modify it under the terms of the GNU General Public License as$ }8 x% T& r) k$ Q; d5 t% Q& w
  17. * published by the Free Software Foundation version 2.
    7 @8 R( H# ]- d. i  z+ Y# `
  18. *
    8 B! Z& g: b# Q3 o& R
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- B. n6 d. f# t* O7 C$ M
  20. * kind, whether express or implied; without even the implied warranty
    * O  N- O+ O7 \) F8 P! t# s, w
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    $ @* M/ t1 U% G
  22. * GNU General Public License for more details.
    2 _9 M$ H1 Q/ m
  23. */7 f. b7 w5 V' V+ f" r! R

  24. ' L( E& V- r9 |% A
  25. #include <linux/module.h>0 R/ p) k0 b% y! q8 n  Z
  26. #include <linux/init.h>1 Q3 V5 M0 B" f
  27. #include <linux/errno.h>3 j2 R2 N/ c/ P
  28. #include <linux/types.h>' M( g3 u' C( ?
  29. #include <linux/interrupt.h>% ~' n9 Q* Z, w+ L! V  K
  30. #include <asm/io.h>
    ; h5 m2 M) J7 Z, |. j" J$ H
  31. #include <linux/moduleparam.h>
    " g* D8 f% K8 ^" m
  32. #include <linux/sysctl.h>
    # A& c5 }, Y. O5 I: O+ p( ^# @
  33. #include <linux/mm.h>6 ?& r8 N  u. Q& J% s
  34. #include <linux/dma-mapping.h>
    4 X! C0 Z0 j: a* e, E# G# z5 r
  35. - ]- r) N9 ?4 m6 C9 C6 P
  36. #include <mach/memory.h>
    : J" }9 J, t# _
  37. #include <mach/hardware.h>: c1 |3 ?+ \! }0 ?0 j) ?: _7 _6 ?
  38. #include <mach/irqs.h>
    # F% {. q7 T0 \4 e7 f
  39. #include <asm/hardware/edma.h>$ D1 B7 l2 p* D( N% h/ W7 a
  40. ( r: d9 x6 f7 ]* a5 L& ^* _1 X0 t
  41. #undef EDMA3_DEBUG
    2 g) V6 z9 x$ a, g! Q
  42. /*#define EDMA3_DEBUG*/4 W/ ?( M" Y1 o, r( _

  43. 5 y6 b1 ]: n0 Q1 U& a+ F/ E
  44. #ifdef EDMA3_DEBUG8 h( b- ~/ L: l. K3 D& |4 [
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - N$ G( d% E1 p; A# o
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) e" b8 n" q: Z; r8 t4 A; C  T
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    7 s3 v- M4 `& W/ ~5 M) }  |4 p
  48. #else9 T0 U# O0 q; t% T
  49. #define DMA_PRINTK( x... )
    2 y6 I6 u/ }/ K/ \
  50. #define DMA_FN_IN
    7 p1 U  E" C: R( B7 Y! }
  51. #define DMA_FN_OUT1 Y/ S0 T% S$ {& @& \. N
  52. #endif6 p) I% J, D. E: H

  53. - ~1 r& M, h4 ]" F" X2 J) A
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    + E+ D& R3 @6 [# b: c6 w: H" J
  55. #define STATIC_SHIFT                3) S2 S: L; o( r1 K1 |( K* z
  56. #define TCINTEN_SHIFT               20
    ; ?8 y+ o# v5 V7 A  f6 i3 t" H; e
  57. #define ITCINTEN_SHIFT              214 k8 P6 i- P7 P' N5 a, x( H3 i
  58. #define TCCHEN_SHIFT                228 E9 p$ K( L0 v8 z; t  Y
  59. #define ITCCHEN_SHIFT               23
    ' _& y4 a0 b7 _" M  I4 T. [
  60. ! F: Z  u0 K) o7 C% l2 `
  61. static volatile int irqraised1 = 0;
    . n0 H& n) m+ c- A  S, I) [5 w1 {
  62. static volatile int irqraised2 = 0;
    5 B( B3 t1 V6 y% a0 @3 r* ~

  63. 6 R: P' a  T: s, P( p1 V8 V
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + X: T0 e2 m9 ^
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : D" g9 U+ `. s$ n: t- y0 D) `
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& O( }6 u- i6 v6 Q

  67. ) ^' E3 r2 F6 P; P3 H* |) Y
  68. dma_addr_t dmaphyssrc1 = 0;
    3 F, H8 d) G/ P) G- u
  69. dma_addr_t dmaphyssrc2 = 0;$ J8 \/ F  {4 l0 h3 s9 ?* `4 e
  70. dma_addr_t dmaphysdest1 = 0;; X  z0 w# O1 z( t% x5 v$ U
  71. dma_addr_t dmaphysdest2 = 0;9 c: k( T2 F, T/ J" g. ]$ y- U5 ^
  72. $ q. ]6 }7 \5 A: Y1 i9 O* R3 B/ Y/ i
  73. char *dmabufsrc1 = NULL;7 [3 s+ r8 m- _4 g: t
  74. char *dmabufsrc2 = NULL;8 [# g4 M/ V0 R4 n! y: F9 [; g( ]
  75. char *dmabufdest1 = NULL;/ k* s0 j+ K6 L6 s: j6 F
  76. char *dmabufdest2 = NULL;6 d6 C( B' x- N6 ]3 P' B- M

  77. : ]7 T$ V) j% G/ l
  78. static int acnt = 512;* m5 Z8 j/ O& d6 f) y2 @
  79. static int bcnt = 8;0 I4 A: w) g- B4 ~/ u
  80. static int ccnt = 8;! ?" P1 Y! o0 v% n

  81. " ^. E  `, {: Q
  82. module_param(acnt, int, S_IRUGO);3 e: d- F4 |$ [7 _: H+ d0 }4 k
  83. module_param(bcnt, int, S_IRUGO);
    , T! ?8 o" q0 I, G$ p) T; Z; s
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 l8 j( p& P% E  I; a

9 A0 z3 m# |! F& l4 T9 X      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; u; d& D, O; H2 C1 D5 [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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 i9 W- |9 J( T; _# D
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" }/ C8 k/ V# ~; n
" y! @+ d7 G  f& j+ k; j+ `
1 t3 h2 ?  t) O, y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-18 19:38 , Processed in 0.040322 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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