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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! {. v' u8 V" u9 J2 c
  1. [code]EDMA sample test application; A0 p. Q( B2 ^8 ~
  2. /*
    4 U1 w$ o9 I' C. b$ @& ^# b) t
  3. * edma_test.c
    + j! q& ]  c  l4 U) B  F
  4. *( O: S5 j' n9 Z" x! X) t7 I
  5. * brief  EDMA3 Test Application- `" v+ B; b: T5 z, [
  6. *
    ; ?( B. Z' Y  a+ k! ~
  7. *   This file contains EDMA3 Test code.
    8 W: w: y7 ^& o' G2 P$ l7 S
  8. *
    * S  N8 r4 \* K% [5 c
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 u) G6 w* ?; x0 ^2 T5 f  S
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( V! h( e2 f6 K4 F6 U  ]) ^" A+ M' u' g
  11. *         TO CHANGE.. x/ B$ f4 X3 }, @' m5 o
  12. *' ]1 ~! A6 Y" v5 @. b9 y4 s
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    : T7 f5 g4 Y3 n; s& e% N
  14. *
    + p( j+ |4 H* O" V: |" y4 G
  15. * This program is free software; you can redistribute it and/or; A3 K- S% M+ b. e- q; m9 y5 f
  16. * modify it under the terms of the GNU General Public License as- Y9 {5 j, j, o" d. J& g- l' `0 W
  17. * published by the Free Software Foundation version 2.
    ! W! `: x) K8 Q+ H) N$ b
  18. *
    2 @0 c. x0 ~: \) [( }* J1 _$ w+ `
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    $ L, O3 H6 H! }* Z! f; E
  20. * kind, whether express or implied; without even the implied warranty
    7 K4 |; t9 ~% A7 ]' e0 k; }2 E
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3 \: O4 Y1 x# n* V! Q( ~1 G% J
  22. * GNU General Public License for more details.
    1 n+ L1 F) l! p' W- j( }3 Q
  23. */( g, G  S& Q2 V" f

  24. : v6 V' S1 Y7 T+ n: H" G
  25. #include <linux/module.h>
    % d- ]; W0 y: O9 \, C& h
  26. #include <linux/init.h>
    " J  y- F  T1 G! `3 V3 _/ }
  27. #include <linux/errno.h>0 y8 V9 R/ H4 Z2 s& \* {
  28. #include <linux/types.h>
    - d# m7 Q' ~) D# F
  29. #include <linux/interrupt.h>: j- c9 N1 k( P
  30. #include <asm/io.h>7 t2 K. B3 X  F, B6 |
  31. #include <linux/moduleparam.h>
    ! S! j( ^  U' B8 E* E9 u( _
  32. #include <linux/sysctl.h>
    8 d" L+ P  c: B& L
  33. #include <linux/mm.h>2 g7 y; |3 d8 O
  34. #include <linux/dma-mapping.h>
    % D  p, w2 _/ @

  35. + ^# E/ ]7 b/ A) G3 t% M
  36. #include <mach/memory.h>7 {) g: l& C9 P* N. _$ X1 i
  37. #include <mach/hardware.h>
    ! e7 \& F# l, L  @
  38. #include <mach/irqs.h>
    6 w4 `( p, j5 ~# q
  39. #include <asm/hardware/edma.h>, p$ q2 P9 g1 h% S. K9 x9 y) R
  40. 0 h: p( L7 F  q$ V
  41. #undef EDMA3_DEBUG
    ) c/ z6 t' A- k/ C  P
  42. /*#define EDMA3_DEBUG*/
    6 u9 W& F) g  G8 Q1 U0 z
  43. / k; R7 m7 L: L) T& O" f2 ]! R' }
  44. #ifdef EDMA3_DEBUG7 p; s7 j" u6 j( L1 m  x! F' C
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) Y/ O. G8 x% o! ~: @( N
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    + S0 i! @5 @/ A( l
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 J3 j2 S6 q  X6 i3 m7 A
  48. #else
    - m* G; `1 y/ X# A/ H! `
  49. #define DMA_PRINTK( x... )! X( ^# K$ u) J" e  s0 l7 p
  50. #define DMA_FN_IN4 w# \8 O, @* g3 A$ u) ^
  51. #define DMA_FN_OUT8 _. @2 `6 {: ^9 k& B/ ~' d
  52. #endif( k7 G3 F  G! {3 J

  53. : P; ?/ J, J8 y, V: i
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)% X. q5 t4 q: [! H
  55. #define STATIC_SHIFT                3
    3 T: q$ J% a% J6 `( @* V$ Q5 }; c
  56. #define TCINTEN_SHIFT               20
    9 ^, x& T$ j! O% |" W/ q
  57. #define ITCINTEN_SHIFT              212 F8 {7 k8 W! [2 r& e
  58. #define TCCHEN_SHIFT                22
    & E6 ]- R, T5 }( [0 K7 m4 @+ n
  59. #define ITCCHEN_SHIFT               23
    ' A+ v1 {( s' O! S- n6 P2 q
  60. ! m2 ?* l0 O; b+ R! x+ f" \
  61. static volatile int irqraised1 = 0;! p% \) T# |- j
  62. static volatile int irqraised2 = 0;
    * B! V/ l3 M! \2 ]

  63. . p) a4 L* L! E
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 @5 n& C# B2 d  H+ n
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ g' e2 n* ]/ V
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / S$ Z9 J- ^' T3 P% A6 t0 D

  67. 7 |' P) B" h1 o" _
  68. dma_addr_t dmaphyssrc1 = 0;
    : L& m$ L- S3 |; O" ?; i
  69. dma_addr_t dmaphyssrc2 = 0;
    : n% s; ^$ [% y. x' j/ Z! e' M/ j
  70. dma_addr_t dmaphysdest1 = 0;
    " b1 x6 o/ ^- v; G0 ]; v% ]
  71. dma_addr_t dmaphysdest2 = 0;
    ( T7 @2 Z; a% F" {& M7 E" o

  72. ( x$ }2 O2 N% ]9 y8 [  {
  73. char *dmabufsrc1 = NULL;# o6 ]: d' t& c/ ^" ?4 l* j9 |8 A
  74. char *dmabufsrc2 = NULL;
    4 @4 }5 t1 ^/ q6 P  J
  75. char *dmabufdest1 = NULL;
    ; B0 o; _. s: y* o5 M
  76. char *dmabufdest2 = NULL;
    : s. m. ?* f3 B. r

  77. & X3 R5 b  b( u: r) m9 A1 Z% T
  78. static int acnt = 512;
    6 X5 }+ S) \4 }' K
  79. static int bcnt = 8;
    # V' ^# W* I$ d/ L' w
  80. static int ccnt = 8;  x3 E1 ~( B3 B! R, o
  81. # }6 r7 p+ H+ }7 a0 b* ]
  82. module_param(acnt, int, S_IRUGO);  f& N$ C" S' y1 _5 n2 q
  83. module_param(bcnt, int, S_IRUGO);6 {! v9 T; ^* d  o! G
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ S  [- O; P! I; g4 Q6 {' p
% `9 N; ^7 g. u  F6 _% v      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: R6 S' ?# H8 T4 l' ]
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 ?! K) }; `* `     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ ~  s! ]1 c: }% E1 Q0 n: l8 r
- F) T; Z; H. g& z  U! A0 V# h- m8 e" c2 r1 l9 B) n
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-14 17:24 , Processed in 0.038050 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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