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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; k( `% [, z2 X4 L. j  F: }: h7 U
  1. [code]EDMA sample test application
    9 G) w1 @7 U% N+ u+ M" M* k; d: }
  2. /*
    4 l" H6 q6 \8 G0 l0 ]
  3. * edma_test.c
    / ?+ i$ w. y6 h% U' L. \
  4. *6 Z$ z* q% n! B9 _- w# t6 V
  5. * brief  EDMA3 Test Application% o: x1 M* |( Q4 F* Y
  6. *3 D6 j9 x6 J+ |4 {( n3 F& M# H* m$ }; B
  7. *   This file contains EDMA3 Test code.
    4 }9 w' K( s; z4 @# B# {: _
  8. *9 U& l& ]4 g% ]. c" Y% @* O
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; t3 l" t: s8 J3 ^/ m0 W, F
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 o7 q8 X. x6 W& @- V. `
  11. *         TO CHANGE.
    8 ?8 d" k8 k: H) `( Q
  12. *
    0 o, ]8 z5 ]  J0 o- R9 z0 F, }
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 L- H( g, X, D6 N: H, n3 f
  14. *2 E/ P; x! ~# V& }3 n# y
  15. * This program is free software; you can redistribute it and/or) A- a0 B% R8 ~5 r) q
  16. * modify it under the terms of the GNU General Public License as# _& ?4 w4 n- ]
  17. * published by the Free Software Foundation version 2.  K; k  D+ H1 R
  18. *
    . w3 s/ m( D+ K1 l' m/ I
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any' X1 _) z, _( G( _+ {
  20. * kind, whether express or implied; without even the implied warranty- p* ^# y- O, T" f6 Q* _( C
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    : w9 J9 J) E  F& F. n
  22. * GNU General Public License for more details.( C8 l: g/ X  X$ _7 c6 @
  23. */
      _3 u: W, N* ?8 p
  24.   `7 f9 ^8 A) V4 @  W9 S
  25. #include <linux/module.h>7 P) U1 o, ^* I6 q1 f8 H
  26. #include <linux/init.h>
    . ?& f3 e5 n: }8 i- ~- S+ M
  27. #include <linux/errno.h>
    8 P4 b& ~! [0 t& P* {' ?# [
  28. #include <linux/types.h>$ \- m1 `, C" ]  _% A" R# I' A4 ?
  29. #include <linux/interrupt.h>0 a! S1 S5 S# `, s8 K
  30. #include <asm/io.h>
    ) U$ D( Z- ~" ?+ q* u6 J; E
  31. #include <linux/moduleparam.h>' s( V( N' ~& Q# g- E& \
  32. #include <linux/sysctl.h>
    / o% P. _8 r7 T3 m  a
  33. #include <linux/mm.h>7 |$ X# C3 O8 n( z' @
  34. #include <linux/dma-mapping.h>7 t: c( W$ ~5 p3 d6 C

  35. / B6 m4 `$ h2 q9 V
  36. #include <mach/memory.h>& R) d6 x: ~' C; ]9 |
  37. #include <mach/hardware.h>: o. O* |6 y! h' h3 C+ ]9 S
  38. #include <mach/irqs.h>
    4 S3 ^: N: X. }1 N6 L
  39. #include <asm/hardware/edma.h>
    3 Q# w& Y4 d) e) l( T' O; o

  40. 1 b, ~# l/ m# w0 c- q& B9 b0 x$ B
  41. #undef EDMA3_DEBUG
    2 a, y+ A* M, T
  42. /*#define EDMA3_DEBUG*/
    1 L/ w0 W" ~2 K% `1 M' `9 A& {# m

  43. 5 d* ?1 N5 H. d* o; J# H  ^( W& U
  44. #ifdef EDMA3_DEBUG- o1 ^' [( ^  R7 Z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 x3 O$ s: C( D, e( `. a# W7 j% E: S
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); A- M$ u2 A5 x: F9 {
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 N- E' C# @! d& L; K4 c
  48. #else
    5 ^$ K. I  L3 }* f
  49. #define DMA_PRINTK( x... )
    3 r0 I) i3 W& X7 Y$ N) k
  50. #define DMA_FN_IN
    - C, r( h2 p& T( m
  51. #define DMA_FN_OUT9 s; e5 f- k4 ], C5 z
  52. #endif! p1 g1 w  ^+ k5 x$ G+ {
  53. 6 t& k% Q4 F# Q0 y8 n% R7 H  S% A
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), F8 x2 o) K8 `, D- i& W
  55. #define STATIC_SHIFT                3
    0 J6 i; a( r& F! q( \8 r, m( g) r
  56. #define TCINTEN_SHIFT               20, q& G) H! i' |% ?, a  I: K
  57. #define ITCINTEN_SHIFT              21
    6 a0 e; Z3 G' g- ~* \, f
  58. #define TCCHEN_SHIFT                22
    $ \+ u- F0 j. A. u* _- l
  59. #define ITCCHEN_SHIFT               237 T3 R( `+ v# ^$ ^# V0 r2 b

  60. " V7 j8 d) V5 ~$ {: X) a% _0 z
  61. static volatile int irqraised1 = 0;) I1 I5 i  c" Z3 ^- V) T
  62. static volatile int irqraised2 = 0;4 z+ [8 M( b8 N5 q3 N/ @. U

  63. % p8 A  N+ U' y3 p5 E# h4 v2 A
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* J8 E2 \! w) x5 b- N. T
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; ^: N9 ^7 q8 Q. `  B
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( {# E. N+ \  J& M1 W5 K, L
  67. 5 Y) n/ ^- L: _/ o- t+ m2 N" r
  68. dma_addr_t dmaphyssrc1 = 0;. L4 o  s: ?/ O) {8 V. [) _: Q
  69. dma_addr_t dmaphyssrc2 = 0;
      }- }3 A9 z6 v$ l8 \- I0 l- ^
  70. dma_addr_t dmaphysdest1 = 0;
    5 R6 }5 \: I9 d& r% c9 d; |
  71. dma_addr_t dmaphysdest2 = 0;' g$ q9 J5 T7 ]

  72. + _8 @: z4 z( }: I# l3 s
  73. char *dmabufsrc1 = NULL;
    . O6 \% D3 h, O6 K- \
  74. char *dmabufsrc2 = NULL;) j2 f* w' W5 P; H$ k
  75. char *dmabufdest1 = NULL;9 }" X# e  x+ ~4 ]
  76. char *dmabufdest2 = NULL;
    # Q8 v) @! b7 y1 i. L2 v
  77. ! {6 P: _! d- p7 v5 N: {
  78. static int acnt = 512;8 Q8 `- b& ~( t; x& c
  79. static int bcnt = 8;
    " G. m& _* S  U: A# t- z
  80. static int ccnt = 8;
    1 m: `( C9 p" k5 k7 Z9 ]
  81. - N: F) a/ S! U
  82. module_param(acnt, int, S_IRUGO);
    : }  N6 s/ Y3 C) G. u9 O4 _, M3 L
  83. module_param(bcnt, int, S_IRUGO);+ R, U. O8 J  k  z/ r
  84. module_param(ccnt, int, S_IRUGO);
复制代码

# I3 m/ b0 c: k% o- Z
; d% I( b7 E3 ^+ B$ v6 O      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 z! q3 C/ A* p
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% T" l$ }: q- q" B4 [# M4 |     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% |$ Z, `! L9 \" |+ q8 ?
( y) h0 s. D; w: {6 F* r9 C

0 u( I6 O- ^9 Z2 {( U
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-14 04:51 , Processed in 0.043793 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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