OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ R4 D! m/ h; c3 t% k0 [$ [# ]
  1. [code]EDMA sample test application
    $ ~% q( p3 g( Z+ m  C/ X6 k, u
  2. /*
    . K# X5 ^# z% Y; g$ C4 ]
  3. * edma_test.c# E% }1 W1 w" ^* O! v% X
  4. *
    " Y# k0 ?1 l7 P4 _( K( i
  5. * brief  EDMA3 Test Application( v5 Q5 F0 A0 ]  l4 u7 Q
  6. *2 t- y7 x1 ?0 M* d
  7. *   This file contains EDMA3 Test code.$ a8 f9 Z# Y5 ^' E1 Q
  8. *2 N; t2 {: P* ]: ~2 r; a
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ m, w  {3 j& V9 ]" s4 I
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    2 z" R0 L$ `, w2 E
  11. *         TO CHANGE.! [% b- S2 u% k0 A! k. S9 E2 w
  12. *  W# e: L5 ?# ^' x4 N$ L' L
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    2 H3 X( h3 k3 ]
  14. *6 i5 M5 r5 e& ^, H+ u& n
  15. * This program is free software; you can redistribute it and/or
    7 ?) R; i0 x, `" N! y
  16. * modify it under the terms of the GNU General Public License as. @8 p$ r( V9 X* }
  17. * published by the Free Software Foundation version 2.* T: S0 H/ f2 |0 ]) A4 e" k
  18. *
    7 \  f1 ^) Z2 c+ }2 u+ C8 k
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    * }+ y+ A  `, X; l( D2 ]
  20. * kind, whether express or implied; without even the implied warranty$ {6 H; u. e' S5 r5 X
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the7 I* ]1 s- j/ H7 y
  22. * GNU General Public License for more details.
    7 d: b- v- K0 N0 M. L
  23. */
    + [  m# P7 i4 ~! z& X. v+ Y% e; R
  24. % g: l1 ^: Z! m+ }$ A5 S
  25. #include <linux/module.h>
    . T8 h1 U0 Q# n& \' J
  26. #include <linux/init.h>
    3 A4 A9 G4 Y. X( I2 g& j
  27. #include <linux/errno.h>! X& r8 @$ z2 ^3 h! h
  28. #include <linux/types.h>; s; r6 x8 c, ^& M
  29. #include <linux/interrupt.h>
    ) U7 |! w  P( A; `8 A6 X- q
  30. #include <asm/io.h>
    ; Y' \* V7 ]: i0 v, D$ a% a: |
  31. #include <linux/moduleparam.h>4 D0 e" y9 C; G2 B3 ?% w
  32. #include <linux/sysctl.h>4 u4 u# @% T& N
  33. #include <linux/mm.h>
    - R2 R' e% ^4 Z
  34. #include <linux/dma-mapping.h>
    + I1 C# f  k, p6 q) t7 @) d

  35. 5 e7 t& N5 s6 B' p% C7 o  S
  36. #include <mach/memory.h>
    ' p! |& l, Y2 ^
  37. #include <mach/hardware.h>
    " c+ f* G1 R8 G% J0 Z4 N6 C! @% I
  38. #include <mach/irqs.h>6 i2 I% v; ?7 R  v1 x
  39. #include <asm/hardware/edma.h>) b$ X1 W; m& n5 b) m8 y$ H+ i
  40. % c+ H4 K3 z% R+ h; N9 R
  41. #undef EDMA3_DEBUG% B2 r  g, n5 m! ~8 U$ A
  42. /*#define EDMA3_DEBUG*/" f2 @3 F1 w% Z+ o' g8 E/ |
  43. ) ?& z2 E" h+ n" q) a+ p# P
  44. #ifdef EDMA3_DEBUG
    - p4 h# q7 i4 f+ B' A5 a
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 [- S5 i" o$ n  g8 I5 `- q, q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    + ^, U1 w$ l$ }$ ?- [6 _7 o1 q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    2 u7 l/ r, K: S2 y; W
  48. #else" h& ^" j! A9 ]: f' F
  49. #define DMA_PRINTK( x... )
    - ?4 y# m7 y0 ?+ X2 F1 q
  50. #define DMA_FN_IN
    7 T; ?. H( d# ^7 c# S9 B' k! X
  51. #define DMA_FN_OUT
    . k! u2 L/ p0 d' u+ _
  52. #endif
    + z" A. X: H5 b( ~
  53. & n$ E" O4 l4 {
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 Z& S) a5 g! U$ S- a
  55. #define STATIC_SHIFT                3# V$ X/ Y6 D. t; M* x; U
  56. #define TCINTEN_SHIFT               20
    . w$ Q+ Q$ O; V- }# d/ e
  57. #define ITCINTEN_SHIFT              215 m! g+ a+ o7 t
  58. #define TCCHEN_SHIFT                22
    $ t2 h5 m8 S8 k5 c& j
  59. #define ITCCHEN_SHIFT               23/ C+ ?7 q+ q1 V* V. y

  60. : \- x- y0 ~2 f2 ]8 I
  61. static volatile int irqraised1 = 0;
    ( M' v  D! l& D, j
  62. static volatile int irqraised2 = 0;
    7 m% C; ?6 H# |# i. W& N. w! A
  63. 4 j1 l3 ?2 o% ?7 F+ C
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 ]; L/ Q- U5 u+ {6 `
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. b4 [+ P& v6 t4 R
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" Y7 H: O+ d4 T1 g8 K# ~9 j

  67. 0 S2 x2 x. L5 ?6 `% v, j
  68. dma_addr_t dmaphyssrc1 = 0;
    . z, E3 \5 Y, u' [
  69. dma_addr_t dmaphyssrc2 = 0;
    $ w  H/ R" |- W% J: [/ v
  70. dma_addr_t dmaphysdest1 = 0;7 [1 S/ M3 A) Q1 W
  71. dma_addr_t dmaphysdest2 = 0;
    " H; p2 _( `3 l3 H) A1 |4 L3 u
  72. / w6 D4 I7 S0 M) F
  73. char *dmabufsrc1 = NULL;
    % ^% {: _' Z" ?. h0 \. A5 m0 O
  74. char *dmabufsrc2 = NULL;3 [: S7 H" Q5 ?* Z* t
  75. char *dmabufdest1 = NULL;
    # E  t9 I' i" X0 c6 a
  76. char *dmabufdest2 = NULL;1 D$ o$ Q7 b- ^; t" c
  77. " U! J% p0 R; P4 f: g
  78. static int acnt = 512;; q* {% K# F9 K& c0 E
  79. static int bcnt = 8;3 u" Y3 e; v8 v. O! ]; s
  80. static int ccnt = 8;. e; g. i: @* _
  81. % c7 z. t; W; Y9 x
  82. module_param(acnt, int, S_IRUGO);% [  O. D' m1 J+ c$ x  c+ Z
  83. module_param(bcnt, int, S_IRUGO);2 H6 E- z' b" y9 K
  84. module_param(ccnt, int, S_IRUGO);
复制代码
) z7 T; B8 K* y, [5 W, V

4 J, R9 U  r+ W: F9 f6 \4 e$ L      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 q) E7 w5 i4 Qarm-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 p7 }! X+ q! v0 o3 C7 G
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. g  K  {6 C' d9 l- i

& P- H8 N5 n0 Y* ]0 {$ S; @$ G$ G' \* K4 e  m. _1 V
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-21 13:55 , Processed in 0.038297 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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