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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : j/ i- p) I* b2 w( r' r2 K, M, u
  1. [code]EDMA sample test application( e1 t# B& {  M6 U: [8 J
  2. /*
    # n# N3 \1 Q" P" B. F! l
  3. * edma_test.c) ^3 n! _6 s5 P% d% E, S& f# G8 q4 h
  4. *8 ^) \# T: x8 j
  5. * brief  EDMA3 Test Application
    7 E8 C8 {7 E/ |$ ]( U0 {7 U0 ~
  6. *% w' U3 \: k! t* c% P
  7. *   This file contains EDMA3 Test code.( z( X5 d- e" G! T" F! e( H5 r! a" H
  8. *
    " h- B9 S7 u" `- _0 v' K: [- C& e9 A; b
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 I8 \/ u7 c) Z1 ~* O
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
      o+ q  D' P5 x  g# V' ~6 S
  11. *         TO CHANGE.
    9 }' J3 G+ O9 r) i' y/ r% _
  12. *$ D" f, o4 G* t; X
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " Q4 R4 f, x- A
  14. *
    2 u; n  h- S* @5 F9 i8 u
  15. * This program is free software; you can redistribute it and/or$ i. }4 J9 o9 i) i( H. o- b
  16. * modify it under the terms of the GNU General Public License as5 ?: C$ n& l$ I
  17. * published by the Free Software Foundation version 2.
      c0 R0 _0 M' a# M0 H5 k
  18. *
    ' H9 f( a0 o! @) I- `9 I& m
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ) M5 P6 u1 q" E# u
  20. * kind, whether express or implied; without even the implied warranty
    ) `+ F- N- i& e9 f/ c" Q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    , S. ?4 r- Z! J' l2 J5 Z
  22. * GNU General Public License for more details.
    ; ]8 B/ u$ P" A. V7 n
  23. */
    0 H8 i4 Y( ~3 i/ e! D" Y& E
  24. $ e; S6 T6 W' Y1 i/ p
  25. #include <linux/module.h>/ Q# Z3 ^, v1 z6 ~7 V5 P4 g
  26. #include <linux/init.h>
    - e* {( |) f% j- j3 Y8 g) k* T
  27. #include <linux/errno.h>
    ( d" R& K7 X0 O( Z, W
  28. #include <linux/types.h>* y) f; {2 q! q6 v3 n
  29. #include <linux/interrupt.h>
    ! C9 ^9 k5 _4 j$ n1 b) M0 W0 m0 O
  30. #include <asm/io.h>/ o$ E: R" k! N0 H
  31. #include <linux/moduleparam.h>; |' ]2 L* h% L% p; [. V' q! o5 T& ^
  32. #include <linux/sysctl.h>( w( A- A3 |: K1 Y  \* [/ @
  33. #include <linux/mm.h>* m& k  E( v1 [. {
  34. #include <linux/dma-mapping.h>7 q0 d4 W* S6 R9 P- Z' {0 H3 E+ \
  35. ) ]. K1 i% [) M
  36. #include <mach/memory.h>- C% F( @: c% v; f; K1 M
  37. #include <mach/hardware.h>
    2 G! Y' \7 K! H" r5 l! ?
  38. #include <mach/irqs.h>
    " `5 z+ ?5 `/ u3 r, h
  39. #include <asm/hardware/edma.h>* ~3 L; o  a6 N$ L/ x) A/ X+ g

  40. / l: t0 @) u4 h8 J, Q3 y4 g8 k
  41. #undef EDMA3_DEBUG
    * d; m, f6 |) z7 [* K9 l  `9 }
  42. /*#define EDMA3_DEBUG*/! ?1 y+ {# d- L

  43. ; x" X. F% s. K9 B" J
  44. #ifdef EDMA3_DEBUG' i8 D/ y+ k* ~0 |
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 a! A( x( R8 M/ `/ l
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    / r* S. q) e9 m  [
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 k3 M# W+ H& w" J( e$ M. P. s
  48. #else' x- [- n; ]1 p) y7 A
  49. #define DMA_PRINTK( x... )1 ^; |+ q9 T$ S  M9 m
  50. #define DMA_FN_IN7 f5 ^& `, s9 x" R2 `" h/ ~8 H
  51. #define DMA_FN_OUT' x: F4 N- }, I8 z  ~# ^+ Y
  52. #endif
    9 s8 x; ^4 t+ z$ F
  53. 4 l! S  V7 ]' H
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)' H1 l: `7 A) N9 Q3 V7 B
  55. #define STATIC_SHIFT                3
    . e! E* f2 b0 \1 r) }/ K2 T) A
  56. #define TCINTEN_SHIFT               20
    + a$ l* @5 e3 b: `, \( H9 x5 Y+ ~
  57. #define ITCINTEN_SHIFT              21
    # A' Q+ D5 C5 _6 @
  58. #define TCCHEN_SHIFT                22( X7 \! u' Y$ h/ T$ |
  59. #define ITCCHEN_SHIFT               23
    , \+ ]0 M! B- y

  60. 9 {- O% C' a5 R  M
  61. static volatile int irqraised1 = 0;/ @" ^3 x: s8 R7 |% R, u. p+ R
  62. static volatile int irqraised2 = 0;; q9 s* K- r  n+ Y
  63. 9 D, s2 n2 M7 M8 K% U% V
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 n5 M) \6 M8 E9 s' O" I; |' Q4 h
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 g0 Y+ ~. T3 n' Q  _* b' e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! |' t7 y" N) h' s* `
  67. 9 ^, y% h$ A- @9 \  N, g
  68. dma_addr_t dmaphyssrc1 = 0;- V% q2 w6 M+ K7 w
  69. dma_addr_t dmaphyssrc2 = 0;
    0 P5 e# k1 q  r( S/ @
  70. dma_addr_t dmaphysdest1 = 0;
    1 v1 |9 L/ K# c- z# q
  71. dma_addr_t dmaphysdest2 = 0;  Y" r4 l. |) m+ }5 u8 s" Y9 l

  72. 2 i1 J, H8 D( j* _/ s% W! o. m0 U
  73. char *dmabufsrc1 = NULL;5 U4 w  p/ p# J6 X
  74. char *dmabufsrc2 = NULL;, z1 E6 o- z: K% L3 O6 B
  75. char *dmabufdest1 = NULL;
    6 i5 F! a8 r& A6 i
  76. char *dmabufdest2 = NULL;0 d6 o. D& W: Y
  77. 3 v8 S; Z$ u3 p" f8 G' F
  78. static int acnt = 512;
    9 s) F% j# s( ~) d
  79. static int bcnt = 8;9 q: E- f. }$ |( ^
  80. static int ccnt = 8;" z4 m* t/ T  V4 S
  81. 8 I' O5 }- g# E5 _
  82. module_param(acnt, int, S_IRUGO);
    # E( K+ g9 s3 y/ t8 O' r+ e; W0 s
  83. module_param(bcnt, int, S_IRUGO);+ C1 d3 I3 ]) X
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% _! D% T# T5 @, V
5 l& C5 m0 X9 p/ V$ q  \9 d      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 i$ l3 P! y2 m5 H. H$ T( v
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& W+ G7 S& ?. R; G0 H
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 g& ^/ t: V9 {0 M) g, B9 ?+ ]6 V& T( }' V3 p
- A" |' Q& |( N8 ]# y% p* ~
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-12 10:12 , Processed in 0.043048 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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