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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 |, d, E. ^: [) U3 W* L
  1. [code]EDMA sample test application
    " i: T( @9 p: A6 W- j0 x
  2. /*
    " I4 g2 p% W, [  Q6 @
  3. * edma_test.c
    $ d. C4 T& l6 m# L' ^" r: g
  4. *% E6 U7 z8 d1 |, A/ K# B3 w( }% |
  5. * brief  EDMA3 Test Application
    : Q. P' m4 v+ f
  6. *
      W& C9 s+ N/ K! C3 _$ z- t. _. F6 Q
  7. *   This file contains EDMA3 Test code.. ~/ N5 Y: ^6 ^4 n* t* r4 Q
  8. *
    ( F1 b  B( D* L" C  ]* M, @
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 m2 {+ r) h( S( f( q# h6 ?
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    " c/ l$ v% M- Z( W
  11. *         TO CHANGE." t) [  u- b, W
  12. *9 U; _- S  @8 p% R+ C2 D0 Z. w
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    & @9 s! s" _: e4 O
  14. *
    & P  {2 ]" p5 C  q0 }+ D* k
  15. * This program is free software; you can redistribute it and/or7 A0 W' Q2 [* R& k4 H
  16. * modify it under the terms of the GNU General Public License as
    , I' y! y; T4 K: S! A, ~. ^( c
  17. * published by the Free Software Foundation version 2.* z6 d; j+ L& g( J/ D9 {
  18. *
    * H. M8 W( }! O: c; w! B
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; a: f3 p6 b# q# D2 u4 k9 h, h
  20. * kind, whether express or implied; without even the implied warranty
    " w4 h1 X8 x* F* _
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    : z5 `+ P4 j, Z$ b) d; K# S4 d
  22. * GNU General Public License for more details.
    ( {$ b$ ?3 B; x5 D, v: ?
  23. */, y" ]1 j4 w  p! G# a. W

  24. ( I* x9 H( y2 X9 Y4 j) `
  25. #include <linux/module.h>
    3 S, g% m8 O' x5 f
  26. #include <linux/init.h>* ?, m7 a" H6 K$ b, Y/ X
  27. #include <linux/errno.h>) d) L4 q- ]( x- O, w! G& X& K
  28. #include <linux/types.h>- z) m* m9 p6 u2 a- Q6 F% T
  29. #include <linux/interrupt.h>0 K, c/ L6 b: A7 P
  30. #include <asm/io.h>
    9 L. p: j4 b0 r0 M
  31. #include <linux/moduleparam.h>
    : t, X- P  a) I0 O9 J
  32. #include <linux/sysctl.h>) {/ q0 @( I- Q3 J* ^' u
  33. #include <linux/mm.h>
    0 |8 j- U) x5 f8 Q5 |
  34. #include <linux/dma-mapping.h>  W+ o" v( F2 v

  35. " f3 ]* }9 J/ J) _; F* Q
  36. #include <mach/memory.h>; x) n( u, ]  H! E
  37. #include <mach/hardware.h>  n) q- q! K5 s% Z2 I" j. j
  38. #include <mach/irqs.h>1 _) c! v/ t- k- y( q
  39. #include <asm/hardware/edma.h>) t. q: F8 y$ m

  40. 3 e2 N& h4 G* p& L( ?  S
  41. #undef EDMA3_DEBUG0 i* y& Y$ a% Y  l
  42. /*#define EDMA3_DEBUG*/
    + u* E6 W2 E$ R2 o. K: v

  43. 3 J7 I9 h+ p3 G. P
  44. #ifdef EDMA3_DEBUG
    5 o: o7 E4 O7 `5 m9 `
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 C% ?8 c2 g0 v* `/ N
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ M% r" \# ~  q! N0 X
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    * X& h  P$ k. `( M
  48. #else
    ' @6 z! T8 B: B9 C( W9 ?" N
  49. #define DMA_PRINTK( x... )7 Z- w/ j: `- V4 o8 y% S+ s8 q6 N
  50. #define DMA_FN_IN+ ^9 x" Y5 v1 |! N
  51. #define DMA_FN_OUT) W+ y9 u% J1 w1 }. m# p
  52. #endif; @& r8 u# W% Q2 }; [

  53. $ `( {$ Y% X. N; y) a
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    9 N4 g3 {! I' M
  55. #define STATIC_SHIFT                3
    ' p6 A9 T, q9 p$ e& c
  56. #define TCINTEN_SHIFT               20
    6 ~$ ~8 Z4 I6 [! X2 `
  57. #define ITCINTEN_SHIFT              212 v2 `5 n0 @' p) k3 z% ]: p
  58. #define TCCHEN_SHIFT                22+ L1 a0 z% `8 [; \3 W' j
  59. #define ITCCHEN_SHIFT               238 N, \8 i* h$ E! W# W- e
  60. & h8 [' B; d6 L! e& a5 k
  61. static volatile int irqraised1 = 0;
    . N6 Y0 x  S! i' Q
  62. static volatile int irqraised2 = 0;
    8 t* q: b6 H+ K( M9 M% B+ T
  63. 9 G0 f1 b  t5 ]6 `4 J. l0 P
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# k4 G8 l- S0 |; Z$ O/ G
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # W7 \5 a# Z6 T7 x: g; L8 J
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . E6 H3 D4 i# ]8 O6 A- _  u
  67. 6 e9 a% `  W+ v" w
  68. dma_addr_t dmaphyssrc1 = 0;& l# e7 k" H+ g* b
  69. dma_addr_t dmaphyssrc2 = 0;
    2 ]* @* t% a! \5 R9 u; K8 D# u! @
  70. dma_addr_t dmaphysdest1 = 0;
    0 Y  ^3 M% c* X6 x! j7 T
  71. dma_addr_t dmaphysdest2 = 0;& c1 o* V9 I6 @1 Y* D) o
  72. % J7 }9 J# _" z& c
  73. char *dmabufsrc1 = NULL;, E# H2 x( L; F( ^6 f5 @
  74. char *dmabufsrc2 = NULL;
    . ?( M( N% I3 P
  75. char *dmabufdest1 = NULL;
    . c, A8 g0 ?: E2 J
  76. char *dmabufdest2 = NULL;
    # J% |& |+ G3 N
  77. $ z' Z. t; O) a. w1 U9 A
  78. static int acnt = 512;
    + O% m1 N) q0 ~4 S/ |) x
  79. static int bcnt = 8;
    3 o) D" g: F! I) v- _
  80. static int ccnt = 8;# t  }# t' _; o& m

  81. / `! H- d: v8 Y0 p8 b  M* Y
  82. module_param(acnt, int, S_IRUGO);, G' d* A/ w; G' A5 e9 W
  83. module_param(bcnt, int, S_IRUGO);
    0 w) B8 `5 K) S' T4 h4 C
  84. module_param(ccnt, int, S_IRUGO);
复制代码
! J" [0 c. L' j* |% c3 U' ~

) c4 u, Y: W: z      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 V8 {$ y, G8 u: L; ]' R
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 b! e8 N% f7 S! a- E4 A     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ w* N% Y; |* J% a( J1 V: g7 z
+ e0 \. H( O/ Z9 t9 c
3 p. v* F& c* s1 g2 o! L9 O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-15 14:25 , Processed in 0.044020 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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