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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% x& i) p; _- e! l
  1. [code]EDMA sample test application/ y5 Q6 [& b$ X  k
  2. /*
    4 t; h1 `! C* z* H' V/ E2 d& V
  3. * edma_test.c
    / ?( a& m0 h* {( F1 J- Z
  4. *
    4 V8 ?- F7 t/ F) h
  5. * brief  EDMA3 Test Application! z7 w9 r+ S9 Y& H+ P7 m
  6. *1 d3 R+ \, a( x* x, M6 C, e: K/ E
  7. *   This file contains EDMA3 Test code.: n/ g+ m2 a+ N4 Z9 a- O1 W  Y
  8. *
    $ ^0 c6 L+ b! I- d
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    , v) Z6 A- Y0 f2 r& m' Y5 B
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 B/ F8 }1 S& y4 q$ _+ f
  11. *         TO CHANGE.
    + v! V2 x) B$ U9 ]
  12. *. z, \5 K  x; N' q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    + q/ Z* K/ F" i" K
  14. *+ ^5 ^0 h7 B4 Q6 E/ V. h
  15. * This program is free software; you can redistribute it and/or
      h  R# i( i: \
  16. * modify it under the terms of the GNU General Public License as/ X9 d* f1 _( m* y
  17. * published by the Free Software Foundation version 2.' Y( k  N4 E) Y$ J" Z/ E
  18. *' Y4 W' i* {5 m3 Q; l
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    1 T% w6 H0 @3 Q! H* F$ ^9 {7 f) ?
  20. * kind, whether express or implied; without even the implied warranty
      L6 X- V7 r' p
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3 ]2 l; i. ^* W1 T
  22. * GNU General Public License for more details.
    % l, J) c" k# T, \: W4 G% l
  23. */
    6 P' F7 e9 L5 M) p: K+ k

  24. . e1 }3 H3 _& @  i' O0 X; |- B
  25. #include <linux/module.h>2 V* P* W" K! h& _
  26. #include <linux/init.h>
    : V. P3 `) g4 C9 Q, B
  27. #include <linux/errno.h>
    ' ?0 G+ h, t% y1 ]0 k
  28. #include <linux/types.h>
    9 W. R8 J) L4 x. Z1 h" Q) Z
  29. #include <linux/interrupt.h>
    3 T+ d2 f  N; b# |% }% ~8 x
  30. #include <asm/io.h>
    + s+ \1 i# k7 ]% J8 c
  31. #include <linux/moduleparam.h>6 J* B9 @: p; I- g7 t$ p
  32. #include <linux/sysctl.h>
    . e8 i$ G0 H6 M$ L$ m( o
  33. #include <linux/mm.h>' @; z2 p: z' I8 a7 q. i7 g
  34. #include <linux/dma-mapping.h>% c2 }  S3 \1 \$ i
  35. / q- @$ c5 l0 w& O. f+ {! o, u
  36. #include <mach/memory.h>
    5 b/ {+ @8 F2 R/ Q7 N, k( m* y& a
  37. #include <mach/hardware.h>
    0 P# _# n; c! ?8 L
  38. #include <mach/irqs.h># M; o0 C) `. C) O- G
  39. #include <asm/hardware/edma.h>
    % T  Q1 W7 q( \3 S: Y' E

  40. 6 }0 O; u% @) K; d+ R( G6 L
  41. #undef EDMA3_DEBUG7 I9 p) O+ C  ?9 M, ~
  42. /*#define EDMA3_DEBUG*/1 u  b, G" g7 q7 f/ V0 r
  43. 8 V; A' t/ x" A* Z: t
  44. #ifdef EDMA3_DEBUG7 ~2 t; V1 G8 G2 q* E3 S
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    0 K4 p$ t# P  `5 v7 h4 p4 e7 E
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% a! T" _  j# [
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 b; B8 ]9 R1 u2 N0 S; j
  48. #else; j4 s$ v8 ]' w4 j- P1 f
  49. #define DMA_PRINTK( x... )( |4 \! P# J* ?+ f; w# X6 k
  50. #define DMA_FN_IN
    1 z( q0 y0 I2 b6 `, K) ]% ?+ @4 i
  51. #define DMA_FN_OUT
    9 h: V  m6 Q1 D
  52. #endif
    ! n- r. ?# W- N' D9 _0 J

  53. . f: q! ^+ p0 {7 f
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). H) y8 U: w* U8 J
  55. #define STATIC_SHIFT                38 u3 q0 z2 K0 m! X& W/ X9 V
  56. #define TCINTEN_SHIFT               20
    : W! a/ Y) t  z4 o' E
  57. #define ITCINTEN_SHIFT              21% S0 }8 B2 \( U% [, U* o3 `) B
  58. #define TCCHEN_SHIFT                22
    % }3 }, p9 x6 z2 J6 y/ t
  59. #define ITCCHEN_SHIFT               23
    0 K( I2 ~1 ^! m* B2 c9 R9 r/ n0 Z

  60. ! J* U3 }* V4 b
  61. static volatile int irqraised1 = 0;
    $ o& d! p5 s" T" K! p) z( D
  62. static volatile int irqraised2 = 0;
    6 t4 ~, f* Z& P" }7 Q
  63. , |! o& V  x3 l' j6 j# X
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 F3 {  b1 f' E8 v$ A: S# [1 a! o* I, D
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % ?% c; F# F4 g" C, Z" I5 m
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% F& g( H2 \1 ~

  67. * |! ]; ~  @% H: a9 Y$ \& f
  68. dma_addr_t dmaphyssrc1 = 0;$ u# n2 ?+ O% O- i+ @
  69. dma_addr_t dmaphyssrc2 = 0;" P& c' i$ |& ]: I  W
  70. dma_addr_t dmaphysdest1 = 0;+ J& E# P9 c, A3 ~9 [# Y* B
  71. dma_addr_t dmaphysdest2 = 0;
    9 ~' M, c- |$ O7 j* E$ W. J
  72. 2 S% I. y9 I, i' d/ ^
  73. char *dmabufsrc1 = NULL;
    7 X/ [" W6 v8 j
  74. char *dmabufsrc2 = NULL;" ?8 C" G' S. X
  75. char *dmabufdest1 = NULL;: [7 M$ ^% [" d( u% h0 q  q
  76. char *dmabufdest2 = NULL;! I& a# ]3 p- N/ h
  77. ; I$ Y' g7 }: p# f
  78. static int acnt = 512;
    9 x8 [: o" F1 |  y
  79. static int bcnt = 8;# B7 x1 [/ E2 o
  80. static int ccnt = 8;
    ) }9 m+ ^7 r8 _1 Z

  81. 6 J) _& [* @- }: d% r% Y' ?
  82. module_param(acnt, int, S_IRUGO);) V, L* R- H" q. p, o
  83. module_param(bcnt, int, S_IRUGO);
    / {+ n4 T! W" P
  84. module_param(ccnt, int, S_IRUGO);
复制代码

7 C, }" v, [7 \8 D$ R( g3 I5 [# Y. f  f) R2 ^% j2 i8 t
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% u, j- O8 e1 ^' a' darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' [+ T1 e: l  k7 d- d2 w9 ]& X     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- @9 v# H" Y, B
& a; j' a+ ]7 I) C

8 W+ a. A: P* U0 u% D3 c
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-24 02:05 , Processed in 0.064600 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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