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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: ]3 L" d7 U+ F, N; }; |, R
  1. [code]EDMA sample test application
    9 T; [  l' `# `/ K1 i8 S
  2. /*
    " q  O9 G; X, Q" ~) s9 a9 }- ^
  3. * edma_test.c
    5 m) S$ K2 g+ \+ L0 l% j0 O
  4. *  l7 P1 M5 {& @
  5. * brief  EDMA3 Test Application
    1 ~: z! S( S2 t6 i
  6. *
    4 c! p$ W5 P: l- H" b
  7. *   This file contains EDMA3 Test code.0 B4 T: n& Z3 [0 P8 |
  8. *
    . z) M  a3 Z4 U! q* w& D, i6 i
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      U, X! m% v" U, ?. }( t% p
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    / A$ K! \& M- q" w3 D
  11. *         TO CHANGE.
    - D2 T( T) s, x: w
  12. *
    7 q) e- N. ~/ @( [4 B3 L! t
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 c6 `' \- |! @3 Q6 C0 q! A( y
  14. *
    6 B+ i, }+ x5 |) C
  15. * This program is free software; you can redistribute it and/or7 ?6 G9 _- o; e) v& c8 M
  16. * modify it under the terms of the GNU General Public License as
    3 a+ A2 s, F: r! `
  17. * published by the Free Software Foundation version 2.$ O) E/ ?( I+ H
  18. *6 d$ f/ b' n& T4 Q+ h. E( e; L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any* p4 a3 A, N) v
  20. * kind, whether express or implied; without even the implied warranty
    7 f- J1 }# \" I& T* P' e; J
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 O1 B6 V4 j; J9 s- X) F7 }+ F9 b# |
  22. * GNU General Public License for more details.& q3 t' R: v5 d+ W* S0 j6 E
  23. */% M3 c: q1 H, T! K* W$ r. p( i/ o0 D) E

  24. 2 O. l9 s# T3 X1 n" q
  25. #include <linux/module.h>0 Z/ t' E$ ]7 [: l. B
  26. #include <linux/init.h>
    + L$ z, w7 q$ y
  27. #include <linux/errno.h>
    % n8 x" }6 T3 A, E3 C
  28. #include <linux/types.h>: l( P1 a* n5 O
  29. #include <linux/interrupt.h>
    . N4 t8 S4 G  |8 `+ N5 P
  30. #include <asm/io.h>
    : [8 L( f' I8 T/ I; ]* m
  31. #include <linux/moduleparam.h>  q3 q2 e2 O9 j
  32. #include <linux/sysctl.h>
    2 S* T6 v  n# b' f+ O  G: C- {; ?
  33. #include <linux/mm.h>8 D. ^8 \6 F: s" ]* h& n! @
  34. #include <linux/dma-mapping.h>- d/ D  U1 C! B: y' ^' H* E
  35. + |, l" x& F- W. N
  36. #include <mach/memory.h>
    $ p9 o) U% s6 d! r( ~
  37. #include <mach/hardware.h>$ Z- y8 z0 o7 Y5 \# Q4 |  A# g
  38. #include <mach/irqs.h>- @2 [- \* h4 r1 ~0 _
  39. #include <asm/hardware/edma.h>) a  ~) [4 m- b0 Y. V/ D4 l5 D5 Z
  40. 9 @: M( X) m% k: X6 G: Z8 v( c. z
  41. #undef EDMA3_DEBUG. E2 j+ [& M, \" k/ M' h) F" V
  42. /*#define EDMA3_DEBUG*/
    2 J1 P$ S! L5 I) ]1 `
  43. 5 k3 s6 G/ L' I0 \3 i
  44. #ifdef EDMA3_DEBUG3 }! o( a3 y* z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 H; M  F8 j; {$ J6 r
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    5 T5 K# r2 c, m) _0 w
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 e  ^% D$ n: F4 {% w6 S. y+ e
  48. #else. W5 l6 i. J3 L. l2 T+ R! E* l
  49. #define DMA_PRINTK( x... )+ O  n; O4 n6 P! p. a4 p
  50. #define DMA_FN_IN: K; M$ {  f5 A" J8 s5 t: X3 K3 N
  51. #define DMA_FN_OUT
    1 @$ w# V1 N2 ]
  52. #endif: J# K" l% U7 e5 M5 M

  53. - d& \4 r+ l% v+ P5 Y" P
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)8 a: N/ }, a( H) J6 U3 Y* r7 c( {
  55. #define STATIC_SHIFT                3
    7 K& X4 ?0 D# T- e% }5 p
  56. #define TCINTEN_SHIFT               202 X8 W; h3 Q, J7 n# p5 Z
  57. #define ITCINTEN_SHIFT              21
    3 q# L' s  \1 m* l
  58. #define TCCHEN_SHIFT                22* a) v' ~* X- [5 p9 m$ A, X
  59. #define ITCCHEN_SHIFT               239 ?( G+ ~1 l# d: M7 G& d3 Z
  60. + N5 u3 D2 R; Z8 A8 o3 v
  61. static volatile int irqraised1 = 0;; \+ D+ G: @1 Q5 X
  62. static volatile int irqraised2 = 0;6 {5 X2 z, z3 K
  63. 7 `/ d( ?$ Q: u: T$ i
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ O: f6 H% `9 `  v- S3 ~7 f6 s3 h
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . S8 V$ q; B1 s9 E- C8 j( L9 o- U
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 n" u6 _) D3 X4 N( I2 G: O7 u

  67. 4 I) E' g3 I9 Y6 z. ^7 y* i, q/ [
  68. dma_addr_t dmaphyssrc1 = 0;
    4 H$ b8 r$ k. f4 ?6 P, m' \
  69. dma_addr_t dmaphyssrc2 = 0;
    / c3 _" i5 W% U( C
  70. dma_addr_t dmaphysdest1 = 0;
    4 V! s2 B% W# E
  71. dma_addr_t dmaphysdest2 = 0;
    ) z# K( B) @+ t$ _4 d: X+ F7 F% f5 m7 {
  72. ' x$ W2 b3 P2 y; N2 \$ e
  73. char *dmabufsrc1 = NULL;
    ! }% X1 b3 ]% ]0 u4 r
  74. char *dmabufsrc2 = NULL;( J# q' G7 h% I4 c+ u' Z7 f/ v# h" F1 n
  75. char *dmabufdest1 = NULL;2 _% S4 K* x7 r% r
  76. char *dmabufdest2 = NULL;
    / S2 E' X3 A! L) d) K
  77. 2 B5 e" V5 m9 g" b0 i
  78. static int acnt = 512;
    / p  A8 w: }& l6 ?2 Y
  79. static int bcnt = 8;
    $ R7 |) G0 j& o3 X% |/ @& S
  80. static int ccnt = 8;
    8 n; y4 B1 x3 k6 @

  81. 9 `7 I, S% q4 m9 x, P2 r& V7 R
  82. module_param(acnt, int, S_IRUGO);/ h$ j( A9 Z0 ~5 \% V- h
  83. module_param(bcnt, int, S_IRUGO);/ g# `5 @* x7 O, g
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 a% q) t* h' v. y" t' ^  k7 u# x$ p

6 v! S% V: X; U$ i6 `      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ @( G5 V$ Q: 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。  M  c% ]1 C" G; o) P  R1 I
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, L/ s& `* v* X! u0 v' P
+ g6 ^1 a0 b  f5 r/ |
' K3 P# n  u- w- ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-18 17:26 , Processed in 0.040261 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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