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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - ]) c& g% I( Y) C; @
  1. [code]EDMA sample test application+ x# x  {8 m  |8 m0 f$ s  O
  2. /*
    4 v9 c) }% w3 A$ O1 @
  3. * edma_test.c0 U& I. n6 ]* W" U
  4. *
    3 U0 h/ Y+ \' q) @* p8 l
  5. * brief  EDMA3 Test Application
    * e/ U+ ~4 U# l; {
  6. *
    . a2 G" ?' ~! ^; Y3 D) _  U
  7. *   This file contains EDMA3 Test code.
    0 H$ i  y# Q3 C3 x) o
  8. *# D7 L1 b7 U$ `: T4 B0 B
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ o/ p' `" H1 D6 {2 G7 p; ]" Z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) z" @' _  c' W- }- f
  11. *         TO CHANGE.6 A: q7 l1 q3 `3 X0 a( k
  12. *6 V" ?  m. D  m  j
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    6 f% p" S0 p! ~* O
  14. *1 \" D5 H* {  L3 w" L3 u3 i/ y$ P
  15. * This program is free software; you can redistribute it and/or
    # k3 ?% V% G4 {5 \1 ~
  16. * modify it under the terms of the GNU General Public License as% F2 q8 f- @+ B" P3 q
  17. * published by the Free Software Foundation version 2.
    : n. ]. {  T$ f7 G/ N6 G1 {' M1 r
  18. *
    " v! i& M1 T0 G& r
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ l) d  c" c# Z' j! p, @7 Q
  20. * kind, whether express or implied; without even the implied warranty1 x7 m0 F9 N+ P4 N' x
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . K7 ]! ^& P- }9 [! ?" c
  22. * GNU General Public License for more details.3 I5 \9 u6 y& I  z4 r
  23. */* f, o1 g% ^2 C6 {% V$ \- M
  24. ' k/ t$ x- h; p; g: k
  25. #include <linux/module.h>, w6 Q  c/ s  s, ]
  26. #include <linux/init.h>+ W4 b7 ~/ G. b% [) E$ {, U2 ~7 U
  27. #include <linux/errno.h>: ^$ n- I- @* u% p* A( O
  28. #include <linux/types.h>) N3 K6 s0 ^4 D6 k% P
  29. #include <linux/interrupt.h># _) G( H. _& l0 b/ M2 l  Q
  30. #include <asm/io.h>
    , i' Q% _" I! z1 O& E" a
  31. #include <linux/moduleparam.h>
    8 p% w5 o' |- X8 {' Q
  32. #include <linux/sysctl.h>
    ! c3 F) N( c3 _8 \( M1 z" Y
  33. #include <linux/mm.h>
    : H6 B1 q* X+ `+ |
  34. #include <linux/dma-mapping.h>' n% j' d, B0 d# j

  35. & z/ x$ M( u. m1 ?
  36. #include <mach/memory.h>
    6 @( m( A+ ~$ |# k4 A
  37. #include <mach/hardware.h>
    4 ^  P2 |- B6 }0 B+ l
  38. #include <mach/irqs.h>
    : B3 V$ |8 A! Q) s0 A
  39. #include <asm/hardware/edma.h>9 ]6 X0 _5 p! e* @
  40. 7 \, X! b# z9 K3 \( \. {) k
  41. #undef EDMA3_DEBUG
      k' [3 y5 K3 U
  42. /*#define EDMA3_DEBUG*/
    , L$ @& x/ `/ I% u7 n; F; P/ }9 u7 q
  43. % `- W5 V# J8 s, b& x3 p4 W
  44. #ifdef EDMA3_DEBUG
    ! k$ l1 C0 D% N) s
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! O4 `0 F, O3 L% h5 ~) t! \
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & ?+ w5 t. O3 l
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% M* o* q5 ^! q& G
  48. #else) p4 h8 t  J$ P3 H6 W
  49. #define DMA_PRINTK( x... )
    5 Q" R  O$ @; i) g/ G# W
  50. #define DMA_FN_IN
    : ]: ^1 ~0 C3 V4 k* H, k
  51. #define DMA_FN_OUT
    3 l5 w& f! v" j1 W. [
  52. #endif
    $ U6 V7 p& q0 a4 {6 Q! ^
  53. 7 Z" R. R! l- T# k. S  k
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ' z! a$ f, P( p  Y9 x/ v
  55. #define STATIC_SHIFT                3
    * n( A, ]9 _+ w3 ]
  56. #define TCINTEN_SHIFT               20; h5 @; t" f' L9 c: K" j, C
  57. #define ITCINTEN_SHIFT              21
    " k# T) u" ~. c
  58. #define TCCHEN_SHIFT                22& a$ I1 l8 E- T+ w- G
  59. #define ITCCHEN_SHIFT               23( M2 W5 i0 w. V! J

  60. 7 l& |3 P/ d, w9 @9 _
  61. static volatile int irqraised1 = 0;  v( v/ w5 ?+ m0 g2 _* \% X) S. [& {
  62. static volatile int irqraised2 = 0;
    4 i6 A% A# T, H2 b

  63. * M$ ^, O$ k& v9 d
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* `/ a0 F$ y, C, \1 n
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( S, U( o" i! X5 {, y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 c1 }& U8 m3 {1 H+ m' Z! A1 X; j) P
  67. 3 E2 |- v  y! P3 G! }
  68. dma_addr_t dmaphyssrc1 = 0;# ~7 ^" W) I6 w; C# o# z# H
  69. dma_addr_t dmaphyssrc2 = 0;
    ) S- j5 O. [3 h  i% l, A
  70. dma_addr_t dmaphysdest1 = 0;
    2 Q6 Y9 \  T0 H) {3 C, B5 P
  71. dma_addr_t dmaphysdest2 = 0;- {" {# w. @2 K. ~

  72. + z' [$ _. D7 {) c5 n* i7 e
  73. char *dmabufsrc1 = NULL;
    : j: P. S: [, h4 f9 w0 L" `
  74. char *dmabufsrc2 = NULL;
    3 X2 \2 `5 O" g; J7 C
  75. char *dmabufdest1 = NULL;' }$ h* p: V! a4 E
  76. char *dmabufdest2 = NULL;
    5 L% b: [/ ~9 F: y: Q# t/ W
  77. 4 c; S# n0 y7 x( I
  78. static int acnt = 512;: _2 O) N' ^) k% R
  79. static int bcnt = 8;
    ; Q& v$ k: r# I" y0 w$ b+ b+ p
  80. static int ccnt = 8;
    " P$ J9 ~5 a8 O6 r! Y0 {  w

  81. 0 ?. e: X* b" T* R  U! D3 b, h: ~* E
  82. module_param(acnt, int, S_IRUGO);- D& k1 b5 N1 P* g
  83. module_param(bcnt, int, S_IRUGO);* p$ X- a1 {7 l# f. Y" t
  84. module_param(ccnt, int, S_IRUGO);
复制代码
$ K+ u' Y' l. [7 J: Q* n

: _  y9 U1 i* M! B7 j) T0 v* D% `      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( u( @  M9 n; Y1 \8 i
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" ~  e( B, l3 l% S  Z& s     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, j; `& `- R5 o2 I  c* o$ I6 P  k/ D, ?- p. A

1 m0 Y5 p: t; X( [- u6 W: d
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-20 00:01 , Processed in 0.043224 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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