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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; `* g& N7 E- C6 G2 H; H
  1. [code]EDMA sample test application
    ! k* \4 u2 q  X+ |# }0 J3 U+ o' P
  2. /*0 H1 T% y8 f$ a8 |/ o
  3. * edma_test.c% |* F7 ]4 u9 V& q
  4. *
    8 ]1 k6 m9 Z% J
  5. * brief  EDMA3 Test Application
    : h3 t0 i; S/ h# C) l/ R) J* }
  6. *2 G) m: n/ p+ g! i$ p9 y  q
  7. *   This file contains EDMA3 Test code., F5 l6 C" I0 w( J) d) i
  8. *0 L+ ~4 N: J' `, O( z4 t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ J  [* P, ^- d5 t$ u' r% s
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 k& Y1 K- M# `; C% j) T. ~$ s
  11. *         TO CHANGE.7 U: \  A+ G1 p$ s4 _" m- S
  12. *
    , o, ^. X! U- w
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ; s/ O+ k. r  q. f
  14. *6 J  ]7 u; d- N% l; l3 f( E
  15. * This program is free software; you can redistribute it and/or
    - W, `) u! l& {& F- ?  ?5 D7 H5 q
  16. * modify it under the terms of the GNU General Public License as  E8 p5 c% m$ d* F+ I$ ?
  17. * published by the Free Software Foundation version 2.
      T# T. f5 y+ v
  18. *
    9 f( B4 X- [1 z1 l: Y) h
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any# y( c  W# ]& t+ P2 \
  20. * kind, whether express or implied; without even the implied warranty
    - |5 i$ v4 V' B/ M# a
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % B; G, T& ~* i% Q; A7 Q& ~
  22. * GNU General Public License for more details.
    . e/ k; u1 H4 B: L1 C
  23. */( U$ z% q3 W+ H5 B9 Y9 m

  24. # w5 g5 w+ g4 |4 P9 `! k: K5 m
  25. #include <linux/module.h>
    0 X$ x9 c1 k) D' F+ ]" P7 }& c% w
  26. #include <linux/init.h>
    + w+ z8 `3 c( L$ P' D; b
  27. #include <linux/errno.h>
    4 Q1 p$ x5 K9 _
  28. #include <linux/types.h>8 ]7 V: q6 u% B
  29. #include <linux/interrupt.h>3 }" F8 f. C& a' m" R; q8 a) ]8 D
  30. #include <asm/io.h>
    $ u% E* U; v* e9 g  N2 Z
  31. #include <linux/moduleparam.h>, |! Y4 s& p0 ]1 I) P" P' O4 _
  32. #include <linux/sysctl.h>
    / U/ }+ O4 ?6 E5 o- q# \( @+ _8 ^
  33. #include <linux/mm.h>8 E5 Z3 j8 R" ]4 P
  34. #include <linux/dma-mapping.h>
    1 D! Z/ x  l# G2 {2 C, q4 x' O0 Q

  35. ; k1 B4 V: G) n4 Y
  36. #include <mach/memory.h>
    : l; r  @1 L* N
  37. #include <mach/hardware.h>
    " q" L9 N5 M8 v& N& N9 L
  38. #include <mach/irqs.h>) O' r: d. B# P9 r- B
  39. #include <asm/hardware/edma.h>6 q0 I6 q0 Y6 ]* H( o
  40. ( o) b  g! i; t! c: z4 V9 \
  41. #undef EDMA3_DEBUG! \/ t+ o; R% _7 u1 L* O3 [
  42. /*#define EDMA3_DEBUG*/
    : ~% W% [. a+ [/ o1 X( C: K
  43. $ j* Y1 \* J7 w' ]9 j; s+ p
  44. #ifdef EDMA3_DEBUG( W; `+ I5 r! Y% d& C, i) X8 a* m
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
      X5 z5 @% o" v) u0 u: h
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 Q2 m# E5 l1 X4 f, d
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# x; `, U1 G( p0 C- x
  48. #else
    ) e+ v7 v6 b3 ?3 I
  49. #define DMA_PRINTK( x... )
    % j$ U  s) P$ e6 l. ~7 i" R6 F
  50. #define DMA_FN_IN
    " b  M7 O7 Z% V. H. J# Y
  51. #define DMA_FN_OUT9 h0 h# B6 r* o
  52. #endif
    . M: G) p/ s2 i. {' f5 v

  53. ( {6 M2 e. O. f( j$ Y7 a# W
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    2 Q8 }: v& F/ @  L4 u# E% Z9 f( \
  55. #define STATIC_SHIFT                33 v; }- l& H% I- g% {
  56. #define TCINTEN_SHIFT               20
    , Y1 J2 l0 V3 \! i$ Y
  57. #define ITCINTEN_SHIFT              21* x* r, a: E% Y7 f
  58. #define TCCHEN_SHIFT                22! k7 s8 j% q, S& P2 R: a& C2 y5 N
  59. #define ITCCHEN_SHIFT               23# f# q% }; X7 \; m% A

  60. 9 a  e/ N5 K1 |3 Y1 U5 c+ {
  61. static volatile int irqraised1 = 0;: n% l9 n: B4 ?: l
  62. static volatile int irqraised2 = 0;# ?- o- S. W; N: V/ l2 _) X

  63. 3 R( R9 r- Q' I8 V( b; ?: C* k
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ d/ F5 {, p: \& M/ d5 a, Z: ^
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - I8 L9 {" R! V5 B& J) `
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  o: A+ P; ?5 q' W
  67. / t. }8 \+ P/ _5 u* v+ k* v5 K/ G
  68. dma_addr_t dmaphyssrc1 = 0;
    ) y* D4 p' f6 U
  69. dma_addr_t dmaphyssrc2 = 0;
    $ _- v, W, D: H6 `* M3 d, t5 B
  70. dma_addr_t dmaphysdest1 = 0;6 o. k# P; c5 O
  71. dma_addr_t dmaphysdest2 = 0;$ g( Z, i/ X. V5 l3 C3 s- E

  72. 9 W( j# }( W+ Q# v9 `. I) D5 r' I
  73. char *dmabufsrc1 = NULL;
    . d! w' ?% q0 j
  74. char *dmabufsrc2 = NULL;
    , ]) Q& `5 F! z$ q
  75. char *dmabufdest1 = NULL;
      M: o2 ^1 ^4 r+ a  ]- a
  76. char *dmabufdest2 = NULL;
    + `0 B+ ?$ r( l
  77. 9 L: Y+ W, k# i
  78. static int acnt = 512;& [  a! E& o# Q, B% H7 t
  79. static int bcnt = 8;
    8 e/ K* ~, R) r6 l. y
  80. static int ccnt = 8;
    9 y1 X- W  E' ~- @
  81. 2 g, a# g: a; W* a1 y  b4 ?% h
  82. module_param(acnt, int, S_IRUGO);
    " L4 f9 X6 X. K+ d/ n" R
  83. module_param(bcnt, int, S_IRUGO);
    ; r" ?6 @! ^3 c* G. u" U
  84. module_param(ccnt, int, S_IRUGO);
复制代码
( Q4 x, ]. M4 D' i
- ?$ x, n& p' u6 u
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: S( V* K) M$ E% @0 C& ^' `! Y
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. ^( {& J; t) U% ^7 P! G
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. ^. [8 v0 f" n% X8 N4 E2 `. e
: Z) Y* I/ H6 D+ m9 R
; K6 N. B7 F! N, y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-2 11:28 , Processed in 0.041577 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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