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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) K0 d9 m' p1 G' B
  1. [code]EDMA sample test application! D, \" A7 C4 I/ F; ^
  2. /*
    " |0 W" K+ h0 l, S% y3 f5 w
  3. * edma_test.c9 C. f& x6 h& D+ `5 w( B$ j
  4. *2 f% p; p& w/ A5 X# O4 I4 f
  5. * brief  EDMA3 Test Application1 t$ S# R! u8 r* @; \
  6. *4 t/ z" a2 `/ Y; o; z4 F
  7. *   This file contains EDMA3 Test code.
    + B5 B9 F# c8 ?4 }/ J1 g4 r
  8. *3 q& t  i* N2 Z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    9 ?* T- m/ v- g  j4 X0 i
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & W( n( l: A6 S# P0 u6 j
  11. *         TO CHANGE.+ b3 q: V. r0 f+ x+ U$ U
  12. ** g* t# B9 y' H7 w4 I' h0 u
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" L, a7 H5 `, k7 u
  14. ** z5 n* i5 H7 y& I9 A
  15. * This program is free software; you can redistribute it and/or" Y7 m7 u8 j% ~' M3 l. F
  16. * modify it under the terms of the GNU General Public License as
    4 D9 x/ J/ q- ?1 N& t% j2 j7 G0 X
  17. * published by the Free Software Foundation version 2.  N; O+ b. ?( k4 p5 w
  18. *
    : V4 w7 m# ]$ ~6 i
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- y  l, t. v7 h# T6 [3 B  o) Z
  20. * kind, whether express or implied; without even the implied warranty  b' x% I6 V2 H- C% S3 @2 {. F
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % J1 @. v1 _! n4 ~% \
  22. * GNU General Public License for more details.
    3 b1 N* G- a3 n) y& n$ U7 K. R
  23. */
    / e1 N9 N/ y. m/ M0 n4 w1 x
  24. & H5 j$ k( W3 n) a) p
  25. #include <linux/module.h>- G% e' X1 t& \0 s9 W
  26. #include <linux/init.h>
    ! X9 i1 V  J8 A$ |% z! o
  27. #include <linux/errno.h>" j# }$ a. L; G3 j% E) s' A
  28. #include <linux/types.h>5 U& k  _, }, J- q8 `, ~2 ~
  29. #include <linux/interrupt.h>6 T- M* R3 h8 ]- Q: p" s
  30. #include <asm/io.h>
    6 u8 ]% ~4 b/ D! Q
  31. #include <linux/moduleparam.h>; T' t' P: ~. r) S3 m$ H
  32. #include <linux/sysctl.h>0 _% K$ p9 N1 z8 A3 z# h) X
  33. #include <linux/mm.h>
    7 U* w  [: m$ }) L
  34. #include <linux/dma-mapping.h>; }9 B9 y( P- r1 ?
  35. + |6 `7 L  Y# \6 X9 s/ K, R% b* F
  36. #include <mach/memory.h>; B7 b! Q  I" B5 q$ Q. M% X
  37. #include <mach/hardware.h>! k3 P9 r/ W4 ]/ R
  38. #include <mach/irqs.h>. q2 G- f' `0 ]8 {
  39. #include <asm/hardware/edma.h>
    2 E5 N) c9 [! v) a6 J& v( F. Q) E
  40. + ^! k8 _8 }1 C) O5 Y; b
  41. #undef EDMA3_DEBUG
    * r' [+ K+ A! H8 c9 M
  42. /*#define EDMA3_DEBUG*/. m2 Q: G& V  s- L

  43. 8 j7 v, ]  _$ r6 z3 ?# ~8 x0 H& i  M
  44. #ifdef EDMA3_DEBUG
    5 _; A7 |; B! o
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( U9 }, @9 L9 f# Z0 W- }* N7 }9 q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & t. X! d0 C# |; F) b& j: ?8 I
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    0 ]5 R) m: c9 b$ M* i
  48. #else0 e4 M" Y) W! z! b& L. x
  49. #define DMA_PRINTK( x... )0 S# Q  g% |3 a
  50. #define DMA_FN_IN0 u% H3 f; Y+ Q. Q; H; l
  51. #define DMA_FN_OUT
    8 y* H1 `; o/ e, Y5 n$ Y: n; h
  52. #endif
    & |' v! G/ p2 B' G- j
  53. + t1 [6 K* m) _( G( w0 W! c* s
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    5 _6 t4 \1 T1 w7 Q9 g9 y
  55. #define STATIC_SHIFT                3
    # E9 `0 V' t+ R2 |4 Z6 y' ^+ w
  56. #define TCINTEN_SHIFT               20) ~$ M9 r" C7 P
  57. #define ITCINTEN_SHIFT              21! e+ D' O6 d! c
  58. #define TCCHEN_SHIFT                22
    / o$ A! O2 Q+ l1 {
  59. #define ITCCHEN_SHIFT               23* c$ \" L4 [, z. {# x2 _

  60. 2 \, L( m* V" o# [1 h
  61. static volatile int irqraised1 = 0;
    ' B& r5 D( V7 s3 s4 ~" p
  62. static volatile int irqraised2 = 0;/ G# G- u0 D0 J. p2 L

  63. % d6 H" D8 P2 _$ e
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: [* X) ^4 ~/ |, n, G* `- B6 }: e
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# j& Y7 y/ a' T6 w$ V9 R. A6 c
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ W6 s# q: [( x: z

  67. + T( M% D: l, d4 a, K4 W
  68. dma_addr_t dmaphyssrc1 = 0;8 v/ _0 m  g3 J% {6 O
  69. dma_addr_t dmaphyssrc2 = 0;
    1 R( P: ~' T8 @! b, K  V
  70. dma_addr_t dmaphysdest1 = 0;
    8 i: O0 p+ ?, R  [* O6 ^8 t) M5 U3 I; t
  71. dma_addr_t dmaphysdest2 = 0;
    - L5 \; M5 T( C

  72. % R/ n/ l1 V# G
  73. char *dmabufsrc1 = NULL;8 s( V9 w( X0 z6 P' F
  74. char *dmabufsrc2 = NULL;
    + d( R/ D! Y3 H# g! |4 T: ~9 ?
  75. char *dmabufdest1 = NULL;4 e$ G8 K+ \8 @& P
  76. char *dmabufdest2 = NULL;
    - X+ O+ z2 a3 Q: X* @8 A% A

  77. & c* K2 q4 K8 k) g! v5 C
  78. static int acnt = 512;  J/ {4 t5 q! J4 y0 B- B6 Q+ l
  79. static int bcnt = 8;
    ; w( [3 P8 K8 H
  80. static int ccnt = 8;3 d$ d6 I- j8 S5 R: _+ r
  81. * @7 P$ G& j% Y
  82. module_param(acnt, int, S_IRUGO);
    2 h0 K# V' c. l
  83. module_param(bcnt, int, S_IRUGO);4 N) }* m: B+ c$ [
  84. module_param(ccnt, int, S_IRUGO);
复制代码
  ~' I: K6 R2 `" X) ]- z
* w8 b! _8 k- s+ T$ }. Q
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 R- H; ~0 c2 S
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( l$ g9 _) e- n8 V5 f& D: j# L     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& z1 h* ?/ m7 e% m7 B
1 t: q& B2 o; \0 j& q, g) I+ ?' a
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-22 13:45 , Processed in 0.039191 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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