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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ t9 l& ^4 F) [1 L, w
  1. [code]EDMA sample test application# W+ X# W2 ]8 i; X! c
  2. /*
    & o) [7 ~' f7 ?. a/ w3 m
  3. * edma_test.c, ~& N7 F3 u3 a3 A) p
  4. *
    ' o2 i8 e7 [9 D7 `
  5. * brief  EDMA3 Test Application
    * G) x" O; G5 [# ]  ]* q
  6. *
    2 u7 D) ^+ X. J
  7. *   This file contains EDMA3 Test code.4 w" \6 T) P* K1 a; S; J0 `
  8. *  g1 e: R) l0 {* o' b! v- Q' @
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    . O+ r4 h4 `/ P' \" }6 Q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ( v  s3 m- `/ r
  11. *         TO CHANGE.
    & [+ y8 O: c8 H: R5 W3 n1 I3 \
  12. *; Q7 u6 L% V) f# \; ~- a3 P
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. a# {* B* N: X: K$ q5 r
  14. *- q$ r" P3 \  z7 v/ h
  15. * This program is free software; you can redistribute it and/or, Z8 U" |8 q/ h0 y: _
  16. * modify it under the terms of the GNU General Public License as1 E! I# F" ?6 @1 G, k/ t
  17. * published by the Free Software Foundation version 2.' ^3 y1 _$ N- P1 G2 C
  18. *4 h7 f* D  J2 l/ P% x' I( Q3 P
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    6 d9 o* B6 U. T) l
  20. * kind, whether express or implied; without even the implied warranty
    ; j! d- \& @! E' I
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      c3 k  U* f, n. _2 \, l6 G/ W1 M
  22. * GNU General Public License for more details.
    3 u+ E* C: a4 z
  23. */6 y  L  c9 [6 ?, d9 s7 J

  24. + M+ Z( I3 z' m& |- p; @( w) I/ V
  25. #include <linux/module.h>
    " L# I% r* R; _; W
  26. #include <linux/init.h>
    # k% h8 t# u; i- L
  27. #include <linux/errno.h>) m% {9 v  e" ]& M3 c  X$ s
  28. #include <linux/types.h>+ u8 Q3 C- K  ^$ ^+ e" I: s
  29. #include <linux/interrupt.h>% d" ^3 {& d, r4 k
  30. #include <asm/io.h>
    * [+ Y0 S3 e9 j- P
  31. #include <linux/moduleparam.h>" {# ?( [) Y0 }3 S- B9 c, _
  32. #include <linux/sysctl.h>: n  x$ p7 g% y5 J- p/ m
  33. #include <linux/mm.h>
    7 t4 c  {" ^4 g
  34. #include <linux/dma-mapping.h>1 |5 o& k: E" Q. U. X9 l. W
  35. * n- D  h% Y% q; Y, ]
  36. #include <mach/memory.h>* U# y3 ~; I2 H# u
  37. #include <mach/hardware.h>
    7 C6 {. v/ \# J5 N& J# ]$ q3 s$ ]& R
  38. #include <mach/irqs.h>
    " w7 J9 ?& V& @% ~' X0 O
  39. #include <asm/hardware/edma.h>5 X. v) W: ?+ s0 Z8 ^4 Q+ a" v" R

  40. , p/ c5 l* \1 p) V2 Z0 f0 j4 d3 L7 @8 D
  41. #undef EDMA3_DEBUG$ Z4 l4 f; u( c' G: Z- B
  42. /*#define EDMA3_DEBUG*/
    2 z" }0 b3 Q* j4 Z$ j- V/ Z

  43. 5 `9 N: h+ A+ Y$ F! S  a
  44. #ifdef EDMA3_DEBUG2 O4 _, b; |  \0 z0 N
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% W/ ^# S3 S  H( U
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    * x( R2 g" {8 m) V
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    4 j( l: X7 w0 T8 u; a8 V
  48. #else
    1 n6 m  v  k+ A# D$ w- M
  49. #define DMA_PRINTK( x... )
    1 L, M" }0 }9 h2 W; a
  50. #define DMA_FN_IN  {( p1 V# j  H" Y) V" ^
  51. #define DMA_FN_OUT
    * z0 F: m& P8 i! v
  52. #endif& W- R) F3 ~- f) v3 Q2 `

  53. - f) C3 t. S2 g5 A4 }
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)$ u. r$ V5 M- o( K6 E& `% ?6 t# z
  55. #define STATIC_SHIFT                3
    1 M3 ?/ S' A- ]! U4 a6 K9 y
  56. #define TCINTEN_SHIFT               20
    ! I* A4 J( x3 E+ m4 |- |* M% j) Q
  57. #define ITCINTEN_SHIFT              21
    . V3 I$ m: y2 O1 B# W
  58. #define TCCHEN_SHIFT                228 G8 b4 S- g& {# U
  59. #define ITCCHEN_SHIFT               23
    - F* m, q2 {. E& L/ P
  60. 8 @* [7 h2 t5 m& f, K+ U* ?& V
  61. static volatile int irqraised1 = 0;
    . I8 b! [( ~' W
  62. static volatile int irqraised2 = 0;
    ; F+ I1 h0 P  n  d, a
  63. $ K/ ~! w$ r% A  S2 a! E
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 N. K! U/ u2 b2 ^( W" K" ^# \
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 ]* @$ T8 A: t3 C
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 s+ B! U' p* W% v5 w
  67. . B& ?+ d6 F) ?" V. a" B
  68. dma_addr_t dmaphyssrc1 = 0;8 o8 u4 l! z9 _. D) B
  69. dma_addr_t dmaphyssrc2 = 0;) S4 u' W, T+ C
  70. dma_addr_t dmaphysdest1 = 0;
    . P& ^- E9 Y% a/ T! g3 K
  71. dma_addr_t dmaphysdest2 = 0;
    - Y8 a4 m3 d# O- z
  72. - u2 }& X8 _. Y4 E
  73. char *dmabufsrc1 = NULL;( r2 O7 z% ~4 D5 I# q" T" x5 d
  74. char *dmabufsrc2 = NULL;
    . T3 r) n8 M; v$ ^+ x
  75. char *dmabufdest1 = NULL;! ^, b& b& o" R/ u7 j
  76. char *dmabufdest2 = NULL;1 y2 m& E9 c. |% S- O( M( q

  77. 5 \# X  e: R5 n( o+ _. Y7 t1 y
  78. static int acnt = 512;
    + z9 Z# K) ?3 z8 D" i* R
  79. static int bcnt = 8;3 p9 k, b5 Q! B& p6 d% X* |
  80. static int ccnt = 8;9 \4 c, D3 N+ i2 z- A( w

  81. 3 R& _& B3 v. m" ~
  82. module_param(acnt, int, S_IRUGO);
    , ]3 l7 R1 v  N" D; U$ |
  83. module_param(bcnt, int, S_IRUGO);4 U& j& N$ j1 t" T. r! {$ U
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 d' b3 o8 R  K' q& o8 N, Q2 E
% p% J8 W+ N- w      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 m/ r; O( T' R0 ~
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- X% d+ s/ N1 ~+ `( R  v4 F7 l& Q     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。  l: f2 l6 z! m- D4 m
. t- F9 S, Q6 h4 J. T$ h
0 G4 F3 B& d! |2 L4 s
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-29 12:05 , Processed in 0.041703 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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