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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 j0 g4 U% N' R
  1. [code]EDMA sample test application5 l% d  B! T. V+ @# L' J
  2. /*/ Q2 r8 B2 L% o: K0 _6 ]
  3. * edma_test.c
    5 a; d  |7 m/ ]
  4. *
    2 j* a  K2 `# O# s
  5. * brief  EDMA3 Test Application6 Y' x0 ^: w4 g, [/ d! S9 i: f
  6. *
    2 k( R5 X; ?6 M* u/ M  ~% `
  7. *   This file contains EDMA3 Test code.( x& E' J, {; G! c# ?  h
  8. *0 W+ b) H% ^6 j7 V- J( e
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ) ]7 W3 E( t- C1 F8 Y- t( f  V
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 g# S/ b1 b* z& y- y5 C
  11. *         TO CHANGE.$ w& j! j& Z" l, A9 u% O+ r
  12. *' S# c3 I8 i4 s- _4 i; K8 S6 O5 W
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    # }7 |2 v& q, L% C- n
  14. *
    4 A4 c  Z5 r/ d0 _6 I- s; H
  15. * This program is free software; you can redistribute it and/or2 K3 }0 c& C( Y
  16. * modify it under the terms of the GNU General Public License as, g) A" ^+ \4 ]+ l/ x: O0 U( c# C0 E
  17. * published by the Free Software Foundation version 2.1 B$ U. t" _/ C
  18. ** p6 N! m# ~3 v/ _
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    5 S# U2 |# e/ k6 {. _% M$ z
  20. * kind, whether express or implied; without even the implied warranty/ ~, d7 ]2 ~5 E# m$ K
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  V0 U, N1 U$ L
  22. * GNU General Public License for more details./ D9 L" J8 ]! z: z5 c
  23. */
    7 c2 X& ?' {0 p+ v1 _- P

  24. 8 n% W2 m' a( X" c4 l! z
  25. #include <linux/module.h>
    & D% V( a2 l. X
  26. #include <linux/init.h>4 z* g; j$ w# x9 ]
  27. #include <linux/errno.h>+ l- b+ }! T7 F' m8 E. U% F
  28. #include <linux/types.h>
    # ]8 @& C6 p+ \9 ~4 ^) m
  29. #include <linux/interrupt.h>) K2 G/ O" K; P- ^/ z
  30. #include <asm/io.h>7 X5 V0 D9 g4 R" G8 W3 ?1 s8 h
  31. #include <linux/moduleparam.h>
    9 j* b  }3 T2 P; w5 l- g" S+ \
  32. #include <linux/sysctl.h>- N: _4 F- @6 t  O0 z
  33. #include <linux/mm.h>5 |) [+ J3 R* d$ W
  34. #include <linux/dma-mapping.h>
    0 g5 K- r/ g1 H/ v
  35. / g: M$ e' G3 k4 C& y# U; I9 g2 P
  36. #include <mach/memory.h>
    % }) z) ~$ J9 q) B+ w
  37. #include <mach/hardware.h>! G/ I5 H  [- y! ?* ^
  38. #include <mach/irqs.h>
    5 N* \+ q) H  o3 q4 Q/ ?
  39. #include <asm/hardware/edma.h>
    & ~  y' b. v/ B+ Q2 |0 n4 g

  40. 4 }8 Z: E0 `3 B$ ^  z
  41. #undef EDMA3_DEBUG1 D5 M  m$ O1 ]% r
  42. /*#define EDMA3_DEBUG*/+ p) Z. d) D) ]+ s- r+ p5 g) m
  43. 6 L* z: W7 p5 |! m  D  z
  44. #ifdef EDMA3_DEBUG0 h; Y+ F/ }  X5 x6 \
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ l& Z6 a/ a5 g8 L+ n& o% V
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): ^7 p% S8 r. O8 Z, {
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 p" e3 n9 q9 D
  48. #else
    2 S7 I: V; w1 ~! o3 p6 N
  49. #define DMA_PRINTK( x... ), ~2 A: w- r% g, r! X. F) Z) ]
  50. #define DMA_FN_IN) o6 k7 g- x" V! `
  51. #define DMA_FN_OUT
    7 O: s9 _+ p' ?* A
  52. #endif& U- m6 c7 x' t' d' h

  53. - ~" Y1 Y/ H: @
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( `' T  `5 R+ p5 z& ^: G
  55. #define STATIC_SHIFT                3
    ' y8 _8 q5 h1 S2 J8 D0 S
  56. #define TCINTEN_SHIFT               20
    . z4 y8 r( W2 G9 m+ I6 |, L: u% ]
  57. #define ITCINTEN_SHIFT              21
    # r- V  R" u9 h+ I6 [0 k
  58. #define TCCHEN_SHIFT                22! q4 m% T& u5 i
  59. #define ITCCHEN_SHIFT               23
    5 e( U5 m* E, k) c* o# H  W

  60. 3 g; k# j$ L5 [; c9 [/ h, J* D% J
  61. static volatile int irqraised1 = 0;# k! J3 f+ K4 S% z
  62. static volatile int irqraised2 = 0;
    % ?; |5 f8 b  e3 \0 L5 x
  63. 8 J; Y6 V# y$ B3 |6 ?: T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 Z/ l; S) P0 g+ q, G! n
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) a9 s# E" _2 M. @3 }
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; c, ^5 T$ }' m1 W: _: u; q* G/ V

  67. ( l) H2 N2 |1 d$ U
  68. dma_addr_t dmaphyssrc1 = 0;
      R2 d. Y0 D) h: z; W6 X2 e7 |: y
  69. dma_addr_t dmaphyssrc2 = 0;
    4 o8 l$ B# W) S, u6 w; j* \
  70. dma_addr_t dmaphysdest1 = 0;
    ( z8 X4 {3 k( _
  71. dma_addr_t dmaphysdest2 = 0;5 u- R0 f8 ~2 b" t

  72. 4 c8 n1 y' F$ [& J
  73. char *dmabufsrc1 = NULL;
      B6 [) P; T) @& [* z7 J$ x
  74. char *dmabufsrc2 = NULL;
    5 n. V# D2 m1 W0 B" ~5 ^  n* s
  75. char *dmabufdest1 = NULL;
      V0 X& y1 j5 t
  76. char *dmabufdest2 = NULL;0 _0 v" \8 E$ O7 N, ?, Y! r/ Y

  77. ' _  F, c# x8 T  s6 a, p
  78. static int acnt = 512;1 M9 I( K2 j4 n$ n
  79. static int bcnt = 8;+ }; K- f" y# {& D" o$ @! P; Y
  80. static int ccnt = 8;
    ( C: ^+ Z5 ?, B! ^: ?
  81. - D6 q( S5 H" m8 {
  82. module_param(acnt, int, S_IRUGO);  L- v4 f/ t1 Z
  83. module_param(bcnt, int, S_IRUGO);
    + Q7 M+ V# ~* g
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 |6 w' O+ `0 K( o$ r0 a- O% h
3 l4 F: j8 L  j9 ^/ Y& ]      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& v, N# c  b$ I) c5 @* farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 o" ~) D0 o6 k2 a  k
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) R0 a- x, q  W# e$ m2 m$ ?4 ]" _

  g' F- G6 W# T. h0 u0 Z- b9 k4 o  N6 h; t
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-26 21:06 , Processed in 0.038302 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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