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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 z, V. }" s; j, S9 z( l, ?5 m% `
  1. [code]EDMA sample test application: N6 x$ q. U! E9 e1 }: B8 K
  2. /*8 Z: x' R- g5 L7 m; \. q) u/ |: F
  3. * edma_test.c2 m, t: {3 M! l2 U. u
  4. *, y- G% N7 E9 t$ E
  5. * brief  EDMA3 Test Application
    * a: `& B$ |# R) ~5 D& `, y4 P
  6. *
    4 m" X5 x3 l3 f
  7. *   This file contains EDMA3 Test code.& \9 _8 [! ]: [% ]. o* A3 P* N
  8. *; l" m1 ?4 n0 _) J5 v% ]0 S  R
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * D2 |2 M, i9 D
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & |; h# m) E  z- f: Z; _
  11. *         TO CHANGE./ ]2 w, t4 B! u) ~4 x1 w
  12. *4 d0 v. _/ y1 ^  t: Z6 E
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 f4 |) D" v- B+ w* X1 T8 N
  14. *3 _4 U4 z+ F! r) z( S
  15. * This program is free software; you can redistribute it and/or
    2 J0 F, {; @2 M- h
  16. * modify it under the terms of the GNU General Public License as& ^8 t7 J* V* Z+ ?7 E- d; C3 P
  17. * published by the Free Software Foundation version 2.
    ! f8 g4 J1 E& i" L4 |4 k
  18. *- Q# d& J- e! J& W7 T# J4 S
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 w' v- p, t1 k0 t- e! t, d
  20. * kind, whether express or implied; without even the implied warranty
    # B& c6 R* r) o" Y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the+ G( t. X. a1 s8 C2 U
  22. * GNU General Public License for more details.3 d6 y$ _( ~3 E7 v
  23. */
    5 A. Q% S- v! R: N! K
  24. ( B4 t7 m; a- O3 U) P/ A6 U
  25. #include <linux/module.h>
    1 q# i% v$ y" s3 ^
  26. #include <linux/init.h>
    ' c7 I( t3 N3 ?
  27. #include <linux/errno.h>+ C$ `$ _7 N# e/ Y; e
  28. #include <linux/types.h>
    $ ~3 V! \& ~7 d( B% ^# s. g
  29. #include <linux/interrupt.h>
    0 }  c) `" h  \/ G! k
  30. #include <asm/io.h>
    : n5 A' e- `* H1 x& Z  K1 |
  31. #include <linux/moduleparam.h>' _. m2 l2 ]8 a9 p' h4 d" l
  32. #include <linux/sysctl.h>
    8 J, D3 q( E. l4 B' L6 x
  33. #include <linux/mm.h>
    ; {2 t. T2 ~. R& M0 A) S
  34. #include <linux/dma-mapping.h>
    ' U( x6 B1 g9 e1 D- U6 c' `
  35. - P( ]( J# P0 \
  36. #include <mach/memory.h>
    ) V$ M6 X3 s+ \6 p  Z
  37. #include <mach/hardware.h>, g( q- y) E* X0 X( c; j, z! T
  38. #include <mach/irqs.h>
    - D5 w8 f3 R* r, o, p
  39. #include <asm/hardware/edma.h>8 @! ^: N  [  B7 n9 g- m
  40. 3 X, g! }4 D) P+ l
  41. #undef EDMA3_DEBUG
    " O2 e9 g- {5 `& b3 r/ h. p( c
  42. /*#define EDMA3_DEBUG*/9 \+ a* F; p% p

  43. : _; p8 B2 A; ]2 J2 ^) i
  44. #ifdef EDMA3_DEBUG
    7 l  x4 M* T+ d; [$ S  @; [
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    9 G, P) r. b5 F1 W
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 C# e( Q  E0 z! y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 B( N' L! d: C" O) q" V* J
  48. #else7 t9 y% X$ e& N. i! k7 T3 ~% ?  `' M
  49. #define DMA_PRINTK( x... )" z6 Z6 P) y9 o. N& u& l
  50. #define DMA_FN_IN
    ' S$ R! q) ]& O0 q  V9 c: J
  51. #define DMA_FN_OUT
    9 {* R( d1 h/ W& T% @% x
  52. #endif6 J3 n  O1 W8 x! V: r* T: y/ b& E

  53. $ ]2 a/ {/ r0 \; e
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): y* L) [7 }9 L4 f, c! i% s
  55. #define STATIC_SHIFT                3
    ' @0 u6 [2 w. Y* E
  56. #define TCINTEN_SHIFT               20% ~+ B. L% e, C( k& h
  57. #define ITCINTEN_SHIFT              21
    ) _( V6 p4 r! H& q
  58. #define TCCHEN_SHIFT                22) u* G$ C' D# u2 f9 |
  59. #define ITCCHEN_SHIFT               23
      x+ T! x4 {: B4 Q# P7 J
  60. / d) X4 i5 g0 B3 f+ k  A. B
  61. static volatile int irqraised1 = 0;) A# t$ ?2 s- l' W7 g
  62. static volatile int irqraised2 = 0;' b  A  A8 j6 m3 V- j" F) x

  63. ( ]$ n7 h! `  m; e+ _+ P  I
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 z+ m: `+ w( \. W0 g* P/ {
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: d& F9 T3 K6 V. S% t5 y. [
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 G1 x8 V2 l, s7 b/ [- d
  67. ) B; @+ r( D- Q4 N: j2 |: }
  68. dma_addr_t dmaphyssrc1 = 0;7 p% e) _+ t' F1 y# ]: }7 z
  69. dma_addr_t dmaphyssrc2 = 0;
    & |! q7 k8 z0 X3 ]2 f
  70. dma_addr_t dmaphysdest1 = 0;
    ( j$ b; X0 a1 h7 A$ g
  71. dma_addr_t dmaphysdest2 = 0;" y8 b- t( A% H# L- h
  72. 8 c/ C2 I+ M$ T6 }
  73. char *dmabufsrc1 = NULL;+ \1 i( }* p& x3 W& l' l  ~: y, j! w
  74. char *dmabufsrc2 = NULL;6 W: p* V& }( L
  75. char *dmabufdest1 = NULL;  b' I3 \! z8 K9 q9 Y  E: S
  76. char *dmabufdest2 = NULL;# d5 K7 \# E+ u# j( j" G

  77. 3 B. f) p& ?0 c8 b9 z! o0 n% T# C- x
  78. static int acnt = 512;0 Y5 T  E- l# K' w! U% Z
  79. static int bcnt = 8;
    ( y/ g% j- A6 V6 M9 ]8 X
  80. static int ccnt = 8;, B% w; [% b7 n/ ]. c7 B

  81. ) J) k3 s8 w4 D* w9 e9 d* B
  82. module_param(acnt, int, S_IRUGO);" @% R8 v9 [- v, ]
  83. module_param(bcnt, int, S_IRUGO);
    * J. U$ O5 I8 U! A  A- X$ |
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 B$ P( z+ ^* n& Y/ @
# k8 B: I! p7 p1 U9 {
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ n6 R6 R- N3 p' }; r& }2 O
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& V+ o: u5 |2 V
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 K5 V1 m8 y/ h$ w- j% x* x5 ^) Q# z
. |7 u) w# q( Z5 Y/ z1 N, I: z

7 R, i: j0 N" g% ]2 Y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-13 14:52 , Processed in 0.038372 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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