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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " P( N4 H: B- w  Z
  1. [code]EDMA sample test application
    / b: v. }6 S' |1 c* V5 N
  2. /*
    ' f% l% S6 E2 {
  3. * edma_test.c/ A& A- o" u& C/ P
  4. *4 w# Z7 r2 E1 b1 j5 j1 n8 j
  5. * brief  EDMA3 Test Application
    # b/ n' S$ F4 B8 L) U  j8 @: [
  6. *# ^2 i1 u- w" l( l" e
  7. *   This file contains EDMA3 Test code.4 l1 u; V: O! d* V% x, B9 d
  8. *
    . D+ x" E0 O, p+ c0 d0 P
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# N2 D' h0 K& ?& ?" x( Q, L, P4 Z0 `
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 K! X0 ^3 F6 v+ j1 _& r2 _$ m
  11. *         TO CHANGE.1 |6 h$ t3 }/ z% i
  12. *" e1 p9 O/ o% P' R0 F
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    0 f$ G) {* w+ H  S3 x6 ^. S3 i
  14. *
    1 M3 Z( \! c* ]& o" l7 q
  15. * This program is free software; you can redistribute it and/or7 l( y9 M) X# ^
  16. * modify it under the terms of the GNU General Public License as+ N7 i6 m6 E. @
  17. * published by the Free Software Foundation version 2.1 l; f& A9 m3 B  x# [
  18. *& G# g) }% `* u! _" ~6 X# {6 S
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # D( `7 O! Y: x/ u
  20. * kind, whether express or implied; without even the implied warranty1 l( j& B% p( E+ M, o
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2 ], B( M# P' J. x: J* d4 L+ R
  22. * GNU General Public License for more details.% Y+ q- L0 ~4 s
  23. */- {! R4 ~, c) A  b& ^

  24. . z* C! k6 s0 ^6 ]& X
  25. #include <linux/module.h># z2 L+ S; q9 k5 x$ Z7 W
  26. #include <linux/init.h>
    6 @6 e3 ?0 \8 W
  27. #include <linux/errno.h>0 I1 `5 `* C) c3 Z
  28. #include <linux/types.h>' w( u" r+ g8 x" q
  29. #include <linux/interrupt.h>
    4 v9 I9 d, f; c, c9 _
  30. #include <asm/io.h># H. q2 G$ [# f( o% A7 X# L) I
  31. #include <linux/moduleparam.h>
    , D( |9 s5 t  d" z  T
  32. #include <linux/sysctl.h>+ ^! i+ l/ E  _
  33. #include <linux/mm.h>) j4 J; F  p( o) c! a
  34. #include <linux/dma-mapping.h>! u  {! ^* I1 D1 |: l1 ?

  35. 7 H4 P0 D. c; @4 Z, w1 Y
  36. #include <mach/memory.h>
    6 k! B& b; O- l8 H5 R
  37. #include <mach/hardware.h>! y7 ]: F+ p% }" j2 G
  38. #include <mach/irqs.h>+ z7 ?  t) N# [9 t% P6 K
  39. #include <asm/hardware/edma.h>
    5 c4 r( E% V6 H) K  P! x* K. {

  40. . K+ r0 f; a. u2 T
  41. #undef EDMA3_DEBUG; D+ p. |! t5 |1 Q. t
  42. /*#define EDMA3_DEBUG*/; E) H6 Z- J( ^* l# ]
  43. $ L( n# o. I! I; f8 A
  44. #ifdef EDMA3_DEBUG7 A0 h0 j1 l. A1 Y( `8 l( K
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 V7 m  `; b( Y& Z0 ]8 [
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 u9 H3 }  ~3 L2 o" p# D/ d0 P5 g
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 G% V6 y% P4 n* `; I" _/ i* C
  48. #else
    . x- G' p( D9 b7 L5 q/ ?
  49. #define DMA_PRINTK( x... )
    0 N" D; P& |8 f1 P) I
  50. #define DMA_FN_IN  g2 F2 J! {3 d/ d8 n
  51. #define DMA_FN_OUT
    ) d* X+ s  m; y, H4 H% E
  52. #endif
      T  m6 H/ O. s) \! W
  53. ) i$ j) k$ E; m4 [4 }
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; C* O; j6 `2 ]
  55. #define STATIC_SHIFT                3
    0 u* F- }  \/ r( |, d
  56. #define TCINTEN_SHIFT               20
    * W0 y) W+ F& \
  57. #define ITCINTEN_SHIFT              21
    0 o0 T( W  {' K3 _# I6 e% i
  58. #define TCCHEN_SHIFT                22# b& ]! s1 o( c9 M) h
  59. #define ITCCHEN_SHIFT               23
    " J# H$ H: y% Q3 \% }7 w
  60. 2 K  j- K9 ]0 l7 }3 T
  61. static volatile int irqraised1 = 0;
    " H1 b3 {* T2 \8 M" d4 E
  62. static volatile int irqraised2 = 0;
    $ U9 W7 r) Q- s. b
  63. 9 S7 ^5 I' S. l& O3 a$ O
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      \) E. {. U$ _% w9 K" P% U
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : ?* J, ^2 A( ?: W" F8 Z! R
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 M1 O( N+ m7 m& t: \+ \8 e5 Z. j
  67. " V' t' c& J* K5 K# a# o% m) X
  68. dma_addr_t dmaphyssrc1 = 0;) B" j0 U; S- k
  69. dma_addr_t dmaphyssrc2 = 0;" [7 F* p: F0 w6 v
  70. dma_addr_t dmaphysdest1 = 0;
    3 }, c% |4 ?5 f- \; N% B
  71. dma_addr_t dmaphysdest2 = 0;
    % Y1 V4 ]+ q% ?& O/ e

  72. & E% t5 K6 `& {
  73. char *dmabufsrc1 = NULL;
    , h$ s: ^, ]  \2 I
  74. char *dmabufsrc2 = NULL;: x7 j8 C+ X1 d
  75. char *dmabufdest1 = NULL;
    7 [& s( ^! L0 ]5 {" G
  76. char *dmabufdest2 = NULL;
    + \7 h; s: u3 F8 n

  77.   Z6 N7 E  U7 x9 x  f' i
  78. static int acnt = 512;' Y6 H, K( K1 }& Q4 X) M; J
  79. static int bcnt = 8;! p4 T5 D' _3 E# L: r4 X8 ^! z6 Z
  80. static int ccnt = 8;3 R: ~& X6 t+ w0 p* {
  81. 4 s0 D$ \  Z6 I+ A( W9 t
  82. module_param(acnt, int, S_IRUGO);
    $ n  Q5 M6 T) `" A2 J; Q/ D
  83. module_param(bcnt, int, S_IRUGO);
    0 v5 ~* l6 F+ ~
  84. module_param(ccnt, int, S_IRUGO);
复制代码

7 S; G, r$ C, z; I! }
) Z2 u7 n& B+ c" O7 ~* y0 \: \      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 g: N8 u  `  w1 U' P; m, }+ g! Xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; V$ C7 G+ o$ p4 B     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& a6 l9 q0 @% Q# |

; F( _! r6 J! ~' N4 }: I# ?+ e& M! a. T6 v4 s" z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-19 07:18 , Processed in 0.038668 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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