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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 O% F6 e. c% ?  C( [7 l% v3 M# p  }
  1. [code]EDMA sample test application- R, Y' s5 H1 i; p
  2. /*
    8 x! w0 g: h* I" O- o. q
  3. * edma_test.c
    $ c' e: w3 ]; z" _
  4. *# ^% J/ s. U0 \0 j
  5. * brief  EDMA3 Test Application  v( F. O1 |# |- O
  6. *
    " r, U* v  ]- h( L7 D. m% y( R
  7. *   This file contains EDMA3 Test code.
    9 _4 n: w5 K3 l
  8. *
    ) @- R$ T. a9 }. ~/ @6 Q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 L  S, [! i3 t( O- X3 ?+ X
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    - N4 j- m; M$ {# K$ L  J6 r
  11. *         TO CHANGE.
    . x( Y; ~8 r. C. o$ ~: ?5 c
  12. *
    4 K9 Z9 c$ i" |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    , d6 n) Z3 D' f3 j
  14. *
    # L3 U) V0 i- Q- }2 j4 U
  15. * This program is free software; you can redistribute it and/or/ P( \0 @6 i% j* D6 X
  16. * modify it under the terms of the GNU General Public License as
    ( S9 J. G1 E! i+ J; }; A# Q: W% r
  17. * published by the Free Software Foundation version 2.
    ; ]; j( D0 v$ p+ ^3 T
  18. *4 A7 w$ w+ M; v  |% H3 D
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any! n' N0 p7 |6 a; q
  20. * kind, whether express or implied; without even the implied warranty
    7 ]4 Z2 Q2 W0 V( P8 M- E1 K5 r, G7 u
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) @' U2 F- j* G3 g& G2 C8 f
  22. * GNU General Public License for more details.4 V+ j- t' U1 `$ x! e: c
  23. */: g# [( Y8 z5 M) [0 `8 t
  24. 9 O- f* ~. F& e2 `, D% }0 d
  25. #include <linux/module.h>
    , s  M& _9 B2 F3 J. J$ p* e( @
  26. #include <linux/init.h>7 ?! }5 Z# Q+ F+ B' I' q' e, G4 z
  27. #include <linux/errno.h>
    5 c$ k7 A( X5 O9 u/ D& E2 P6 p
  28. #include <linux/types.h>' e/ |3 H3 x6 A. L
  29. #include <linux/interrupt.h>! x3 N9 c! x7 F: M; g
  30. #include <asm/io.h>
    4 @+ S: f5 J9 j$ s) u
  31. #include <linux/moduleparam.h>
    3 N' S2 D0 e7 g! h# K1 L; _+ k
  32. #include <linux/sysctl.h>
    ! f, C. l3 E1 z$ T7 }( g8 a. b5 h
  33. #include <linux/mm.h>
    2 F1 w' J0 W$ l5 F" V2 u
  34. #include <linux/dma-mapping.h>
    2 j3 E! J( X1 v% A& ?  M7 Y
  35. + \/ W$ T) `/ ?3 s
  36. #include <mach/memory.h>/ e1 v. U5 O4 f+ b# Y0 `
  37. #include <mach/hardware.h>
    ! z# h( o+ L, ]7 ]9 ]4 U2 r
  38. #include <mach/irqs.h>
    " ?8 E/ U# J& S/ Z) `1 H5 M8 j
  39. #include <asm/hardware/edma.h>
    9 \4 m- ^: f/ q
  40. 7 h5 l# g5 ]2 c
  41. #undef EDMA3_DEBUG/ i8 s0 Q7 `' E- Y0 t
  42. /*#define EDMA3_DEBUG*/
    $ H5 L- r  A) {% K5 ^$ k4 _

  43. 2 w: j  X  ~  Z5 F' l0 r4 J  e
  44. #ifdef EDMA3_DEBUG' R; ^( H3 K& D$ i
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    $ o1 S- K" K- ?4 J+ ?( b
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ [- e/ M  @2 A: ?
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    0 D/ `( K4 T% u; x' M
  48. #else' z( L1 a  }! S; o; ^
  49. #define DMA_PRINTK( x... )
    & h) _- X( ]0 M% k% r% |5 W
  50. #define DMA_FN_IN
    ( S' Z  }+ O  [: Y1 e" H
  51. #define DMA_FN_OUT
    7 E. L2 j0 O# B8 l6 |
  52. #endif
    8 o8 A# e# K" u. h, s
  53. 5 r: g# s* _+ J- i6 ~6 _$ g. \
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    # b& }4 A5 J) |! s' ?/ o
  55. #define STATIC_SHIFT                3
    1 B. G$ J$ U& M% V
  56. #define TCINTEN_SHIFT               20
    . \0 o* I% J8 G  _8 j# w4 x7 {
  57. #define ITCINTEN_SHIFT              217 i: s2 X5 ^$ Y* X0 o% S: o) [
  58. #define TCCHEN_SHIFT                22
    # V) N7 j+ l4 v, U+ g- C, r- N8 R) U
  59. #define ITCCHEN_SHIFT               23* ~; G$ P! E) I& H: K4 C
  60. % E+ _0 v) x+ n2 b  b: w6 V
  61. static volatile int irqraised1 = 0;( I1 s" u' P7 f4 ]
  62. static volatile int irqraised2 = 0;
      H& ]2 h3 B8 m* @3 T8 _
  63. : p7 t" Y; b) I  }  _$ p
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 Z5 x* ^& B# W+ k$ n/ x
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! W+ s$ q6 ]" B2 F
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, A) _# j3 v1 l' G& L: y
  67. , h5 y' n5 j6 D- x
  68. dma_addr_t dmaphyssrc1 = 0;
    : W6 U0 u5 ]8 Q+ w
  69. dma_addr_t dmaphyssrc2 = 0;
    ' r" o5 Q1 P3 w' \( j2 X# r5 j' E' Y$ L
  70. dma_addr_t dmaphysdest1 = 0;
    * \% c+ }7 b% E- l5 v
  71. dma_addr_t dmaphysdest2 = 0;
    6 v8 n( p0 F/ H0 o. I. R* b

  72. 5 h( y- V) T8 z! M0 s/ |6 U' T' _: Q6 h: f
  73. char *dmabufsrc1 = NULL;
    , p+ ]& I# |2 d/ J, m) Y9 D
  74. char *dmabufsrc2 = NULL;3 C, q. j  B! w2 H, U
  75. char *dmabufdest1 = NULL;) v! E9 T! E5 N
  76. char *dmabufdest2 = NULL;8 c( R+ K, i- V1 G3 S% t4 q! ?$ F

  77. & a- }7 F1 g/ T) p. a  M8 R8 i% n! y
  78. static int acnt = 512;
    2 O+ c3 V  m/ W3 B$ N+ t% _& K
  79. static int bcnt = 8;" j1 n! E: c, S( j9 D
  80. static int ccnt = 8;
    & g6 g7 Z. H$ O4 U

  81. 8 ^2 m9 T9 Q+ E1 }' ~
  82. module_param(acnt, int, S_IRUGO);
    8 L) p  ?# K! ?7 Q3 {3 u# B8 d
  83. module_param(bcnt, int, S_IRUGO);
    * Y" N2 _6 [& L. y+ ]
  84. module_param(ccnt, int, S_IRUGO);
复制代码

" R$ A+ `3 A8 _, x5 @8 D  x9 E3 L& J; S# J: y: h
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' }4 D  [! R' F
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& v; i% A% I% P, _' h# L% n
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( ~) X" g! z5 F3 E1 t6 d5 y# j& G9 Q* n& y9 w

0 P9 q3 n. h5 b* d
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-13 08:37 , Processed in 0.040426 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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