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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& B% |0 C/ i6 }
  1. [code]EDMA sample test application& }2 r$ Y8 I7 s- b1 R0 w
  2. /*
    / F6 F1 T  o4 h
  3. * edma_test.c3 ^$ k3 ]7 j2 y  V
  4. *+ p( m1 P0 B* h3 y8 M/ i5 Q
  5. * brief  EDMA3 Test Application/ j8 l6 a+ E0 a) n0 ?$ e+ m
  6. *% d! y& \  @+ F8 d$ T( p
  7. *   This file contains EDMA3 Test code.0 M  t% X- e+ S( w+ u7 A
  8. *! F% a+ N. f" j* j$ W0 x* i
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ Z( i' w. L6 Q, o; H
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    $ C. D& [) G4 r2 j. y& a) U2 z& H
  11. *         TO CHANGE.
    . v6 y: F. F3 p: O. X
  12. *; `5 m3 z5 j; o; P7 j0 e+ r; v
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) m) @: o, i9 q
  14. *
    8 f; P: b, K4 D
  15. * This program is free software; you can redistribute it and/or
    & \( U/ j. G; |+ j( _' e
  16. * modify it under the terms of the GNU General Public License as
    5 v# Q6 i% |  N0 {- ]
  17. * published by the Free Software Foundation version 2.* W9 t! @& F! V* S) G" R
  18. *
    % w6 u, W* O1 _- {5 g  z( `# H
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ! }) A, Z) u& H6 Q- L( i
  20. * kind, whether express or implied; without even the implied warranty! n* l' r9 w9 z0 ^, x* [/ R; d
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 g) G4 ?2 e) J; z, O0 t, J2 h4 @4 i
  22. * GNU General Public License for more details.
    $ C2 t; b- m5 f4 A
  23. */0 `3 b  j: j' \( O
  24. " X5 H% r1 [/ p0 \$ H
  25. #include <linux/module.h>
    " O+ Z0 ~, z# S. l3 ], K/ f6 y; j
  26. #include <linux/init.h>, y; u4 S5 J9 J
  27. #include <linux/errno.h>% S6 t: A# w1 [# ~+ n+ @/ k
  28. #include <linux/types.h>
    4 x- b( G) w/ g8 ?
  29. #include <linux/interrupt.h>
    3 r' B5 q& j6 Q6 @1 d: U/ F% K
  30. #include <asm/io.h>0 K* v& }) S+ G. b4 d+ U' `
  31. #include <linux/moduleparam.h>
    5 C9 W* T* w( R( M5 f% a+ D2 W
  32. #include <linux/sysctl.h>
    ( s5 l- w$ {" [( d- t  \
  33. #include <linux/mm.h>9 C: o4 {" C- h) b0 K* I5 l
  34. #include <linux/dma-mapping.h>/ g+ E! q" @  Y% V7 {
  35. / X6 l. o4 m7 U4 z" N" W* n
  36. #include <mach/memory.h>  @5 B) h4 P+ E+ H( y
  37. #include <mach/hardware.h>, Y2 {7 Z+ t7 e  I0 f! a, F& N
  38. #include <mach/irqs.h>9 u$ w% Z& K2 o1 |8 I9 T! o
  39. #include <asm/hardware/edma.h># q. x$ Y/ T+ I

  40. $ o# c) t  ^  N5 W/ L; O. l! H
  41. #undef EDMA3_DEBUG
    4 r0 i; j( l+ t# w* s% V
  42. /*#define EDMA3_DEBUG*/0 k4 |) J" D) [& B: f' R3 `. p
  43.   Q/ c( t  V9 R$ n. A# Z; c
  44. #ifdef EDMA3_DEBUG
    9 l. ?4 f- E' L0 N  Y$ \2 p( m
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    / D6 B: U4 o7 ^  g! B8 G+ h
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# i9 c1 S0 u: h# B2 g
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): |" ~( E: Z  o0 ^6 ]0 e
  48. #else7 v- D' @5 Z4 a% _
  49. #define DMA_PRINTK( x... )
    . \$ s+ c6 A- R/ a! H
  50. #define DMA_FN_IN
    * D, @' ]  B) p# _* L9 \
  51. #define DMA_FN_OUT
    , D" D8 c1 r" A" S; }  o
  52. #endif  w. s8 m. [( `& t* I: `: O8 N# P8 f

  53. 7 `7 Y2 ]8 Q; Q! F3 R
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( t2 L. ]3 j( W+ d2 n
  55. #define STATIC_SHIFT                3
    , t5 i6 n4 y: W6 y3 x3 G  {
  56. #define TCINTEN_SHIFT               20% W' z' g5 m# h
  57. #define ITCINTEN_SHIFT              21
    7 b7 S6 W/ j1 A  t- W3 D
  58. #define TCCHEN_SHIFT                22* J4 _  q: H' v8 S4 D
  59. #define ITCCHEN_SHIFT               23
    9 S& z$ i/ k' k. l& L
  60. 3 g! y  O/ f  x  x4 Y4 A) N& C
  61. static volatile int irqraised1 = 0;. P' F8 u9 a8 G4 A( A0 ?9 t
  62. static volatile int irqraised2 = 0;* a& @9 l# Y) A% H3 g( J: b; Y

  63. $ s. ]& c4 w0 b5 f1 k
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 Z$ K: e6 u# J; E3 s  N
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" K7 d" x% E2 D
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* }0 K1 B( o1 R' C; Z/ X0 Y. C' ~
  67. # c3 D' I3 N% j) F* w, l
  68. dma_addr_t dmaphyssrc1 = 0;; ?  A: G) D5 ]# ?8 A& W/ i
  69. dma_addr_t dmaphyssrc2 = 0;
    0 T5 M0 C3 }; M% r: q  x; t- m
  70. dma_addr_t dmaphysdest1 = 0;3 I. W1 g) w8 A+ w' s( P: p' m
  71. dma_addr_t dmaphysdest2 = 0;9 B% v+ a2 L2 b6 b

  72. - S5 W, a. k1 ~/ Y' h4 P
  73. char *dmabufsrc1 = NULL;$ i0 C+ t$ `3 _! {+ e+ w
  74. char *dmabufsrc2 = NULL;
    ! b+ s7 X4 G& p* L4 b! Q
  75. char *dmabufdest1 = NULL;  m3 S8 D" ~9 y* y7 {
  76. char *dmabufdest2 = NULL;
    8 z/ C  G/ X$ ^4 p$ l
  77. ! r- _+ Z# h2 z, R
  78. static int acnt = 512;
    4 R" O7 _) W3 Z# W0 T' p9 s3 q
  79. static int bcnt = 8;
    ( ]0 X- |# i/ V) k# c" }
  80. static int ccnt = 8;
      E' x( I5 b3 F0 q* i) x) H* y% s3 l

  81. / ~2 @' U6 S) m6 }
  82. module_param(acnt, int, S_IRUGO);% ^2 ^) A6 }+ x  y+ i, |& g- A
  83. module_param(bcnt, int, S_IRUGO);
    % w. M1 F* x2 l/ G+ V7 N
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 ?) Z/ S% v* t+ q& F
6 s& u0 l* ]/ J( r6 B' q
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- }+ A4 _4 K0 H( v5 n% larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( ]' T6 Q# }- q" Q+ H7 D4 h7 J
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ W8 {0 ^+ C" w1 g9 L, q4 n
9 v  r; L1 a5 b$ q
# m4 j! r4 ?/ ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-15 19:55 , Processed in 0.037740 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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