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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % k8 N  o2 j# e' L3 E5 F
  1. [code]EDMA sample test application0 o3 i* R, N) @* }  K
  2. /*; \; P/ D  y+ L4 u' o
  3. * edma_test.c: G3 b( ^; M: W
  4. *
    4 G, X9 u8 r& H6 _) X8 c2 ^4 H
  5. * brief  EDMA3 Test Application5 W8 X- {8 ?0 X8 D, F& ]% R; r0 n
  6. *
    % H/ F8 O) O, I: f1 j
  7. *   This file contains EDMA3 Test code./ {& y6 _9 i5 e& p7 `5 W6 M8 S# |
  8. *8 ^, z" W# ]" y) U6 l" k
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! k9 O9 b4 M: ^
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    # r8 B' `8 i6 i0 _, V
  11. *         TO CHANGE.9 r" F! u# r7 A
  12. *
    6 }- u* F# b) ?( k* J: `
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ! [/ z1 Q4 r5 u* r8 r( K
  14. *, f" H! u6 s9 k" y+ X& f8 l8 f
  15. * This program is free software; you can redistribute it and/or
    . q& ]- C- F5 f5 `. A2 f1 F) ^
  16. * modify it under the terms of the GNU General Public License as! X3 [# i; p6 E: j
  17. * published by the Free Software Foundation version 2.
    ! V6 M7 i! U$ H% P( H
  18. *7 I/ m& N/ _3 m5 l# o% D; j; R
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any. W$ G4 s+ g- L5 ]& t
  20. * kind, whether express or implied; without even the implied warranty/ r' G: i8 F# B% b5 o( H! x
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the( B0 m* b8 n) L. T- j
  22. * GNU General Public License for more details.
    ) G( ^4 Q0 X( j: `, a& k: M7 w
  23. */: `6 G. {9 e7 Z, k* M

  24. # i$ b0 |* q" |% r* |9 X
  25. #include <linux/module.h>
    - H+ L/ p2 E* e+ }0 A% o
  26. #include <linux/init.h>, v" o) r$ @( V1 X  f+ h
  27. #include <linux/errno.h>) a" D. f4 p& P) g. _
  28. #include <linux/types.h>' l1 T2 H8 ^0 {- I9 K. x7 |
  29. #include <linux/interrupt.h># x9 ]( ~+ t! B- Q( _6 s, I
  30. #include <asm/io.h>; Y7 _( n2 n; {' v, X+ U
  31. #include <linux/moduleparam.h>
    # c3 ~( P8 L/ W4 W
  32. #include <linux/sysctl.h>. f; w2 e" U" |& u! [
  33. #include <linux/mm.h>3 z  R0 b. W8 |) r$ Y; v0 l
  34. #include <linux/dma-mapping.h>$ V$ V  Q) f4 m  `% V% ?
  35. 1 O' d( O: i7 C. U+ o
  36. #include <mach/memory.h>
    % z. L! I5 U/ n. t, k
  37. #include <mach/hardware.h>& Z8 E* \, p" W4 Q) C
  38. #include <mach/irqs.h>
    & g( T' R! @: ]$ n! q9 x$ J: D1 D
  39. #include <asm/hardware/edma.h>
    4 F# L9 y# x: t( M1 C, f
  40. " [6 [5 c' I- K5 e9 d2 N
  41. #undef EDMA3_DEBUG: Z* ?$ F9 @# J8 v
  42. /*#define EDMA3_DEBUG*/
    ) h- K+ G  d/ x; n) j

  43. " |4 a! A, v  R6 g' S
  44. #ifdef EDMA3_DEBUG: d! u' o; P) f
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 i( i, x8 m/ D
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): R# v9 |5 C# F5 K, u5 O
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 S$ a: C! O+ z9 q5 l% J
  48. #else
    8 R( `! e. D8 b' B% b  l# c
  49. #define DMA_PRINTK( x... )6 Y. j2 d9 }. d* t7 @* P
  50. #define DMA_FN_IN
    & a2 p0 S0 [4 Q2 F% R
  51. #define DMA_FN_OUT- M1 f3 K- l  S6 z8 V
  52. #endif
    4 G4 @' m) ?( Q8 S' P" K

  53. ( L9 `, N+ L8 a
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 G, H4 O- B6 ]: |! ~
  55. #define STATIC_SHIFT                3
    8 D: q: u9 Z' v  @
  56. #define TCINTEN_SHIFT               20
    9 E* q9 |) R; W9 D) B) d3 W
  57. #define ITCINTEN_SHIFT              21
    ( b. ^/ J/ [5 `  @6 F
  58. #define TCCHEN_SHIFT                22
      J7 a3 R3 ~: }9 V8 P
  59. #define ITCCHEN_SHIFT               23( |% @/ a6 q$ G2 N. \

  60. % c, T4 o8 a+ s! F5 I+ ~
  61. static volatile int irqraised1 = 0;7 t( e  R6 T' n6 v( {
  62. static volatile int irqraised2 = 0;( [5 ?- ~# V3 P( }' M8 T) o1 R
  63. 4 [) d. Q- c) i, i+ a+ Z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* e8 c( v: G# U5 @4 R0 [: v
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " h) O1 D- b* W# e. u
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- T. `' G# e7 Z' c+ W" L* ], J3 u
  67. 4 M" `, g0 O+ D" U9 j. g0 @( e
  68. dma_addr_t dmaphyssrc1 = 0;
    : G: q6 m  h! l' p0 d' u6 R( }
  69. dma_addr_t dmaphyssrc2 = 0;
      [- j( }* r0 h9 ]: V
  70. dma_addr_t dmaphysdest1 = 0;2 u0 \" g0 [! G+ x1 ]3 _; m. R( O
  71. dma_addr_t dmaphysdest2 = 0;- F. U0 A: x, b3 s* O% {
  72.   v0 V. n$ p9 x/ N
  73. char *dmabufsrc1 = NULL;5 w! p  z) e# U. g
  74. char *dmabufsrc2 = NULL;
    7 w: _3 F. g! E4 E9 ?
  75. char *dmabufdest1 = NULL;
    : E! [0 A( G/ |2 M# G: v1 D
  76. char *dmabufdest2 = NULL;
    ! [, Q* J! V6 N: o; S/ ]. ~% I, m
  77. 9 h8 E3 X3 @! x: D# d* P
  78. static int acnt = 512;
    + |$ W. t  m4 k6 q
  79. static int bcnt = 8;3 H( I4 V. l# T0 o  t' C  E, V9 H
  80. static int ccnt = 8;: d2 F/ O+ M  ^- Z2 }
  81. 3 m! B( r4 L5 N2 O
  82. module_param(acnt, int, S_IRUGO);- R! r9 y( K% Z$ O2 \0 C
  83. module_param(bcnt, int, S_IRUGO);
    5 q  J% e/ l( Y7 h. c( i3 C
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 H! [0 @8 e' W; b( d
7 T7 ~; d1 D* T1 C/ Y4 H/ t      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ `2 d5 A: c+ L- P9 D
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& ?# N8 O: B7 K* {" u! O
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 x' d/ z- @7 Q' s% l  K
! r3 m, @2 H& j# W2 S7 Q5 V% M4 ?. Q  p+ g# D! e
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-11 06:23 , Processed in 0.039033 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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