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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 f* K2 C2 M$ ]' x, _7 X
  1. [code]EDMA sample test application
    # _. ~) v* h; Y; @5 ~( |8 X) T
  2. /*
    & Y8 t3 H, u( t4 Z
  3. * edma_test.c5 A3 o( }  L+ j( p* o. h
  4. *3 D+ Q2 }4 [, d, [2 A7 m
  5. * brief  EDMA3 Test Application8 m& U- Y* A! T% B
  6. *- n: Q1 U* T9 a. b5 Q. V
  7. *   This file contains EDMA3 Test code.! c  L1 d6 P4 q3 D* _$ ~
  8. *# m( H2 q$ Z7 G$ G+ h, j' c
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ F( I8 [# }1 J6 T. k* U- e8 Z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! \  C5 n. \, t; D6 M
  11. *         TO CHANGE.
    - O& Y% ^5 R$ ^, R3 t  x1 |( S
  12. *$ M" s5 a" H+ E9 ?
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% g( ]3 C5 L5 X# v1 U4 C
  14. *; L1 f  R! u! M! J  T2 I
  15. * This program is free software; you can redistribute it and/or" \0 {3 d! N$ o# }% F
  16. * modify it under the terms of the GNU General Public License as+ M4 e( K; ]0 O
  17. * published by the Free Software Foundation version 2.
    5 n. d' j* @" n5 [; B! R4 Y$ [1 Q3 S
  18. *
    6 y" d) _, e& n! @6 g
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any" t% z1 R! m- ^6 [
  20. * kind, whether express or implied; without even the implied warranty
    9 V8 H6 d$ L; C: S, j: H
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    : u$ c) z7 i+ m; D- j, \* ]
  22. * GNU General Public License for more details.
    4 I5 e& r7 v) j0 ?
  23. */
    % ]# [2 U7 `, E) e, b

  24. 2 }. h( x. ~5 b, W# B8 v/ L% P8 t
  25. #include <linux/module.h>, X1 [0 w/ U0 {
  26. #include <linux/init.h>+ M4 f) ?( x8 h3 F/ v
  27. #include <linux/errno.h># H! e8 y# T0 M$ U0 t
  28. #include <linux/types.h>/ W9 }* k8 i# w  N4 O
  29. #include <linux/interrupt.h># X0 h0 a+ K: U5 @( ?" T/ L
  30. #include <asm/io.h>! E# Y4 d  l' Q5 t
  31. #include <linux/moduleparam.h>3 L$ l* a7 B8 @, b
  32. #include <linux/sysctl.h>/ n  q" J' W$ K+ Y7 C. U
  33. #include <linux/mm.h>$ ]! G* w2 B. _0 {! L& v
  34. #include <linux/dma-mapping.h>
    / B/ U  D$ R" u: E  z! a/ M
  35. " l# y9 e) s' n" ^. |, w9 H! A
  36. #include <mach/memory.h>3 S  k+ k! f: j
  37. #include <mach/hardware.h>2 i( G! k$ Z& t# b/ ~" j( i+ E
  38. #include <mach/irqs.h>- {& j6 ]& y5 Q& c- k3 L
  39. #include <asm/hardware/edma.h>
    % v1 ]: T9 t, e/ V, j, t$ I1 h

  40. / _& ]  W8 G2 \' P
  41. #undef EDMA3_DEBUG
    " Q: Y" K" o; y4 p) i+ E- H
  42. /*#define EDMA3_DEBUG*/
    6 V" z% w) ^, ~7 F4 b, l

  43. 9 K% m" P( D' C$ A; z1 V
  44. #ifdef EDMA3_DEBUG' r4 d: H' ^- x% |
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% b6 \  `% k- h2 Y3 Z& z7 G( U
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " n" F% V3 D6 T3 E
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# ^1 m  R: z+ o' z( J0 K- p2 S7 X, {
  48. #else- O; k3 }, o3 B+ E1 U. O) O
  49. #define DMA_PRINTK( x... )* F: v! x. p+ Q! Y
  50. #define DMA_FN_IN  Q. o% h: w" b8 P! U8 I
  51. #define DMA_FN_OUT! c- l) C3 t  X& S8 O, f* h0 K
  52. #endif5 b) k5 z) d" I# _
  53. 7 B/ R7 g* T- B* }( P
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)) c9 o% h! H0 Q5 q5 \& g
  55. #define STATIC_SHIFT                3
    # x6 f- g3 q- ~# R- w0 ], v
  56. #define TCINTEN_SHIFT               20
    - Z/ ^/ R% z1 _, E% X' q  N4 I
  57. #define ITCINTEN_SHIFT              21: _, N1 Y# z: }) A9 a8 m4 K
  58. #define TCCHEN_SHIFT                22* j. v4 l1 o+ D0 N% G% t# Y$ W
  59. #define ITCCHEN_SHIFT               23
    + [! j. D2 g* D1 ?4 R) ]7 T
  60.   s( n* c* N, L2 S1 S! n
  61. static volatile int irqraised1 = 0;7 G: h6 T4 t$ J! n% ?
  62. static volatile int irqraised2 = 0;! r# c9 w5 B; g
  63. . `; n( o, ?) c$ C. X- O3 b
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 J* ^9 c3 f; _' \+ ^  \
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" v+ e, z/ ^) z/ @# l& K- `/ l
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( R! }( u  \1 Q8 o

  67.   ?1 V- ]9 I. F+ X" b8 V6 E
  68. dma_addr_t dmaphyssrc1 = 0;* }) k! O* Y6 a; r
  69. dma_addr_t dmaphyssrc2 = 0;3 m" p9 m' ?. L" F
  70. dma_addr_t dmaphysdest1 = 0;: B6 ^" e. i  T
  71. dma_addr_t dmaphysdest2 = 0;
    : o, b& ^. q) a$ v, _: }3 D1 Z

  72. . ^4 k; u1 l" H. \
  73. char *dmabufsrc1 = NULL;  s- E. X) `5 W! O6 G
  74. char *dmabufsrc2 = NULL;
    7 ^/ ?% w7 f3 v
  75. char *dmabufdest1 = NULL;
    # [6 z' ?9 Z" Z! W3 f) c' \' h& i
  76. char *dmabufdest2 = NULL;* u) S) Q7 {! [, D" y( _

  77. : e, g6 U7 c: k# ~8 X6 I( X- U- n
  78. static int acnt = 512;
    : H; F  J  i+ ?8 x& @% O' m2 J5 h
  79. static int bcnt = 8;
    * R2 q- y* x4 K* ]! J( v4 g
  80. static int ccnt = 8;6 P' g5 Z0 Z3 t' ^5 F" L

  81. 4 v. n' Q% M2 L  e' _! z  @
  82. module_param(acnt, int, S_IRUGO);
    5 t/ O. }* ?% ]3 O) `
  83. module_param(bcnt, int, S_IRUGO);: j( E* Y. k( f, l
  84. module_param(ccnt, int, S_IRUGO);
复制代码

8 F8 B& N- C7 ^1 }8 p
# m1 z, W7 s1 a  x' u1 V# L5 @1 ^  C      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& X6 I  j5 e( a# Q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ Q+ O' y9 ^5 \( Z     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* S8 ^0 i! ^$ f7 m# a; G& B0 a$ O3 `" `
2 c3 e; n. e# K7 z( |
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-10-15 17:13 , Processed in 0.036989 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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