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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! S3 {1 Y' Z9 v' ], J
  1. [code]EDMA sample test application# _3 l3 W+ x: C! C' a
  2. /*/ D. \2 p' D4 T( i0 j
  3. * edma_test.c9 s8 s. O+ Y3 U
  4. *
    # T( L. \5 c! {, X; G: G
  5. * brief  EDMA3 Test Application$ L% [0 f% M* C$ W0 n( b
  6. *
    . S, d" _; @) p$ s  c8 [; `
  7. *   This file contains EDMA3 Test code.
    , W( U9 s3 D, z' M$ O+ B" p
  8. *
    % T1 ^/ C# _/ L! X* X; z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" [' W4 m! E1 a, F7 q) }
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% s* @4 L6 ~9 U& J' ?( u
  11. *         TO CHANGE.4 J  \7 y0 ^" x# Z1 `' v
  12. *+ M" X, p, }  `! W
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    + z- d$ T3 E, Z8 h( o+ r. l; r
  14. *5 o3 v7 R/ Q( c% Y9 I' s' q
  15. * This program is free software; you can redistribute it and/or
    % _6 c% G6 ^1 p" O& a5 s; L, V
  16. * modify it under the terms of the GNU General Public License as
    9 K/ C8 k& B: ~8 |5 }
  17. * published by the Free Software Foundation version 2.3 }9 P' K  a$ \) J3 `+ I
  18. *
    * u9 l4 Z& h4 D6 \" Z9 I' x$ Q+ C
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any. o( ]" B1 ^* N0 b: }7 V% Y
  20. * kind, whether express or implied; without even the implied warranty
    7 s% O8 c6 N( t% P2 K  E9 |
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the+ W" u1 [$ P0 E, f0 m& U* \
  22. * GNU General Public License for more details.; h5 Q* k' }; ~  k: c; u
  23. */  M8 o0 @! n8 U& a, L' c

  24. 6 z& B- J, r8 V/ U1 n
  25. #include <linux/module.h>
    - f4 w3 e; e) z
  26. #include <linux/init.h>
    8 D& H$ r1 z  ^  e" L1 h5 |
  27. #include <linux/errno.h>
    0 u5 L. u+ h  T
  28. #include <linux/types.h>; c) G/ Q3 h- w5 r! m
  29. #include <linux/interrupt.h>
    # p4 ]- E: N- ?( d1 {" I  a( R
  30. #include <asm/io.h>8 F# ]7 c) g8 T1 E: x0 x
  31. #include <linux/moduleparam.h>
    6 U, S0 i; Z0 U+ I, N2 ~
  32. #include <linux/sysctl.h>7 u6 v3 F; Y0 w0 p0 C* c4 m
  33. #include <linux/mm.h>
    4 \! ]$ @7 T+ C) `) g
  34. #include <linux/dma-mapping.h>7 l3 s* p1 z5 e  T9 R+ s
  35. , G. |4 A& Q2 ~
  36. #include <mach/memory.h>
    5 r/ x/ O% P, ^5 Z- v9 H6 e2 z) f
  37. #include <mach/hardware.h>9 v4 X" f8 G' I/ M8 r- g3 N3 l
  38. #include <mach/irqs.h>
    8 a+ l; R% t/ ?
  39. #include <asm/hardware/edma.h>
    : d; n' Y% z, ]3 R

  40. . ~& a8 Y; i3 v, a" P. G( W8 D+ b
  41. #undef EDMA3_DEBUG0 @8 S* z4 {! p: J
  42. /*#define EDMA3_DEBUG*/
    1 l; M9 @5 V6 j/ X; B! d& X
  43. % G, y- N  t% b* s7 S
  44. #ifdef EDMA3_DEBUG( w" c/ K0 g8 l, b3 ]$ ^- P  O/ e
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    $ ?  M$ U+ B- P1 K; o: y# J" F
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 w0 F9 K2 n. G
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    2 a# A8 c! `, U: v! k
  48. #else% {* {) J: K5 ^( I" P
  49. #define DMA_PRINTK( x... )& v$ T, U6 {4 i) f* `
  50. #define DMA_FN_IN! j( I9 l0 q1 j; q+ @/ z+ A# b+ Z
  51. #define DMA_FN_OUT
    9 @& v  u6 b# O1 s# s
  52. #endif
    4 ~* ^/ [  E' t

  53. / d% @+ C7 P+ b, ^
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    4 S0 Z  U' [+ o) ?1 T7 r$ f
  55. #define STATIC_SHIFT                3- h3 m- M+ H+ l3 b  r3 r6 H7 K% k* b- ]
  56. #define TCINTEN_SHIFT               20
    8 {4 X% P9 g1 P) E0 f. ?, w, N) l- K
  57. #define ITCINTEN_SHIFT              21
    " l# L/ o, U, T0 l* a' Q
  58. #define TCCHEN_SHIFT                22- H1 e5 K$ O1 F4 f0 L6 U) E" I
  59. #define ITCCHEN_SHIFT               23
    $ {: _& X8 R) `
  60. ) P0 V7 a1 z* X, a
  61. static volatile int irqraised1 = 0;
    ' ~) [3 p! `8 x; w4 D# u& b$ ~
  62. static volatile int irqraised2 = 0;
      [" U& W( @& r
  63. 2 g0 m% d4 }. s. _, q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ g) W8 m9 r% V# A2 z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; }: f" f( x0 ?% ~& F
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) C  g4 S0 U- h. |! F. V

  67. ; j: [! `& l/ V' N
  68. dma_addr_t dmaphyssrc1 = 0;. s# p% V( y6 b" f1 @9 ]; G; e( I& c
  69. dma_addr_t dmaphyssrc2 = 0;
    ; Q4 l) l$ S4 R( F6 W
  70. dma_addr_t dmaphysdest1 = 0;3 |4 O% O: t, v2 r  z7 n
  71. dma_addr_t dmaphysdest2 = 0;& R5 H) ^% w* A+ y5 Y1 I) A

  72.   T$ ~  i4 h  v( b. e' H; {
  73. char *dmabufsrc1 = NULL;
    $ \: W' ?" [$ _2 g& A% K* A
  74. char *dmabufsrc2 = NULL;
    % i7 I/ m% p- W3 s
  75. char *dmabufdest1 = NULL;
    - p2 H0 \( {: l) K3 ]' |
  76. char *dmabufdest2 = NULL;
    ( h3 _$ K; S. y+ Y' X- e

  77. 4 r1 q/ w2 M. S8 D, P0 \
  78. static int acnt = 512;! o# T& M: X; y: B* I" R( r0 b6 Q
  79. static int bcnt = 8;& P0 ~3 S! S7 m& f
  80. static int ccnt = 8;
    5 [+ U. ^1 }0 T
  81. ) W' Q* L4 o3 C9 N
  82. module_param(acnt, int, S_IRUGO);
    + H% x2 r/ `& c2 e% |3 j; g  ^
  83. module_param(bcnt, int, S_IRUGO);
    : u% t- a# e6 `4 I9 c
  84. module_param(ccnt, int, S_IRUGO);
复制代码
: K, z8 E5 K/ P7 y$ T$ R
" i2 j( W3 W4 s0 R3 Y6 i
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% R1 y! w1 O' X% F7 D. F6 D8 s& y9 T
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 W' l. I1 o& W* ?6 r8 q5 d* Q
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; J* n& ], R1 a8 j; I$ V- M; N9 Q, t, S: A3 i
/ N+ _1 H3 Y8 B6 n4 |) p! {$ O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-6 07:43 , Processed in 0.037970 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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