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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / _% N/ J( [- U' G5 @% V2 g
  1. [code]EDMA sample test application
    0 ^3 x: V2 A3 J! V: j
  2. /*" o5 o! H( U/ s1 y: {) t+ b
  3. * edma_test.c
    4 U8 v' `6 \2 H# x1 b
  4. *
    1 G9 c, B: O! X6 T
  5. * brief  EDMA3 Test Application
    ; x5 x# }, N% `, S) j
  6. *8 U* _6 i( p" j+ I9 n
  7. *   This file contains EDMA3 Test code.
    3 r. {5 e5 p8 p1 T- f
  8. *
      X) j0 f/ ]# y  Q: J) p
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    : t, e* p8 X; R; Y2 [2 x
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' d6 b4 @. X2 w
  11. *         TO CHANGE.1 R4 [6 n5 d, }; j( d
  12. *
    6 B" i! b3 P9 Z4 \. y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% {# m- c( R# e* W$ S8 \  d, t7 I
  14. *
      e' O, l9 ~, C
  15. * This program is free software; you can redistribute it and/or
    2 ^/ a) A/ v$ y% V  V/ h: L
  16. * modify it under the terms of the GNU General Public License as
    - y) {) \/ V1 G- j% S
  17. * published by the Free Software Foundation version 2.) ]6 D3 ]' @2 g+ o
  18. *: Y" }3 |3 \* D
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / P/ k0 j3 M. k; q+ T* Y* P
  20. * kind, whether express or implied; without even the implied warranty, W% ?$ |  p8 v! V6 V5 g
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the/ B" w3 [) S/ p: n: w9 M
  22. * GNU General Public License for more details., t& m$ l- z3 k# V0 D6 ^) I5 r
  23. */  c$ v" g1 P( N# k  Y

  24. / l# N8 Z9 Z* I( K3 R5 E2 r
  25. #include <linux/module.h>6 I$ g: J  r5 r6 k0 e/ N1 U
  26. #include <linux/init.h>
    ) S9 }6 [6 {- _6 f& }6 D5 ^, p- o4 c
  27. #include <linux/errno.h># A" Z. y; l: o: ]/ z
  28. #include <linux/types.h>) E' ]* r' t6 V6 p! X, f
  29. #include <linux/interrupt.h>* @* [# s( L% u; R) l+ }" x' l
  30. #include <asm/io.h>
    # |+ S& Q2 i! Y7 c7 h6 Z) V; w4 H
  31. #include <linux/moduleparam.h>
    . P; ?/ f2 D! ^+ k; n3 P0 u
  32. #include <linux/sysctl.h>
    . S8 T, t- n& v1 y. y
  33. #include <linux/mm.h>/ d8 p& t. r7 \4 e' G9 w( d
  34. #include <linux/dma-mapping.h>
    ) T4 F7 a7 E2 P+ f6 j) [' A/ B. V: G
  35. " p- s5 w- S8 y( x0 S
  36. #include <mach/memory.h>/ m( v$ B3 a4 N# A6 G
  37. #include <mach/hardware.h>
    7 S- X# N& N/ N% S
  38. #include <mach/irqs.h>
    7 A' ]2 F5 J: ^2 B2 V1 m, i9 I
  39. #include <asm/hardware/edma.h>; F* m7 x' ]  M8 R! Q* U# X
  40. & \2 F3 s; M1 Z1 Y8 W
  41. #undef EDMA3_DEBUG
    2 n$ n/ ]! B# R  i! k. ~/ `1 }& M. K
  42. /*#define EDMA3_DEBUG*/4 F; r8 A0 |% d$ A! f2 ^' `

  43. 5 _" [0 v, u- v. _; c
  44. #ifdef EDMA3_DEBUG
    0 F$ m4 B* `+ \/ i- r
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- [# E) z  K" n* w
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% }9 f4 C3 o- W
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 d. Z) u9 K6 S: S
  48. #else. h& u3 o, Q, D+ l6 K3 s
  49. #define DMA_PRINTK( x... )# U$ x6 I+ }4 F4 w0 J4 ?- f% `
  50. #define DMA_FN_IN$ N% i. f& N6 G* V
  51. #define DMA_FN_OUT
    ! y- d# z# k0 W: y$ d/ K
  52. #endif
    : I* t' e: ]( ~' R, X3 D5 @
  53. - }3 `8 k( V9 d  v# Y' x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ) }( z. m- U1 z
  55. #define STATIC_SHIFT                3
    . E) Y1 w! }1 S9 u3 }; g
  56. #define TCINTEN_SHIFT               20' C  j$ t: n0 q/ H+ l: Q( g; n+ V
  57. #define ITCINTEN_SHIFT              21
    5 M6 l6 U5 I, p8 q7 J0 o9 F5 Z8 [
  58. #define TCCHEN_SHIFT                22
    ' N! g: q2 e1 z+ S5 T) e, K, u
  59. #define ITCCHEN_SHIFT               23
    $ y9 O% |0 W  T9 q( t) v( ^3 W
  60. 8 b7 G$ {7 n7 W8 {
  61. static volatile int irqraised1 = 0;
    7 L! ^( x8 G% }/ y( v; Q" w
  62. static volatile int irqraised2 = 0;
    2 m8 T; b( @  X; S: i* N+ w4 I. s0 m

  63. - t0 e7 P/ g. d3 ^- Q5 ?" b
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! F1 Z3 h6 Z- {5 p+ d
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 u8 M- F% u# F; E$ d9 h: S
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 g* ?/ a! H/ A1 ^" I

  67. " d) D9 d8 E* a( u
  68. dma_addr_t dmaphyssrc1 = 0;! l4 P0 Z& F3 `1 t" g
  69. dma_addr_t dmaphyssrc2 = 0;1 Y6 Y3 Y) [! Y8 v. n  F( B
  70. dma_addr_t dmaphysdest1 = 0;
    9 H5 O2 z, q1 \8 R
  71. dma_addr_t dmaphysdest2 = 0;+ F7 k, D; W+ t- _( l) X* i3 |+ w# i
  72. : j( v9 P  R4 {/ g- A$ S
  73. char *dmabufsrc1 = NULL;
    2 ?, e; j# o) g' `9 d
  74. char *dmabufsrc2 = NULL;% c3 X2 l. o# Z- B, [
  75. char *dmabufdest1 = NULL;( t% D+ s& n  C# w% z5 ~* q) j5 `
  76. char *dmabufdest2 = NULL;7 ~/ r! N& [& U2 o! s6 P6 g3 s3 ^* [
  77.   `; }; A! U$ s5 C  N) [
  78. static int acnt = 512;5 O$ q% `+ r: S9 c7 q" w* _8 ^2 J. I
  79. static int bcnt = 8;2 f/ ~7 o0 H  e) d
  80. static int ccnt = 8;
    + ^! Y  |! U$ C0 s7 R
  81. ! K0 t% }7 G9 E/ i; H
  82. module_param(acnt, int, S_IRUGO);0 E- H2 X' J8 |# y# u/ [+ r; q
  83. module_param(bcnt, int, S_IRUGO);
    2 F, e% p" V" D, x2 r5 E- V7 _( r! a- ?
  84. module_param(ccnt, int, S_IRUGO);
复制代码
' b2 J9 d0 `$ p
# D' U4 z. x7 r2 t! p7 q
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* \# e; H, M1 K  w! e
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( m2 ^( X- f& R0 s: N' C! y# x9 Y
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ M6 `! Q( v4 M6 J8 i; ~/ x. ^$ u3 [% }

1 @0 G, [- M  y1 X
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-24 08:10 , Processed in 0.039220 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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