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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 ^: r6 S2 b6 A$ D3 T- a
  1. [code]EDMA sample test application9 W! w* o- W7 A/ X/ A
  2. /*
    + B$ q' L8 ?4 c* H
  3. * edma_test.c6 _* G7 k/ S" E
  4. *6 ~' }5 ?+ l" l: E2 U
  5. * brief  EDMA3 Test Application8 `5 g- X) Y) x1 O3 U7 w9 z; @
  6. *
    + @* `$ v. \  z0 M3 T$ l. e
  7. *   This file contains EDMA3 Test code.4 ]' M, c! I6 n! B' t3 P% N
  8. *
    4 b+ }+ ]4 M) A, K+ m0 A0 @; Q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 `) L7 b( ]% c5 b6 u' \
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ' r% Q3 _% K" _- @7 X& n
  11. *         TO CHANGE.
    ) R* J( j5 Y/ {
  12. *
    0 ?9 N8 R" n* x) L& l* V1 F! I4 S
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 y* C0 d  w2 |; _9 o1 x
  14. *
    ' S, b6 I0 F$ L) L
  15. * This program is free software; you can redistribute it and/or
    6 W* \9 m& y5 X4 W) V5 f
  16. * modify it under the terms of the GNU General Public License as
      A; e  D. J3 {* O
  17. * published by the Free Software Foundation version 2.% D' b( m9 X0 z# ^/ E3 H8 o$ k
  18. *- d: W/ x2 o  f+ a
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 w4 l5 m2 Y/ z! q
  20. * kind, whether express or implied; without even the implied warranty1 E; F! ?8 B) }* l# H9 B: ~
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 |4 H5 T, {, B+ O7 D6 l- h
  22. * GNU General Public License for more details.0 k2 b* R8 D" E/ N
  23. */2 h- `% a' n% o! o6 w. \
  24. / R5 T& ]6 w7 n& y
  25. #include <linux/module.h>
    " f& N% p4 d" N0 v
  26. #include <linux/init.h>3 S1 A  u' l% X1 x
  27. #include <linux/errno.h>
    1 V2 i' a& }4 A0 w9 `% f; e- k4 G: `
  28. #include <linux/types.h>
    " e/ E0 z- u6 f: _
  29. #include <linux/interrupt.h>
    3 ^  @, p+ S; ?3 M) J2 l
  30. #include <asm/io.h>
    " p/ k! m8 e  K5 Q+ Y- \2 k2 t
  31. #include <linux/moduleparam.h>
    2 p9 M7 M( a. j4 v8 x* ^
  32. #include <linux/sysctl.h>
    ' v/ d* f" k/ B& y3 S
  33. #include <linux/mm.h>
    * ?( {( T9 ]0 `1 E6 |" B" M
  34. #include <linux/dma-mapping.h>* f6 C9 L# j: d& h5 _5 D, L

  35. . X8 s) b" I; k3 L* ?
  36. #include <mach/memory.h>
    + y* h; G9 a$ ]8 ^) V
  37. #include <mach/hardware.h>9 d. g. u9 m! N6 O% Q% W/ {' V
  38. #include <mach/irqs.h>
    - F2 |: [' q' o+ J& @
  39. #include <asm/hardware/edma.h>
    * H* r( w" h9 V0 @* ~

  40. ( ?/ ]; _" l- x
  41. #undef EDMA3_DEBUG
    3 ^/ m8 G5 Z6 L1 }5 l6 c
  42. /*#define EDMA3_DEBUG*/
    7 P  e5 ]# Y3 l4 S& [6 }2 ?

  43. ! q3 G' @9 e) E* F- j. g$ |0 K
  44. #ifdef EDMA3_DEBUG
    * n$ q' m: Y% D' x. w
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    4 Z1 D- e5 F# W
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    1 H4 W( s' J' j, {* A2 @
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ( c6 ^& }) q, u/ R/ f* b
  48. #else( O" f/ f3 W+ K7 R. J' F; Y, X( G
  49. #define DMA_PRINTK( x... )) t; [& u0 q+ h2 o0 N" D( u
  50. #define DMA_FN_IN
    / C4 j$ J3 Z) t; _5 _
  51. #define DMA_FN_OUT! E6 X( D8 U* {! T. j' t
  52. #endif7 J( I' w- e: d- W, ?- H

  53. ' x( J2 ^4 c: A$ J$ {) s
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    6 q4 p  G) W4 k; C
  55. #define STATIC_SHIFT                3
    $ V0 B+ J; ^5 I; I
  56. #define TCINTEN_SHIFT               20
    1 ?9 ?7 v; y0 p; c1 z7 W; W
  57. #define ITCINTEN_SHIFT              21
    1 N: `2 ]6 W" p8 v# [9 ^
  58. #define TCCHEN_SHIFT                22
    & a6 N! k: Q6 g; n0 t' j& l0 }; X7 x5 {
  59. #define ITCCHEN_SHIFT               23
    ! w/ d. S  P1 G7 q5 M6 k

  60. 6 i6 X' q1 e) F( {
  61. static volatile int irqraised1 = 0;
    4 m9 p- @2 Y$ Y6 c0 g) {; p- l0 x
  62. static volatile int irqraised2 = 0;6 e0 @. r- g$ d1 j; s, B7 @5 F

  63. 1 n; \" e) D8 }+ x. R/ R+ Q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 D# ^5 T& l/ w6 R$ j
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. M  b/ g3 V3 e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; M; J6 r' j9 q. K: }; F
  67. 3 n/ A9 }) M' M- m8 x, c# G- s
  68. dma_addr_t dmaphyssrc1 = 0;4 R( P& W/ N- C6 Q, H# F
  69. dma_addr_t dmaphyssrc2 = 0;) ]% L% M$ S; x" W% M
  70. dma_addr_t dmaphysdest1 = 0;  W& M' D6 |6 W7 W
  71. dma_addr_t dmaphysdest2 = 0;! N1 b% k# n8 J* H3 E! i3 T

  72. : o; ?; l7 R8 T# s
  73. char *dmabufsrc1 = NULL;
    6 ?. E( O) h6 n* M
  74. char *dmabufsrc2 = NULL;
    + h/ e  e+ i& U9 ]( ~9 l/ w- ~# y
  75. char *dmabufdest1 = NULL;
    / m  @$ j) {' I/ w4 E
  76. char *dmabufdest2 = NULL;+ N/ |7 z& v: l

  77. 6 N9 Q7 L5 s, c& N+ s3 V0 v9 z
  78. static int acnt = 512;8 ~( i! ~8 }: {: m' q" c
  79. static int bcnt = 8;- [! C: `+ c  m
  80. static int ccnt = 8;- q8 v3 s+ t' ]& W
  81. 1 g3 D, s; e7 Y6 o
  82. module_param(acnt, int, S_IRUGO);1 G% l+ V4 h7 M2 ?$ j: z$ t
  83. module_param(bcnt, int, S_IRUGO);3 I- |* u6 x$ p. W5 p! @1 ~3 `
  84. module_param(ccnt, int, S_IRUGO);
复制代码

# f. }$ S% f, ?2 R; C
  @3 p" D  c8 ~  b. j3 h% I      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 _* Q* e' X" H8 f+ f% }) z- W
arm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ s* n1 r4 C/ H5 U3 p     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 H5 L3 O" e9 ]# `' s
  D: x! T( @, h; |

. ?! G4 j& L7 p5 C4 u# `$ \& a+ |
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-7 22:15 , Processed in 0.036391 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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