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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# n' \5 s5 a8 L
  1. [code]EDMA sample test application
    ' B4 q" V5 u7 W/ V
  2. /*9 S1 r9 B, w& w- J" G
  3. * edma_test.c
    + m' Q# E5 q% f. ~% ?' [
  4. *
    , e+ d7 _) g8 ^* B; Y7 r
  5. * brief  EDMA3 Test Application" n2 A1 o# P% f/ Q4 e
  6. *
    " Q3 x" D$ d1 b+ }+ U
  7. *   This file contains EDMA3 Test code.( I' F; f/ m/ F1 N7 I! D! o- u
  8. *8 c; z' R4 I) i
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 ?* w- G" r1 b& O  {* K
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 s7 s3 X5 \% q. [* R& F" P3 p
  11. *         TO CHANGE.
    4 R# l( ?2 \- E" R
  12. *
    0 |! P2 j& Q" Y. g2 P! Y) r* m5 C
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    2 D& q5 L  X  }" A* u* k
  14. *
    0 u, x0 |9 w% M4 r
  15. * This program is free software; you can redistribute it and/or$ B. H& I! [" \$ X" `1 z! n
  16. * modify it under the terms of the GNU General Public License as, \1 _' p) N9 d$ h( Q. y2 ^/ E" ^
  17. * published by the Free Software Foundation version 2.1 o" {  I) d4 `7 @4 d* J9 y, H
  18. *
    1 Q' W1 s, f0 k0 ~
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
      M$ N- m% X% a: V: I$ ~( n
  20. * kind, whether express or implied; without even the implied warranty! i. V( k3 @2 z' C& D
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ; W- I; l. A) U1 |
  22. * GNU General Public License for more details.' U% R7 L9 A& V4 _9 O' c, C( W
  23. */* S; c  N8 p: R/ Q5 c. H

  24. 4 ]/ F  V: U+ T1 i- y; s
  25. #include <linux/module.h>
    ' h% u, k. W3 }. P; T6 V5 p
  26. #include <linux/init.h>
    " P; y- p1 j: U- ~; Q) p/ U
  27. #include <linux/errno.h>
    + y5 M0 u5 D' T. V) J( b, ]
  28. #include <linux/types.h>
    ; F; B' _5 S0 J8 ^. \2 `
  29. #include <linux/interrupt.h>
    2 `0 T$ B4 K/ p! l" U
  30. #include <asm/io.h>$ I0 k( L3 f0 ^6 Y  J% W
  31. #include <linux/moduleparam.h>  r+ o/ O+ r. k+ g, s# M4 @
  32. #include <linux/sysctl.h>2 X# O2 T4 @4 a7 D) T5 N& @
  33. #include <linux/mm.h>' X: u6 H  t9 n0 g' ?
  34. #include <linux/dma-mapping.h>5 F# y9 {- h; h  k, n! p  l8 R

  35. ) [" q+ t; p8 |# g' o  V: w" G
  36. #include <mach/memory.h>2 ]/ C) S. ^; q, S; X0 k. P' g+ c
  37. #include <mach/hardware.h>& w1 {' x/ P1 M7 H8 a
  38. #include <mach/irqs.h>6 Y6 V; p& q+ @4 \5 @5 i* |0 P
  39. #include <asm/hardware/edma.h>
    * x0 l' @6 |7 M
  40. 0 ~% k$ C2 k7 {. H+ |0 E
  41. #undef EDMA3_DEBUG
    / H5 F$ z9 X6 N
  42. /*#define EDMA3_DEBUG*/
    : y6 p0 G' D6 v

  43. 1 q2 Y' ]. [. b' G& i, n
  44. #ifdef EDMA3_DEBUG8 v7 @; _0 P: \7 }% w. ^9 T% P
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), r7 G8 e: {& e/ q) b% I# b( j4 B
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ M) v& l, A1 f9 u. y; Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ' z* b6 D6 x, [# P7 i* S
  48. #else# `9 p* D( O) x% d, q
  49. #define DMA_PRINTK( x... )
    ! x; |$ Q' u4 E. @: A
  50. #define DMA_FN_IN' W1 R3 R) ?& Q! Y
  51. #define DMA_FN_OUT' x% N( L) Y- r$ R4 b1 W9 c% |
  52. #endif
    9 a: L! f, L& F/ u$ |( F) B
  53. 2 S- a/ M8 ~' C8 J
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 x* k/ N2 [; b) p' o
  55. #define STATIC_SHIFT                3
    ) u4 T. r  G9 o0 G
  56. #define TCINTEN_SHIFT               203 f5 G* C) _, |& y
  57. #define ITCINTEN_SHIFT              21
    ' v" P3 e  t  N* f% ]
  58. #define TCCHEN_SHIFT                22* u# O! e; d5 ]
  59. #define ITCCHEN_SHIFT               23/ a! `, k+ W( W* h

  60. $ n# \. B6 u% W  E1 O
  61. static volatile int irqraised1 = 0;# }; @1 Q) P- P5 `0 K7 L5 J
  62. static volatile int irqraised2 = 0;( M: ?& A* C# F) l5 i' ?9 j! y' W
  63. 0 O3 Y( c" ?9 L0 M
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 B$ {. i" k, A* j! N
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ I  {- d7 J3 E9 \; ]/ _8 {
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + m3 [1 s/ r; w. y. n2 ~! [7 X! w. _, D

  67. : i. V( S2 b1 D* ?) {
  68. dma_addr_t dmaphyssrc1 = 0;, T/ ^. Y. A6 A
  69. dma_addr_t dmaphyssrc2 = 0;
    : P: w# O0 f: C2 D" x: o
  70. dma_addr_t dmaphysdest1 = 0;9 @" l* {$ ~  g8 u$ @: r5 D
  71. dma_addr_t dmaphysdest2 = 0;
    % A. c) k+ v# Y. ^0 `

  72. : Z! i; `, i5 Y/ n
  73. char *dmabufsrc1 = NULL;
    5 [/ ^- L* W0 C5 G
  74. char *dmabufsrc2 = NULL;
    2 H4 G, u- X0 m1 F. x, w8 X8 `  Y
  75. char *dmabufdest1 = NULL;
    % g: X6 d: u, s( B6 g+ H
  76. char *dmabufdest2 = NULL;
    ( w! S/ ^5 K: V9 G3 ~7 C9 a
  77. , q( X+ C- i/ C$ ^* @2 [& v
  78. static int acnt = 512;- w0 J3 [: f3 k0 e$ o: Y% k
  79. static int bcnt = 8;
    ) d) q& [, G) |- u. |2 ~& z, u
  80. static int ccnt = 8;; r3 D: m8 Q: \
  81. / c7 V& a3 q! ?# U; c& D
  82. module_param(acnt, int, S_IRUGO);
    & x& Y; L( k9 I" `! f0 P( U; P) }
  83. module_param(bcnt, int, S_IRUGO);
    8 `0 {2 g- \) A: k+ A. u
  84. module_param(ccnt, int, S_IRUGO);
复制代码
- u; Y. o9 Z: X3 W7 I: g

2 ]: J' z. n7 Q      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ R: ~3 W" ~1 s& e
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; C+ M7 q5 ^7 c     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 c: ^7 R  I4 Z5 Y

5 b8 @) d1 P; n7 h* `& D; K3 S
& M1 H: V7 L, A6 `& }( L' C
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-26 13:43 , Processed in 0.039309 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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