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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& ~+ w# b# [  C/ K3 s6 k- ]+ t. G/ r
  1. [code]EDMA sample test application* e9 Z3 t- u8 ~1 j2 y: K) m
  2. /*
    " R" ~3 @' _& d( H# Y) M7 x
  3. * edma_test.c
    ' W1 W3 [( m+ v6 K4 z/ q6 V0 Z7 k( }
  4. *
    . }+ }2 N3 }# B- t- O
  5. * brief  EDMA3 Test Application
    3 T. w0 M, f8 ]$ R2 c
  6. *
    ! C/ ^3 _+ O8 _! q+ T5 ~
  7. *   This file contains EDMA3 Test code.( D$ E' t- X- A3 l' K; ?7 D  h
  8. */ U4 @0 W: C8 |: A
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - n+ Z7 @, x2 d9 A. Z* A9 A
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% c3 ^6 _' W* N, U  n4 P" C2 H6 C
  11. *         TO CHANGE.
    + j! g" u0 |0 K6 a, y
  12. *
    7 b* f1 Y+ w; y& w5 H. _  Q9 k) _  z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    2 x* h7 P. [" e! E; W6 V
  14. *+ p2 q" G5 n& l- U" w8 v. j# k
  15. * This program is free software; you can redistribute it and/or; @9 U% P) P- K, z& ?
  16. * modify it under the terms of the GNU General Public License as; X9 E- }, n3 R" S% o, h) j
  17. * published by the Free Software Foundation version 2.6 v1 f  `# d; h6 X
  18. *" o" K3 v' t* p6 N% O2 X3 N
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- H; j/ \6 L6 G0 f
  20. * kind, whether express or implied; without even the implied warranty! I; x2 d2 X6 y2 q( {7 C) f  w
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - o) w! S+ W- y% |2 U1 B
  22. * GNU General Public License for more details.
    0 S/ G2 |4 V3 P% E- m5 O7 t. ]
  23. */2 a5 U' c1 L3 b$ a/ Z

  24. + o$ D  I5 q9 k5 s/ s
  25. #include <linux/module.h>
    , k4 ~& C- b" L) r% G% q* ]
  26. #include <linux/init.h># i% c$ z* z3 E9 i
  27. #include <linux/errno.h>& ]# W& J2 n1 H  S" p! g# f
  28. #include <linux/types.h>
    5 `8 G3 A4 @8 I- }0 S( l: N3 \$ E
  29. #include <linux/interrupt.h>
    2 R% R, F3 n% ?& w+ k! w9 U& J
  30. #include <asm/io.h>- y  t0 P: E$ R1 ?7 X* a
  31. #include <linux/moduleparam.h>  X2 j/ d1 m* i4 W; }
  32. #include <linux/sysctl.h>
    + v. d0 ]" v) K0 r; ~8 r' p8 Y
  33. #include <linux/mm.h>% w) W" C1 t5 {1 r2 r4 d; }
  34. #include <linux/dma-mapping.h>
    7 Z$ K+ {6 Y8 d/ _  P% c

  35. 1 W7 Z9 e" R6 j# J% A
  36. #include <mach/memory.h>! j7 y1 {& @( z* B5 c
  37. #include <mach/hardware.h>
    ( P  K/ u. W8 y; u% A3 [* L
  38. #include <mach/irqs.h>: R# t& U6 y- P$ p0 U8 `$ D- u$ _
  39. #include <asm/hardware/edma.h>, M6 p3 i( Q$ b# ]% i* k; j
  40. 7 b! R9 {+ D1 V9 h% I) K/ s' r
  41. #undef EDMA3_DEBUG
    7 k, f2 @+ k4 ]& A% i8 X
  42. /*#define EDMA3_DEBUG*/
    , K6 c  r1 q0 O4 C2 C; v, ?4 N+ ?

  43. ' ^* W- ~+ u2 M; t# C- _
  44. #ifdef EDMA3_DEBUG
    0 b( M  H: H# p1 U  U) `  d
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# ]: R* o' Y+ c# G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 M# `. N9 L! a
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ T* N" {2 W9 H
  48. #else
    3 j- ^6 g' J/ `% i6 [6 ~: G+ F
  49. #define DMA_PRINTK( x... ); w! [- n6 J2 c! d2 J. R& q
  50. #define DMA_FN_IN
    + t+ L* b) r; U) G( A
  51. #define DMA_FN_OUT
    1 ^; i2 e' o' q+ K4 [: ]# D; O
  52. #endif) D( @2 d8 `9 T1 @
  53. 5 {0 f% C! l" B5 Z' [  z+ k2 ?, P
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ' K: t& ]0 R. \
  55. #define STATIC_SHIFT                33 r  d2 r6 S3 f/ N% N  h
  56. #define TCINTEN_SHIFT               206 z" K6 Q9 m: s
  57. #define ITCINTEN_SHIFT              213 m  G2 d! v0 r1 ~* S( ~" i1 T
  58. #define TCCHEN_SHIFT                22
    : ]) N" T3 v( b; d% m6 h2 d
  59. #define ITCCHEN_SHIFT               234 D& w% Z7 H9 _
  60. 1 `# n4 s4 t2 ]+ z
  61. static volatile int irqraised1 = 0;
      E, \# t: y8 n, J. k! D
  62. static volatile int irqraised2 = 0;4 X) \8 R9 q, U5 _  }
  63. , X' T6 h5 B/ y. M7 T3 H6 l0 h' S
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 f9 X5 _  D; k3 e
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 P# A8 W" x( R2 k
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' r& F5 [( q' d1 J# M: N! |6 Q

  67. ( C6 u' K* B9 S8 x9 u* s
  68. dma_addr_t dmaphyssrc1 = 0;
    - T) Z2 M' p* M5 L- H0 N6 O" V' ^
  69. dma_addr_t dmaphyssrc2 = 0;# ?! z; X- b& r% d. v7 @
  70. dma_addr_t dmaphysdest1 = 0;! W; `5 T1 v; |# f5 S
  71. dma_addr_t dmaphysdest2 = 0;
    ( Q6 R; G7 ^; r4 c0 P
  72. 8 S7 u) j. h1 {. ]
  73. char *dmabufsrc1 = NULL;3 `. @! K! o! i0 f
  74. char *dmabufsrc2 = NULL;
    . z; p. {4 Y- K
  75. char *dmabufdest1 = NULL;
    / j* J5 p/ n3 x' ~
  76. char *dmabufdest2 = NULL;! e  X" L# I- K) a) O+ V

  77. ; e! \  A/ r* n2 P
  78. static int acnt = 512;
    2 T' B6 N! O3 U: t# g
  79. static int bcnt = 8;
    % t% X4 U1 G3 W
  80. static int ccnt = 8;8 S4 D+ |7 N2 m5 [+ H# X+ d. x% n
  81. 9 B; @9 o# e. r: r
  82. module_param(acnt, int, S_IRUGO);
    9 ]2 W8 d) T/ `4 W5 t% Y  i
  83. module_param(bcnt, int, S_IRUGO);2 g' T5 c! @) k5 p
  84. module_param(ccnt, int, S_IRUGO);
复制代码

8 O+ ?2 {+ d. N  V( e" e, ~
2 V5 t& P3 ~( x) O" F7 L1 ^      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: Y8 Z" o: Q$ U& Aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
  r$ h! T5 _! e& W$ U. @' E8 _5 E     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ h! G' S3 D  L+ c3 z- W# Y0 e; U( Q! f$ n

, T- B4 j9 X& ]( Y7 [  T3 {. E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-5 18:15 , Processed in 0.040448 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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