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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % o+ C0 Y, i. J5 t- J
  1. [code]EDMA sample test application
    ) t0 D* _  C8 {5 Y+ j7 S
  2. /*
    ' V* h) A$ O% s+ w6 [; r8 R
  3. * edma_test.c/ D1 u6 f# y. u# _0 g
  4. *+ W: r9 I7 C0 ^1 ]) m. D
  5. * brief  EDMA3 Test Application( y: d$ P* A6 h7 V+ u( e7 Y1 U
  6. *
    & d) J* ^/ w. A/ T0 N6 f" s4 _
  7. *   This file contains EDMA3 Test code.
    8 @7 ?1 j8 U. r0 ~% ~$ U
  8. *; m" Y* f8 R1 [2 r
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 I, E1 c9 j6 x! e  _
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 M# Z0 s! S7 S' b( K
  11. *         TO CHANGE.. ?% m* i# H  N
  12. *
    3 ]  R4 }3 \( ], G# x3 b
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ) d; |1 ]) G  K4 J  K
  14. *
    ) F& G3 k; p! [, D
  15. * This program is free software; you can redistribute it and/or: E0 d3 h& K3 W: y% |0 F
  16. * modify it under the terms of the GNU General Public License as
    . S/ {( J0 }5 f) U1 i0 r: p
  17. * published by the Free Software Foundation version 2.$ k* c! E3 X3 c" ?' t) d3 W( O
  18. *
    " D1 r0 E6 V9 ~# p+ \$ R! j1 S
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 n2 ^& F( X: c! p, Q2 v" S
  20. * kind, whether express or implied; without even the implied warranty
    6 A" X# }9 k% t9 h
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5 L/ d& ]- U+ p" [5 A, p3 T# Z( n2 ^
  22. * GNU General Public License for more details.- d7 J% a+ X4 u! h0 Z7 z' @2 |
  23. */: h: a/ |/ N2 `. Z6 E" h3 d0 u

  24. . N2 F3 V! M. \0 z8 S
  25. #include <linux/module.h>
    $ t# n8 Y6 I. E( L0 k7 z* c6 {, @
  26. #include <linux/init.h>- c* b8 F* l2 P! G# T9 \! l
  27. #include <linux/errno.h>( B9 W$ ^. f8 I5 V
  28. #include <linux/types.h>
    + G. E# t& k! t: t
  29. #include <linux/interrupt.h>( y4 V2 U0 A% R$ W/ b  u/ t
  30. #include <asm/io.h>
    7 \, r' d0 k* W8 F% L: l
  31. #include <linux/moduleparam.h>
    ( M# ^7 e; h* s0 n- Z
  32. #include <linux/sysctl.h>
    # G& u8 K1 N7 `6 c4 ^! M. L
  33. #include <linux/mm.h>
    1 z  T+ J2 _: `. Z
  34. #include <linux/dma-mapping.h>$ ~, Q- z& R1 h

  35. ; C( ^3 Q/ M/ j0 ?8 j$ c" }
  36. #include <mach/memory.h>3 o0 ]. ~5 {6 R; P
  37. #include <mach/hardware.h># C2 O* Z% U3 P2 r, p9 c/ p4 [4 G
  38. #include <mach/irqs.h>
    ; o7 H, z4 y5 }
  39. #include <asm/hardware/edma.h>, Z% m, z) ~9 U4 }, h" S4 I9 K

  40. . Z1 a8 b* b% R/ J. f9 F" c
  41. #undef EDMA3_DEBUG
    * X/ ?. P- T$ i* C, h/ w& E
  42. /*#define EDMA3_DEBUG*/. d# A5 X: w& s# X; {& ]
  43. 0 ~$ k1 K* A8 x/ n' J9 ~% h
  44. #ifdef EDMA3_DEBUG% o2 C5 W* m; I" }0 w6 v, O0 [
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( P4 R5 Y5 o, f4 v1 |% P
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): f" O/ `! P+ ]" ^3 o
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* W2 F* Y6 A* @
  48. #else
    4 W$ z1 N7 Q0 t! C0 E0 z' k
  49. #define DMA_PRINTK( x... )
    3 J+ P  D" ?+ |6 @: }
  50. #define DMA_FN_IN; `4 ]" i6 d. P
  51. #define DMA_FN_OUT
    $ L" P( }) O3 r; R% O1 Q/ H& J+ r
  52. #endif
    ( p+ M! q5 _5 k0 J
  53. + [3 u: E$ V* v% I
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , Q/ X/ b0 {) ~) b- P& K
  55. #define STATIC_SHIFT                3- K5 D( K1 K) c
  56. #define TCINTEN_SHIFT               20* e! ^8 g8 t8 y" O( \
  57. #define ITCINTEN_SHIFT              21; c% {" f8 W( |5 V  \! K& B' e/ t$ r
  58. #define TCCHEN_SHIFT                220 {. R9 Q! P$ b1 R8 Y) N
  59. #define ITCCHEN_SHIFT               235 S* r! P/ T5 c+ H8 E/ D1 G
  60. ! @" s; T; x! W
  61. static volatile int irqraised1 = 0;
    7 X% |6 I3 o8 W, {) }, \# g9 D
  62. static volatile int irqraised2 = 0;" ?! @0 L7 d. `5 z  F5 U) ^

  63. 8 w$ n5 T( M  l. r7 e
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 F1 Y( @0 ~( p- k2 A
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 [2 L2 @1 R* \. s) L) d1 E  r
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ H# [3 l; c, t! x+ j4 p( F

  67. / t. l! C1 b% }7 S! N, m4 H# A2 A
  68. dma_addr_t dmaphyssrc1 = 0;5 O' ^7 e* n& u: t" v
  69. dma_addr_t dmaphyssrc2 = 0;. M7 d0 v& k9 B6 _7 v; y
  70. dma_addr_t dmaphysdest1 = 0;3 o+ T' x; s) o3 n8 l1 h
  71. dma_addr_t dmaphysdest2 = 0;& F8 J. U. l) D/ o" J. ]* \
  72. ; v: l# w+ N0 T% D
  73. char *dmabufsrc1 = NULL;
    ( \" `7 X% k: N
  74. char *dmabufsrc2 = NULL;
    9 S9 e. L* x. G# G
  75. char *dmabufdest1 = NULL;& y! P0 S2 i$ {5 a
  76. char *dmabufdest2 = NULL;
    " J2 w5 ]3 N" C, T4 z- |

  77. - F: G' [: G* @
  78. static int acnt = 512;
    1 T  n8 g( N3 [7 ]
  79. static int bcnt = 8;
    8 E3 u1 s  c. u3 _: J. C% g" z- T
  80. static int ccnt = 8;6 \+ k1 H% Z( a

  81. & `( y) \$ q2 Y& }: P: t, C
  82. module_param(acnt, int, S_IRUGO);4 _5 F1 J$ E; g
  83. module_param(bcnt, int, S_IRUGO);
    6 B! i" k- }  b" y7 W
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 X4 y  t: m- Y! o$ u3 h  S

: a2 K- ]: X/ u/ R5 A9 Y      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 T) d$ l8 ?# E" \
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ ^$ R- v' t% m7 [# s, Y     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% N' H7 X0 d  i6 x: X6 g( f, A
+ f; C! @$ ]3 f0 Y; a' {0 V) B3 t+ P9 k# w) b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-5-17 00:11 , Processed in 0.040343 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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