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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: ~0 G' K( V5 g0 ]4 u
  1. [code]EDMA sample test application
      k- @: y. B" ^5 o$ q# _2 y+ d
  2. /*
    . x) ]3 _1 E& I! P& P/ o
  3. * edma_test.c
    + d" Y& Y% b, v6 N, i. s) n
  4. *
    2 Q& p' L% q9 ?
  5. * brief  EDMA3 Test Application5 P, J9 l, W9 ?9 o: a% P- Y1 Q
  6. */ L+ n3 J( b% P, a
  7. *   This file contains EDMA3 Test code.
    7 k; I  D# m' e; j
  8. *
    + M3 E: B: R" G( ~% _4 l% |
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 `0 h6 D$ ^5 Q4 I
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' S& E. Y& w# ?$ U
  11. *         TO CHANGE." t9 `+ A4 ~9 U0 H
  12. *
    : S; u. D( I0 y; Z! F: v6 C( Z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % ^- r* ~. Q5 o: Z/ b- Z
  14. *
    + j; @5 i) d$ Y7 b4 G
  15. * This program is free software; you can redistribute it and/or
    , h. n! b. Y; n: h5 \
  16. * modify it under the terms of the GNU General Public License as
    1 z+ z; Q- V/ e, W, }: U/ [
  17. * published by the Free Software Foundation version 2.7 {' k2 \2 d# a! p
  18. *
    % ]" D1 ~% S1 r$ R0 p
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    : t% n. O0 i, U/ p$ @" J4 u
  20. * kind, whether express or implied; without even the implied warranty0 c8 F8 C% i  x  f7 `
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 B4 T# I8 f! f. H, M+ \
  22. * GNU General Public License for more details.
    ) Q1 J+ o7 H$ N& A" \
  23. */2 k! I5 I, R, `- y( }1 k

  24. . ^" u: p6 d$ A( `7 m) S
  25. #include <linux/module.h>4 h5 ~9 o+ u" k7 ?# z6 w
  26. #include <linux/init.h>. M4 j  u/ R( A: _. L
  27. #include <linux/errno.h>
      ^1 P; H# h0 H% M
  28. #include <linux/types.h>9 I% C6 A7 l1 h6 t* o; _
  29. #include <linux/interrupt.h>
    & E* K: r. l1 T  X5 @# I8 G
  30. #include <asm/io.h>
    # R  k! h/ v3 Q5 ?& K) P
  31. #include <linux/moduleparam.h>7 d$ F  e: K. N5 E3 P( ?
  32. #include <linux/sysctl.h>
    7 D3 T1 `, B% S
  33. #include <linux/mm.h>; m: A5 `" E" ~$ E7 |
  34. #include <linux/dma-mapping.h>7 A' ^: q  `" T$ c% V! R
  35. 7 W2 q. g. n6 S- r* a: w6 E
  36. #include <mach/memory.h>
    ( B& ?6 {- b# s: f/ l$ y
  37. #include <mach/hardware.h>
    # w3 e9 a8 x% c6 m
  38. #include <mach/irqs.h>/ n0 G8 X( i0 j2 a1 V. ^$ V1 O5 i. Z
  39. #include <asm/hardware/edma.h>% g; G: v/ \; m# A; W9 d) s
  40. ! ^3 n  o! d& Y% Y
  41. #undef EDMA3_DEBUG
    ; m1 K* X* |/ a9 v! R7 H0 O  j
  42. /*#define EDMA3_DEBUG*/
    5 L3 w6 z8 G6 Z, X8 P7 i& y

  43. # n8 N$ W, E) W& Y9 X3 ]& w
  44. #ifdef EDMA3_DEBUG
    ( Y. V* G7 P4 C5 L2 J9 c% J
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# |0 o5 {2 t* y# h7 M
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" \2 g. B3 A+ E- P4 H$ q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    : Z: H7 p* j0 b5 t
  48. #else
    8 d* V) r" E9 H; _+ _4 n. t  ^7 `
  49. #define DMA_PRINTK( x... )* K3 a, Y) Z6 T+ z# c: H7 c
  50. #define DMA_FN_IN( ~/ m- G( \6 b3 N- W
  51. #define DMA_FN_OUT
    % C2 g- v" R7 O! |6 {
  52. #endif% @3 T' a/ c! h' i, U1 \  y

  53. ( M# B) X7 s5 z- Y& s0 k" @9 Z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 A" \+ T  N! B, f5 U
  55. #define STATIC_SHIFT                3
    1 ~" Q% @  F" p3 @; r6 o
  56. #define TCINTEN_SHIFT               20+ N  \. P- c  S1 Y3 h6 u
  57. #define ITCINTEN_SHIFT              21/ M' ?- B% _. H# B  T- v
  58. #define TCCHEN_SHIFT                22
    8 m+ T# h* h+ D+ s
  59. #define ITCCHEN_SHIFT               234 p" S8 A! o& r4 @

  60.   c; D5 P$ G: O! M5 c
  61. static volatile int irqraised1 = 0;; K% n( T, q+ N+ S6 k
  62. static volatile int irqraised2 = 0;
      C, `9 X7 p: P# c" T9 _# m5 o  |" T1 |

  63. 4 A# Y) y, d* H
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # H' [2 z3 A4 j8 U2 [/ o8 H, `! m
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! e# V) ~+ Z) u
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 Q) [) J6 c! O2 ^5 b# ]
  67. 4 f  j/ @- W  x
  68. dma_addr_t dmaphyssrc1 = 0;" V1 g+ K( a8 b" H( y
  69. dma_addr_t dmaphyssrc2 = 0;: O7 s/ v6 ^( Z% r; X1 m
  70. dma_addr_t dmaphysdest1 = 0;+ Q7 S; B& M' X( M& z- o& c
  71. dma_addr_t dmaphysdest2 = 0;
    2 ~# y8 C/ {" g' O* Q2 i( Y: k2 L

  72. 4 o1 C8 z- b! `: t  Z
  73. char *dmabufsrc1 = NULL;9 ?. u; t2 v* v& T0 L. T: j
  74. char *dmabufsrc2 = NULL;
    # R: v; a, L- M$ a2 @1 I% N! U
  75. char *dmabufdest1 = NULL;
    & r8 ?0 k) R! S( V4 y3 c8 I* j; `3 z- @3 h
  76. char *dmabufdest2 = NULL;
      C  y( ]' P. |# s
  77. 2 E; Y- U6 i2 ?% \1 ^7 Y
  78. static int acnt = 512;6 {& ^  o  K( o2 p6 X  z
  79. static int bcnt = 8;
    6 O+ R9 Z3 @6 c" }' i
  80. static int ccnt = 8;
    9 E" M# p, P- ^0 o2 P) [% a9 [

  81. 7 m4 y7 {0 }1 d: n1 o  h
  82. module_param(acnt, int, S_IRUGO);
    , b3 j# Q* F- `& V- Q" e
  83. module_param(bcnt, int, S_IRUGO);
    ) V% @7 G2 z7 d4 ?1 e0 O0 M) j
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( h4 A3 `8 S5 C; {9 s. G2 z7 h/ M% L
% u% O4 y0 [( V$ o6 ~8 W: A      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! Q+ l! E3 V. U6 ~
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 Z, c. n& C) x2 k* {5 ~
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 w+ z& r, H8 @# k* K8 K' ?6 I! H
( v: _; e5 f1 D6 u# A! g
/ {/ _+ G4 P2 s7 l
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-29 00:56 , Processed in 0.041375 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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