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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ D# n) v( k5 g' V
  1. [code]EDMA sample test application
    2 A4 |( J" i& x) W
  2. /*
    * d6 I* P$ I$ f
  3. * edma_test.c) W5 ?3 }( \, G$ {4 d- d
  4. *) V( _' f% w/ c' J% _$ N
  5. * brief  EDMA3 Test Application
    ( _3 ?9 b# V: E+ j. {
  6. *) q& R3 D; r( t
  7. *   This file contains EDMA3 Test code.# \' H) u6 ]/ A* ~9 }" g
  8. *; M. ?) ]# s. H/ R% A, H
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    . t- u9 e, I; j9 X1 Z) U
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 ?/ y* _0 E4 C: j
  11. *         TO CHANGE.
    ( ^, [- p' [- [# @
  12. *: l& D1 a+ w1 F- I) o2 [% B
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ! z8 ?0 k' z' A. G/ A
  14. *' r& M; d1 s4 t) s% T. g# b
  15. * This program is free software; you can redistribute it and/or
    ) o" p6 {0 i  S# y( d. C
  16. * modify it under the terms of the GNU General Public License as
    0 f: O6 Z; j" ^4 M6 X! g, k
  17. * published by the Free Software Foundation version 2.3 T2 |7 t5 t# G; D2 p& [
  18. *
    5 B" J$ X3 E3 j$ O5 e
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 Z0 P+ C% a. j) P1 S$ ^4 K
  20. * kind, whether express or implied; without even the implied warranty
    7 Y& n/ z8 @, X- W$ g# e" J
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the, ^% ~- K3 O& s  W8 q$ e) ^
  22. * GNU General Public License for more details.
    / J" n- @. v+ x1 A/ Q" L: L
  23. */
    / r  w$ s3 p1 H$ U* i$ d% {
  24. 9 J& C! H$ @2 a+ N
  25. #include <linux/module.h>
    : k* c& l: a0 z& p: K$ w
  26. #include <linux/init.h>
    0 t$ A8 a1 g: E9 D( C! E
  27. #include <linux/errno.h>
    6 ~' b# p# y7 a9 x3 {" r
  28. #include <linux/types.h>- b( x+ B! G5 }' i& U- X2 ~
  29. #include <linux/interrupt.h>2 A- E0 Q3 ~2 H  g, L6 a9 B9 x& w
  30. #include <asm/io.h>1 b. u$ z8 k/ R- d( x
  31. #include <linux/moduleparam.h>) q. e, {" H7 j2 l5 f
  32. #include <linux/sysctl.h>
    ; Y# k2 J$ |/ D; r3 V
  33. #include <linux/mm.h>
    , e, d1 |( }8 \
  34. #include <linux/dma-mapping.h>  Y, {7 f8 L* O0 [& Z! V+ z5 ^
  35. ) i0 Q) R+ H' R
  36. #include <mach/memory.h>
    ; Z6 @0 \; Z1 Z0 \( J9 e( _2 j
  37. #include <mach/hardware.h>
    5 F4 X# i8 R* r3 A0 R0 V8 l/ P3 B" N" m+ W
  38. #include <mach/irqs.h>
    , k& m) I& B5 C* f! \/ G6 a% `$ f
  39. #include <asm/hardware/edma.h>
    8 y+ ]" T9 G1 \& H/ f4 P5 N' h
  40. , [* o1 X! e6 E+ l8 a% |$ z- F- s
  41. #undef EDMA3_DEBUG
    1 f" [. p4 F% {
  42. /*#define EDMA3_DEBUG*/6 _% A6 i, [( L! a  @$ v! c: s. o

  43. 8 n/ R( g" I) u' c1 C6 d
  44. #ifdef EDMA3_DEBUG& M3 ~+ A+ B) O1 u- P2 R' z! F1 M
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)  |1 F6 g; }1 _9 A  L
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    9 @- p. h  o, j) T. V8 Z- ^2 o
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ |7 h: p% X5 t: Z0 o) T- K
  48. #else1 w! V, Z$ r: Y
  49. #define DMA_PRINTK( x... )
    1 ?, v+ r2 y4 X7 y+ j  ^3 s- K' E  t
  50. #define DMA_FN_IN
    ) j8 p' ?: ], r- g
  51. #define DMA_FN_OUT; I' \# C7 |5 J* X
  52. #endif% g1 Z: |6 X# {  V3 }7 R4 Q

  53. 0 `5 F1 T9 E& E) y- b- {
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)8 o) O3 O5 K$ L: i8 h# M+ L% h
  55. #define STATIC_SHIFT                33 g6 _" g2 m0 ?& \( ^& x! ]- ]
  56. #define TCINTEN_SHIFT               20& y7 J. S1 K  J1 n8 h: B/ q
  57. #define ITCINTEN_SHIFT              21
    4 h9 `7 k, F9 T7 v' `, ?
  58. #define TCCHEN_SHIFT                22
    / d8 k8 ~- T7 W( O* ~" f
  59. #define ITCCHEN_SHIFT               236 e) u# K3 e: A3 H1 X- _3 n

  60. , r' q& w# w  ^" a) ?  E
  61. static volatile int irqraised1 = 0;
    2 o: I) }5 i7 n# M6 n) G
  62. static volatile int irqraised2 = 0;. ?: b; N. c; o. h
  63. & c; Q# X2 Y$ T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 e5 T$ f3 l  G# Q% r7 G5 S
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) h; n8 m4 u9 O7 Q: c- R
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 S* n% O1 m; a; u. \

  67. 4 ^# K" ^9 V3 Z& i: p
  68. dma_addr_t dmaphyssrc1 = 0;
    $ z# R4 K+ Z4 W: h
  69. dma_addr_t dmaphyssrc2 = 0;
    8 o, g. W0 ^+ b& N7 j8 j, {, I8 X
  70. dma_addr_t dmaphysdest1 = 0;8 L1 Z4 C. K2 w, G7 b; R; q
  71. dma_addr_t dmaphysdest2 = 0;
    7 F+ Q/ s0 d4 j4 l# v; \$ r4 R/ U
  72. 5 m" J" p8 Y' k+ D0 i
  73. char *dmabufsrc1 = NULL;+ H5 T+ O2 s9 [
  74. char *dmabufsrc2 = NULL;2 M& j8 t. {5 C% t3 ~
  75. char *dmabufdest1 = NULL;5 b/ j- K8 T2 y( P0 v5 t4 W! f
  76. char *dmabufdest2 = NULL;
    9 ~1 F, ]+ q4 O- I: _0 s
  77. 1 {# c  c6 B( b/ D8 `3 R
  78. static int acnt = 512;
    & z/ M; V3 \5 Y
  79. static int bcnt = 8;
    7 H( k; `# B# u0 m4 A2 t
  80. static int ccnt = 8;
    3 O7 ?3 @& W8 I- Y) h4 l, F
  81. $ o  U2 [( D" f' e# X
  82. module_param(acnt, int, S_IRUGO);
    / b6 [9 K, Y7 d5 e
  83. module_param(bcnt, int, S_IRUGO);6 l0 C  Q" P- R! u
  84. module_param(ccnt, int, S_IRUGO);
复制代码

9 j5 B' k) v7 ?" `5 T2 x3 G3 c) [
/ i% q6 Z" |8 F      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
  n$ I$ p0 e7 H+ yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 x$ d2 Y. N% n5 ]! E
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* G7 u6 B: w: W) F
0 ]# x. O4 L" l; H$ s2 k
; g8 ~/ f; D5 `* n% B' d# J( Y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-8 18:24 , Processed in 0.039775 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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