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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 Y8 J/ K5 L* d/ d$ l& B
  1. [code]EDMA sample test application
    $ P5 z. V3 X# W! ?
  2. /*. _, x8 e6 G$ }! D% @$ F2 `
  3. * edma_test.c
    ( L( S: s* j! d
  4. *2 R+ Z$ W; D. {$ X
  5. * brief  EDMA3 Test Application: p" v9 a- k3 }* l
  6. *
    ) J% E) i3 J' f) L
  7. *   This file contains EDMA3 Test code./ X7 V1 ?) R4 T" ?7 Q  `
  8. *
    ) n& K# r3 h  l- K6 o7 k
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    : `4 o) M* s# p6 y  |9 H
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    3 _1 |& R6 S+ u1 T: r
  11. *         TO CHANGE.( u9 @; _7 `# S0 v1 M6 e
  12. *
    " e9 e2 X+ \" X& ^9 l
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    * m  O2 E8 t! D" @3 M
  14. *
    ) q. r3 j, Z  I8 D
  15. * This program is free software; you can redistribute it and/or
    3 W/ w% j0 e4 ]3 I
  16. * modify it under the terms of the GNU General Public License as' _* y1 P! E9 _% Q2 i, F! }: V& T
  17. * published by the Free Software Foundation version 2.) G3 _; g1 O+ I2 K! g& s3 B3 [
  18. *) c0 Z% u1 R. g5 W  r
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    7 @4 E* X5 ?& ?6 k$ B) [$ s+ R# y$ A
  20. * kind, whether express or implied; without even the implied warranty
    8 ?8 a' b( D' ^2 N% B, n
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' j; {6 M+ Y3 h
  22. * GNU General Public License for more details.
    % J1 t5 x& c0 h) m7 s* X7 w0 N
  23. */4 ?8 p+ R- @- w" C

  24. 4 S6 W1 o! R5 R9 X. }- _6 Z
  25. #include <linux/module.h>
    : {9 u3 x' a0 l/ L" k, i6 ^: R2 R
  26. #include <linux/init.h>
    * j. Y; D2 i, f
  27. #include <linux/errno.h>9 t  i. |1 @: B& A' ?' g
  28. #include <linux/types.h>
    3 L1 {' N. p6 w2 J, F
  29. #include <linux/interrupt.h>4 {/ n5 r, K/ l2 e/ U
  30. #include <asm/io.h>& Y6 `6 _4 a: C& K' m$ B8 q
  31. #include <linux/moduleparam.h>
    9 u  j5 i  u  e9 z1 v7 ^7 y
  32. #include <linux/sysctl.h>
    : k- T0 j6 c8 J/ s9 L6 B: I0 }/ u. ^
  33. #include <linux/mm.h>
    ) P' b: s. {5 b% y8 T3 l
  34. #include <linux/dma-mapping.h>
    % I" o+ Y( |# C. C. g

  35. 2 z! H$ h8 F( A' Z3 p$ H6 k# g: y
  36. #include <mach/memory.h>' }$ y, ~! J+ q6 @
  37. #include <mach/hardware.h>( a) b! z. M' J) s9 w
  38. #include <mach/irqs.h>: d5 D; V- B) w- g. {8 x1 W
  39. #include <asm/hardware/edma.h>& l- D* y7 a! i! k& t

  40. 3 C  |+ N2 x3 w( j
  41. #undef EDMA3_DEBUG8 q% d2 O0 u; F' k; y
  42. /*#define EDMA3_DEBUG*/+ x  ?5 ~' V4 v3 B9 T! r1 Q
  43. 3 R6 K* G3 _% p8 o$ ]. B
  44. #ifdef EDMA3_DEBUG, V. }6 w, W" d0 i, i
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* \/ f5 e, Z3 G" _3 o2 b
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) j! d% S8 m& O' {+ r
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    * s( t! g- a3 X) J' L
  48. #else
    2 S  b+ S8 z& V2 q7 A
  49. #define DMA_PRINTK( x... )7 ~. ]7 l7 G! B: q6 {3 {1 O4 R
  50. #define DMA_FN_IN6 K0 x5 t4 d6 x
  51. #define DMA_FN_OUT* D3 E. t7 x6 i/ S* R
  52. #endif- r! S' ^$ Y$ t! r
  53. 1 U* [' ]/ N* U$ C; R4 P7 L" y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    % q' Z. w. x3 f6 u, I1 y( Z$ L
  55. #define STATIC_SHIFT                3
    ; @& `& ^: {: m
  56. #define TCINTEN_SHIFT               20
    , G- K' F2 b! n/ T8 c5 N
  57. #define ITCINTEN_SHIFT              21
    : p, A& o+ r/ D
  58. #define TCCHEN_SHIFT                22
    1 |. R) {- z; {! B
  59. #define ITCCHEN_SHIFT               23
    / {3 f) Y/ V: F) U
  60. " D4 v5 \( T" \) F: }
  61. static volatile int irqraised1 = 0;
    2 C5 d8 d+ `' D3 T% }9 y
  62. static volatile int irqraised2 = 0;. m0 [  P% A( H, _- }. ^, m
  63. + A2 _- Z% e. G& I3 \2 W. d  w& J
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; n2 _* J/ v6 B2 w' c6 s1 G3 R
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: j- U$ G( A1 e8 ^8 {+ v0 P
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 g3 I) t% S$ f2 j0 D  |: k

  67. ; g3 H3 Y' {$ t
  68. dma_addr_t dmaphyssrc1 = 0;
    ) }. i* v6 o9 `) m. g: K* \
  69. dma_addr_t dmaphyssrc2 = 0;
    # S/ e' w1 h5 Y; P/ A/ f
  70. dma_addr_t dmaphysdest1 = 0;3 ?4 B- `( P# m6 J
  71. dma_addr_t dmaphysdest2 = 0;
      q- B  r+ K2 [

  72. % N. p8 X  r1 m- S0 R
  73. char *dmabufsrc1 = NULL;4 d7 n2 L1 Y4 b* u- L
  74. char *dmabufsrc2 = NULL;7 g- O! @# ^: w8 N5 p4 D6 y, V
  75. char *dmabufdest1 = NULL;& _: ~. a4 M, @$ }- F. ~: P
  76. char *dmabufdest2 = NULL;+ R7 M  f1 S. P. m6 k: a0 Y' Y" x0 C

  77. . d+ v; i6 Q: W: u5 Y
  78. static int acnt = 512;0 ]) K/ k  B5 f  N- H
  79. static int bcnt = 8;
    ) L$ ?4 y( `! ], i* h" \
  80. static int ccnt = 8;
    0 F1 U! i* a; |  F9 o( N

  81. & c9 H: I* L# f* S
  82. module_param(acnt, int, S_IRUGO);' ]$ t* m: H. A0 y8 z3 f
  83. module_param(bcnt, int, S_IRUGO);
    2 _3 r" S: R8 ]
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 K* ?: O/ r6 }2 y. }. x& G! F8 p2 r

- x1 t) }# w' {3 g, W      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% T! Y. d- N3 n9 f0 Y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ H3 B* r, N$ V! ]7 t     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 r2 x. q* Q1 N( ^" [1 e5 O1 m

: u: g5 [+ C/ C; [2 v
2 ~1 V0 l, D- Y0 ^# u4 K. }- t
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-7 06:40 , Processed in 0.040312 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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