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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& ~! u7 Y: L+ t4 ^* W2 [, b2 T0 N
  1. [code]EDMA sample test application  [: {. _( F  y# N! M
  2. /*5 C* c0 g6 ?  L! U
  3. * edma_test.c. b0 {  e; c- u1 p
  4. *
    ; x9 C5 @6 @* W( N" |. o6 K
  5. * brief  EDMA3 Test Application
    # s, W" S5 o0 @" Y9 C
  6. *
    9 f% u7 _3 p' h; g
  7. *   This file contains EDMA3 Test code.! p2 ]& e/ U! y7 {) O
  8. *, A2 u2 G  g2 A  I, B
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " z" Y- |/ u. I  V8 C' ^8 O
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- |) p# g% U8 V6 t
  11. *         TO CHANGE., a3 R3 [. c, f9 q. \3 {
  12. *
    1 M- \  `* E' H+ g4 j/ {$ n( b
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, G' y. b# b! Z$ l
  14. *
    4 c2 }8 Z- c  ^# r( P+ L
  15. * This program is free software; you can redistribute it and/or* H& ~0 Q' [: t. d/ j5 g
  16. * modify it under the terms of the GNU General Public License as
    * g9 z: G3 n/ b( t5 ^4 J
  17. * published by the Free Software Foundation version 2.
    ' ?0 A1 _& U+ S( r$ I! p
  18. *
    6 F+ g) @3 s- w1 q: K' F" [
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    " o2 f1 W! ?; C( Z) n: V
  20. * kind, whether express or implied; without even the implied warranty
    . s6 V$ X  C4 m/ n+ @, p% _
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! G" B( ]: n/ H
  22. * GNU General Public License for more details., G% {" y9 J* ]5 X" }6 p. X
  23. */0 m( [  R4 _& Z
  24. % D2 ?  A7 f: S% M3 @
  25. #include <linux/module.h>: i5 A9 r; m3 O1 O. l1 j
  26. #include <linux/init.h>
    ( \+ q6 d$ g. W/ s+ D
  27. #include <linux/errno.h>
    , O' r9 M- d1 E* k- q" U$ j
  28. #include <linux/types.h>9 D0 D8 M4 `  ?$ m
  29. #include <linux/interrupt.h>
    $ [9 A, [# B8 O* s: @
  30. #include <asm/io.h>
    7 d3 `- ^; O! g; {4 C  B  B
  31. #include <linux/moduleparam.h>
    $ L. V3 B, `7 X0 |; O$ _
  32. #include <linux/sysctl.h>- E' J/ X2 g% I6 `" ?
  33. #include <linux/mm.h>
    * c. @3 V8 Q( D# \9 p3 \4 Z
  34. #include <linux/dma-mapping.h>
    , L6 [: a. r" E+ d9 A. a
  35. , G2 \, L4 ?1 M$ B0 V: }- b& H& ?
  36. #include <mach/memory.h>
    * @9 H! M# _- _) Q6 E, i* s( _
  37. #include <mach/hardware.h>
    5 E. ?, ^/ X8 M0 p1 J3 `
  38. #include <mach/irqs.h>
    3 J) L1 c9 }' W* n9 |% W
  39. #include <asm/hardware/edma.h>9 c8 d( |: G8 j; W9 f
  40. ; [  q* b) i) d3 |8 R( e. a0 j
  41. #undef EDMA3_DEBUG: `5 R) g4 U& k3 w" _4 c
  42. /*#define EDMA3_DEBUG*/
    4 U, I. z/ h0 G
  43. 9 X* h3 D$ Y2 ?) P3 e  _3 T
  44. #ifdef EDMA3_DEBUG
    * f8 ^3 s. J* A9 Z# g
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - @$ H) [" ]' K4 F% o6 K: ~2 ~
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 b. h( R3 c4 r! m/ s% j4 D
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 P1 |1 I. Z; M. n* |& \( D
  48. #else
    5 [0 E9 g! U% i6 I4 m+ ~" H9 c, }
  49. #define DMA_PRINTK( x... )# M& Y9 j* A- v6 ?; U
  50. #define DMA_FN_IN; m8 p6 V+ C0 ?: }* k1 U9 y9 _% a
  51. #define DMA_FN_OUT2 C8 L7 S  U* o, U" L5 @
  52. #endif
    " }$ z* Z+ m+ R7 P. _

  53. " r) n+ U1 V3 a9 v5 ~7 B- m5 U/ Q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)3 _6 L. R1 ?& \) P  ~' y# x4 l
  55. #define STATIC_SHIFT                39 H1 v. q" k, y/ T
  56. #define TCINTEN_SHIFT               208 }0 y; q7 V. X
  57. #define ITCINTEN_SHIFT              210 a+ \5 b$ R- S4 K
  58. #define TCCHEN_SHIFT                22! p% V) ?$ h8 {5 ~9 _( |, W
  59. #define ITCCHEN_SHIFT               23& r, M+ N  b& ^) R5 ^2 ~; x* p

  60. 6 _, L" o+ K; W0 A7 J) y% |
  61. static volatile int irqraised1 = 0;# y% p) F' s# B% O2 f; r; v- |
  62. static volatile int irqraised2 = 0;6 }- y7 i: x9 v& P8 s
  63.   u& i1 G& m* a
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' v2 [; E6 X; K4 p, D5 E# s& N5 v
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - a: V& {+ n8 y& x. X! ]( d8 V) {
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 Z$ S8 r# Z; D7 g+ l; c- h! t

  67. : i& V8 F: B5 o+ X( h
  68. dma_addr_t dmaphyssrc1 = 0;
    : b0 Z! J2 r; r3 ^3 z# k" o' a
  69. dma_addr_t dmaphyssrc2 = 0;' Q1 q8 ]+ C0 C3 G( a9 z
  70. dma_addr_t dmaphysdest1 = 0;; Q( w1 I7 i3 }1 u& A/ o
  71. dma_addr_t dmaphysdest2 = 0;
    . L$ D$ F/ G$ w! j' m- ^* h) c

  72. ; O0 b% I" ^8 j$ y
  73. char *dmabufsrc1 = NULL;& z9 G$ o+ [  N) r) Q
  74. char *dmabufsrc2 = NULL;! l( c" d) `5 G, h) U: ?
  75. char *dmabufdest1 = NULL;( u. M4 N9 s. d2 n
  76. char *dmabufdest2 = NULL;) d5 ]  C  ^  E) T! D5 R
  77. 1 C' ?' _, W/ C' C
  78. static int acnt = 512;
    ; Z8 H0 M" u9 T3 H4 F3 b# u
  79. static int bcnt = 8;
    4 E( h6 @* J, `
  80. static int ccnt = 8;: l6 v' X+ b+ `
  81. : f: _2 @$ A) R" A
  82. module_param(acnt, int, S_IRUGO);3 F! b! G* R: m8 z0 J4 d2 \
  83. module_param(bcnt, int, S_IRUGO);
    $ k6 ^- B: F/ g: j* f! c: i
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 G' F0 w" J1 R4 p
/ \" p( S/ m0 k, S/ T( L% U
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 T9 w6 N; W( c1 }+ X9 _
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' V# @8 {7 Q! t  Z: S: y6 V
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& x# f- Q7 Y0 F. ]1 o% {6 `# v) v* v, A# `. M# K1 v/ o

8 b0 s) ~) x7 z# A
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-1 14:48 , Processed in 0.042858 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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