OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ z; E, R1 U. `7 t0 ]
  1. [code]EDMA sample test application
    4 q( |( \' d% ?* _$ E4 E& V5 h
  2. /*8 M: x5 f! [6 t8 L
  3. * edma_test.c
    - f/ \/ E4 S+ O3 E5 J) k
  4. *& s8 _  u( K% m& t
  5. * brief  EDMA3 Test Application6 [' }, W7 l- M4 O* M
  6. */ T' w  V) z9 Q" l6 A2 z9 q
  7. *   This file contains EDMA3 Test code.
    # E+ v' Y2 h8 k% Z: e' b; M' U
  8. *
    - v& P3 F2 m6 ~) u
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    % X( g& }8 T/ a) r5 n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 b; ?# Y; e4 v2 Q
  11. *         TO CHANGE.
    / ~5 A% l' b5 j  [  @: H; Z" N8 K5 d2 m
  12. *+ s4 N5 T2 F4 L- _+ C3 O2 X# r7 s! c
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    0 G& C5 g' b0 ]" U3 T2 U
  14. *
    3 n) N: u8 Q# }6 R1 ?. f$ l7 J) B
  15. * This program is free software; you can redistribute it and/or
    ; }5 R! q5 c( |# p  X. g& D: w
  16. * modify it under the terms of the GNU General Public License as/ a0 J# J1 e, X* x% K
  17. * published by the Free Software Foundation version 2.' o0 G0 T4 v* f( a: h5 b" t
  18. *
    9 x! S8 z/ d& W3 w$ i! m2 R: H
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 j9 M" G* u( v' u  A3 l8 b' l
  20. * kind, whether express or implied; without even the implied warranty
    ( ~0 q  `! R# C# }+ M9 A0 }; |' h% O
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the( m, E6 ^9 `6 K
  22. * GNU General Public License for more details., _2 _. Z* ?0 {  C- d4 H* v  D0 W: F) N
  23. */3 [1 _2 }8 H$ d, g6 T

  24. ' G: F5 G8 E2 ~* y( ~
  25. #include <linux/module.h>0 Y6 C6 p- E0 N( A
  26. #include <linux/init.h>
    - ~* T5 u7 W5 h+ M' o" s$ p, Z2 `
  27. #include <linux/errno.h>& H0 N4 q+ O+ S8 y0 u
  28. #include <linux/types.h>
    " x8 Y. d2 P) [% b7 F# O
  29. #include <linux/interrupt.h>
    ! s7 i' j" [+ ]; Q" T1 g) O
  30. #include <asm/io.h>
    3 c) z  r: a: o/ n
  31. #include <linux/moduleparam.h>& y( m, t; e! }6 J- T
  32. #include <linux/sysctl.h>: P; ], q' S" ?8 j( k
  33. #include <linux/mm.h>
    % N9 P- V6 m* t; b9 p: I1 i* ^
  34. #include <linux/dma-mapping.h>
    3 B" C# J* o. ?+ r

  35. 5 x' H. R; C( r: j" A
  36. #include <mach/memory.h>
    - c3 G7 G+ E$ \0 U* U
  37. #include <mach/hardware.h>
    2 U) G8 a) t0 O! J5 n
  38. #include <mach/irqs.h>8 @9 C4 L$ f5 P3 R: F
  39. #include <asm/hardware/edma.h>8 ]& k/ s0 u* ^. _0 F! Q
  40. 4 Q+ ?: F$ [1 t1 w$ |
  41. #undef EDMA3_DEBUG
    ! J) m. I  W8 g/ D8 i+ {6 u0 e- U7 }  D
  42. /*#define EDMA3_DEBUG*/* Z0 y, Q9 {1 j* h  Z, F9 f
  43. % |6 k8 I8 r2 k# p4 B/ [9 a8 W
  44. #ifdef EDMA3_DEBUG
    - q1 j. \+ C+ X6 u0 }
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): P+ h* q- l$ Q  j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    3 m5 c3 }1 c+ |0 T5 M/ `' n
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 ^6 \% D4 z4 V% o3 @1 R* U
  48. #else
    0 D; n7 I- i' V4 j$ A( d
  49. #define DMA_PRINTK( x... ); O5 r' e% i6 X! P4 E
  50. #define DMA_FN_IN
    0 e7 h0 o' }# S- W
  51. #define DMA_FN_OUT
    " ~% P/ X  |2 l1 X8 h, |
  52. #endif, l$ h8 w0 n5 U! Z$ x+ ?
  53. . d1 x# u, b* _3 t
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); q: o: {% p0 O" a
  55. #define STATIC_SHIFT                3! _6 l) |( t1 |1 V; K
  56. #define TCINTEN_SHIFT               205 g  G& M! Q( h9 h, |
  57. #define ITCINTEN_SHIFT              21
    & p$ a, B7 i* F/ J: t1 E* ^
  58. #define TCCHEN_SHIFT                22
    % F3 P" t, j3 V8 p4 Q
  59. #define ITCCHEN_SHIFT               238 o# c; M) ^, X' u( q

  60. 7 k: `" Y1 A0 |3 _% W" V
  61. static volatile int irqraised1 = 0;
    ! x# r$ ~7 F5 ~: P
  62. static volatile int irqraised2 = 0;
    % e4 }: B6 i+ x1 a3 X9 T! E% T

  63. % d5 K3 W2 y9 g! M$ k
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : l. m4 K( r4 _7 C  a2 K
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + Z1 g& S' a- t/ C( H5 M
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 `3 O9 k' j: {) B2 F% r
  67. / F% o: v- {0 l! N, L
  68. dma_addr_t dmaphyssrc1 = 0;
      o. l5 }8 D5 s0 x, j% ^: N
  69. dma_addr_t dmaphyssrc2 = 0;
    : b+ N2 Q5 i# a5 I" K) A4 C
  70. dma_addr_t dmaphysdest1 = 0;2 ]6 D* H2 J% z
  71. dma_addr_t dmaphysdest2 = 0;
    8 n# g$ x$ a$ u! g- B5 a4 N; f
  72. 6 [, d; W$ m8 J4 i+ |7 N$ f
  73. char *dmabufsrc1 = NULL;
    + L7 ^/ }# c1 A; q
  74. char *dmabufsrc2 = NULL;; A2 s2 `6 e  N# z
  75. char *dmabufdest1 = NULL;
    9 ?; D* ~" w0 _* K/ t/ O  {
  76. char *dmabufdest2 = NULL;3 o: u5 q* [* K7 J5 f3 U$ y7 q; D; A$ G

  77. ( k% }# M1 G0 `
  78. static int acnt = 512;
    ) ?+ w# c+ n  k7 b) N
  79. static int bcnt = 8;( j! Y1 v' g# R
  80. static int ccnt = 8;6 Y: h( y5 |  Q/ V

  81. " q/ H2 ~- N8 E! r7 O  s: m/ n
  82. module_param(acnt, int, S_IRUGO);  g! D% ~" c. c0 q& T# y" D
  83. module_param(bcnt, int, S_IRUGO);. H' e$ o/ V6 c* v8 y
  84. module_param(ccnt, int, S_IRUGO);
复制代码
9 X8 k* P; `: R+ d$ p7 ~4 {1 _
; v+ B( Z3 A' t& K' I! P& ]0 ^; B
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 n$ v1 T, G% G. ^. P- H* s
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( d4 B/ T2 @: S/ I
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% ]2 [. E" B. n* x2 A: {0 H1 l

( H/ P. I$ |% f& S" H
0 I$ M% ?2 \6 V' `" t1 \2 y1 P
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

点击跳转“创龙科技服务通”

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

GMT+8, 2026-7-18 00:54 , Processed in 0.042748 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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