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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . q, K$ e! k; ^/ _' j. p. I5 `
  1. [code]EDMA sample test application
    7 W$ Z  v; B1 B) P5 |* K
  2. /*9 E* d4 ~, P' ~) f
  3. * edma_test.c5 V; D& h: u  c  `) \
  4. *; M3 k  m& \+ ?7 x5 v
  5. * brief  EDMA3 Test Application
    6 K9 q1 e7 K& r7 W0 L
  6. *) L& G* V! t2 ^7 }1 H
  7. *   This file contains EDMA3 Test code.
    9 H$ {! \* l  F5 Y
  8. *$ f- O9 J8 C) k
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    . B) u& \) ~  |# }# n. E# ?
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 d: p" {5 r- t
  11. *         TO CHANGE.
    " N* `1 s' k3 N
  12. *
    3 W, s0 m  p7 U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    $ g: C) Z2 R+ q9 w0 }0 d- b
  14. *
    ( e6 K2 f- ~- F2 T
  15. * This program is free software; you can redistribute it and/or9 s/ f/ C1 z1 e% _! _1 N# t7 k8 Y
  16. * modify it under the terms of the GNU General Public License as& L+ j( V: z0 W0 b8 V
  17. * published by the Free Software Foundation version 2.; [* g! J& f1 G# x7 i# f* @
  18. *4 k' a- W8 q0 J( T$ T+ Q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ( H0 U5 y* ], h2 R! R
  20. * kind, whether express or implied; without even the implied warranty( o) ?" B9 C  f5 Z! ?  M
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + I6 Q* S, y7 h2 r; D
  22. * GNU General Public License for more details.
    2 }/ c$ O2 g6 @- Y: n& Y" P6 `1 _& p
  23. */
    5 T2 ^. P8 u! l7 ]* @" B9 W

  24. . |8 G8 R! K- T% ^
  25. #include <linux/module.h>
    : S4 R9 ~' \+ Q  l$ V
  26. #include <linux/init.h>
    ; ~# H: M- k- A. x- r1 _2 a
  27. #include <linux/errno.h>' V: a+ }. z$ V; K
  28. #include <linux/types.h>
    - u" |- a; E! `5 r5 b( G
  29. #include <linux/interrupt.h>
    3 W3 H6 Y8 w: j" q
  30. #include <asm/io.h>" Q* a8 ?3 x; `9 T% N
  31. #include <linux/moduleparam.h>
    . f9 V( N$ p: `6 I" J5 o6 z% J: a
  32. #include <linux/sysctl.h>. `, I+ n1 S) S0 y) h
  33. #include <linux/mm.h>6 c" \' R5 M$ z) R
  34. #include <linux/dma-mapping.h>7 d" T; U, ~2 X4 v

  35. " x; K# d! J5 M9 j3 s- ^! A
  36. #include <mach/memory.h>& A- B! r: d. b5 l' x
  37. #include <mach/hardware.h># x7 l* r* b4 W' w
  38. #include <mach/irqs.h>
    2 t0 N: m8 f+ R
  39. #include <asm/hardware/edma.h>- G0 r+ L  D9 L9 x

  40. 0 f  H# `' n4 h" f7 {. D4 N  G3 [
  41. #undef EDMA3_DEBUG% p0 `4 F* f& @% @( r; x( p* u% D
  42. /*#define EDMA3_DEBUG*/1 c' t/ k5 v7 a' S) y
  43. % V+ `$ }3 G( S5 L  \* X/ T% a
  44. #ifdef EDMA3_DEBUG2 o1 Y; K4 f: l, j: V1 t8 r
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    8 [, H: o5 }) _- T6 j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# d/ `% j2 t- x% t7 K# r- ]! |- S
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ' J4 s* Z( o  U  I/ V
  48. #else& a4 H; q6 h) i6 u3 R/ _' T% L# y8 Q
  49. #define DMA_PRINTK( x... )) B( y( a# e7 D$ F, D
  50. #define DMA_FN_IN" ~% ~# y/ x! J4 P: F% k
  51. #define DMA_FN_OUT
    % x' ~( u1 a: o; v
  52. #endif( T6 W% J$ y" ?( S9 g" u

  53. 6 G' j8 J- ]. \8 L; Y0 _# t
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 S+ Q% z, Q7 r: @( M  a! ^
  55. #define STATIC_SHIFT                3
    3 ?/ L2 D. K. _# N1 {8 K9 |
  56. #define TCINTEN_SHIFT               20# I  f. j% O, l% D* x$ z  w; u
  57. #define ITCINTEN_SHIFT              21
    2 O8 S& ~% H( V! B1 Q- {$ _/ M0 x
  58. #define TCCHEN_SHIFT                22) T! T- X2 Y' X$ T1 A- O
  59. #define ITCCHEN_SHIFT               23$ |& x/ J2 Z  @/ g! p

  60. # [+ }: d% f: p6 y1 @# B+ s3 E1 J
  61. static volatile int irqraised1 = 0;
    % b- {9 u5 }7 \# M8 v! Y
  62. static volatile int irqraised2 = 0;' L7 u0 ^% w6 g. `3 I8 L/ H1 N
  63. % o( C" s1 q% D6 ~8 }
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      f9 A* ^/ h# E- ^6 F5 P- R& Z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; p8 G; o. \1 R2 X8 _
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ j0 D2 z9 }+ H; `/ |& T
  67. ; Q. _! [5 [- d2 v
  68. dma_addr_t dmaphyssrc1 = 0;
    * v' @; @5 S3 `1 }
  69. dma_addr_t dmaphyssrc2 = 0;+ H# J0 O4 l6 B4 t- Y8 J
  70. dma_addr_t dmaphysdest1 = 0;0 m6 C  u7 C* g6 J% x
  71. dma_addr_t dmaphysdest2 = 0;
    # h6 A8 U# a" v' o! ]3 p

  72. 8 z3 h/ y6 N- [- B- m" g7 [1 q
  73. char *dmabufsrc1 = NULL;: q( e9 _) ~* d' H# }2 c
  74. char *dmabufsrc2 = NULL;
    * G; \* z. g- G/ i% t- ]; ]
  75. char *dmabufdest1 = NULL;3 ]  [. Q" E1 K5 g5 M+ w
  76. char *dmabufdest2 = NULL;% ~0 N& u* _; K* X$ ~

  77. / A( U2 a& A  k: o, ~
  78. static int acnt = 512;0 h1 @3 ~2 W! z7 ~( E
  79. static int bcnt = 8;/ }6 L! {6 [- q6 Q  n2 h2 |+ m
  80. static int ccnt = 8;
    ( |$ g$ a: u  h; ^3 y
  81. 0 C- H; z% u, h
  82. module_param(acnt, int, S_IRUGO);* h3 @+ Q4 u0 s, t8 M3 j
  83. module_param(bcnt, int, S_IRUGO);
    * F( f) P* E/ `$ b/ v7 w
  84. module_param(ccnt, int, S_IRUGO);
复制代码
8 G* m0 |) W, \/ `, [

! A( ~$ u1 u$ B& O5 C/ O' f      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; u9 ^$ K" i( \( D0 Q3 c( Narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; C2 d$ D& c) Z5 Q* T: b     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 f) z# g9 o* ^2 s# ]0 y8 U: B0 J

8 _7 S' r7 s: s$ A# ?) c' d& j3 E9 j( I5 V9 X0 @. J( ]' h3 s
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-23 03:05 , Processed in 0.040372 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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