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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* B8 A' v# y/ B$ Y  b
  1. [code]EDMA sample test application5 K+ W7 p, n3 U5 `% v1 A0 T0 l
  2. /*% j3 O! w0 M$ q' k/ @  K$ ?: `
  3. * edma_test.c6 p# i4 I) K4 R# k
  4. *0 @( G" g% x6 ~
  5. * brief  EDMA3 Test Application
    , H5 E1 B. w+ ^" e& _5 S
  6. *- v3 o" B$ D* R: _# O" N& w& l
  7. *   This file contains EDMA3 Test code.
    % F) e# o# V( H4 H  h5 u" ?
  8. *" d5 T; m5 {. y6 t5 i0 o7 X
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' u+ j* [' ~; I7 M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    - d6 m( X2 D* C! _, X
  11. *         TO CHANGE.$ C1 _4 q4 C$ F% `
  12. *. f- A; E7 {: a+ h  E  H
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; q1 B! ^$ m/ J- _
  14. *
    & _, Y( P0 X0 }$ A0 e/ R
  15. * This program is free software; you can redistribute it and/or
    1 y- [. }3 ~: m+ p* T
  16. * modify it under the terms of the GNU General Public License as
    ; y* o9 \- o5 Z3 R) h# H
  17. * published by the Free Software Foundation version 2.
    ; ?0 H6 t9 B2 O
  18. *
    - G0 Y( \' c1 h* v
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any% Z. x; e, J; E
  20. * kind, whether express or implied; without even the implied warranty/ Z5 `) @& f. e0 Q5 l" d( b
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 `4 z4 T7 u( x8 I- }
  22. * GNU General Public License for more details.
    5 p/ t4 x- L- w( B
  23. */
      n2 \7 ^/ ]1 p5 t& s- }; M- N$ M
  24. $ e9 x4 c$ V% G  {  ]
  25. #include <linux/module.h>) p0 r0 s& a# \/ E( C) a4 S- j2 v
  26. #include <linux/init.h>
    * z; ^, b4 B2 x; H" G8 M$ _& l# z
  27. #include <linux/errno.h>& U2 ^. p1 \/ @- g' _6 L
  28. #include <linux/types.h>, q5 R/ Z0 n. o# B& _: r$ i
  29. #include <linux/interrupt.h>8 i  z7 W* }3 X+ l- i
  30. #include <asm/io.h>$ c  |6 U3 z% R. N" ?; e2 l9 l
  31. #include <linux/moduleparam.h>
    7 |$ l2 J) H# L4 R. U: H- Y7 i
  32. #include <linux/sysctl.h>
    ( o- ]# Z" Z9 W" ?4 \2 d& c
  33. #include <linux/mm.h>1 C* Q& ~* F9 r  J
  34. #include <linux/dma-mapping.h>
    # |( ?8 x, T  @
  35. 2 B' _" {- D- ]
  36. #include <mach/memory.h>) n* E1 {4 y  z' ?/ k. a) Q7 m
  37. #include <mach/hardware.h>0 X8 F( H" L# P$ X1 X+ i, o
  38. #include <mach/irqs.h>2 P! _4 l$ R- `8 u/ g% N# S
  39. #include <asm/hardware/edma.h>
    / n, \3 C4 b2 L  i" O1 e7 I* l! @- R
  40. 9 a( o3 B2 z0 t2 G# w% Y6 z
  41. #undef EDMA3_DEBUG  w5 h5 o, x5 z7 i2 W
  42. /*#define EDMA3_DEBUG*/
    8 ]2 a6 @9 g; ?  H; \; N- s3 e& Y

  43. 7 u7 j4 F2 W  b* i: e$ Y4 R, r
  44. #ifdef EDMA3_DEBUG8 {6 v$ d' f! Z2 Q, N/ m
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 c. @+ v  [& W6 _: @1 w
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! c0 h9 e+ Y! ^% s3 J' m
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 w: x& P- m5 S3 ?9 E) ]- |
  48. #else( k( `5 N. Y# O3 L
  49. #define DMA_PRINTK( x... )
    3 \* B  F7 c/ D$ O2 f" D
  50. #define DMA_FN_IN
    7 t) e6 |0 v$ G& Q
  51. #define DMA_FN_OUT4 `3 |/ {  k  V4 X$ H5 K) Z
  52. #endif/ W( t% k* Q* `9 S: {
  53. 8 L: j+ x8 Z0 e0 ~, {! d
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ) v0 N. E9 d* m
  55. #define STATIC_SHIFT                3
    . m% O2 m  N: Z& d" i" @# |8 y
  56. #define TCINTEN_SHIFT               20
    ; A9 E+ }" m) g+ h5 x$ f
  57. #define ITCINTEN_SHIFT              211 k, O5 W% `; x4 i
  58. #define TCCHEN_SHIFT                223 O# q  f; X. u  @
  59. #define ITCCHEN_SHIFT               237 Q8 m5 i1 J9 G( x3 r

  60. / l$ `7 U6 T6 Q! b
  61. static volatile int irqraised1 = 0;2 s& L% _. e( H8 a5 U+ s
  62. static volatile int irqraised2 = 0;' h/ k  p; G& T8 `

  63. 0 x5 V- ]$ S- U/ |. k
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . Y. `, E9 n( `; u# P1 O
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  I. E& }7 e7 @
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' S3 @* [0 j* V0 h; W1 H! ^8 T+ w
  67. ! u. T0 r; n  p. x" H* v# f
  68. dma_addr_t dmaphyssrc1 = 0;% L* m6 w9 w: r( W; O
  69. dma_addr_t dmaphyssrc2 = 0;
    # o" ~% Z8 X" W4 Y6 @. Z% d* U
  70. dma_addr_t dmaphysdest1 = 0;( R  P, J6 x( w* Q1 r
  71. dma_addr_t dmaphysdest2 = 0;" O! s" ]# b/ A* M& {2 y
  72. 0 }: `; O, Z4 t- R$ M* B8 y
  73. char *dmabufsrc1 = NULL;
    5 Y, B4 L: h6 _& v. X9 O6 z- v8 y
  74. char *dmabufsrc2 = NULL;
    " j; Y/ E$ ~: e1 ]4 H/ ^, Q
  75. char *dmabufdest1 = NULL;
    ) `0 R: ^! F; h) g% e0 U! Z
  76. char *dmabufdest2 = NULL;5 d: u. u  f6 [: z/ }
  77. ! q/ V( d* a0 ]- A
  78. static int acnt = 512;
    2 D$ A" R& H: k6 E
  79. static int bcnt = 8;/ h' @# Y9 ~! q& s( @" ]- ~1 U
  80. static int ccnt = 8;
    $ `( j$ v9 K5 g$ o1 Y! |2 r8 ~+ P( x
  81. ; `! S! n& _7 T9 M! }, d. w
  82. module_param(acnt, int, S_IRUGO);& M& {# ~1 h7 [( a* W: R! Z
  83. module_param(bcnt, int, S_IRUGO);
    " R8 e# g/ k2 r5 Y
  84. module_param(ccnt, int, S_IRUGO);
复制代码

7 f) _8 j$ |, P( @( B" k/ s  n' Y) B7 c, S) L5 N
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 c' b7 I# j# g- Y. s6 T1 z- U! Z5 [2 C
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 W$ @3 b2 I* x) G' \7 r     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& ]- T+ s  X: v6 F
4 `# C! f- X) t, V
: @9 f) d, S* A4 B( ?$ h
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-19 09:39 , Processed in 0.038132 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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