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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ g) c! x8 r- h; `
  1. [code]EDMA sample test application, \2 k; s2 V  I, N0 M! k. A. }
  2. /*
    & C1 L0 z( z3 K. L4 P
  3. * edma_test.c
    , h/ E+ z9 L3 A0 q) p9 t
  4. *
    7 Q* ]4 T/ c) r& [+ i7 N  T4 x, }
  5. * brief  EDMA3 Test Application8 X" {% r, Z7 ?' j6 z. y
  6. *, A3 Y: Q# w! r; L
  7. *   This file contains EDMA3 Test code.( x) f7 b3 E/ u9 M7 Q8 H) p- ~
  8. *
    + Y$ x2 q8 s0 g$ y6 S- t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + h6 p/ L# v8 ~# ^) N- W( s. l! ?
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) t2 y& \( @1 r. @
  11. *         TO CHANGE.
    2 p, p) I( L9 Z. O  H
  12. *3 f  c/ y) C3 m  S( ?, L
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    : S, V3 x5 D* q/ {
  14. *) {1 H, O' W0 \9 X" E
  15. * This program is free software; you can redistribute it and/or7 {+ u6 G4 @, U$ V: N  P
  16. * modify it under the terms of the GNU General Public License as
    . W% S) F5 W8 L
  17. * published by the Free Software Foundation version 2.
    9 n7 n% P  Z- ?5 d! H  G/ c
  18. *
    ; W! S# ?  I$ C0 o5 w2 N0 I- Y1 K
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    1 r) z6 s' L/ M) E2 D. k0 R6 m
  20. * kind, whether express or implied; without even the implied warranty
    % J6 L. }* \8 l& F/ _) A# r, k- [% J
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the: U: ?, R, q* K
  22. * GNU General Public License for more details.
    4 b/ z/ K! y- N* t: Q$ V
  23. */  u3 \( q) Z9 `7 M  l) x
  24. . R3 y1 M8 l, n' u
  25. #include <linux/module.h>5 D5 N, S/ ~) @' `
  26. #include <linux/init.h>* b$ G; a2 C8 ^1 P8 l
  27. #include <linux/errno.h>4 _% c# S# M9 ~* n9 l
  28. #include <linux/types.h>
    1 P5 z, s, t! @
  29. #include <linux/interrupt.h>, `8 K# h1 L2 z: R
  30. #include <asm/io.h>
    ) E6 p  d8 e, ^1 U# ?( [) E  m; J
  31. #include <linux/moduleparam.h>- J5 }6 C  n# L  D6 w) t8 o
  32. #include <linux/sysctl.h>
    . G  n9 @: `0 z( b% E& {
  33. #include <linux/mm.h>5 {3 E* J/ Z* Y
  34. #include <linux/dma-mapping.h>
    ' h0 V% {  R" Y. R' z5 `
  35.   L+ `  l/ F0 M' {8 E6 h2 ?' I
  36. #include <mach/memory.h>* P5 d( [% c  O& r
  37. #include <mach/hardware.h>& v4 F$ e& J+ f8 L% G1 @8 w
  38. #include <mach/irqs.h>: A$ Z- P- w( a3 P! A
  39. #include <asm/hardware/edma.h>8 m+ ?) F) y8 V% |* p  J
  40. - ]* y3 e8 }1 s. v2 X- m
  41. #undef EDMA3_DEBUG
    * B5 \3 m5 s( V
  42. /*#define EDMA3_DEBUG*/
    + `$ Z/ K5 w! k/ {2 w; z. Y0 u

  43. : G. L+ O% Y- C/ S9 ?
  44. #ifdef EDMA3_DEBUG
    - }% \: ]7 t" e" `9 B
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 c' O" J2 C2 s; W) B# i
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    3 x0 X) M& C5 `* I, p5 k3 U% x
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 E. w3 {) l. u, o, W0 x6 G
  48. #else
    ; w( w% }$ c4 [4 k: m! \
  49. #define DMA_PRINTK( x... )
    * Z( t$ ?) D8 {/ \  z
  50. #define DMA_FN_IN
    , d6 r9 u4 O" w4 n, H8 ]. P, ?0 h1 c
  51. #define DMA_FN_OUT
    5 d5 ^* N1 V- x0 @8 x! {* x! J8 k
  52. #endif
    + |( y: ^7 ^/ F/ f! ]: A8 H( Z

  53.   I" X) c9 k) R7 r0 u5 v
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)# F* s$ _1 l& S# K
  55. #define STATIC_SHIFT                3
    ) Y8 F; N5 U% v1 @
  56. #define TCINTEN_SHIFT               20
    : f# e% a3 S. J- j: F$ b+ C
  57. #define ITCINTEN_SHIFT              21) D3 H  I. Q" g- C+ h8 q( @
  58. #define TCCHEN_SHIFT                22( K- j) ]6 m: b% }8 y1 u
  59. #define ITCCHEN_SHIFT               23
    ! k; p9 Z" d; v1 K

  60. / `. [' E/ Z; e% N, s+ j
  61. static volatile int irqraised1 = 0;7 O: o& l. W" u1 |5 t1 j3 ?2 k
  62. static volatile int irqraised2 = 0;
    ) ^/ D0 U! u9 u7 ~4 W/ f

  63. " H4 }0 t/ J, L; v) B0 ^
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; X1 G9 K. ]/ G; C$ F9 h
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ ^. h2 i+ d0 d4 u* v7 ~% E+ ^+ ]
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 x) }8 T7 ?9 j5 o8 K
  67. 9 o) m/ K) b, k# Q$ ^! s
  68. dma_addr_t dmaphyssrc1 = 0;
    ( ^) i9 M7 B6 }5 ]
  69. dma_addr_t dmaphyssrc2 = 0;
    4 k* t1 X! h( C# e7 x0 o
  70. dma_addr_t dmaphysdest1 = 0;6 L* {# @/ G* j- _( J& z* U
  71. dma_addr_t dmaphysdest2 = 0;
    * o9 {# [0 S0 L$ H" K% J4 \

  72. + Z+ U6 U$ D8 u* R( T7 ]9 K0 U, x7 M
  73. char *dmabufsrc1 = NULL;
    / I3 W, ]0 y, r
  74. char *dmabufsrc2 = NULL;
    2 O8 g# n! {; S; |1 e
  75. char *dmabufdest1 = NULL;
    5 W) ^! o' ^7 K) u  \1 a( S- b
  76. char *dmabufdest2 = NULL;& g% ?  Z9 v$ c) i
  77. ( d! C5 \- c+ T
  78. static int acnt = 512;: t6 U" o1 m% D4 d) ]  c' d
  79. static int bcnt = 8;
    ' z9 [$ j) i6 A5 p* j2 r
  80. static int ccnt = 8;+ m2 s6 k. K; `& n9 c) k+ l" o
  81.   ?# g) L7 O$ a7 {* R3 x- g
  82. module_param(acnt, int, S_IRUGO);6 {7 F+ G4 h, N  ?. r0 R  J% M
  83. module_param(bcnt, int, S_IRUGO);/ ^$ w# q8 |4 D7 c
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: B4 [5 I* i( j/ N
3 `& N4 k- X0 h, _      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- A+ ^' t$ R: k2 M
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: A2 b) ?4 x, A8 E* x+ d
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 ]. h/ v2 m4 }  O  m
) @; ~6 X" w) I: i
/ S) H/ C# f/ Z) b+ |
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-11 04:50 , Processed in 0.053672 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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