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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 v! _. o4 l6 q2 C2 h: `
  1. [code]EDMA sample test application; @& R) w: _* M0 l4 s! y4 ^
  2. /*! b) z" v- }0 K/ `7 @/ G
  3. * edma_test.c' f' g7 T: H5 N4 K- e: a+ _
  4. *
    0 O, {( n4 r2 P/ O  m
  5. * brief  EDMA3 Test Application. ]; c2 m. X# H7 T
  6. *& v4 s8 f' Y7 w) i
  7. *   This file contains EDMA3 Test code.
    5 B& z; [4 N! H) q
  8. *( e" _1 Z/ ^) ?0 t3 s7 |
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ p' b3 d4 H& C8 Q( ^: @
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ g6 V  g6 y9 E$ j3 H
  11. *         TO CHANGE.3 I9 o. [: G3 d$ K; v$ h
  12. *8 L4 E) Q8 H8 H4 g/ h- ?
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% p) B# Z+ Y* d8 k$ T+ K5 n7 e
  14. *
    : y2 m( L3 v. g" `. k) o( G( F
  15. * This program is free software; you can redistribute it and/or  {6 t8 n$ N8 E4 Y- t+ T
  16. * modify it under the terms of the GNU General Public License as
    1 I8 b- P) ^+ L# n2 f- Y
  17. * published by the Free Software Foundation version 2.
    5 p7 q8 F( H  \$ z
  18. *" }: T5 N6 ~) T2 n
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - o/ n0 t$ y4 y7 x" K
  20. * kind, whether express or implied; without even the implied warranty
    + h, ^9 u% V: o  S* F& Y/ Z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ k. U- d: T1 \* [6 T
  22. * GNU General Public License for more details.
    $ o! |3 w0 a# Q! m
  23. */- Z* i* C3 x, B' [
  24. 8 b( C* e& s3 D, o* k
  25. #include <linux/module.h>
    # l: f7 @0 o2 b2 Q7 J
  26. #include <linux/init.h>
    * L* Y4 Q, s; D. p9 u
  27. #include <linux/errno.h>
    # m0 \! g; [8 Y( A
  28. #include <linux/types.h>
    # ]; n" a% R1 D/ X  y
  29. #include <linux/interrupt.h>
    5 b. w, ]7 o0 t/ N5 i  P
  30. #include <asm/io.h>
    + y! G& r% Z! g7 r0 u3 h
  31. #include <linux/moduleparam.h>
    ) _( t! `8 @6 W2 Y9 @0 i% M
  32. #include <linux/sysctl.h>
      s. D/ {& y2 l5 g
  33. #include <linux/mm.h>
    8 X: q+ m7 F$ c" t8 g* X; |
  34. #include <linux/dma-mapping.h>
    0 t3 N; M$ |' I' g
  35. : e) [! Z& a. u8 j/ z9 _4 B
  36. #include <mach/memory.h>7 z& b/ b% z. H3 d
  37. #include <mach/hardware.h>* W3 y% W5 W4 V6 x
  38. #include <mach/irqs.h>: P8 P7 I0 u) c0 O; h7 g, B
  39. #include <asm/hardware/edma.h>
    ( Z: Z# I" ^3 F2 y
  40. 7 Q4 Y* B+ U1 |3 s
  41. #undef EDMA3_DEBUG
    ) M! Q# ]2 q6 J9 I* C$ w
  42. /*#define EDMA3_DEBUG*/
    4 w& W6 _8 p; z. ]6 c2 Q& m/ I( \

  43. 4 u8 q! x: w7 r, ^5 g
  44. #ifdef EDMA3_DEBUG
    , J9 u% u' Q3 k  L: Y1 j  Z3 f- R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 c* O# ]8 q8 ^" Y( M: f2 h+ ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): L  g: ?6 A) G! _- x0 `
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). P; T0 r7 ]% I# k# E1 |
  48. #else
    7 V* A! m$ B, R1 e  [# K
  49. #define DMA_PRINTK( x... )( [$ z& p: k& X& q
  50. #define DMA_FN_IN
    ) ~( {; f' v4 t( N. o1 {  Z
  51. #define DMA_FN_OUT( k& o2 w7 q+ w# E9 x/ h9 z/ B! J4 P- r0 r
  52. #endif
    7 ?, x/ V) P7 X( k

  53. " @9 O# U( s3 Z$ K1 a, n& E
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)6 m6 e' U* x) ?  k4 k! V
  55. #define STATIC_SHIFT                3
    ; x  b# G& r5 L& ^2 o) U5 v5 N
  56. #define TCINTEN_SHIFT               20
    1 o9 \9 L' W  U$ W- t- @
  57. #define ITCINTEN_SHIFT              21
    ( }% @* N" J  y) G& H
  58. #define TCCHEN_SHIFT                22
    # V! O; _, g+ r7 P" S
  59. #define ITCCHEN_SHIFT               23
    7 i9 e+ c9 i0 C, p

  60. : i- F" i8 s5 B
  61. static volatile int irqraised1 = 0;
    # `; R# B% Z: n0 j" X+ N& Q0 |
  62. static volatile int irqraised2 = 0;8 p+ H4 G, m/ Y: ?0 J% @5 ]

  63. . b& c0 z5 ?" S/ h
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 r; p# a' C& |2 ]! Q  z' R
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      }* Q% _) A0 r& a. z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ L$ L. E* \7 F; B9 G

  67. : m: ]3 h$ ], |' N5 N; V. m( h; ?
  68. dma_addr_t dmaphyssrc1 = 0;
    1 y8 X6 H1 Z; j/ M  q7 u# N& M# a9 Q
  69. dma_addr_t dmaphyssrc2 = 0;
    4 ^7 X# K. m1 m) q4 w2 i
  70. dma_addr_t dmaphysdest1 = 0;
    . t% P4 {! \3 V7 m
  71. dma_addr_t dmaphysdest2 = 0;
    + m3 q2 ?3 ?& G# y7 S$ Z; J$ l, @
  72. 1 X" C) z. }% T  t# |6 P
  73. char *dmabufsrc1 = NULL;  d) O! M6 q0 ~1 W
  74. char *dmabufsrc2 = NULL;& q, P) P7 P4 n; i2 H
  75. char *dmabufdest1 = NULL;
    - z' [6 B. t! R1 m. g1 \
  76. char *dmabufdest2 = NULL;: i4 a: [( Y5 c/ T4 s9 ]5 _9 m8 l

  77. ' V3 ?+ y# Q$ ^7 \2 I% {
  78. static int acnt = 512;& e. y9 p! X2 X) {6 J! L, k" Z
  79. static int bcnt = 8;
    0 `# o/ a* L$ X: a/ I  R
  80. static int ccnt = 8;
    0 @8 B, d* M( U2 r( c& l
  81. + ^8 F2 c7 w8 C, i3 O; [8 |
  82. module_param(acnt, int, S_IRUGO);
    1 h3 s' J9 w! d/ P7 G. s
  83. module_param(bcnt, int, S_IRUGO);/ |+ k+ K- ~7 H9 \
  84. module_param(ccnt, int, S_IRUGO);
复制代码

2 H) W% @; Z# E8 U3 n1 k4 m: _/ M! H! U
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 t; c0 t  q# H0 E' q9 T
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 N* O# }0 P( p3 G
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; t8 e  G, J5 h- K! c
" S; X( ^* B% n0 R
9 r; E$ F+ l! m: F$ a# q1 w# E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-23 06:23 , Processed in 0.040624 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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