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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 G) @( m; M/ G  E3 J8 H
  1. [code]EDMA sample test application
    * G6 V9 H, u9 Z  Q1 }+ k% O4 g
  2. /*
    $ d7 u: o' r% s. x. k6 K# l$ b
  3. * edma_test.c
    ; L# f/ b5 A# M7 o0 s+ ]+ A. S# Q
  4. *
    , b8 ?* R5 Z) `9 R& [# T$ \3 _
  5. * brief  EDMA3 Test Application' ?' i- [- o. }
  6. *2 u& ]- R) F3 ]- x5 U
  7. *   This file contains EDMA3 Test code.4 p  _$ `( m9 @3 R5 F0 b3 q+ ]- s
  8. *, X2 Q4 `9 w7 ]) D; U6 ^. W3 w
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  K- P. g8 ]0 ^7 K
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 G: l, p* d# d: r4 i
  11. *         TO CHANGE.
    9 _/ k4 L" k! V) j& t- Y6 F4 b) T, B: S
  12. *& I$ ]. L* |8 g$ z/ v8 [& {
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% ?0 h" R9 a* M& i1 b2 v
  14. *
    ; `# J; t' x# g
  15. * This program is free software; you can redistribute it and/or
    % t( ]% `  y2 @: x# Q- _0 c- S! F
  16. * modify it under the terms of the GNU General Public License as
    9 M/ Z! a+ A$ c% t) k% H
  17. * published by the Free Software Foundation version 2.5 {2 k: M5 b3 ~1 F2 {$ M
  18. */ T+ S5 K+ P+ c- ?9 S/ S( \
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / j  Q- ^2 i+ Y2 Y3 J. x. ^
  20. * kind, whether express or implied; without even the implied warranty
    6 g0 F4 i( P& B' n. g
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . P! b) V% N0 L& `
  22. * GNU General Public License for more details.9 O8 N) {+ b  H$ x" Q; c  e
  23. */
    ( r" g% [6 A) H7 V# |
  24. , B* p0 N9 M  `
  25. #include <linux/module.h>  Y* y2 P$ ]/ w" {- E
  26. #include <linux/init.h>* h. T& [4 T1 ^( [0 P, N# ^. v
  27. #include <linux/errno.h>) B. |* U! ^. C" l: N+ t
  28. #include <linux/types.h>0 k6 E0 S4 {. c: A8 [) S, e
  29. #include <linux/interrupt.h>
    % x& }4 e3 K" G0 q3 {0 \- R
  30. #include <asm/io.h>0 h0 G3 Z3 ^1 N1 {3 t
  31. #include <linux/moduleparam.h>
    ' U  @) L/ f/ U
  32. #include <linux/sysctl.h>
    7 _( y9 n  v2 c# b
  33. #include <linux/mm.h>0 W  x8 u3 B4 r8 L; J9 U0 ]
  34. #include <linux/dma-mapping.h>* P, |( c- F( `& q

  35. ! _2 M) H3 r! Q$ J
  36. #include <mach/memory.h>, p/ A1 P) D1 q& ?* C
  37. #include <mach/hardware.h>
    8 k4 U, n$ u% x( b! X9 l' [
  38. #include <mach/irqs.h>5 ]5 q: `2 X0 U: S
  39. #include <asm/hardware/edma.h>+ F3 t! p3 W) b) K) d

  40. / T4 ^5 T4 M' {$ W9 i% k% E
  41. #undef EDMA3_DEBUG: G0 ]; e/ }' ]0 E
  42. /*#define EDMA3_DEBUG*/& f$ d$ W5 G' o# h2 ?" x# s* E/ M
  43. " F) B1 [+ l8 H' L$ |
  44. #ifdef EDMA3_DEBUG
    " @$ X, P$ W9 ?* e
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    4 w) P! ^/ V2 q* t' C
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    , V9 k- |5 x  q: ?5 b2 W- I( i
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 q. A& t( p# z8 V1 e7 h
  48. #else
    2 T9 @' i: R/ v9 s) A! x: x
  49. #define DMA_PRINTK( x... )- y) \+ ?/ U( `; g5 M
  50. #define DMA_FN_IN
    ! g. d# w  u/ U7 V! I$ |2 E
  51. #define DMA_FN_OUT2 ?/ Y  M9 _) c6 s4 f3 y8 s
  52. #endif
      G" S" M" ?2 e' O

  53. + m# N: }0 H& q& g' N4 R
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)* \3 b/ f* _8 E" c! }
  55. #define STATIC_SHIFT                3
    # h3 X6 n" a& @/ `
  56. #define TCINTEN_SHIFT               201 d5 j$ Y9 A* Y  g! g
  57. #define ITCINTEN_SHIFT              21( K5 W, K2 V1 @
  58. #define TCCHEN_SHIFT                227 ^( N" Z8 E0 \6 }1 R
  59. #define ITCCHEN_SHIFT               23# c5 f$ o) @% c4 o
  60. ) |/ c& o( |7 W* Q$ c! S
  61. static volatile int irqraised1 = 0;
    0 y9 e- n+ Z1 K- X2 X. Y( s/ D+ X1 M
  62. static volatile int irqraised2 = 0;  L2 O6 d$ J4 j6 _5 b) ^
  63. , L, x/ I# b% Q& m; c2 R5 x
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. \4 U) y. j$ E6 e% f- u
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 V: X  `* e% G& Z9 y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . V4 n, F" O! H  r; m( A) y

  67. 4 A. K, o1 ]6 y
  68. dma_addr_t dmaphyssrc1 = 0;
    5 m) Z+ O5 K0 m9 S& p5 t
  69. dma_addr_t dmaphyssrc2 = 0;( I* `% `+ u/ p5 `5 r3 w
  70. dma_addr_t dmaphysdest1 = 0;0 a& w$ x% F* d2 C; G, p: `
  71. dma_addr_t dmaphysdest2 = 0;
    * S* k5 H) T+ [- `! R

  72. 5 X5 i, G  w7 K0 a8 L# _* z
  73. char *dmabufsrc1 = NULL;
    " z1 y( I3 a  h8 \9 `& H6 y3 M
  74. char *dmabufsrc2 = NULL;! t1 O5 @1 _! }9 W# L! ^6 ]- [
  75. char *dmabufdest1 = NULL;% K3 i+ ~# V, x
  76. char *dmabufdest2 = NULL;- s  K- I$ Y+ c8 ^: c

  77. & {; k, z+ S/ `1 J
  78. static int acnt = 512;0 p( S7 P5 I4 i# G; ]% ]8 F
  79. static int bcnt = 8;
    % o* k2 {& s, E* a  I
  80. static int ccnt = 8;
    ! e% [2 `( U) `0 U( F$ e
  81. ! }+ y# Y6 G0 F# P/ k5 P
  82. module_param(acnt, int, S_IRUGO);
    8 n- \0 X# N' W% c+ w( I, U
  83. module_param(bcnt, int, S_IRUGO);
    - H8 t+ `! h2 k
  84. module_param(ccnt, int, S_IRUGO);
复制代码
% ~5 m9 m- y. _& ^! ?, S! \& h6 Y: x
" F5 A4 f9 [* ^* _! Z& B0 w
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 o' k: D$ t7 c! d- ^( p/ sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
  B7 w1 x. p( f     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( N$ |7 K0 e. S. K: G" e
. p4 f. l& `3 J$ l! p7 Y4 M

4 t/ v. l7 n) E% R, M
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-12 18:12 , Processed in 0.039650 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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