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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + J+ H% o  ]6 @
  1. [code]EDMA sample test application0 ~; C2 A3 f7 a# D/ n$ H) C! @5 U4 T* p
  2. /*
    9 _8 l; u$ M+ v! M) E; O, [
  3. * edma_test.c
    : Y( n7 ~+ z3 m4 `# j
  4. *: A+ w5 ]% ?& H% U2 m& ^1 i
  5. * brief  EDMA3 Test Application  \; I" H3 `: ?) n8 a' x
  6. *
    7 D  X* p( s7 L/ V, {' D
  7. *   This file contains EDMA3 Test code.
    ; g& X  P# @, M+ @/ [, y* _/ ]
  8. *
    ) ~( F) }. d0 r5 Q3 {
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / Y- D6 ~3 P, K) [* y+ b
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ o4 F& }: s0 E6 Q# K
  11. *         TO CHANGE./ R, ?4 n4 n6 V0 j
  12. *
    " p% E8 G" z( Z' M$ s
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    # t1 y  ?3 Y4 r+ I( d
  14. *
      F  D8 p: `8 y; t
  15. * This program is free software; you can redistribute it and/or+ B4 Y1 I, u- G
  16. * modify it under the terms of the GNU General Public License as
    . A* O; T2 ?8 C' ]! }1 O. z7 g
  17. * published by the Free Software Foundation version 2.
    * i/ z8 K# r8 ^6 Q, d
  18. *
    . |$ D% b8 A' [# j# k  v
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    % }* H; Y9 f' D( W
  20. * kind, whether express or implied; without even the implied warranty
    5 Q) ?" ], I' V- n9 u" d  I
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3 ?2 X# ]& R. F1 j2 |+ i1 L# |
  22. * GNU General Public License for more details.0 N& Z0 u; t$ B7 v" }
  23. */
    4 B1 W% N1 g+ o/ e5 v) q0 z

  24. / E4 f# S( V# T3 X9 g" |+ G& C
  25. #include <linux/module.h>$ C2 {, G2 |4 E& A5 m6 ^5 d
  26. #include <linux/init.h>
    9 p( ^5 t2 t0 B6 J- |
  27. #include <linux/errno.h>* d7 O, Z" U. o
  28. #include <linux/types.h>% t( p0 E) G* G9 N
  29. #include <linux/interrupt.h>$ p, E; O; M4 K/ d
  30. #include <asm/io.h>& k  F3 d! p/ t- N$ `8 n7 k
  31. #include <linux/moduleparam.h>
      B) W2 q5 m3 z) M0 N
  32. #include <linux/sysctl.h>2 m8 M6 i- j* y; y, q
  33. #include <linux/mm.h>9 Q# e2 ~1 t9 h0 {8 V" u1 V+ t4 F
  34. #include <linux/dma-mapping.h>6 Q7 [- R, G: z6 ], a
  35. 6 A- @& c) @- M# ~+ ?3 _
  36. #include <mach/memory.h>0 a6 n7 |4 i) g+ ^
  37. #include <mach/hardware.h>  Y' j% c% G2 N- R) c
  38. #include <mach/irqs.h>
    1 ~8 }$ Z4 `+ A2 F7 k* X
  39. #include <asm/hardware/edma.h>6 d. [" F6 G0 q/ F
  40. + n2 P7 M* T% Z6 U5 ?
  41. #undef EDMA3_DEBUG
    3 z$ C7 r! d+ O4 |1 R1 O) O
  42. /*#define EDMA3_DEBUG*/1 \3 Y8 P& F0 X3 @% m& B1 I
  43. + u0 {2 x0 k; ?+ N
  44. #ifdef EDMA3_DEBUG0 j# N& B0 V6 d6 h; q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - I: }6 c$ I8 f% ^/ {
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 s3 {' |9 O: s+ N* ?2 e. z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); ]  }8 `  F3 E
  48. #else
    0 Z( V8 z$ a4 R8 r1 n& G8 c
  49. #define DMA_PRINTK( x... )
    5 a8 c  W1 `: k6 S$ ?8 S  [# i( A
  50. #define DMA_FN_IN
    2 V- g) \9 y! r, z' X
  51. #define DMA_FN_OUT: n  x. K: y/ l
  52. #endif( ^  x2 |3 R7 ?

  53. 9 Z* U( [+ p+ k0 o: x$ X) r
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ! U4 a  E; x0 C! R
  55. #define STATIC_SHIFT                3( ?: ^- e* h; N* z0 Y2 `( K: ]
  56. #define TCINTEN_SHIFT               20
    ' @  o; W9 |& F- X" \  H
  57. #define ITCINTEN_SHIFT              21: f8 ^* f# |( B6 B# k# t0 Q/ I, T
  58. #define TCCHEN_SHIFT                22# Z( T8 t" @- b! {5 _
  59. #define ITCCHEN_SHIFT               232 R4 Y6 @7 Q8 s
  60. + Z0 P& P; B$ o7 Q
  61. static volatile int irqraised1 = 0;3 z+ |  j# Z7 B
  62. static volatile int irqraised2 = 0;' a% ^& l* m3 h. ^; U  p
  63. 7 S3 G' K- q$ w0 z/ B
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 |6 `& x0 k, n3 ^3 U8 q  p
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" l' ~6 Y2 b' _% l+ L
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& D2 A1 t2 a  L. A$ @; l: v. b

  67. 1 K! U! d( k, J
  68. dma_addr_t dmaphyssrc1 = 0;- _0 c9 E% |: e, u- F% k3 A) o
  69. dma_addr_t dmaphyssrc2 = 0;
    * x' F& y9 z3 \2 M3 G% _" k
  70. dma_addr_t dmaphysdest1 = 0;$ v% P" V7 O- Q, r
  71. dma_addr_t dmaphysdest2 = 0;
    . [7 L- C4 z% l3 |3 V4 M2 z0 y! M

  72. 2 s- T6 z. a# w( d
  73. char *dmabufsrc1 = NULL;* f, C4 f0 m( b% b$ y
  74. char *dmabufsrc2 = NULL;
    7 `$ d$ E  X; `& l. x4 w& U  E
  75. char *dmabufdest1 = NULL;& ]' y  S! t0 U
  76. char *dmabufdest2 = NULL;1 \6 `( A6 D) ^
  77. / l& D9 u9 R" `! x( ?: c) a
  78. static int acnt = 512;
    * _- f' \, V9 O
  79. static int bcnt = 8;
    0 s7 E' U2 N+ J+ b" d
  80. static int ccnt = 8;
    1 X( i! h: ^' ?* q& c, J5 u* X3 o
  81. ! W" l8 l* D# x2 Y
  82. module_param(acnt, int, S_IRUGO);/ V" y; T/ i* Y9 A7 k* N
  83. module_param(bcnt, int, S_IRUGO);
    % v/ u0 b) D5 J0 `, n" Z
  84. module_param(ccnt, int, S_IRUGO);
复制代码
- @4 A" G, L, T. o. u! c
1 d) ^" L5 v  W( d: i
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- ]) H5 l1 z& A: ]2 U# Warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( |$ |& t+ @1 S; @$ r
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' i5 V; j2 \% G2 O9 D3 E, l$ D) D6 V+ i4 H4 d! n) p

$ h# G7 D( I) H+ `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-1 10:41 , Processed in 0.037267 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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