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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 E  r, M( t( @  Z% o
  1. [code]EDMA sample test application; S5 q" k( X% ]
  2. /*6 P2 R7 u# Z. l
  3. * edma_test.c
    1 m' s8 h, s! f+ m  \
  4. *8 p/ e, e8 S2 Q% i  u8 _' s
  5. * brief  EDMA3 Test Application
    % J( t) j5 c1 a; t! k3 V
  6. *
    , `! I3 N& M  l3 g' s
  7. *   This file contains EDMA3 Test code.% \% K* C2 Z0 o$ W1 W/ O. Y# J" Q
  8. *& c3 H1 w; ~3 m3 v/ P' ?5 @
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, [0 v5 b/ X  S" ^! f
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) D4 s6 J4 U$ ^
  11. *         TO CHANGE.# b& ?, d* V* ^0 ^" k
  12. *
    0 l1 R% M! B' t
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 S$ j' x% B: F* A6 \+ W" C
  14. *
    6 p/ I* l9 ~+ _0 n
  15. * This program is free software; you can redistribute it and/or9 }/ x% h$ t1 _' M- y
  16. * modify it under the terms of the GNU General Public License as& C1 _. t. i( p) L7 D
  17. * published by the Free Software Foundation version 2.7 d, q1 Q; N! @7 r0 d/ V8 J
  18. *. k9 z) q' }( f9 |5 k% F
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any) o) X$ W4 z" f) X4 P
  20. * kind, whether express or implied; without even the implied warranty8 T; _4 y! D0 ^! @4 f, ]
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! E! V$ P; K6 f9 q& B
  22. * GNU General Public License for more details.: [3 r+ I0 ]7 o: x+ N2 G' I+ L8 l
  23. */
    , [* Z+ L# ?/ L2 A
  24. 9 @0 x5 [7 N. f0 J- a# S+ }
  25. #include <linux/module.h>; {: n! [  h/ r; K
  26. #include <linux/init.h>
    0 A/ `) Z0 @& p6 ^2 e3 t9 t4 j: p, i
  27. #include <linux/errno.h>
    2 ]7 U, n. ~1 L7 U& c
  28. #include <linux/types.h>
    3 i0 Z- z' p6 v% t) ~7 {
  29. #include <linux/interrupt.h>4 n5 S0 x0 r# P; w
  30. #include <asm/io.h>
    $ m% @% y. f7 q! t% a% `
  31. #include <linux/moduleparam.h>, v+ L% g7 T$ d8 y. Y3 k& m. J
  32. #include <linux/sysctl.h>( K2 L- g/ q+ N5 t+ C- x
  33. #include <linux/mm.h>9 L% K/ G( H  l* |; |8 N5 b  N$ E
  34. #include <linux/dma-mapping.h>
    ' l) m& S" W3 g( q% n/ l
  35. ) {2 I  ?0 ]2 }2 d5 m# }8 }+ H
  36. #include <mach/memory.h>% I. X% W5 Q' R" h' a
  37. #include <mach/hardware.h>
    : ?# B! v: I; |8 q/ z1 C7 `$ r
  38. #include <mach/irqs.h>; V! M! c3 N' w2 B6 L
  39. #include <asm/hardware/edma.h>/ s6 @( p4 X) s. ~/ K2 |# p) D

  40. ; {, `" J& n7 }/ f" u  x! u3 S' P
  41. #undef EDMA3_DEBUG' N5 G: V/ ?8 R* B( k  U! Z
  42. /*#define EDMA3_DEBUG*/, `& g: b$ S1 a1 k7 ]! @

  43. 2 H; w+ H" V  |* H3 H; ^  W/ K
  44. #ifdef EDMA3_DEBUG: _- n$ x  E8 n: l
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 A3 q9 @) n( y0 u  w( T1 H
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    / }( C1 V8 c5 @
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). A: w+ \. X" r& z( P6 }- P( J# k
  48. #else) {0 c2 X8 }' \2 h% f
  49. #define DMA_PRINTK( x... )
    ! z4 O* u: G- R2 f3 S% |
  50. #define DMA_FN_IN
    6 G4 A4 o7 c) }/ e2 h% L
  51. #define DMA_FN_OUT
    & M5 H8 M$ x% ~1 c0 `( T$ [! {; d
  52. #endif
    $ T2 f; \/ C, a, j; A5 |

  53. 8 O" p/ c, I7 U- K; T1 V, z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  p1 C% s' O0 X" t, k
  55. #define STATIC_SHIFT                3" O! O. H" r) e' X
  56. #define TCINTEN_SHIFT               20
    1 Q7 G3 q! k# U$ ]
  57. #define ITCINTEN_SHIFT              21* p2 u1 N; E1 r6 m4 h# X
  58. #define TCCHEN_SHIFT                222 n, Q) Y9 L% E9 H6 k' q' Y
  59. #define ITCCHEN_SHIFT               23
    3 x( ]3 V: t: h3 g* O$ N& \! I$ H
  60. & z7 \+ z+ [2 x8 K! @% h+ _
  61. static volatile int irqraised1 = 0;
    * |/ {: c8 X' }% S* A! U
  62. static volatile int irqraised2 = 0;, @) @3 d# E; W! _8 J. d9 @+ \

  63. ( a8 b+ E; \1 G
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- J* l/ B7 ?/ U3 j) Z) U$ |
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' y2 Q3 C( S2 d5 [
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ W5 M9 i2 i3 J9 R) L! Y+ ]/ o
  67. / q3 R7 [4 {2 E) N8 `$ `# e
  68. dma_addr_t dmaphyssrc1 = 0;. k& b% ^6 P$ i4 F* s: M3 \5 A9 |
  69. dma_addr_t dmaphyssrc2 = 0;0 ^  f6 C- J" u. C, k
  70. dma_addr_t dmaphysdest1 = 0;- B# A: S1 O/ M9 ~, J7 e
  71. dma_addr_t dmaphysdest2 = 0;
    + U4 ]. b4 F% p

  72. / C/ h; r. s. d( y$ M9 l
  73. char *dmabufsrc1 = NULL;
    $ n2 @9 w) v8 M! f; t1 ~
  74. char *dmabufsrc2 = NULL;$ ?" Q3 I2 B6 b# t) x6 l: |. g
  75. char *dmabufdest1 = NULL;1 B; X, o2 M, |1 o7 u$ o
  76. char *dmabufdest2 = NULL;
    : |5 J! e( e/ @2 x4 `3 \7 r- J
  77. / a8 B# {% H( r9 O4 U( D5 d
  78. static int acnt = 512;
    ; u: c$ f7 x/ R& y; f9 K5 N
  79. static int bcnt = 8;  Y& R8 f& w  l. F2 i" O; S: U
  80. static int ccnt = 8;
    ) [* i# r9 G7 h5 H
  81. . a: K3 q. N* G$ y, ~5 X2 K( X$ u
  82. module_param(acnt, int, S_IRUGO);8 q: {% p6 J3 |4 G- L
  83. module_param(bcnt, int, S_IRUGO);5 q& K. |; ]0 e) U- M% H! ~  H
  84. module_param(ccnt, int, S_IRUGO);
复制代码

" G5 T/ a8 _# W9 r* r; I: S) k; r: r
( R- ?- z, k/ M# @# h      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ \8 _9 L+ H" d- n8 I
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 l: `% P: X/ d/ Z+ j9 J$ w3 e     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* j5 A; D5 s; s6 H0 Y6 D# i

% P6 I5 q: A! p" h* v; Q. ?
0 f) E( d% L1 l. _- K
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-3 16:45 , Processed in 0.048602 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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