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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 r; H8 ?5 d# C  q( d
  1. [code]EDMA sample test application
    * j0 W- N  |# \  H& U1 u! C4 p
  2. /*- I" L; }# H, z5 X( ^/ e* M
  3. * edma_test.c& b5 ~! j6 X8 j# E; Q, f* v
  4. *
    , }! K; U9 a) C. K) P3 e
  5. * brief  EDMA3 Test Application
    * Q/ n5 E( E" u5 f4 ~) c* p0 J" |
  6. *
    5 i/ _; `0 w- F
  7. *   This file contains EDMA3 Test code.
    2 ~7 D0 Z% H+ z3 I" E/ e
  8. *$ E! w* ^* X6 C4 N$ W
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ; b( N/ B" D  X% B8 _7 E
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 a2 G; g: R, [/ M3 V# x  P
  11. *         TO CHANGE.; u6 H- ~8 h" t4 r( x. s  ~  S
  12. *
    : m) {* ^/ ~( B3 ^" x- j+ |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" G) D* @( K, a. d( j
  14. *
    ( F# J. N4 F8 \9 g/ I% \& c' _
  15. * This program is free software; you can redistribute it and/or
    % m& ~* _: j$ I: D6 f% w
  16. * modify it under the terms of the GNU General Public License as
    # D* r% c! z- t: U7 n
  17. * published by the Free Software Foundation version 2.6 H' N) h6 N; s; H
  18. *
    ) G1 w1 D& J1 [" P
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 r! a& R* M2 M( |0 {  B
  20. * kind, whether express or implied; without even the implied warranty, o% q, B" g7 U5 D# C' p$ r! j
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1 C, {6 \% U( h2 ^
  22. * GNU General Public License for more details.
    ! Y, e2 h; Y9 I, o2 H' f7 a
  23. */
    $ m2 Q2 t4 @9 p& F

  24. 6 j( _4 l* N  I  I2 |1 f" W$ o( d
  25. #include <linux/module.h>
    5 Y1 G, N0 z3 v
  26. #include <linux/init.h>
    ( G* B  x4 Y, t- j* h: s, P
  27. #include <linux/errno.h>
    ! t. u1 r! d! e" R% G5 O
  28. #include <linux/types.h>
    ' z4 u; Q, z( e
  29. #include <linux/interrupt.h>& }* ~; I, ~& a5 ~8 F$ n* f2 E
  30. #include <asm/io.h>7 n: c2 G6 Z  t' u
  31. #include <linux/moduleparam.h>
    ' h+ P; ~" K; W7 u" K5 i" f
  32. #include <linux/sysctl.h>
    1 Q6 Q0 `' `: c$ R+ ~* g
  33. #include <linux/mm.h>
    ; O+ `, A& B; b7 ^1 t
  34. #include <linux/dma-mapping.h>; B7 h" Q! J( ^' p% o) E6 c

  35. * ?- t! [6 P, i. n' O( U8 R. j
  36. #include <mach/memory.h>
    ' i' u1 M5 o  H2 c6 p" i
  37. #include <mach/hardware.h>
    ; f' y3 V/ {. S! j# l
  38. #include <mach/irqs.h>6 S( D) \  y  r7 h
  39. #include <asm/hardware/edma.h>) s+ p4 K% {4 J# E$ e* G8 |
  40. + `0 p, D$ K  Q2 b" J5 \5 K# d
  41. #undef EDMA3_DEBUG) T4 t; o+ ~0 w' ~/ l" \* z
  42. /*#define EDMA3_DEBUG*/3 W& [8 @1 B3 ?" K. i
  43. & {. j" r3 u& M
  44. #ifdef EDMA3_DEBUG1 H* ]  y- p- q5 W$ D
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 G$ w: S5 e  O6 G- |
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# @1 T- k  w/ n0 Y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) R" w4 F) I% U; |
  48. #else
    - N: u; [- h! b6 \( B! t2 w
  49. #define DMA_PRINTK( x... )  z7 ]% U' r. E  M" t& i, J
  50. #define DMA_FN_IN4 }5 T! E( b/ [  P/ M: Z
  51. #define DMA_FN_OUT. V8 ~+ X( \- y
  52. #endif
    ; f$ x8 s! K/ A

  53. 5 g5 d9 n% p2 {
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): @) u7 K7 u7 H; S- U& P
  55. #define STATIC_SHIFT                3
    - j+ \; M$ f4 `. \$ c# ~  s
  56. #define TCINTEN_SHIFT               20
    $ M: R3 F" P# f) i
  57. #define ITCINTEN_SHIFT              21# O+ O/ T) Y2 B' Q4 K% ?! Z
  58. #define TCCHEN_SHIFT                22  D1 v% e2 c# ~4 C  C, E1 G  J+ M
  59. #define ITCCHEN_SHIFT               23
    ' Q- Q0 B) X/ I: a

  60. 4 ]4 ]1 [3 ?+ i3 t: }3 h% h# r
  61. static volatile int irqraised1 = 0;
    7 i3 S" H% D2 J+ s8 F+ f
  62. static volatile int irqraised2 = 0;
    # k3 N# ?9 k/ M. O& ]

  63. 2 q. A6 g8 M8 c! K& D
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- R8 o1 q0 W* n- t  M
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 W' A; M( R4 S' Z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) C0 y% ?& W  C6 N; I+ `9 G
  67. . `7 q; j- g! \
  68. dma_addr_t dmaphyssrc1 = 0;/ r6 B4 H3 M$ G" x
  69. dma_addr_t dmaphyssrc2 = 0;
    4 K( n7 v8 T* n+ H" `
  70. dma_addr_t dmaphysdest1 = 0;
    9 X0 M7 J5 i- R' Y  D! ~7 n! ^' U
  71. dma_addr_t dmaphysdest2 = 0;3 B3 K7 |# V3 P# `
  72. 8 a/ v9 T, d+ S' ]+ e
  73. char *dmabufsrc1 = NULL;
    ! Q4 ~" M5 U$ V8 u# C
  74. char *dmabufsrc2 = NULL;
    * O2 g$ R$ v/ R  H7 j
  75. char *dmabufdest1 = NULL;1 n3 I* o2 v9 w% y
  76. char *dmabufdest2 = NULL;# E; f/ J. u6 B( a/ o/ v( B
  77.   ~; u- H- M7 M9 Q1 `; f5 q
  78. static int acnt = 512;
    / h' D$ X! i. f
  79. static int bcnt = 8;2 Z% m4 v& \. Y$ \  @/ p: H* Y6 Z- J
  80. static int ccnt = 8;
    7 ?" f5 J/ E: q" n3 C4 v# X- C
  81. 2 P1 g7 L# x4 k5 B8 P- p/ S
  82. module_param(acnt, int, S_IRUGO);2 G2 o6 R1 s% A, q8 V
  83. module_param(bcnt, int, S_IRUGO);
    % v$ X2 W2 I( j7 D3 T8 b5 m. P
  84. module_param(ccnt, int, S_IRUGO);
复制代码
- f- Z8 R+ R/ n8 B  ]$ R
; Z2 A4 ]. J0 C% y7 ?" |
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 \2 t& o* ?( Q2 }8 L. Z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; Z! Q" [. n# b/ L
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 h+ O2 r6 s$ K2 F) ^, w3 q# I
1 Q, t& L+ b. a' C& D- [

/ o7 H% \0 ]( H6 Q! F0 c6 I
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-15 15:02 , Processed in 0.037485 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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