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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ S7 R: N9 E: \6 v6 W  O/ X& m
  1. [code]EDMA sample test application8 l5 u( `' D/ {9 O6 O) T
  2. /*
    " @0 @' T$ D' i
  3. * edma_test.c
    ' `, W: C9 v4 V& {4 J* {
  4. *4 B' B5 {/ c0 A/ W& \. o
  5. * brief  EDMA3 Test Application2 j( K; M: W6 _& H( U- L
  6. *) b( y, q( |: O9 ]# C3 M  X
  7. *   This file contains EDMA3 Test code.) s$ m9 N; X* S
  8. *. ~& z" d  {7 W5 n; V* n/ H
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    : o% {3 g$ g8 z5 j
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 g4 @3 f: [  w! c' A
  11. *         TO CHANGE.
    1 W, j7 P1 i5 c
  12. *, I7 c3 T+ `1 [; M  i, |; u5 ?
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 I7 f# _2 i2 R6 V7 a) j# U. u
  14. *
    # C: Y, |3 B7 }
  15. * This program is free software; you can redistribute it and/or$ F/ j8 J; g9 g4 L
  16. * modify it under the terms of the GNU General Public License as
    " L; O9 V6 D4 `
  17. * published by the Free Software Foundation version 2.! X7 n% `& C8 ?4 g: }& C; x6 |3 L
  18. *+ l5 S6 C% A9 c
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / r8 ^  \4 B4 r* C( @0 B
  20. * kind, whether express or implied; without even the implied warranty
    6 t- E0 \7 j3 F; a: A2 t7 X; r
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2 a4 u1 V3 N: ?9 c* z
  22. * GNU General Public License for more details., j1 F% [1 R* n( t0 d% h* u: `" C
  23. */
    1 @+ Q3 m! ^9 a8 F, K
  24. " e% q  d+ f! g# a
  25. #include <linux/module.h>
    - H8 V' U7 u6 Z# |& r# |; p
  26. #include <linux/init.h>) A2 y- V6 G8 w. O. v/ F
  27. #include <linux/errno.h>
    , `/ n( D: m2 m3 h
  28. #include <linux/types.h>: ]$ `3 m) z# r
  29. #include <linux/interrupt.h>
    ! Q8 Y3 u# J0 b) a9 e
  30. #include <asm/io.h>9 n3 w7 \# {0 [
  31. #include <linux/moduleparam.h>
    ' x9 ~, v$ U% C3 @- x5 P, E9 E) z
  32. #include <linux/sysctl.h>, ]$ y3 i  ]& ]( r; Y% \5 L; V
  33. #include <linux/mm.h>
    0 ?# T3 v& }) m* i
  34. #include <linux/dma-mapping.h>
    9 Y1 \% {- ]0 x9 h8 ]& H. @
  35. : ]# p* y  }4 F
  36. #include <mach/memory.h>
    ) r4 `$ l* C+ Y& Z) r* d
  37. #include <mach/hardware.h>
    ) d9 i) n, e9 P7 @/ \3 ^% p" l
  38. #include <mach/irqs.h>" G/ D) ]7 I/ k% S. p# ^$ u4 p
  39. #include <asm/hardware/edma.h>% J. `, f- v0 l' j% ]

  40. 7 r$ I0 T' L9 C7 ]' @8 x$ J& t7 A
  41. #undef EDMA3_DEBUG
    7 C* f& R3 U% O# ?8 v
  42. /*#define EDMA3_DEBUG*/
    * f9 B( ~* k6 F5 m5 @6 }5 b
  43. " I; q3 }2 B+ D  Q/ e3 [; ^
  44. #ifdef EDMA3_DEBUG; j: ]5 u: i0 e; |- \+ V
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): n! g* P" f# L5 I/ g( k- Q5 D
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    4 v. G6 H$ V. Y! O& S
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! R! n4 ]8 Y# `0 T' b
  48. #else! t& s, C% y8 c8 o0 n7 \6 ?
  49. #define DMA_PRINTK( x... )7 v+ ~+ n7 V# |7 ]9 U
  50. #define DMA_FN_IN+ o# n  m: m4 d
  51. #define DMA_FN_OUT
    2 b8 n+ N' W. ?+ U4 Q4 n
  52. #endif8 o% [" A) g  [6 L

  53. 0 g( p  _. `: L! Z; k% E
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . o% X7 R! i* `/ k# y+ N/ f9 V" O
  55. #define STATIC_SHIFT                3
    7 E) a' v, [) f
  56. #define TCINTEN_SHIFT               209 u7 w( h; U" `' p8 R" u: m+ i
  57. #define ITCINTEN_SHIFT              21
    . i$ b. h4 U3 d
  58. #define TCCHEN_SHIFT                22+ G1 A5 v  S0 Q
  59. #define ITCCHEN_SHIFT               23) [1 y* I5 w% k# U
  60.   Z1 O3 C5 R4 K
  61. static volatile int irqraised1 = 0;
    ' ^, S# c2 ~" s, K4 T  z
  62. static volatile int irqraised2 = 0;
    & I" h7 c5 F5 W4 f: v. P
  63. 3 C1 e  h* }. O4 X2 H; }
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 q! ^  H  x! y9 q+ h$ v( r
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! N% z- d5 ~. ?2 ~& \7 j7 G" Y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 K# M* u  B+ ]6 M8 D, ?6 f2 v

  67. & u7 g, H& s+ ~2 h1 w2 b2 s8 ^2 h# x
  68. dma_addr_t dmaphyssrc1 = 0;0 C# M0 h/ ~  N, a
  69. dma_addr_t dmaphyssrc2 = 0;
    # ^, [; O+ Q  ]+ O: e+ Z
  70. dma_addr_t dmaphysdest1 = 0;6 t/ E# U7 e/ C* x6 j. \# c3 z
  71. dma_addr_t dmaphysdest2 = 0;/ C' ~- ]: J7 x) x" a3 g. v
  72. . W# o* c6 c4 h4 P
  73. char *dmabufsrc1 = NULL;
    ; D. r* d' o' ?% z
  74. char *dmabufsrc2 = NULL;
    * S6 H5 A* R7 \) g- Y% g
  75. char *dmabufdest1 = NULL;
    ! m- w4 x9 f+ {# S9 L4 O
  76. char *dmabufdest2 = NULL;
    $ s2 T0 }6 j, W+ s* x6 [7 M2 {
  77. 7 ?4 x5 r1 k5 R
  78. static int acnt = 512;
      J, H3 Y3 p, \; p' S- w
  79. static int bcnt = 8;* V5 u3 Q0 U. x1 g* p1 F) H% w
  80. static int ccnt = 8;( Y8 _, ?+ d) |6 V4 c& A% L* H
  81.   f  R  G6 K9 C6 J+ K
  82. module_param(acnt, int, S_IRUGO);; M( |$ ~/ _, r3 T
  83. module_param(bcnt, int, S_IRUGO);
    - w3 y8 G( h6 v( G
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 e( |  [1 h# D

, m( z* Q5 c7 {' {- l# Y+ @4 Z      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 K2 I! y3 e! [+ _0 l: l
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( z% J: K4 ]  g4 \3 f     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) Z3 F7 F" r. b" l  X$ j& F% ^7 w; D* d* A4 ^

: g6 o4 Y) J+ W# h/ \6 b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-19 18:29 , Processed in 0.036054 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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