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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 [9 B) h) P8 Q
  1. [code]EDMA sample test application* }- ~8 u' m' W5 F& h! H
  2. /*& {* F. R* [7 x" a, D. d, z, o$ A- k, B
  3. * edma_test.c' p& C; Z2 z+ z( _1 t
  4. *
    " D$ P6 T2 G# n1 U9 K% c" }
  5. * brief  EDMA3 Test Application
    ' ~5 G$ j5 ^" a' P1 A0 u" j5 `
  6. *% e% o* D" Q8 ^
  7. *   This file contains EDMA3 Test code.5 x" C# r" }0 I9 e* P! z/ Y0 H
  8. *7 w+ o% f! I* f
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ i- f, m3 k; U( S. o, x5 Z1 `' H3 R
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    9 t: ?! m1 Y+ g: ^: P
  11. *         TO CHANGE.
    " w7 y2 J+ y1 r& m% @* y" ~' U" g
  12. *
    7 p8 G: j- k; ~* {* {1 |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 z: ]) E( R% D& u1 y1 a+ a- [
  14. *
    ) W5 m& ~. Y1 f
  15. * This program is free software; you can redistribute it and/or
    1 Q% {$ W2 n# c' r& Z: s
  16. * modify it under the terms of the GNU General Public License as
    4 M7 _' ?1 h. L8 _8 {4 d
  17. * published by the Free Software Foundation version 2.
    ) l' P* u  i: [/ ?. q( J4 f' U
  18. *7 u( l8 B$ g- m0 C$ A5 b
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    : ^) u' ~$ k$ U) y3 p
  20. * kind, whether express or implied; without even the implied warranty! \% E( M1 [8 M$ R8 p/ t
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ v% }* L" U$ H# p/ M8 K
  22. * GNU General Public License for more details.0 W, p4 g2 p1 U' L% r9 R
  23. */. N. p6 y& l8 f5 ^/ y7 x5 P" B2 P0 G

  24. ( t! p( p9 A% X! v4 W1 v
  25. #include <linux/module.h>1 d( @  S! m* l  k6 L" k6 R; @
  26. #include <linux/init.h>
    ( Y" c9 P& O& Y
  27. #include <linux/errno.h>
    6 E5 Q4 m" j2 O! {" w- }
  28. #include <linux/types.h>3 K9 S" f4 q1 D+ i8 J7 F
  29. #include <linux/interrupt.h>
    2 L( v/ c9 \! n0 \9 b2 W
  30. #include <asm/io.h>- x2 \% ~& o+ B, Z0 Q
  31. #include <linux/moduleparam.h>
    7 ?4 c! |0 ^% b9 z+ ~1 e( S
  32. #include <linux/sysctl.h>4 G8 W& ?5 K$ R" Z
  33. #include <linux/mm.h>
    & \) t9 {# g6 @7 T1 `/ Z
  34. #include <linux/dma-mapping.h>/ @4 @; K$ [( h1 B, u
  35. 2 Z; N+ G2 D  V
  36. #include <mach/memory.h>+ Y: q: b6 o1 Q. [
  37. #include <mach/hardware.h>
      J% X- F, ^; Z4 M5 \: j
  38. #include <mach/irqs.h>+ R0 U; Q, i% P5 ?
  39. #include <asm/hardware/edma.h>' }4 c* D% ^5 U( z5 y  m) W1 z

  40. 6 t; h4 m& X1 L! M5 ^# U. v  s
  41. #undef EDMA3_DEBUG% q/ C7 i0 @' d" ]8 Z1 w6 a% c/ K. F
  42. /*#define EDMA3_DEBUG*/8 H7 e$ l5 E* n2 h) |
  43. + s( K+ }1 Q' z4 W
  44. #ifdef EDMA3_DEBUG6 a% W" |4 s- y1 D5 f2 Q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    4 h: O6 M6 m: _8 E( `; N
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" q1 a8 n0 d% `2 a. |9 @, P8 l6 W5 q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    : I! A6 @- S; {6 U6 z& J! ~
  48. #else; B" N: f1 H: B9 h5 I, d
  49. #define DMA_PRINTK( x... )! Y. v9 ]8 H4 T& B4 B* D6 n( G
  50. #define DMA_FN_IN3 h9 F" I$ l3 {2 F5 z3 |2 S
  51. #define DMA_FN_OUT
    - n6 I3 Q; \; T8 d
  52. #endif! R( M/ ?. x# d: x$ j' K+ _9 K
  53. 9 Y% D0 r: Z! ^
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    3 B8 ^# N0 s/ f- p  N* S) A
  55. #define STATIC_SHIFT                3
    ' _5 i9 r3 [* Q1 Y' c
  56. #define TCINTEN_SHIFT               20
    + C6 b1 E+ p" v  Q2 A
  57. #define ITCINTEN_SHIFT              21
    & ?' \/ q) k+ w4 z" e, c
  58. #define TCCHEN_SHIFT                226 f1 k% \; Y" ~  u$ w) C! [/ I( p
  59. #define ITCCHEN_SHIFT               234 M4 B$ j+ o% ]4 F, D9 P
  60. * N1 `# b8 O( V4 w$ \( \! [/ v
  61. static volatile int irqraised1 = 0;
    $ Z5 t. T" F" V2 _" B
  62. static volatile int irqraised2 = 0;
    " f- X# P- j% ~

  63. & F2 x2 D9 W8 C  I' n: h
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. Z9 b& F- Y) v/ w
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 \% ~# K3 T) x* c3 }9 _
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ F( L# s' K4 V, y

  67. 4 S7 O" j# S; j8 }+ s
  68. dma_addr_t dmaphyssrc1 = 0;+ M3 R6 K* E% S0 V( D9 `& Q
  69. dma_addr_t dmaphyssrc2 = 0;
    ( O* h' d" V( F4 Q3 b
  70. dma_addr_t dmaphysdest1 = 0;- X. W% `. y. U0 ?3 Y
  71. dma_addr_t dmaphysdest2 = 0;2 @! r& b& \6 t+ I. {. q1 F) b6 Y

  72. 6 z6 c; G3 I8 b1 u8 z1 \
  73. char *dmabufsrc1 = NULL;
    % Z: [( A( S6 e3 g. k+ e
  74. char *dmabufsrc2 = NULL;" d6 l9 \/ H4 k* S  a% I
  75. char *dmabufdest1 = NULL;
    9 f, Q; e: D  m1 T; s! @
  76. char *dmabufdest2 = NULL;
    - y, W# C4 k' M& H6 l
  77. . Y; l# Y# a, G" U& f! n$ a6 y/ P
  78. static int acnt = 512;  |) A$ B. T) V! V+ g) }
  79. static int bcnt = 8;
    ( ]8 p% e! C7 L$ o7 s# Z2 a- g
  80. static int ccnt = 8;
    ; p, x" O3 c) c" K! j

  81. 1 M" _6 S. M; S% I
  82. module_param(acnt, int, S_IRUGO);7 H/ e8 j8 e8 V3 |: ^
  83. module_param(bcnt, int, S_IRUGO);
    & W3 P& V2 w' S$ s3 k; N4 I4 ^
  84. module_param(ccnt, int, S_IRUGO);
复制代码
  r  I+ S  W% B0 N1 t
- M+ I4 b0 e- b( O: Q+ _
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 J: q4 c" \" zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 b7 z  A2 D8 b" ^8 ?0 m     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; M; \" L1 n4 A# m
6 |. m3 U1 l  }9 w" Q7 A- t: z2 z# ^+ t5 A
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-11 09:00 , Processed in 0.046873 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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