OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: V0 I1 Q! t. Q, N
  1. [code]EDMA sample test application1 X1 O, D2 \" ]- N2 o/ s
  2. /*
    5 I6 @4 W$ S% y( f, ]
  3. * edma_test.c) o5 B! p, @5 {
  4. *
    0 N/ H' ^5 @' s" e# ]
  5. * brief  EDMA3 Test Application& I( f: b9 {# J6 I5 [/ O7 [
  6. *
    4 S! i) e4 e# Z
  7. *   This file contains EDMA3 Test code.
    + Z! `' a" N. t4 C  B4 D) d2 S
  8. *
    8 V' r8 D- z! U3 J. E
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- R8 F6 A$ r+ P* u" b- R9 V
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    . T! o5 U& D3 N. y' k$ z/ `; Y% I
  11. *         TO CHANGE.
    3 K& q. k2 w0 x) t9 M1 F: w3 Q- e# G
  12. *8 H, O# `* N( ~/ }. T; x7 q' e
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 l6 J  b  D! f* g$ w" g
  14. *+ l3 y" \& t* p6 [% x- y6 ?- S
  15. * This program is free software; you can redistribute it and/or$ g' E* k4 m/ d
  16. * modify it under the terms of the GNU General Public License as% r6 |* c3 s: |! V6 \4 k
  17. * published by the Free Software Foundation version 2.
    $ S4 E1 R, ?; A: W5 B$ O( |- }
  18. *+ L+ u7 X' w- D1 X
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 I" D, i5 Z& ^; Y: F
  20. * kind, whether express or implied; without even the implied warranty
    * Y- L: K" `+ F; o
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the3 t7 S7 l2 n  }4 _0 g
  22. * GNU General Public License for more details.
    4 h. e# b* H$ n1 Q8 `# B: x: i
  23. */
    # b; P. v; ^" S5 A8 G
  24. ' L* [% ]/ s, a4 p
  25. #include <linux/module.h>
    ; b: X% G# `* m) N
  26. #include <linux/init.h>
    % J  I/ P9 \0 [: b
  27. #include <linux/errno.h>
    # {) e, s  L; ?' ^) M. k5 e
  28. #include <linux/types.h>
    2 a  {' I( T* u) c2 T# r
  29. #include <linux/interrupt.h>2 e. L/ i* w2 d- p. s# E0 f' A  }. N- U
  30. #include <asm/io.h>$ x$ `( Z+ I( R- {0 R' q
  31. #include <linux/moduleparam.h>9 h6 `# }1 k4 {% J9 Y: Z9 x
  32. #include <linux/sysctl.h>! w7 Q& H. W3 h* t! _( E$ G
  33. #include <linux/mm.h>
    * m4 h  [$ _* J' s# u/ b% A9 J- q
  34. #include <linux/dma-mapping.h>& G" g$ F* u7 S
  35. 8 B9 \) y1 R# u# b
  36. #include <mach/memory.h>
    ( D( E. \; y. b4 C. I: N# m
  37. #include <mach/hardware.h>: }; I# ?6 R: a, ?+ @! P! }+ r
  38. #include <mach/irqs.h>
    / d3 Y, W8 `: i
  39. #include <asm/hardware/edma.h>1 \" f& s8 R2 J* {1 k3 [# b3 R

  40.   m% X( ^+ k" b! b2 h+ V
  41. #undef EDMA3_DEBUG, g7 R; H9 K8 b) G! H: L, K
  42. /*#define EDMA3_DEBUG*/
    1 t& V, e' g( g- m" o; N

  43. ) E3 c0 Z, |3 J5 z$ f2 Q) P1 b
  44. #ifdef EDMA3_DEBUG6 P% P# J5 i# C
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), H3 V: O& L: c" O) ?( \( S$ A1 l
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 t' P! v4 Y5 o7 H3 n
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 _' q/ v7 i# t! n
  48. #else
    / ^* J1 V  z6 L: s  Y- |
  49. #define DMA_PRINTK( x... )- I2 o0 Z0 ]$ h: a" u* b
  50. #define DMA_FN_IN
    ' H' h( v2 P2 g( {' F8 W
  51. #define DMA_FN_OUT0 n3 E' m3 @. v( R# H
  52. #endif* |, b6 g, d/ r9 a" t& ]4 k, T

  53. + n, a5 n1 Y& k! B! r
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    % @, s" B. E) P: s7 ^, v
  55. #define STATIC_SHIFT                35 |# B7 \7 z. |0 G% q
  56. #define TCINTEN_SHIFT               202 s+ Q% W& K/ {& w  W$ [6 X6 g, t& A
  57. #define ITCINTEN_SHIFT              21
    # b& r# v0 ]# K$ k
  58. #define TCCHEN_SHIFT                224 y% L' a% g: p$ m9 f9 O
  59. #define ITCCHEN_SHIFT               238 K; j! Z0 Z6 X  f5 ~

  60. ; q4 \8 V2 B# E7 D+ w
  61. static volatile int irqraised1 = 0;
    % P1 N& S6 n; ]+ c; L
  62. static volatile int irqraised2 = 0;( M5 e6 r$ v5 v( J0 B

  63.   d9 a. ]- P+ r) c- d! R0 ~& T* k
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      [6 H8 O' L) v
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ b0 V% V& u, ?. s: Z, e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; B/ a0 B( E' N- g  I, O
  67. 7 R' I6 `3 {7 d9 k5 U4 q
  68. dma_addr_t dmaphyssrc1 = 0;- ~- w6 ]5 R6 h% f; \. }. U
  69. dma_addr_t dmaphyssrc2 = 0;  Y% ?9 q4 C. H3 @1 w- O% b' t2 \
  70. dma_addr_t dmaphysdest1 = 0;
    " O" i' j# s/ P$ Z% G
  71. dma_addr_t dmaphysdest2 = 0;0 @+ W4 L( r% c% h

  72. # }' u1 a' d8 i( I  c7 [
  73. char *dmabufsrc1 = NULL;3 m: A" p4 q6 ~
  74. char *dmabufsrc2 = NULL;
    + D2 }/ D8 l5 N$ ^( a2 S
  75. char *dmabufdest1 = NULL;
    $ x( J7 ?" ^7 h$ m1 a
  76. char *dmabufdest2 = NULL;7 o  D  Y* A* `
  77. 4 x. @! I  z6 g5 ?
  78. static int acnt = 512;
    & ~) d$ B- e$ I0 Y! ?3 G
  79. static int bcnt = 8;
      `( R4 C  d4 e; T0 X; Z
  80. static int ccnt = 8;# R8 m+ ?8 `1 C0 e% [  Q2 g
  81. ; x: h" s; o" d! U0 A( s
  82. module_param(acnt, int, S_IRUGO);
    3 G: O; b0 [: ~5 |" j+ d. h
  83. module_param(bcnt, int, S_IRUGO);. G0 i4 d0 C3 v* d7 ]
  84. module_param(ccnt, int, S_IRUGO);
复制代码

; M8 [# r3 [  Z  ?5 D; g; ~) m( p
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ E: b. k% B) R1 Darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* o9 Q! C$ D$ q% a( |8 x& H7 w     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 {/ U# n: S0 G- ~) J  c/ v. q
+ u! b4 q6 r% I1 b: n+ o: o' i* E4 J; B4 U  I/ g: W
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

点击跳转“创龙科技服务通”

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

GMT+8, 2026-4-8 17:53 , Processed in 0.043293 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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