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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) |4 p' n; u" l; \5 v4 G
  1. [code]EDMA sample test application4 ~0 b/ F+ W1 V( P- g( n# ~
  2. /*
    . H1 Z, R; |' m( k
  3. * edma_test.c
    ' x/ b8 N$ a! S3 V, f
  4. *
      [# z7 X# l7 Z" ~# R" L
  5. * brief  EDMA3 Test Application( U6 c. r8 U! j; b
  6. *
    * _; E! M" t6 w; ]! G
  7. *   This file contains EDMA3 Test code.) v3 h0 n5 \$ O1 I' {
  8. *' `# M& M1 K  j  P
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, T# E: r4 e& r9 e/ I& m9 m& U. n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' b9 |2 \4 s- B- h3 ?
  11. *         TO CHANGE.4 S- p; S2 l+ f
  12. *
    2 S5 T7 z1 y' O& ~9 I+ l& I0 m
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    & w4 F( |/ Q5 [- @- }
  14. *
    / e7 ?8 s) ^& N6 ?" r! y. R6 M
  15. * This program is free software; you can redistribute it and/or. z  {( U; D$ g$ n0 {' J/ P' s; |
  16. * modify it under the terms of the GNU General Public License as  P8 z: G4 g, a$ l" x
  17. * published by the Free Software Foundation version 2.
    ' c4 {/ l, m( x! `
  18. *
    4 ]  s# a. f" E" |4 b! n
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ' i+ t% C* U) \! H) m
  20. * kind, whether express or implied; without even the implied warranty
    ' o$ ?- ~" [- H$ X) N
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + p! y* U8 a3 g$ E
  22. * GNU General Public License for more details./ B7 U' ?6 o: w; t7 X
  23. */
    & I0 u9 H$ e. t
  24. ; }. S  Y$ D' M* y  ]: u; @# \
  25. #include <linux/module.h>
    + B. P4 }5 L; S3 e0 s4 I4 a
  26. #include <linux/init.h>
    7 B' Y7 D* G, K6 o" f
  27. #include <linux/errno.h>
    9 H3 V2 V$ Z3 W5 x( B) Y6 \0 T: t
  28. #include <linux/types.h>" n+ l- j) o3 Z% U3 Z6 l
  29. #include <linux/interrupt.h>$ I) U$ V3 i" u/ p5 g; S+ t  q/ S
  30. #include <asm/io.h>
    5 X8 L. ?6 M$ z% J
  31. #include <linux/moduleparam.h>
    6 T# ^2 f& Y: y' T  X; M
  32. #include <linux/sysctl.h>
    1 j! U" c, A, x7 a( I( z& X
  33. #include <linux/mm.h>$ K' a# C* R) p# g# H1 T
  34. #include <linux/dma-mapping.h>- Y' j1 H& Q7 o, j+ U: p' E
  35. . [% A2 s# ~& s! x6 \
  36. #include <mach/memory.h>
    ; Q* A# Z7 O+ E4 z# l
  37. #include <mach/hardware.h>9 p" _! b' J* V
  38. #include <mach/irqs.h>0 q) R2 H' A1 X3 ~% o; z2 L
  39. #include <asm/hardware/edma.h>  k3 k  g; s; c; Z% i# p$ I

  40. 7 S" Z% f! X- P+ ^  H
  41. #undef EDMA3_DEBUG+ T" ?. p, ], A4 R% R2 P
  42. /*#define EDMA3_DEBUG*/
    % y. o4 i5 x- T* B0 R3 b+ Y! u3 W2 E

  43. 6 K0 f/ G& q1 c2 Z% a7 K
  44. #ifdef EDMA3_DEBUG6 y, u" m9 w. J* @
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). [5 q! @, O0 ]4 v0 Y0 H' E3 Y6 P
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& r6 `  g' [, I$ P
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). ^$ W8 ]) ]( r0 _( W; f3 t
  48. #else; g8 a# R4 B0 r6 M* @3 [: \
  49. #define DMA_PRINTK( x... )
    ! b+ C$ [7 g. O8 \0 }9 A+ ?5 P
  50. #define DMA_FN_IN9 O" q( Y& @  g
  51. #define DMA_FN_OUT
    1 @, g. L* Y6 e  G
  52. #endif  J/ s- ]8 E/ P7 p, d% y
  53. - O! K; h0 N7 H8 t/ }1 e) r* v
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( F2 P2 Q: r0 u& q( ~( m
  55. #define STATIC_SHIFT                31 _8 D) T% b7 p6 |# f  t2 @, {/ f+ a
  56. #define TCINTEN_SHIFT               20
    . c3 E& U  X1 @# G5 H
  57. #define ITCINTEN_SHIFT              21
    ; T! _) @: O. H& E0 V2 ~
  58. #define TCCHEN_SHIFT                22
    2 o$ m6 v& q9 {" @" s& T
  59. #define ITCCHEN_SHIFT               23, |% o% V% p! W2 S! b0 G0 c$ b

  60. / V6 |% Y" _$ g4 m
  61. static volatile int irqraised1 = 0;  i0 V, B: _1 s5 x8 p* m
  62. static volatile int irqraised2 = 0;
    ; q) |* {& t) V" }# b

  63. ; F  N* a8 C6 G* c4 q( f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * p( c3 V- u2 g' d' J1 Y) @
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. w+ @" @8 \$ }7 n) x  h8 O
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& X1 s) S/ f4 G# z9 C( f* K
  67. ( l; k# \5 w" l7 i$ a
  68. dma_addr_t dmaphyssrc1 = 0;( }$ j; U; h% `3 t  d- f
  69. dma_addr_t dmaphyssrc2 = 0;% W! v8 K+ q. B9 D) s) @% Y
  70. dma_addr_t dmaphysdest1 = 0;
    . D) P0 E7 o, x& t) i4 ~
  71. dma_addr_t dmaphysdest2 = 0;
      k4 v& T' n* |) i9 P
  72. ! F1 ]$ z6 t# {! ]' e; F! N
  73. char *dmabufsrc1 = NULL;
    ; H8 k- P' o, `) G! d6 k
  74. char *dmabufsrc2 = NULL;
    + U  w8 w- r0 `/ C
  75. char *dmabufdest1 = NULL;
    ! o+ |# S! K. G2 |- F
  76. char *dmabufdest2 = NULL;
    - s" j# e/ L% O) T, Z' L; g1 `. ?
  77. 7 x7 G$ d, `9 o. p+ q+ v7 c- h6 B
  78. static int acnt = 512;# B' c. ^' F/ X. Z/ g! [
  79. static int bcnt = 8;
    3 `$ z3 t' L6 m7 U
  80. static int ccnt = 8;5 H  K2 V$ B% v- d3 M9 R

  81. 8 q9 W$ W; T/ u+ E# f
  82. module_param(acnt, int, S_IRUGO);) n8 e% T3 V0 w7 ]: M
  83. module_param(bcnt, int, S_IRUGO);- A: B3 ~1 w: h' q) ], T
  84. module_param(ccnt, int, S_IRUGO);
复制代码

# F) A" A' J' b- l8 ^9 E' h6 W8 T, X: g' O/ K5 c# r6 B
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" n+ Z5 [, Z3 z3 a& g6 e" Y  j# d4 L4 O9 Yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: l9 ^' ], z: \" o; M
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' |9 \! s4 U) E/ A. j1 @& a+ T  G2 h/ Y1 }9 q

( ^! z0 M' E; H- O; a6 Z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-6 14:30 , Processed in 0.037663 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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