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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - f2 d$ `) Y5 ]* ]0 j0 M9 y
  1. [code]EDMA sample test application
    9 E0 _# w* C/ x% }0 f0 y9 `
  2. /*" @( l& E5 X3 l5 E) |
  3. * edma_test.c
    ) `- `: V3 M3 Q) c2 i/ t+ Q
  4. *
    ' \& q, b- |4 C6 n! N5 {* \6 _
  5. * brief  EDMA3 Test Application+ _& E1 }* F6 ~9 s" F+ F. \
  6. *% u+ z; A2 F# }/ C& g+ b
  7. *   This file contains EDMA3 Test code.3 @0 _5 c+ t+ i  V. i5 A* w& b
  8. *. Z' H; w3 [4 R; M: ?9 f
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    6 g2 O! d5 z. F! K3 F) f+ S
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( t6 y4 n9 W6 M9 N1 l
  11. *         TO CHANGE." s( b1 c+ K! ~5 K
  12. *# |8 B6 l( d4 B8 c
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  |- _' w3 U7 _" v6 n; G
  14. *
    3 p: z. y: r+ u) e! J" V/ I
  15. * This program is free software; you can redistribute it and/or
    * ?, e5 C  a% s
  16. * modify it under the terms of the GNU General Public License as
    1 a5 C" k2 }# S, n7 W3 Z6 H
  17. * published by the Free Software Foundation version 2.
    0 P" ]5 y) k$ |
  18. *% H, y4 b. L% |* p4 Y3 l1 p
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 y* k9 N/ L2 Y+ q0 p* l( J; j
  20. * kind, whether express or implied; without even the implied warranty. m; W) s! }# U! P: H
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7 |0 \$ d1 }. `6 D4 Z& d
  22. * GNU General Public License for more details.. X6 o9 O( E4 D/ ?6 B0 }  ?6 |( F  S
  23. */
    6 P* {- A0 a5 D/ o

  24. ; I& M' T  e  C: M: [- a+ g
  25. #include <linux/module.h>" M3 P; b9 S+ i
  26. #include <linux/init.h>2 f1 B! `, i) G7 ^$ p
  27. #include <linux/errno.h>1 W# p* G# q- y  S
  28. #include <linux/types.h>- T" k1 W: r' c
  29. #include <linux/interrupt.h>) |$ `" @3 G. }' P* F
  30. #include <asm/io.h># y# Y7 s" {% [
  31. #include <linux/moduleparam.h>
    - P9 A4 {" r" B
  32. #include <linux/sysctl.h>
    ) Z# H% x. A+ x6 M
  33. #include <linux/mm.h>5 {4 {6 f; y. X: X7 b
  34. #include <linux/dma-mapping.h>: G! p3 t- E- S* g, U1 ~
  35. # ]7 \0 `2 m6 p% _+ @* O/ P
  36. #include <mach/memory.h>
    " z* i* u/ R9 J0 F8 c
  37. #include <mach/hardware.h>
    ( _/ u2 A! X' A, w& |2 p+ Y1 a2 |8 S
  38. #include <mach/irqs.h>
    5 a2 e2 E1 U0 l8 |) Y7 m
  39. #include <asm/hardware/edma.h>/ ^0 ^) F' ?* F  i8 d! w
  40. 5 D1 i+ }  S* m
  41. #undef EDMA3_DEBUG- g& s' J2 C% C1 \% x
  42. /*#define EDMA3_DEBUG*/# @& e7 Y5 R& N! e+ G1 `$ P
  43. 7 n: h, a- H# Q! D! h$ U8 j$ W
  44. #ifdef EDMA3_DEBUG
    " N" ~; A1 I+ }1 w% d! n( Z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    * ~+ P( l6 T7 ~" p/ S
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( i  o% X$ y" A: H1 ~! u
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    * W" ?$ I+ l. J
  48. #else' i/ c. G8 }7 A1 e! ?! g
  49. #define DMA_PRINTK( x... )
    4 _) E7 W1 P& A" @+ D' f5 O
  50. #define DMA_FN_IN# Z& k: Q# n8 J/ t4 x: J
  51. #define DMA_FN_OUT8 C1 h# K- U) J: s. L
  52. #endif+ B3 @2 H# U0 V; X  p# a

  53. + M- U0 S$ B, z$ l, `, M/ ^/ @& c
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    * N2 K/ M6 Z. l2 z$ H
  55. #define STATIC_SHIFT                32 K5 b. Q" v$ L) R) B# I
  56. #define TCINTEN_SHIFT               20
    ( r3 l9 d6 p2 _+ j3 B
  57. #define ITCINTEN_SHIFT              214 N$ {. `6 v7 h9 {- b
  58. #define TCCHEN_SHIFT                220 a" z% E$ U  Q
  59. #define ITCCHEN_SHIFT               237 l+ L3 ]  Y% V1 ~6 Y4 B9 A

  60. ; Y6 W, P& N  H( u- L. `
  61. static volatile int irqraised1 = 0;
    1 F& \) A" J+ U$ m
  62. static volatile int irqraised2 = 0;
    6 j0 J' |: i+ ^* g' {

  63. 6 y9 U$ j9 L4 j4 Q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - x2 I$ D- j, F; S; I
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( f, n) S! ^2 Y2 i
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 ?8 q8 e5 @1 p% G7 I% C2 L
  67. & o% o( H" h9 Y# _
  68. dma_addr_t dmaphyssrc1 = 0;
    * v' e0 D7 X) v3 p% A  w+ q4 V
  69. dma_addr_t dmaphyssrc2 = 0;5 M; S% b: K+ R! w! p
  70. dma_addr_t dmaphysdest1 = 0;
      B+ D5 l2 }+ N; Y6 D
  71. dma_addr_t dmaphysdest2 = 0;
    ; J  Z, n4 Y6 F- C; {4 h2 a

  72. 5 m1 M7 Z" P- N, p" i1 i
  73. char *dmabufsrc1 = NULL;
    ; z9 U5 R2 a6 Y* z
  74. char *dmabufsrc2 = NULL;
    % y+ ~; A9 X8 D: @7 {, p' a
  75. char *dmabufdest1 = NULL;
    2 R0 N# }( ]8 ~
  76. char *dmabufdest2 = NULL;+ u) R0 a: _4 O) _5 W
  77. . {" w( }( A" M3 _/ u3 o9 O$ V
  78. static int acnt = 512;
    & C5 A5 [: y  l# D; M
  79. static int bcnt = 8;
    4 c& g, C- [4 r/ C! o
  80. static int ccnt = 8;
    9 V) g$ j" Z+ N

  81. + V; e: k0 b! `2 i1 e4 `
  82. module_param(acnt, int, S_IRUGO);2 m% w/ U& H; d7 d4 n$ X( i
  83. module_param(bcnt, int, S_IRUGO);
    5 _; P# R2 |3 Z, a; W, {/ Q$ c
  84. module_param(ccnt, int, S_IRUGO);
复制代码

9 U' f7 ~$ y7 d  y9 w
5 H& z) V; l( o8 d- U1 z9 _" o      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 |9 ~. `: ?+ M! m( }5 }' v
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
  R- Q; X- S3 Z5 C# n     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, \2 W. o& S) x- o% _
: g7 d/ K% Y& i( J/ \- p6 z* x8 b1 ]3 ^/ D9 L. X$ m6 j' B
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-18 13:54 , Processed in 0.037548 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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