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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 U- S  `/ ~7 b
  1. [code]EDMA sample test application5 V; b; L3 T6 ?
  2. /*
    : x8 n3 }5 p3 r- ^) B  e
  3. * edma_test.c6 B. i& y+ Z+ a" S! Q
  4. *0 t" {' ~) c" D% Z
  5. * brief  EDMA3 Test Application
    . A4 r7 N0 I& s/ {+ d1 F! N
  6. *
    5 {6 b) l4 Q. P9 Z. H( [6 P9 T
  7. *   This file contains EDMA3 Test code.
    ) d* W/ i7 p) o) G  p0 P' D
  8. *
    ! s7 m# |  {0 n; d3 N+ j
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - b9 P9 g3 ~% A
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 h# O! V( i! d$ ^5 A. o% s
  11. *         TO CHANGE.0 v& L3 {1 e( d, x! }7 E
  12. *% f% Z0 W2 K# v  F; g8 u" H6 N/ X
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 K- v0 I* {# ]0 D7 T
  14. *
    ' }; y7 i+ I& ^* a. Y1 j% _, n
  15. * This program is free software; you can redistribute it and/or; c3 J4 T3 N+ e0 Y' h3 Y$ h4 ^
  16. * modify it under the terms of the GNU General Public License as
    & ^$ u; ~5 A! o2 }
  17. * published by the Free Software Foundation version 2.. P  f' i' E: I) X
  18. *
    ) T+ |6 G, n: s: [, H. w. r7 G
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    " g# p& z+ i8 U
  20. * kind, whether express or implied; without even the implied warranty2 C7 i. J  s* N7 }7 b
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the" d3 H( d5 ?5 W# {: Z
  22. * GNU General Public License for more details.
    ! q, ?6 {+ L4 e' ?7 @
  23. */+ O. @5 J3 \# G3 A/ ~

  24. 1 `- Z' B% Q' H+ o
  25. #include <linux/module.h>
    3 s& u6 F* F+ \7 W% p+ x# P& M9 T$ h) P
  26. #include <linux/init.h>
    , _+ J3 @8 ]9 i: A! i7 J
  27. #include <linux/errno.h>; D: E+ ]+ R/ J% Y1 I& Z
  28. #include <linux/types.h>
    2 Z1 V# w  y0 W0 E4 C! i2 n$ u: b
  29. #include <linux/interrupt.h>
    6 t% Y" h* X3 A9 v
  30. #include <asm/io.h>
      y) x# y! f0 Z6 u  v( W
  31. #include <linux/moduleparam.h>
    0 n" Y- w! u9 o; r# E
  32. #include <linux/sysctl.h>, v( m% X. C' r- T% ]" |0 c5 G
  33. #include <linux/mm.h>
    ; \, g7 j1 N# i* \
  34. #include <linux/dma-mapping.h>
    1 Y; i' t; v; h1 x$ c9 W+ K) b

  35. & w( t  Y; h: e& w
  36. #include <mach/memory.h>6 |/ A1 S8 \4 G8 C2 u( P
  37. #include <mach/hardware.h>9 k' r% B" T4 W) d8 _
  38. #include <mach/irqs.h>
    / |9 n3 P2 J1 K& I. I$ e3 F5 I
  39. #include <asm/hardware/edma.h>9 ?9 j* l4 S' R& m2 b5 Q, B- b

  40. ' Z8 V$ y9 Y7 y8 ?
  41. #undef EDMA3_DEBUG
    * V: U8 W5 t5 g, y' |' K" F1 p) D
  42. /*#define EDMA3_DEBUG*/
    2 G+ S/ W! x4 ]+ _/ _
  43. 4 Q% ~! h' e  s# @
  44. #ifdef EDMA3_DEBUG/ [& \# R3 b7 d, e! b' S
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 r, [4 L- D! @$ P. Y4 ]
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 T2 W5 p. I2 _
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); g$ ]( u2 v: S2 ]* S
  48. #else
    4 W1 F4 ~0 X# z+ B) Q6 l  _, P
  49. #define DMA_PRINTK( x... )
    8 a! P4 G' M* O% d# q# [
  50. #define DMA_FN_IN
      N- B1 y# H0 L9 S
  51. #define DMA_FN_OUT
    5 L& B& p! ^6 K) g( l* Q5 i9 e/ w
  52. #endif% Y" v. N2 u1 o6 F2 X+ O+ U
  53. 1 f1 E6 M" j+ I+ ]' |
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    # y; w3 w* h" c9 C3 k
  55. #define STATIC_SHIFT                3
    * c  p  N0 e: X0 R8 P$ b  Z! M
  56. #define TCINTEN_SHIFT               20
    # h# B# c, j# q0 c0 S8 ^8 c) R
  57. #define ITCINTEN_SHIFT              21
    9 n, P( ~" P8 F# L( \) h& [, j6 N; t
  58. #define TCCHEN_SHIFT                223 m& z4 e! {6 S% f
  59. #define ITCCHEN_SHIFT               23
    # O9 M+ b# H# c4 u6 R* W  G
  60. * K$ @6 Y; K1 A. \
  61. static volatile int irqraised1 = 0;
    + a; D: s+ p* A4 `0 C
  62. static volatile int irqraised2 = 0;
    " [; b# A: u: M% O( E

  63. ; S6 e- Z! t) M
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 J7 A0 V5 t+ j! h" ^3 t, H' k
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , \; }& h- }5 ?! F# a/ w+ i2 R- `
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * k: y6 B& p. J: L7 a! u9 H

  67. 3 @" H' h! n5 Y  H
  68. dma_addr_t dmaphyssrc1 = 0;6 X4 f0 y. P6 v9 f- O
  69. dma_addr_t dmaphyssrc2 = 0;
    5 X$ t" ?# U8 I% E: q1 c
  70. dma_addr_t dmaphysdest1 = 0;
    1 a2 j6 u/ K$ l) v6 O/ P
  71. dma_addr_t dmaphysdest2 = 0;" c; T6 I/ l( ?- X/ r1 Y
  72. ; U2 S8 D  q0 k  `. s+ V
  73. char *dmabufsrc1 = NULL;3 o; D: f- D- U- }- v1 |
  74. char *dmabufsrc2 = NULL;9 L& F6 C- Z: O% F
  75. char *dmabufdest1 = NULL;
    " w% ?, m( d! p, _
  76. char *dmabufdest2 = NULL;
    : h- n1 P$ J; N: S" z

  77. ; l) ~, r, |. b" c
  78. static int acnt = 512;
    0 x5 f/ b/ I; D0 X5 K4 N
  79. static int bcnt = 8;# }, S- E& ?; _- H2 q- w& i
  80. static int ccnt = 8;7 i) L: q" ^; o+ f

  81. ! O4 E6 j3 c7 O7 Q
  82. module_param(acnt, int, S_IRUGO);
    . y8 H" c4 O! ]( q
  83. module_param(bcnt, int, S_IRUGO);1 H2 Z# \0 G) Z, `/ `$ D6 q& M
  84. module_param(ccnt, int, S_IRUGO);
复制代码
  m/ J7 u5 a: v! g/ U( ~4 j* V
" Y, T0 H8 S$ O4 x* R; L: m' ^. L% J
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# E0 ?+ {$ u6 C) oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- Y  Y& J+ d8 b  T     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 i3 v& _& S, \2 L* {3 z
# b7 ]# u1 v1 B- G- y& `6 s+ h8 _# m7 H& d7 n0 ^! q: j. J
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-6 14:12 , Processed in 0.048681 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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