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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. A* u, S6 a, p8 g/ E' _
  1. [code]EDMA sample test application
    9 Z' ]* J0 s/ w5 J
  2. /*- G$ n5 X) ^6 {
  3. * edma_test.c
    * K; U$ ~& L" u
  4. *
    3 k! D- L9 n0 f% A! K$ I# D
  5. * brief  EDMA3 Test Application
    6 W8 r: `' N6 L9 c- K
  6. *
    : E3 [& K0 d3 `
  7. *   This file contains EDMA3 Test code.
    0 q* a. `7 E0 Q  v$ V# C8 F, ?
  8. *
    - P$ ^( F5 R; D& \+ Q0 _* J
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! f. s6 ]9 a( c% N6 @5 @  ^
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! c( o2 {* u2 f+ v3 I1 d7 o2 q! j
  11. *         TO CHANGE., P: X: K- R9 P0 W/ D0 t4 Z3 e  c
  12. *
    $ `$ Z" H+ z; ~# A/ u- b0 F* x: W
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 `; s+ e# V% ]# [  O+ a$ y9 {4 y( l% j4 R
  14. ** {' o; {2 J  f2 a
  15. * This program is free software; you can redistribute it and/or
    , I7 B2 C" |: m2 g1 ?7 R5 b
  16. * modify it under the terms of the GNU General Public License as
    6 m$ Q; _0 D: m+ R3 n* M: h* p9 ?1 m
  17. * published by the Free Software Foundation version 2." I! y, Y0 A- Z2 r  L
  18. *
    8 k( w, X1 s: g+ J( T1 Q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    $ f# F9 T9 B  g- C$ h+ o; @
  20. * kind, whether express or implied; without even the implied warranty7 z6 D7 E, V  n
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* p* G- K! ?3 V/ ?6 \& N
  22. * GNU General Public License for more details./ e( H. B% ~8 C- P! T+ f; \$ X4 T- r
  23. */
    1 v. l2 M* \& j' D/ [
  24. " r' y* b6 m7 \+ ]! e- ^. h
  25. #include <linux/module.h>5 h" s3 o6 [" Y" q
  26. #include <linux/init.h>
      W+ R; i* m) V& W6 \
  27. #include <linux/errno.h>
    6 s8 t5 r5 f8 l% l
  28. #include <linux/types.h>
      K: k( z# q( I0 b( e' W
  29. #include <linux/interrupt.h>( O+ @5 I+ q: i0 ^( Z6 q# |
  30. #include <asm/io.h>
    ; F4 Z7 u! x, u! n( H$ Q
  31. #include <linux/moduleparam.h>7 B1 ^% _) m& Y! z; U  U
  32. #include <linux/sysctl.h>
    . d) a  {# k$ Y
  33. #include <linux/mm.h>
    ' h8 E9 O. d$ \- [. \# \1 ]  A: f+ D5 l; |
  34. #include <linux/dma-mapping.h>) W- m- ~( m* j0 `- n  n
  35. 7 T. q9 {) g5 z9 g
  36. #include <mach/memory.h>/ B# F7 m% o3 b5 `, y, ?
  37. #include <mach/hardware.h>
    0 P/ B( W: g' a# f& @$ i" e9 Q$ T( E/ [
  38. #include <mach/irqs.h>
    . Y1 w) N( {3 U8 N" p
  39. #include <asm/hardware/edma.h>. a6 y; e4 H7 d& `* D0 H
  40. * l+ t7 y8 T' r7 C; k' q/ t: k
  41. #undef EDMA3_DEBUG! k8 y' \0 X$ C
  42. /*#define EDMA3_DEBUG*/
    - E$ _8 |$ i1 E5 x4 S3 c, |
  43. 7 K2 M  N7 V1 s" g1 W& m8 w4 m
  44. #ifdef EDMA3_DEBUG
    9 C) x* E6 E5 _8 A7 E, R7 W+ V
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ) l3 d* h$ }. U8 p+ H* }' ^# D
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    3 H/ l: Y3 P# B& K. C7 g9 c
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ B- O; U) J- T( h9 k" p! A- p
  48. #else* {' o+ n  M" j9 P. H; |- ]# C
  49. #define DMA_PRINTK( x... )% i; T) F4 h- Q! \# W
  50. #define DMA_FN_IN
    $ L' j+ ?6 S8 }7 K. }" o# Y* \7 U
  51. #define DMA_FN_OUT. J- {1 o- s5 c5 g5 m
  52. #endif
    6 _8 A8 J4 Q9 O

  53. 2 H, `: c  Q! p# h7 m$ x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( M. b" I; ^! |. G0 `1 L% R
  55. #define STATIC_SHIFT                3+ T& @6 O7 O: V& d/ ?* ^
  56. #define TCINTEN_SHIFT               20$ S! h* Z9 E" h9 z4 G0 X! h
  57. #define ITCINTEN_SHIFT              21
    : ^8 d6 [1 m" Y- h
  58. #define TCCHEN_SHIFT                22, w5 O: Q0 ^& D) ?
  59. #define ITCCHEN_SHIFT               231 u3 Z5 r9 E$ J9 }3 b* S! x
  60. : Q+ }$ D* r. q; b. \
  61. static volatile int irqraised1 = 0;
    8 R9 q) ]0 Q# z  A) n" R0 u2 w' j7 d
  62. static volatile int irqraised2 = 0;
    * j: o% i& b5 {( c9 o

  63. ; b6 n# r3 o) v& ~) ^1 o3 a$ ~4 ^( m
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : k% f7 A  w. H+ G& d6 J+ T. b
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. a( F& S6 O% v  s$ M6 q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! H7 J! L8 P- x
  67. 0 l; Q/ l& J* h, G: `
  68. dma_addr_t dmaphyssrc1 = 0;
    / g2 T' q" {3 \: V; I
  69. dma_addr_t dmaphyssrc2 = 0;
    . C' K! B1 L9 @' s9 N. v# V8 I8 {7 n
  70. dma_addr_t dmaphysdest1 = 0;8 J5 D) w1 V' Q( v
  71. dma_addr_t dmaphysdest2 = 0;
    7 S* {* C$ k# x) _: _$ J  K4 B

  72. ( z& }/ \6 Q/ j0 P
  73. char *dmabufsrc1 = NULL;, R/ Y2 d$ G0 u! L/ D7 }2 ^
  74. char *dmabufsrc2 = NULL;! X) Z5 Q* T+ s3 R. x
  75. char *dmabufdest1 = NULL;5 F' @' k& `# w! i
  76. char *dmabufdest2 = NULL;3 z3 p, b# M; O4 x# O

  77. : P0 A$ m4 |- m* w+ {: \
  78. static int acnt = 512;' U& l: _1 d: J( V0 `. S/ n7 v" ?3 p
  79. static int bcnt = 8;$ N% d- Z/ T3 g* y0 B) N  e
  80. static int ccnt = 8;0 w# _* K% P5 n

  81. 4 w+ s4 w5 T7 K/ O
  82. module_param(acnt, int, S_IRUGO);! L; H& j: c4 }0 ?+ _
  83. module_param(bcnt, int, S_IRUGO);; S' k$ l; ^5 [6 D0 B
  84. module_param(ccnt, int, S_IRUGO);
复制代码

8 {6 W: ~) ^' y3 ?, {( J# e/ m: t  J
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# U9 I& m8 u$ x* p. d' aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 ^1 v8 u' t; K. H% s4 s! @
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* l; Y0 _4 n9 r: `' w9 a6 }

- H* o0 c  \- e8 G2 a) p
/ u8 }& F9 \, `# Z: E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-21 13:17 , Processed in 0.038629 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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