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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 Z: B: i  o! A8 W, j  I: h
  1. [code]EDMA sample test application
      ]9 y& J1 o0 \0 {; t$ |; e3 {2 u
  2. /*
    " O3 ]# ]- i6 p' [" W
  3. * edma_test.c
    / t8 o! ?8 M7 r
  4. ** l- C+ Y1 M( A' W, N. p
  5. * brief  EDMA3 Test Application, t' F3 o' I6 d( ]
  6. *+ B/ a9 \# F' Z$ R6 V; H: l
  7. *   This file contains EDMA3 Test code.
    ( y1 [/ ]2 F2 F8 u6 {, Q
  8. *
    * I( {% k, F# e: }( d+ o# J
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    2 y+ w' _& d, A0 h2 `0 v! `
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    " r1 A0 A" v+ h- l: |/ C
  11. *         TO CHANGE.
    9 s, d7 l& n2 A" B
  12. *& x( x- U4 t9 I, A3 T, Z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ a: J2 s5 n; c0 C8 x6 ]
  14. *
    2 F0 m  ]; X- M* T7 D. M
  15. * This program is free software; you can redistribute it and/or
    ) y0 I7 o% K+ r2 L
  16. * modify it under the terms of the GNU General Public License as9 V9 ^1 O! t) Y6 M+ C
  17. * published by the Free Software Foundation version 2.
    - w. _. K& g: {! R' M
  18. *
    ! a5 u; g, T5 _$ R( f
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    " t' t' P& R: J+ d! X* l
  20. * kind, whether express or implied; without even the implied warranty
    " w( D& W% Z+ z# f8 p$ _; Z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      Z# v% j* r) Y; @5 T; Z' X* {
  22. * GNU General Public License for more details.
    * j4 O' A/ E2 A+ z& V) `2 I
  23. */+ v) }7 v6 R5 i$ ~4 Y& k' Q
  24. % Y, L6 Y+ A, g
  25. #include <linux/module.h>
    ; t- j. H/ X" z3 _% Z
  26. #include <linux/init.h>* U; o/ z. J1 L! F( z
  27. #include <linux/errno.h>
    9 F( r' m5 Y9 O+ T
  28. #include <linux/types.h>
    ' j; m, b! F( B1 G
  29. #include <linux/interrupt.h>
    ! W" I3 c! x" L' l
  30. #include <asm/io.h>8 F# v  f2 a' a! \! K& [1 D( ]$ z! k9 c1 T
  31. #include <linux/moduleparam.h>
    : x8 P& y: T4 E
  32. #include <linux/sysctl.h>* ]6 J- W/ \% g% c6 C1 O) d  t
  33. #include <linux/mm.h>
    / p( T1 h1 p! f$ D5 e6 m
  34. #include <linux/dma-mapping.h>
    5 {; A2 r- I3 b' [, O

  35. ' ?4 f! \4 q. z8 y; v7 G
  36. #include <mach/memory.h>7 Q: z+ e' \: Q4 g; ?8 O; w
  37. #include <mach/hardware.h>1 C! |, D1 `3 J6 u3 J* ?" o& ?( [7 Q
  38. #include <mach/irqs.h>$ B/ `# q5 @5 e' A9 }% |" ?
  39. #include <asm/hardware/edma.h>
    ( i1 k' g+ e, m* @. F# [6 q
  40. * Y4 d( s5 @8 I4 j) a4 E
  41. #undef EDMA3_DEBUG4 Z0 ~+ _0 A* v# z* V/ X* U
  42. /*#define EDMA3_DEBUG*/
    7 W0 l% T! r$ z9 W
  43. 5 u: `, g5 h; N) Y6 n* b) a( ?/ j
  44. #ifdef EDMA3_DEBUG4 C/ C% R4 a! S7 c6 d
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' `& X, ?/ @  f( }# @
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ' N- Y7 I7 d7 E1 P7 j
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 f. x0 T8 w, ~& @: i  W
  48. #else" ~  B" b6 U- d: z
  49. #define DMA_PRINTK( x... )
    ) L; N: D7 f8 W, R% z8 s9 t6 b
  50. #define DMA_FN_IN
    8 C9 m; e5 C7 h* H
  51. #define DMA_FN_OUT
    , [7 G0 ^; Z, s$ k9 J- r2 @
  52. #endif
    1 U* H7 L( J5 G4 i
  53. 2 }# d- F4 `9 m. f+ t' ~
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 `* b% M/ h) J1 v
  55. #define STATIC_SHIFT                34 @1 w+ p% C7 P5 Y- M/ `
  56. #define TCINTEN_SHIFT               20
    - Y0 c/ x3 U0 w
  57. #define ITCINTEN_SHIFT              21
      v, s& G) P% @1 @. b, l
  58. #define TCCHEN_SHIFT                22
    . S/ T# |) G- m) P4 o3 E
  59. #define ITCCHEN_SHIFT               23' Z3 V, ?" R: ~6 U% g6 M
  60. . x6 H. V1 z- t' p4 M) E9 y8 o2 X3 d1 ]
  61. static volatile int irqraised1 = 0;5 x1 c) l+ l5 n0 A
  62. static volatile int irqraised2 = 0;
    8 I" c5 d0 P" W& q& G  Q4 C
  63. 7 @" T) W$ x% e* D- j! T) L
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  u- j1 M. ^6 T7 Y7 Z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " g& n6 B6 C/ w& b
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 ~6 j. t: T3 {/ D" p6 e
  67. 9 A. }! J3 s0 a: t
  68. dma_addr_t dmaphyssrc1 = 0;+ l( o+ S2 u8 F' h
  69. dma_addr_t dmaphyssrc2 = 0;' G+ W7 ^- p8 o; T/ Y! e' n
  70. dma_addr_t dmaphysdest1 = 0;  V9 r8 C1 t/ k
  71. dma_addr_t dmaphysdest2 = 0;/ G) K0 k  p; f9 z) @0 K

  72. ; f6 R' Q4 I2 F/ z( |! Z
  73. char *dmabufsrc1 = NULL;
    # z" X7 [: j" |
  74. char *dmabufsrc2 = NULL;
    ! W* J0 E$ b0 Q: F2 c/ R
  75. char *dmabufdest1 = NULL;
    0 S: t9 {* C& j
  76. char *dmabufdest2 = NULL;
    $ k* w; i$ w0 P3 p, M' L  l
  77. $ y: Y2 _4 L2 Z
  78. static int acnt = 512;
    6 M! d) v( ]' T6 E" m& z, d. h
  79. static int bcnt = 8;" y4 L# _1 F. R5 `* C
  80. static int ccnt = 8;$ {; W# I1 `/ c: ~2 d( o  G7 I7 y
  81. * E5 J. d$ _6 [- t8 H6 h
  82. module_param(acnt, int, S_IRUGO);
    ! ^; u* s2 S/ |7 Y
  83. module_param(bcnt, int, S_IRUGO);
    6 D4 ~* O) t# a4 b% o
  84. module_param(ccnt, int, S_IRUGO);
复制代码

9 s) `7 a  T9 s7 V0 n1 H8 h6 s8 m7 L/ y( u" l5 J* G
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' U& r& I! D7 q% N
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& s  {3 s& x, k! E5 C8 p  e% }9 h' F, `
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: x1 Y8 U+ D& V+ x' r% P6 ^
0 R# K$ Y  a8 r
& F/ E1 |9 D8 R# p
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-26 01:19 , Processed in 0.035167 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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