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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 S2 B! s% j+ L  T3 p
  1. [code]EDMA sample test application* D* Z& E5 f, E, J$ s' M
  2. /*1 o# I9 N# U5 J$ |: G( I% y& n
  3. * edma_test.c
    * t, e) k5 y* u* R& O( k4 ]
  4. *7 O' q+ x& A" d. j7 K0 j  o8 k% v2 C
  5. * brief  EDMA3 Test Application
    6 }9 f- B) `' }, j5 w7 w
  6. *' g& {6 K8 l* ~
  7. *   This file contains EDMA3 Test code.
    + K. S8 d3 N( Y! @$ t! n" R( v
  8. *+ D8 d! r" K0 d- t9 J/ @+ ^$ C8 F
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    8 F, q: S  C7 [
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & Z! c# Z1 m& i) H
  11. *         TO CHANGE.# ^* f) N! Q- l
  12. *
    0 f  P" D8 k6 x. a
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 h# H" T1 ^; [9 [
  14. *4 Z7 ]! `$ ~8 ]3 I2 _5 `& ]9 T
  15. * This program is free software; you can redistribute it and/or- B; @- t3 N  T  V
  16. * modify it under the terms of the GNU General Public License as
    3 _. R" i: u8 E4 H% d+ k. S& g
  17. * published by the Free Software Foundation version 2.
    , D0 n3 i9 m) a: M! t5 ?2 ?
  18. *" C, \& _- s* H
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ k1 H2 Z3 C9 r$ y0 z) p! _+ \# p' D3 E
  20. * kind, whether express or implied; without even the implied warranty- W8 G8 I0 Y+ y' e/ }8 ]( {; E
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) u& v5 b0 U6 {1 |3 f; E
  22. * GNU General Public License for more details.
    ! `9 `( ?# }& W" ]9 M
  23. */
    * y: z; j" {* w% x) E
  24. ( r. C3 h% o0 D6 ?: m) @6 z/ M
  25. #include <linux/module.h>
    - [3 g( ?/ p0 w! I
  26. #include <linux/init.h>: s+ D% J- O" C- j6 n
  27. #include <linux/errno.h>' r1 L9 i9 y$ X/ P* k( ?
  28. #include <linux/types.h>
    / w: A7 b7 Q" I/ G! h
  29. #include <linux/interrupt.h>9 s7 k. J# \% q# F
  30. #include <asm/io.h>
    - R  @3 K5 V$ {, y+ P
  31. #include <linux/moduleparam.h>9 {: ?6 j. U' h1 R
  32. #include <linux/sysctl.h># c7 L9 F/ q. y; S' ~: G6 _
  33. #include <linux/mm.h>
    5 J% @* Y( F+ Y+ M7 L% w& o
  34. #include <linux/dma-mapping.h>
      J4 A- @- C- m

  35. 9 a7 W3 X$ M" p4 G0 z
  36. #include <mach/memory.h>! ~; x! W/ G; x9 N' u9 V4 U0 Y4 d7 D
  37. #include <mach/hardware.h>* S6 T! v! v+ i5 \. R+ v
  38. #include <mach/irqs.h>% z! A+ X1 @! A# w1 E3 `
  39. #include <asm/hardware/edma.h>
    # s! v  _+ C$ G4 a
  40.   i9 j5 c! N" i. }1 ^
  41. #undef EDMA3_DEBUG5 h6 h; _0 h: D, `3 G! r& c
  42. /*#define EDMA3_DEBUG*/
    - L: o; b) Y2 q. y; f

  43. % ~3 e: A5 Z$ @$ M
  44. #ifdef EDMA3_DEBUG
    2 [% W! w0 x% o; p
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - p( a) S3 Q* L
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 F  H: h: |9 E6 `
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 R. t* J- v) J
  48. #else
    2 B! l, p: \* @5 w, Q  b
  49. #define DMA_PRINTK( x... )
    7 j: N; D. @2 C* E- K
  50. #define DMA_FN_IN
    ! B: b8 \  w! x7 s1 Z2 \: E$ _% u
  51. #define DMA_FN_OUT( D4 M) r% ~' a: \4 @$ i7 M% K: f
  52. #endif. {" \$ _# H6 {* [
  53. 1 \; r: s( e2 g! O% n
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; \* h; p: E4 }, E
  55. #define STATIC_SHIFT                3
    $ ]9 k$ i. h. N# x
  56. #define TCINTEN_SHIFT               20+ o* g1 V8 O- a" r2 ^, G) A8 a
  57. #define ITCINTEN_SHIFT              21
    1 r0 l9 o5 `% N; q: i! l
  58. #define TCCHEN_SHIFT                22
    4 d& X7 f2 q4 j- b1 R+ E
  59. #define ITCCHEN_SHIFT               23! A& Q( s8 y$ M8 J* [

  60. 7 T+ A2 I) u9 M+ {1 Z
  61. static volatile int irqraised1 = 0;
    & j1 }+ ?8 v) i
  62. static volatile int irqraised2 = 0;
    1 Y0 S1 z* ~; p8 b) M* T+ [

  63. " h% T# t  y7 n+ l0 G
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# m( ?- j& q1 y# t5 ]4 {: j" R& x. y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      t4 L$ c# |# X7 J8 g3 S
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( w' M% W" S6 l( `6 }/ O% ?* {

  67. / I% q6 [$ y9 K0 C0 l; l" ^5 d
  68. dma_addr_t dmaphyssrc1 = 0;
    ) C9 ^3 L: t/ q6 n& l
  69. dma_addr_t dmaphyssrc2 = 0;
    : Q- h4 ^3 Q' j& X5 M; c# w
  70. dma_addr_t dmaphysdest1 = 0;0 i0 _5 t/ I6 S+ F* }9 ^5 J
  71. dma_addr_t dmaphysdest2 = 0;2 \4 G  x  g/ J; `( u- c
  72.   A, K* ^, c* N+ r7 A& u6 N
  73. char *dmabufsrc1 = NULL;8 c( [  O. V! g. K
  74. char *dmabufsrc2 = NULL;) j; r; F; u9 }, _8 @. B
  75. char *dmabufdest1 = NULL;9 [' J8 y! v2 F% Z' R; u" ?
  76. char *dmabufdest2 = NULL;
    4 Q" O5 ]) r2 L& Z

  77. 9 q8 ?# c# A* i- @
  78. static int acnt = 512;2 n( O6 X8 q. e+ u9 \/ W
  79. static int bcnt = 8;
    & _3 e1 s& N- n
  80. static int ccnt = 8;! t2 d% z( }! m$ j

  81. ! {* s$ F; l8 s# z  j. ?
  82. module_param(acnt, int, S_IRUGO);
    * @) Q5 C3 c9 h3 f5 n
  83. module_param(bcnt, int, S_IRUGO);+ C+ {  ]1 W& e3 }* s# r
  84. module_param(ccnt, int, S_IRUGO);
复制代码
' \0 Y; a- S5 F9 G9 b
' T/ i7 |. W3 p$ d# Y2 M
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: v& G8 a* y7 J( Parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 [# _- c: \( ^3 d+ a( g     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 y; ~& {- h& n; o6 ^+ k0 u2 `  R

4 }3 j  V8 ]. y- M' R6 U2 G
( R/ s  f+ X+ m' ?9 }$ A
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-24 16:08 , Processed in 0.037564 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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