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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 c9 f1 d9 |; v
  1. [code]EDMA sample test application( O9 n# Y5 Y/ E8 z3 n$ I
  2. /*
      B& C1 ]. K% @. e5 l+ c
  3. * edma_test.c
    4 i; r# ^% o6 Y$ n
  4. *
    . `% O" u/ K( j& g
  5. * brief  EDMA3 Test Application
    * h9 n% P& u& I
  6. *
    ! U3 R# Q; F2 G# j3 F5 }- j, Q3 a
  7. *   This file contains EDMA3 Test code.
    - Y. i: q: j  Z
  8. *
    8 \9 O- p( I3 [
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    & P6 `' v8 ^. @
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , J8 |+ K+ E, H
  11. *         TO CHANGE.
    3 Y' S. ?' G, [) n, g, ^9 W' ?
  12. *$ _7 T# F6 ]) I4 U3 U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % w; }$ T6 P( z+ c) H, ~' a& z5 v
  14. *
    " z, u) z! L" _* @  t( }
  15. * This program is free software; you can redistribute it and/or
    1 N: ]" ^% K0 C% Y: T3 M2 q* q
  16. * modify it under the terms of the GNU General Public License as* e; ]% F! q$ I- X+ n
  17. * published by the Free Software Foundation version 2.! F( X1 |/ f/ @1 Y# q
  18. *
    3 ^& z& ~& o% K2 a% ]/ [! N& ~
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ @" z- ^2 R5 s) |: B  h# ^/ z
  20. * kind, whether express or implied; without even the implied warranty
    ' ^& D( Z# v+ F1 y" V! o
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! Z3 S& b$ R0 |2 A6 B
  22. * GNU General Public License for more details.0 I6 }% n& V: Q) O9 B* x% a
  23. */
    9 R9 c6 m. w* m4 U2 d2 v3 i1 b
  24. ; e6 g- }# r0 |  B7 s. e( i* i% @
  25. #include <linux/module.h>
    6 f5 p$ t( C$ ]" A, n! o
  26. #include <linux/init.h>
    ) D, d8 E8 A9 q2 J; t" a
  27. #include <linux/errno.h>
    ; L! |0 x4 R# X- d9 e+ K. @4 Y
  28. #include <linux/types.h>6 ^# b- r& O  L
  29. #include <linux/interrupt.h>/ ^9 M) Z7 f) {( c- c( u
  30. #include <asm/io.h>
    . _9 V  P' p$ I" }% N- Q
  31. #include <linux/moduleparam.h>- {8 [# X" J  [$ P
  32. #include <linux/sysctl.h>
    " g1 Q$ Q% F/ m: _0 @/ a1 n: X
  33. #include <linux/mm.h>8 n1 k( ?0 y6 |- w" ]- h! l4 X
  34. #include <linux/dma-mapping.h>& W9 T6 ~) E$ X) Q5 `
  35. ( y# X  V- I1 p4 M9 ]
  36. #include <mach/memory.h>7 Y% {7 p. [4 Z& \
  37. #include <mach/hardware.h>
    ! X" K* J# e8 f2 n
  38. #include <mach/irqs.h>/ S5 F) _; ~: z) \( \* F. Q
  39. #include <asm/hardware/edma.h>
    ' I. [' G) ]* }
  40. ) n! u1 U6 q/ w
  41. #undef EDMA3_DEBUG+ U( b& F0 x/ s+ Z
  42. /*#define EDMA3_DEBUG*/, D0 k! o8 r$ J& }: Z
  43. 3 `$ R, U, [8 ^) ~5 \
  44. #ifdef EDMA3_DEBUG8 T; ]) z/ `& U/ z/ d
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' c  y  W( U4 X4 M
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' a9 Y7 D8 w# J( i+ J8 `' s
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 o6 y# Y8 k/ W3 {2 _0 ~! n; i
  48. #else
    6 ~3 |* K$ e, ]0 I
  49. #define DMA_PRINTK( x... )" L/ d" V# H( |) B
  50. #define DMA_FN_IN
      u9 a4 o! F0 }6 U& g, r* W4 {7 V
  51. #define DMA_FN_OUT
    ' y6 C+ ^% e2 j- g" H5 q, a
  52. #endif- R2 M3 F: g! M4 K; K$ y
  53. $ V" v4 I% j# V
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 q! s, t: A" W! l. W" W6 V
  55. #define STATIC_SHIFT                3
    6 }: ^1 g8 J, ]& p. N
  56. #define TCINTEN_SHIFT               20
    % U; |0 n  O4 O2 Z" y! u
  57. #define ITCINTEN_SHIFT              21
    8 [; [/ f3 E4 S7 n' A- [, j$ ?
  58. #define TCCHEN_SHIFT                22
    4 [1 U, M! Q% {
  59. #define ITCCHEN_SHIFT               23
    2 r% e, N6 J5 O: X- ~+ G
  60.   g5 F. H6 M/ i# W) t
  61. static volatile int irqraised1 = 0;1 ~! y0 t( y' K% a# `
  62. static volatile int irqraised2 = 0;- O/ M& s" L4 U$ W
  63. , M; |8 t/ G% l! O/ R) Z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& w1 d% t  H( }6 Q+ U! V" G
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. v: o9 q; c0 f& h
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 D. ^8 \) c7 f, [% E

  67. . G$ m6 v! N# X
  68. dma_addr_t dmaphyssrc1 = 0;* p  d4 y: P2 t/ N3 o; v& k
  69. dma_addr_t dmaphyssrc2 = 0;/ O: o& t' }5 D& Y& I
  70. dma_addr_t dmaphysdest1 = 0;
    ; \3 _2 }( ~2 G, S; g; ~
  71. dma_addr_t dmaphysdest2 = 0;
    0 U) z1 w  P/ `# e- C* {5 y8 ?
  72. - Z# B8 O1 s% M
  73. char *dmabufsrc1 = NULL;% p3 k5 i- A/ ]- V3 Y" ^5 ]/ ?
  74. char *dmabufsrc2 = NULL;0 H6 I- [% x* r5 [0 Y
  75. char *dmabufdest1 = NULL;! Z, D* `- k! f5 W. i7 [
  76. char *dmabufdest2 = NULL;
      O6 p' W% M0 X; @  R( F9 D5 W2 ^8 x

  77. 8 a* B( @0 e/ @3 u
  78. static int acnt = 512;- E2 H, o$ a- r2 |5 q1 M
  79. static int bcnt = 8;
      @( v$ ~' Y: k7 k/ v- r. u' u
  80. static int ccnt = 8;& u$ P9 s% w; o/ l% ^  @* J+ T

  81. " w% M: M, M0 L2 s7 O
  82. module_param(acnt, int, S_IRUGO);
    6 P# I1 P* a5 n$ {# Y
  83. module_param(bcnt, int, S_IRUGO);
    2 L3 H: A, H1 a* O: H0 g' t
  84. module_param(ccnt, int, S_IRUGO);
复制代码
* K" V+ b+ X: Z/ X9 R" j- _; o

( \. j- E9 r( w. M" |1 \5 n' n      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 h) t4 d7 D: Tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& D" E1 M3 y4 Q2 C' d     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 t9 ^) q& N( t4 L6 ~/ g0 t+ C& B

) l4 i* x$ m/ R6 e, c0 \/ m! t4 U: \% Y9 K
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-15 04:02 , Processed in 0.037300 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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