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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " C8 E7 K% B' g8 B; M7 m; q' M' e0 C
  1. [code]EDMA sample test application
    & Y/ C' G  ]- ?* D' Y
  2. /*! ]# F. l( _' G5 N( N# Q6 y1 I
  3. * edma_test.c( `0 m& G3 K' \2 Z5 D/ {" l
  4. *# n) e9 A) G' l; j
  5. * brief  EDMA3 Test Application0 G! F0 f, i( l, F" x: B2 r3 }
  6. *
    - X- K* t7 j( f$ u
  7. *   This file contains EDMA3 Test code.
    . F4 l. {0 H. W9 b  b- d
  8. *
    1 b- m4 M7 o/ z& R4 C+ d% ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( F3 k) ]/ T* W
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) d3 P9 E: t" h& H
  11. *         TO CHANGE.
    3 M- q. ~& j( P; O2 _- R/ @2 Y9 F
  12. *
    0 v+ P$ P0 z( V; ~  a  A
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% k2 r1 U. D. E& e
  14. *
    5 @8 B' ~& v6 ^, ]& g8 j
  15. * This program is free software; you can redistribute it and/or
    + \$ H3 |' a; _' O( d: W7 w- `1 B
  16. * modify it under the terms of the GNU General Public License as
    ; x: u% b" t! ~. W# k
  17. * published by the Free Software Foundation version 2.8 G: x$ j9 ?1 i- C; L% g( l. c
  18. *0 z8 S5 ^  f$ N2 P1 W5 q% [% B( c
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / o8 K$ T2 X0 f7 y# @
  20. * kind, whether express or implied; without even the implied warranty
    3 l7 {! P; G( S; i# z1 M
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - v- d1 `4 w4 x3 B7 I1 R/ w
  22. * GNU General Public License for more details.
    2 l2 ]& q; i2 {+ i$ B1 M
  23. */
    3 Z: ~/ H- \& c5 A) x
  24. 3 u% a2 a( m2 \" p
  25. #include <linux/module.h>
    5 w. l' w4 o  h1 f
  26. #include <linux/init.h>
    $ N" I4 \% ]3 i; g9 Z& d& W
  27. #include <linux/errno.h>
    3 N( f" x* z- u& K$ {* B
  28. #include <linux/types.h>: X8 K; T2 ^4 ]# L
  29. #include <linux/interrupt.h>9 `, H# m5 Q( ^+ P
  30. #include <asm/io.h>
    : o2 I2 J* E6 q0 {, G
  31. #include <linux/moduleparam.h>. b+ _' J4 U6 L4 c; D7 Z8 w1 @( ]2 ^: G
  32. #include <linux/sysctl.h>
    3 ~4 v! K- Z: |" |9 G: _
  33. #include <linux/mm.h>
    , O$ c1 P9 K: a7 {' [# j
  34. #include <linux/dma-mapping.h>
    9 R6 x2 `) ?; }9 Q9 a) l' n9 Z

  35. 5 o$ ~# b$ U( C+ f# b
  36. #include <mach/memory.h>; i8 K& j& N  o% ~8 ?2 G
  37. #include <mach/hardware.h>5 j$ K4 \; @) }  M' i
  38. #include <mach/irqs.h>
    9 B8 S* H! L- K2 t2 X
  39. #include <asm/hardware/edma.h>; G9 [8 L4 r  z  L8 ]) h
  40. 1 Z7 z, P3 b/ F( Z2 E) ^# m
  41. #undef EDMA3_DEBUG
    ; u7 X% T" f8 l( q3 B# P3 ~
  42. /*#define EDMA3_DEBUG*/
    * _7 Z2 _6 ~7 a% A

  43. 8 l% x2 q  r3 ~; T2 {
  44. #ifdef EDMA3_DEBUG
    * _; [* E. S( p8 q8 d
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): N2 A9 g7 @  i( Q$ d' o5 v
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & Q3 E: X* \; Y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % A9 K2 f4 p7 X1 W7 S0 t6 C
  48. #else2 |  X" ?. X, j4 S( G% ]4 c" p* @
  49. #define DMA_PRINTK( x... )6 w$ }" K7 y2 ]1 L% w* P
  50. #define DMA_FN_IN, t$ [8 _% r0 T
  51. #define DMA_FN_OUT
    $ o& @4 q. T# B( N7 D6 z0 b
  52. #endif+ m- |; V0 |  ]$ m5 g6 k# s/ }
  53. $ I  y7 t- `/ t  w; _$ U3 s& u
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    3 j4 G# f6 O! }; U& h1 K
  55. #define STATIC_SHIFT                3
    % z5 X4 L9 b0 m  ]0 w( h) F
  56. #define TCINTEN_SHIFT               20
    # B, x. @# m4 v7 f: O+ z
  57. #define ITCINTEN_SHIFT              21
    9 Y" t7 c$ T5 U/ \# U
  58. #define TCCHEN_SHIFT                22
    8 f5 j, a% E, m2 P. K
  59. #define ITCCHEN_SHIFT               23
    8 F  Q' G! K0 g& p$ }
  60. 7 W. N$ F0 R" X7 l, j1 R; Y
  61. static volatile int irqraised1 = 0;5 ?- v$ h2 |/ u6 j( l$ c
  62. static volatile int irqraised2 = 0;
    / U5 n' S9 ^' C2 u5 N3 W, _

  63. * {# w% w. f" N& I5 Y) C7 v. y2 F
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' a1 ~* g3 ^7 @& J
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ C6 L# d& ~+ @+ l3 ^# ~) G1 G
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 H. w" A( Q) {. I# j/ ~
  67. ) V8 z$ H/ j, q6 }: p2 t) i3 z
  68. dma_addr_t dmaphyssrc1 = 0;
    4 Z1 b/ `$ a, T: a4 l
  69. dma_addr_t dmaphyssrc2 = 0;
    7 ]4 v* F# ^2 e1 z! \& I0 n, w- Y1 Z
  70. dma_addr_t dmaphysdest1 = 0;
    ) y6 \& K4 X" H2 y
  71. dma_addr_t dmaphysdest2 = 0;
    ) }) P% R. l0 e5 I

  72. 7 u) w! M! M8 y' C0 x
  73. char *dmabufsrc1 = NULL;
    # O6 x8 \7 L4 Z1 W+ v
  74. char *dmabufsrc2 = NULL;1 E+ F. ]0 ^7 l' ]
  75. char *dmabufdest1 = NULL;
    ( R6 c# m! s( J9 \5 W: i) e
  76. char *dmabufdest2 = NULL;
    0 m5 X; t, Z7 f% T4 R
  77. / H6 u- g$ K8 ~) }4 D: {2 X
  78. static int acnt = 512;2 n6 Y! b/ S7 M* z4 R
  79. static int bcnt = 8;
      C) b& B) E9 n, ^* @+ s, h% T7 s6 \
  80. static int ccnt = 8;3 k' B& b7 [* L( v5 S& O
  81. ; N3 J- ]  e3 Q" k
  82. module_param(acnt, int, S_IRUGO);  [8 s$ l$ D7 Q+ |6 G) a
  83. module_param(bcnt, int, S_IRUGO);$ W- g7 l" T3 o; [
  84. module_param(ccnt, int, S_IRUGO);
复制代码

8 t8 p& k( z4 o5 |
- f$ B% `5 h- Q8 D3 s3 J1 A4 y      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 m& o2 r% P  K: N( {- ^$ N7 e. h/ iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* k& i( k5 l7 P9 _4 n5 D     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: K  c+ y( Q( p) a4 i- Q
1 t4 ~& T8 v& X3 _0 v  _: ?5 F# n  c0 H( h
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-14 22:01 , Processed in 0.039579 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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