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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 f7 q8 v, a$ X  ^
  1. [code]EDMA sample test application
    4 J$ M) D6 C% [4 @
  2. /*, S8 b. N" k, m/ x: O) D
  3. * edma_test.c# m! @  N  g" }+ x: a+ [* e# e% `# d
  4. *
    : }% I2 E! ]7 E6 P
  5. * brief  EDMA3 Test Application
    5 s; {5 B! T' P
  6. *
    ( I, Z/ E1 j$ Z4 l! ~
  7. *   This file contains EDMA3 Test code.* X& ^, P0 n3 X9 G3 ]  n' n
  8. *" p. v2 l! o0 a+ I6 `
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ F! _& V4 I5 P/ o; T
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    9 N  |3 L2 ]3 X
  11. *         TO CHANGE.
    : U  w) a5 ~* o$ O  ?5 n) T+ D
  12. *) X8 h; Q  r* P7 {
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: h  R% v9 ~+ R" {% D. l$ A/ q
  14. *. I, q% }! v" X6 ]
  15. * This program is free software; you can redistribute it and/or  g" J( z# F0 d9 b6 r
  16. * modify it under the terms of the GNU General Public License as2 B4 |- a2 `6 N
  17. * published by the Free Software Foundation version 2.
    , h) G8 O0 P( m5 O3 l& [" q3 s
  18. *" e; `: |: |6 a2 N; r9 H+ B1 [6 N
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    + Q) e6 s( x9 U; y" @
  20. * kind, whether express or implied; without even the implied warranty
    + g* [! `3 T* H
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    $ `( |3 H: ^* N2 Q( d, E
  22. * GNU General Public License for more details.5 O2 _2 ^  G' D
  23. */3 @9 }) }7 b5 V2 a% g

  24. 0 G+ i; _+ G6 e( F9 U5 r$ Q; K& p8 H2 `
  25. #include <linux/module.h>0 Y# K1 x7 `6 w5 ~! f. w* ?! i
  26. #include <linux/init.h>2 V; ^( m) p( A. A
  27. #include <linux/errno.h>8 i/ L3 B4 S2 x3 ]& p4 B8 j
  28. #include <linux/types.h>
    - a6 j% J; X; k3 M, X2 Q) H9 i) n
  29. #include <linux/interrupt.h>$ Z2 l1 K) X9 A9 L  c  k: i
  30. #include <asm/io.h>( D# }' P  ]! i6 ~
  31. #include <linux/moduleparam.h>: u+ r8 M+ u+ a2 F( |& j# S
  32. #include <linux/sysctl.h>
    4 `$ W( I7 ]! `# c! ^# w! U# n
  33. #include <linux/mm.h>$ A* I" c3 P6 G) q' b# G
  34. #include <linux/dma-mapping.h>
    1 }% D& u2 t# ~' O$ q$ Y7 u
  35. 3 b: Q# t+ `. T0 g& N8 k
  36. #include <mach/memory.h>9 P3 h5 b: T  w. y
  37. #include <mach/hardware.h>3 U+ r1 |5 w) U0 ?( j2 G1 ]
  38. #include <mach/irqs.h>
    1 f3 S& X( Z' u7 ~0 B0 E
  39. #include <asm/hardware/edma.h>7 M  U) T5 W, `1 p) }" @1 y
  40. ! L2 r6 S$ C' \& C
  41. #undef EDMA3_DEBUG
    9 U7 c, [* d: j4 l
  42. /*#define EDMA3_DEBUG*/
    ' z: [2 k' {2 K$ T% l
  43. 7 ]& P& b  P1 j3 ~" d, u3 v
  44. #ifdef EDMA3_DEBUG
    / m. h& p/ j8 x% H2 N( x, E4 @
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - r4 Q' f( x  L
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ) c1 K: L! ?6 W; {; l
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! N; _2 @0 m8 i4 m  m
  48. #else
    ) h1 M! y4 a  D/ q+ B
  49. #define DMA_PRINTK( x... )( ~1 ?! y8 N% V+ s& A
  50. #define DMA_FN_IN
    2 G1 u% W3 Y, u* B6 X' H9 l8 |$ {
  51. #define DMA_FN_OUT1 W& `% M5 ]2 \! ~; J& B
  52. #endif- @7 u. x& s1 t" Y

  53. 9 k. u* c2 i- v- f- L# l- u* g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)% o) h& ^' J& m: ?
  55. #define STATIC_SHIFT                3, a. l* [) l7 r; U% u3 a- r" R
  56. #define TCINTEN_SHIFT               200 ]! _! Z1 ~6 l; F7 r* C" ]5 `
  57. #define ITCINTEN_SHIFT              213 N, g  z8 B, B+ |
  58. #define TCCHEN_SHIFT                22
    1 H6 {% }, o7 I9 G5 A4 N
  59. #define ITCCHEN_SHIFT               23& d" a1 |+ x2 M" D- S
  60. 5 O0 q1 l1 N+ j) Z* b) V5 f6 D
  61. static volatile int irqraised1 = 0;0 J( R; Q, J5 W9 Q9 c5 d
  62. static volatile int irqraised2 = 0;
    # N; X4 W; t; d3 Y
  63. $ S! ?/ p" D9 ^8 f- E
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 _; I" p5 Q4 R% M$ D0 o/ @" f0 o4 H
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 P; X2 A9 U0 o) G6 u
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , }9 y2 h: M6 }  t3 M' ^

  67. / t) Y2 q2 S* z7 K' f
  68. dma_addr_t dmaphyssrc1 = 0;: I! A6 U! B8 x( e) s' ?
  69. dma_addr_t dmaphyssrc2 = 0;- B! W: h! s1 ]4 T6 P8 `
  70. dma_addr_t dmaphysdest1 = 0;
    % S- F) A. ?8 F% p* u
  71. dma_addr_t dmaphysdest2 = 0;2 T3 G+ J; S& s8 K" {- Q( D
  72. 3 M  i9 S) A8 G7 R! o4 r
  73. char *dmabufsrc1 = NULL;- J! N9 V, y2 j6 V! @
  74. char *dmabufsrc2 = NULL;" }2 H. q8 ]: R6 i* o( f
  75. char *dmabufdest1 = NULL;
    6 ^* G9 w& @1 r& F) o; L: j, F% g9 C
  76. char *dmabufdest2 = NULL;6 l: Z: V- R$ N. r  D
  77. 7 @- E& I8 e$ o, V" W; A
  78. static int acnt = 512;
    7 n7 }4 ^8 _3 \. N; o
  79. static int bcnt = 8;) B; q; N) k- U3 X% a' W* _4 o
  80. static int ccnt = 8;
    & `2 F, ~7 n& J4 y1 p5 F' Z

  81. , u- K3 P, `' f( J: O+ |5 C
  82. module_param(acnt, int, S_IRUGO);1 U% L/ ]7 x8 `) r" W
  83. module_param(bcnt, int, S_IRUGO);
    / S$ z. d& G7 v& `) ~
  84. module_param(ccnt, int, S_IRUGO);
复制代码

, V3 j! t3 m! _0 @& a2 I* F0 ?) m% W
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
  w& X4 l7 }( g' ?# Tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: x" L2 x/ I9 w( g     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% [# y; D% ~  }% G5 l

" f! w; H) D  A, H$ H, J2 W: p  R3 p0 k3 M5 m, ^: U+ Y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-6 07:06 , Processed in 0.056965 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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