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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# s+ G$ v2 b# H
  1. [code]EDMA sample test application
    4 h# M5 K% D4 ^/ P: d
  2. /*5 z( h3 Z( a9 N" S7 y, M- K
  3. * edma_test.c
    + ^9 |3 \: f. S
  4. *1 G; C; T4 v( ?' r% l1 o$ Q( `
  5. * brief  EDMA3 Test Application
    1 x" H( |3 E) l' s3 E
  6. *" _2 E: F, ~$ j$ N( r) |
  7. *   This file contains EDMA3 Test code.% Y" s* ]4 X# j1 ^6 L. |; H+ m
  8. *
    ( ^7 N. ?+ M4 ]* }8 D2 }7 O) H
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 t" P) C' {* ]0 k% B8 C( q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 D' N3 b# z7 u( q
  11. *         TO CHANGE.
    + K) u) I0 o- J, {) Q
  12. *9 i7 z0 ?& i8 v" c. ~
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 {& D& H% H1 \/ J
  14. *; i4 h- s6 @4 q/ L9 ^
  15. * This program is free software; you can redistribute it and/or
    ( {  F% n/ w/ d; L3 d5 ^, z- k1 R8 T2 ]
  16. * modify it under the terms of the GNU General Public License as
    3 b; g* q! H' ^+ B
  17. * published by the Free Software Foundation version 2.! p! ~  b$ l, H: P& r! R
  18. *' Y/ M% ^2 Z9 I6 c# b8 `) ]0 N! \
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any( ?" Z, ?- x7 f( O2 x( _/ G/ O9 u! y
  20. * kind, whether express or implied; without even the implied warranty
    1 [7 b. ^# l& D. F- H, d- @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - B2 B, @) ~% @! D% G
  22. * GNU General Public License for more details.
    6 l3 x3 u* c; I+ K2 h
  23. */) V; E% S, C. k7 Y1 L# h# Z# a
  24. ( S8 N/ w9 X, j# c6 l
  25. #include <linux/module.h>
    1 q1 {# V4 C7 ]/ x4 E
  26. #include <linux/init.h>
    5 E- y1 r( B3 N9 x% t9 _
  27. #include <linux/errno.h>3 l) J6 k0 p5 s1 B: D: C
  28. #include <linux/types.h>1 R5 `& F7 `0 u* w; T' R
  29. #include <linux/interrupt.h>; H# P' ]3 f5 Z5 F. `
  30. #include <asm/io.h>' s1 @3 f2 q! m; ]) V: V: f
  31. #include <linux/moduleparam.h>& ]$ K; M2 A) t  W. v" {5 J# p
  32. #include <linux/sysctl.h>
    * p2 \8 I' y  `7 Y
  33. #include <linux/mm.h>" r0 I. p3 j& ~% f$ y
  34. #include <linux/dma-mapping.h>/ C* ^  j1 }/ E2 E$ g

  35. ! m7 ~8 O4 P  i8 ?
  36. #include <mach/memory.h>/ ~; _) h# q0 Q6 J) Z9 A- ?% U
  37. #include <mach/hardware.h>  s2 D/ C& _8 q; r# o1 h) B
  38. #include <mach/irqs.h>
    8 r- S% K' G. R4 l
  39. #include <asm/hardware/edma.h>+ c  L" s! R. O) t7 D7 }$ x/ Q

  40. 5 }& f7 ?  H9 ?- |- r# ~  B. ^
  41. #undef EDMA3_DEBUG0 Q6 m2 u. `; ^7 D
  42. /*#define EDMA3_DEBUG*/& p: E( U' c/ V

  43. 9 b5 R# o; \1 }
  44. #ifdef EDMA3_DEBUG& Y4 J. x- R6 A- ^6 A0 ?" Y! U( C
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    " k$ o. l: o$ I
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 `% b" ~. H; d; \$ w, }" ?* g$ a
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): q6 k3 Z( z/ z; F% N
  48. #else8 h! Q% ?: D$ v  o- a
  49. #define DMA_PRINTK( x... )
    / G" u: `- N6 ~
  50. #define DMA_FN_IN
    1 }9 P* Z4 M, O; j, e3 G: e7 ~
  51. #define DMA_FN_OUT
    ) l+ O8 l" B, u" `4 y5 ^( D
  52. #endif
    8 G$ W& T. [+ {
  53. 4 j+ w3 s( @0 R
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)' ~! A9 ~; o3 C" w/ a( \* t# j
  55. #define STATIC_SHIFT                3
    0 k" l. W/ S; A: p& @5 D3 @* c; \
  56. #define TCINTEN_SHIFT               20
    : L7 d( v. g4 t! B
  57. #define ITCINTEN_SHIFT              21
    ) e7 e4 z  h; F$ j% b9 I# {4 L
  58. #define TCCHEN_SHIFT                22
    ( ?) v" E+ n- [5 `% e5 Y5 p
  59. #define ITCCHEN_SHIFT               235 Q0 ?6 g, n6 {0 Q3 u

  60. 2 H; p  o! u% R/ A% U
  61. static volatile int irqraised1 = 0;" c7 T. A: a& E, h
  62. static volatile int irqraised2 = 0;
    8 h2 O5 p- ?1 e5 v' i4 o7 W
  63. 0 W- B7 Q  u! K2 a( J1 V
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 B& G4 |  d! O4 U, z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " w% t; z* R: F- k
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' ?4 K8 P2 K) z1 o) Y

  67. : I- O$ U# R, M. P
  68. dma_addr_t dmaphyssrc1 = 0;
    3 u/ M: A' Z/ f! J% z! X
  69. dma_addr_t dmaphyssrc2 = 0;
    - \! F- Y& U, |
  70. dma_addr_t dmaphysdest1 = 0;
    1 ?% _, X  v. y: V% z' ~
  71. dma_addr_t dmaphysdest2 = 0;$ f6 w9 N: h( v/ I
  72. : ?9 O% l; }' R
  73. char *dmabufsrc1 = NULL;
    % b$ f% w, m# E& y
  74. char *dmabufsrc2 = NULL;! G2 x# H6 p% }. m6 y
  75. char *dmabufdest1 = NULL;
    4 U& e' q. A6 @
  76. char *dmabufdest2 = NULL;
    ; T" k$ _' Q& N2 {3 P0 R+ D
  77.   {& C5 ^7 u* i/ {7 G; t, T% z
  78. static int acnt = 512;$ E! V* e0 D  W% E
  79. static int bcnt = 8;
    5 M' j; v" p5 P' L
  80. static int ccnt = 8;3 S7 L6 _7 G9 x2 @7 j4 ^, b4 ?
  81. ' m$ Z- {% F% s) m! ~# }
  82. module_param(acnt, int, S_IRUGO);. W% @8 U1 o# N# m+ X2 V( ^. B
  83. module_param(bcnt, int, S_IRUGO);
    $ i, h; C# Q& n0 e1 A: N
  84. module_param(ccnt, int, S_IRUGO);
复制代码

9 r( [/ g4 ]3 W" G: E% }1 G
+ z9 k1 D7 ~) d7 a: \      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ o! A% F* S8 W9 W. W- 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' U0 W) i; H) J7 m+ U
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 U6 [9 c2 T+ `! }0 B5 g* ^7 b$ U! P; k+ `7 C3 I' T
+ m) b% k5 [7 `- N( n
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-9-18 16:37 , Processed in 0.040766 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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