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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; l, y4 [+ P, y, Z% @
  1. [code]EDMA sample test application' d) U0 l3 G" e7 |5 H' b9 K4 y6 O
  2. /*
    ; ~# W' L8 n0 q; d& X
  3. * edma_test.c
    ( B4 ?/ X% }2 H  n: G3 v
  4. *
    ( W9 T1 [; }# L$ p* B, m
  5. * brief  EDMA3 Test Application
    2 j7 H+ q3 I& n
  6. *8 s  i% |! G1 Y4 y$ ~3 O
  7. *   This file contains EDMA3 Test code.0 |2 R6 W$ ^; M$ {2 b
  8. *
    3 l8 u0 s3 A5 b. R4 s
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    9 w( i4 B& s: |( ?2 M* s  z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 p2 {6 O  c% s9 G, s/ R* ^* C
  11. *         TO CHANGE.
    " S$ f8 {- u. D' r
  12. *# E. C0 l4 x* ?2 M  {% A2 K! s- l
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ( J0 U) F1 ]# w% x  |: ?: _
  14. *( j2 e8 c% q+ M$ p
  15. * This program is free software; you can redistribute it and/or
    7 H, t6 v7 g7 m) B0 E
  16. * modify it under the terms of the GNU General Public License as
    : X. B) Q1 \8 K! A+ l* h
  17. * published by the Free Software Foundation version 2.: Y$ k8 u% ]* Y) H$ {! O
  18. *3 }1 l' X. f5 t8 V
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: Q% e" k0 t: b  V
  20. * kind, whether express or implied; without even the implied warranty
    1 h. ]' g9 D; t# G) V; n" Z: d; E3 d4 e
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the5 y( }7 G; j6 I& F6 F% H
  22. * GNU General Public License for more details.9 G# o( |7 Z: x" x& i$ S
  23. */
    5 l4 v) c8 w% S# N# j

  24. 8 w8 D& B5 Y: E8 v/ K
  25. #include <linux/module.h>
    1 t, W1 T. B3 [9 f) `
  26. #include <linux/init.h>/ c: G. K! `, @  s8 u  c2 ]
  27. #include <linux/errno.h>' Z- i, y( ?6 r2 }
  28. #include <linux/types.h>, v+ J6 A9 b; N0 g8 B
  29. #include <linux/interrupt.h>' d2 m9 E' v. @0 ?% F$ N
  30. #include <asm/io.h>. ^  i1 W- B* W1 `5 R, l9 l- `) A
  31. #include <linux/moduleparam.h>. [; G' T& w$ C. \" ~
  32. #include <linux/sysctl.h>% [& q* [4 H) I0 I3 L( a! a. \
  33. #include <linux/mm.h>
    9 B  J, Q$ k9 {
  34. #include <linux/dma-mapping.h>
    . V- k6 ]4 D2 `) y, B/ _5 J  x
  35. 1 X+ _8 L: a/ q; A; j
  36. #include <mach/memory.h>  s) ~* H2 r% A' S! P6 \; _
  37. #include <mach/hardware.h>
    2 u5 q, E8 G) r) f* T; `; M4 y
  38. #include <mach/irqs.h>
    5 v. l2 u/ ~* W% d
  39. #include <asm/hardware/edma.h>( k- u8 o( r9 i

  40. / T( Z3 q! z* @4 ?
  41. #undef EDMA3_DEBUG
    6 [; Y9 U9 v! q! x- ^. n+ H8 I- ?
  42. /*#define EDMA3_DEBUG*/' D2 {' H; {- b

  43. 7 J$ Q* j- D/ v  C$ ?
  44. #ifdef EDMA3_DEBUG( ?8 |, O' p6 V% [2 Q, ]
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    8 r; X6 v, p& j$ C0 W' r( c
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# O: P$ q$ E0 o: l/ w4 a
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 i0 g, ]1 O/ Q" J: t  X5 D
  48. #else$ o# C" O' c2 E. \& B4 \
  49. #define DMA_PRINTK( x... )
    3 z/ a& z7 [; h3 [  D3 u
  50. #define DMA_FN_IN. M' e- M3 \. H7 N
  51. #define DMA_FN_OUT
    5 H2 u  f7 f6 n& Z: }
  52. #endif  u6 L6 z- J. O9 ~- O1 y3 \

  53. 1 A2 U; d1 }6 p+ f8 R4 m( @/ K
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . G) Y, J6 u4 }# B$ d+ S
  55. #define STATIC_SHIFT                3
    / W3 q5 H5 V9 T
  56. #define TCINTEN_SHIFT               207 H; ]& V0 ]1 g8 j
  57. #define ITCINTEN_SHIFT              21
    , G" x$ T  O% U8 U2 P
  58. #define TCCHEN_SHIFT                22
    $ R3 V. ]" ^4 V2 k9 r! T/ R8 u
  59. #define ITCCHEN_SHIFT               23. Q0 Y8 W- J& V

  60. ! T/ e5 {! T3 ?) \  x
  61. static volatile int irqraised1 = 0;7 a$ m. h' Z* \. L. r, J
  62. static volatile int irqraised2 = 0;. T3 F- \# c7 q7 B

  63. . {  y5 h" [/ |  F' G# O
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# b: a9 U  o! O' r
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 q' u8 c4 X) \: i% x4 T
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " {- U  T, x# Q) d1 B9 C" S

  67. + r, s. m) o7 O2 ^. o- u
  68. dma_addr_t dmaphyssrc1 = 0;- ~: E6 b" c$ |
  69. dma_addr_t dmaphyssrc2 = 0;" Y% Z; W* T, e% K
  70. dma_addr_t dmaphysdest1 = 0;
    0 A% h+ o; {: F
  71. dma_addr_t dmaphysdest2 = 0;
    0 z1 L9 k) b0 u3 T  _/ }7 t0 ]& {

  72. 2 j0 e/ c  E$ s7 I) G
  73. char *dmabufsrc1 = NULL;" @- o2 ^/ L: [) v
  74. char *dmabufsrc2 = NULL;
    " S4 p$ v+ [' V
  75. char *dmabufdest1 = NULL;" V0 j; e+ H: z1 e: |
  76. char *dmabufdest2 = NULL;" t* m/ [4 A2 Y4 g: l# J

  77. 6 w$ [4 }, K7 K- j9 q
  78. static int acnt = 512;- y$ V3 _2 S; Z/ |* s7 {$ O& b
  79. static int bcnt = 8;4 [) }0 r  c; ~/ N0 c' O6 X  u
  80. static int ccnt = 8;
    " u  U! Y7 Q+ W; {
  81. % K0 ?" |& K, Q0 d! E
  82. module_param(acnt, int, S_IRUGO);
    ) A5 |) @  u, H% r
  83. module_param(bcnt, int, S_IRUGO);
    " E! ]0 {3 ]( O1 @, i; k
  84. module_param(ccnt, int, S_IRUGO);
复制代码
$ f8 `) r1 P* Y& ?9 y1 L* Q9 L

4 G& u* ^# I  B' B      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 n' O! G7 y6 ]) q% S4 C
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; i  m2 @, G; A2 c5 h# P
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 t; @) [: i2 |- J9 M
* h9 R3 r4 h7 C1 t% v+ H, P' m" i8 u4 v
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-6 16:09 , Processed in 0.041072 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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