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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ s! ~: v' d5 b# c
  1. [code]EDMA sample test application
    : Z! t0 z- e: O3 t
  2. /*4 X! J- K+ J( |, I
  3. * edma_test.c( T; \$ O6 _5 V/ e
  4. *8 y7 T9 g* A( j9 h" i  e- a( o
  5. * brief  EDMA3 Test Application! B( G8 z3 c& v
  6. *- C9 [& d, ]% x3 u7 s& K
  7. *   This file contains EDMA3 Test code.
    5 ~0 F2 P/ }: g, W( I+ a" C; u# }
  8. *2 Y2 _6 B" x5 R6 H7 U, M( o& L
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + _! p' C# h/ u1 Z8 L/ O' t
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , q$ G7 m' n2 ~' E; W4 Q7 n2 l
  11. *         TO CHANGE.6 C' m9 B1 e+ l! {3 R3 o
  12. *" T6 w3 X) @& p- o
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 P6 Y7 {+ L7 S$ ~, E$ N1 e
  14. *
    8 s5 [( U7 T0 |$ X$ o# l
  15. * This program is free software; you can redistribute it and/or
    ; U0 K6 C8 }  H
  16. * modify it under the terms of the GNU General Public License as8 X: b/ ^0 D1 R1 C
  17. * published by the Free Software Foundation version 2.% M0 p, l1 k" H) d
  18. *
    8 v3 g% a5 k' g: F7 N
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any" t* \) c% G; s2 a
  20. * kind, whether express or implied; without even the implied warranty4 A1 ~' i" S) t0 H
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the# |% o( `9 F8 k( J
  22. * GNU General Public License for more details.( W) ^+ [+ n% Y3 V
  23. */
    , j' c8 D$ R+ @, q. D- `. W

  24. ! T7 P) O* f. z
  25. #include <linux/module.h>
    2 j2 c+ z' O" X! T4 T$ N2 a6 K
  26. #include <linux/init.h>
    0 y, b8 z& \, T; B2 Q  q
  27. #include <linux/errno.h>
    ! {- J. A- e3 E0 s6 r( g9 p
  28. #include <linux/types.h>
    ( U2 J+ B: k) q* _3 K
  29. #include <linux/interrupt.h>
    / Z) |. }, @# D! {# w) S' Q$ ]
  30. #include <asm/io.h>
    . n- ^$ s/ b! F
  31. #include <linux/moduleparam.h>/ R0 V: Y. g- M% W- S, c; ]& Z" R
  32. #include <linux/sysctl.h>3 z2 Y2 y8 c' _: Y9 n; l
  33. #include <linux/mm.h>
    9 L( R; F8 p' O* A: A$ p
  34. #include <linux/dma-mapping.h>
    ! x. G( p! f# B0 e; t) t. L: i
  35. / B$ N4 W  \3 p  v$ \! L  K
  36. #include <mach/memory.h>* y5 x. w$ ]$ x5 S
  37. #include <mach/hardware.h>5 Y- w, ?" S3 G4 j4 }$ F! V
  38. #include <mach/irqs.h>' V( H6 v4 V# z" S
  39. #include <asm/hardware/edma.h># ~- h0 l+ L9 n- h- }8 O

  40. - c/ m2 C4 u3 D3 O
  41. #undef EDMA3_DEBUG
    ) r1 g2 e! p8 d8 t7 e4 ?. @) \
  42. /*#define EDMA3_DEBUG*/
      A$ \( w5 F. G# G9 B

  43. 7 `: U. t7 U% W! `% [; u
  44. #ifdef EDMA3_DEBUG
    0 W4 Z: O8 l4 h; n
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 L* [6 t; I) c, {
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 |+ J* T7 B& v$ W6 g
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 l" c6 j, A- S/ \2 I/ x- `
  48. #else
    % J3 d. \% P/ A: S/ |; U7 b  ^
  49. #define DMA_PRINTK( x... )& J0 w8 e9 K+ g* B$ k7 g; b3 S6 m: w
  50. #define DMA_FN_IN# X6 W$ k) j. E& D: b7 p" m
  51. #define DMA_FN_OUT
    8 O& y+ u5 k# L
  52. #endif* V: b: ~$ y  X. g) H( L
  53. + P  @7 ~; L9 y4 q- N
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ' {6 C$ O0 l; ]1 C7 x, W1 y9 e
  55. #define STATIC_SHIFT                3- _# q' R& P+ G: ~1 m
  56. #define TCINTEN_SHIFT               20( m. s( F4 K9 j; i4 y$ R1 k4 }7 S& D
  57. #define ITCINTEN_SHIFT              21  I( B# \6 ^) S: j' N9 j) A5 A
  58. #define TCCHEN_SHIFT                22
    ! ^7 G# n8 i4 t. k+ ?
  59. #define ITCCHEN_SHIFT               23
    $ \2 q1 e) x( O! I/ F
  60. 3 W; j7 f) s, R! v: K
  61. static volatile int irqraised1 = 0;
    4 r8 V2 f+ I$ Q5 {; p, i
  62. static volatile int irqraised2 = 0;& b- n! d/ Q$ c% ~# ~
  63.   A( n; {, ~/ x1 u0 D
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( o+ g8 ^2 X" Y1 B
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ O) ?# I- T) }9 P' g' @4 l4 O6 ?) K
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      i  d. s% `7 k

  67. ! B) k( H1 f3 b  \: z( \
  68. dma_addr_t dmaphyssrc1 = 0;
    * P1 ~9 w+ R) D5 i5 |
  69. dma_addr_t dmaphyssrc2 = 0;0 D( E1 O- s9 w- j) C0 e- J5 J
  70. dma_addr_t dmaphysdest1 = 0;5 Z" _2 g' z3 b# W$ o3 }
  71. dma_addr_t dmaphysdest2 = 0;7 \, _; p0 D' B! I4 }' U" p
  72. : @( P: e" W' v# ?* E7 f: z
  73. char *dmabufsrc1 = NULL;
    ) N& U3 E& h+ I4 D! c: X% U
  74. char *dmabufsrc2 = NULL;
    $ }# X# G9 C" k8 I. N3 E4 r" }3 d
  75. char *dmabufdest1 = NULL;
    0 O+ n* M! C. i6 Z9 ?
  76. char *dmabufdest2 = NULL;! A* Z# P5 l" m# t- O
  77. 1 M8 @& m, y% x. v: ~: {* \+ W: |# Z
  78. static int acnt = 512;5 _' @0 {% L2 J1 E* m
  79. static int bcnt = 8;: z( `2 V( A& K
  80. static int ccnt = 8;
      j" m" M% N# {( C7 F; g* ?
  81. ) J5 w! o8 Z! ^) @/ q& j* Q0 {& t
  82. module_param(acnt, int, S_IRUGO);6 y) M$ y! @: ?) G. E; v$ z
  83. module_param(bcnt, int, S_IRUGO);
    8 ]# Z* M: r$ P
  84. module_param(ccnt, int, S_IRUGO);
复制代码
( J8 z  n) J  X' D8 z0 L

. B: j2 N9 [4 }      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 p5 h; L* K) L4 carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 Z( k  U0 [5 ^# `* m' B  [
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: M- Y( @8 Z5 ~9 W

( c/ E- ~* ^1 j+ J/ s3 ]7 d
# U: G" d; K& Q; K  S! L
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-11 00:31 , Processed in 0.040093 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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