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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 C+ }0 z7 _5 s' }
  1. [code]EDMA sample test application
    # p7 s' T7 g3 ]) A
  2. /*
    1 N2 f/ B' ?- ^
  3. * edma_test.c/ O) e/ T- [6 Y0 Z! a" F
  4. *
    . c: i( c" e* t3 S1 x, |
  5. * brief  EDMA3 Test Application/ J6 O6 L' p. R+ h5 s- ?4 d) x* {
  6. *
    ! i3 ~  B1 v6 e5 x# G* F9 J
  7. *   This file contains EDMA3 Test code.
    0 k5 k  }9 q2 ~. I+ C7 f
  8. *
    4 l  k" U6 H: @4 l5 Q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 G  \* o; U8 I/ B6 G+ R; @
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& W7 A+ C6 z( m' s( `$ h  w
  11. *         TO CHANGE.
    7 L$ b# F! j) ^( K3 e& h7 ^! y1 N4 L
  12. *
    * i, i: E" c, C
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' U3 d4 \; X" O$ I3 J& i
  14. *, h2 i5 ?2 I6 E, W$ H
  15. * This program is free software; you can redistribute it and/or
    : s& X5 z0 W9 {, F0 ^
  16. * modify it under the terms of the GNU General Public License as8 h* K/ K9 r. z& ]; I
  17. * published by the Free Software Foundation version 2.
    ( y! r8 x+ w1 B* ~9 L4 A4 V
  18. *
    8 F5 s/ J! Y0 j# }
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ; y7 K& O1 o, v" ?$ P. W6 q
  20. * kind, whether express or implied; without even the implied warranty2 M1 Y. H& u6 C* X8 }" L) k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 h* \* v: D; X( U8 R3 K
  22. * GNU General Public License for more details., @- f# m4 x$ _# a8 \
  23. */8 t5 b. C! ^/ e3 c# U, m
  24. 8 a6 m: S2 x& f! I3 }
  25. #include <linux/module.h>- i7 j2 W: s. }- t4 K+ P; w
  26. #include <linux/init.h>7 f/ T1 p; j6 l: Z5 [
  27. #include <linux/errno.h>
    - G. Q# }" {6 P7 ]
  28. #include <linux/types.h>: ^# i+ K* c. N$ b
  29. #include <linux/interrupt.h>
    # R$ T1 e+ l/ |( ?. T7 @1 n7 R( i
  30. #include <asm/io.h>
    ! o, M  V+ D% \  p* R) a8 I
  31. #include <linux/moduleparam.h># S: Y3 t) X' |' b1 ~7 e2 I
  32. #include <linux/sysctl.h>
    * V# Z0 p+ [2 w+ W
  33. #include <linux/mm.h>
    9 @+ |' v4 Y0 w& V
  34. #include <linux/dma-mapping.h>
    7 E! ?( {/ M7 P& O
  35. : u% i  f8 Q* x: {
  36. #include <mach/memory.h>
    . f/ z( v" Z) X- G- B$ n
  37. #include <mach/hardware.h>- l  f' H9 @& j) H5 J! \# O/ w
  38. #include <mach/irqs.h>
    ! s1 o) Y& K2 ?0 \$ }: c+ ]2 ~
  39. #include <asm/hardware/edma.h>
    $ N* z/ ~' R6 n. d8 g
  40. 1 t9 T# S' E# F$ Q& o5 H
  41. #undef EDMA3_DEBUG. N8 ^$ T. p' j& W, ~
  42. /*#define EDMA3_DEBUG*/, N$ x2 J+ z' g# F" Y5 D
  43. 3 y4 b" R0 H- F
  44. #ifdef EDMA3_DEBUG0 M: P2 I4 Z" ]: J5 y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ Y! h# E2 x3 ]1 P
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 q) L# J0 R3 D" m/ p
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* D( ^& v) g* X6 p- }/ w+ a1 e' M
  48. #else) k) q% R  d5 m% z
  49. #define DMA_PRINTK( x... )
    . [1 E$ y* t. Z4 y& P- G
  50. #define DMA_FN_IN
    + T! j- U& Q; \1 K" y6 Z
  51. #define DMA_FN_OUT8 G* y+ }. A% x+ M( b0 p
  52. #endif
    % j8 D, C3 I0 P' |
  53. ! O, T3 P: I7 H; y4 C
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)& y/ M; b! c  J# z* h5 t
  55. #define STATIC_SHIFT                3  p+ y7 D# T5 j5 R
  56. #define TCINTEN_SHIFT               20: {% J1 x; X5 ^1 I" m
  57. #define ITCINTEN_SHIFT              21/ w5 r% b0 |4 m: O
  58. #define TCCHEN_SHIFT                22% c* G6 n6 A0 f" l) \+ ]1 e
  59. #define ITCCHEN_SHIFT               23
    8 A% w4 G  i& ~! `( U% z! Z

  60. 1 @- w) U1 c( `  N: _
  61. static volatile int irqraised1 = 0;
    4 O  z0 o5 l! [( q; }' Z
  62. static volatile int irqraised2 = 0;
    2 C* a# n' _5 q( l% x' q& b& o7 M4 D

  63. ) ?6 @- v- u8 q: C, ]
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 I/ D0 K4 e& Z$ E
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! s) ]; X$ \  J5 I+ ~( H
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) m) A3 V% i+ m+ v

  67. * \$ ?9 [0 p3 l& E2 c: z
  68. dma_addr_t dmaphyssrc1 = 0;& h) R3 A- V5 r& w- O( h$ o. K" n- l
  69. dma_addr_t dmaphyssrc2 = 0;
    / B+ P) Q$ y/ d- {5 L# B# K1 p; X9 I% ~
  70. dma_addr_t dmaphysdest1 = 0;1 ^" }8 I& |* C; A' g' M
  71. dma_addr_t dmaphysdest2 = 0;8 a5 n- j* Q5 \
  72. - v- M( ]' S& Y  W8 Y
  73. char *dmabufsrc1 = NULL;
    . L2 p" z* X2 N4 K
  74. char *dmabufsrc2 = NULL;+ k. V$ V. \+ b0 g) z% _
  75. char *dmabufdest1 = NULL;2 w& G# \) F- T7 y# G
  76. char *dmabufdest2 = NULL;, W# A3 _, H. u: c5 C( A6 J7 D$ v0 S
  77. & i' v# c4 R/ G! m' h
  78. static int acnt = 512;
    # m* }3 {8 |$ {
  79. static int bcnt = 8;( S2 n4 x, l, Q1 b$ m$ {
  80. static int ccnt = 8;
    # {. v1 m" m6 @% t5 i; P5 h( n
  81. % @' |$ m2 l5 Q5 x! V. s
  82. module_param(acnt, int, S_IRUGO);
    / G9 K1 n$ ^% d5 Z
  83. module_param(bcnt, int, S_IRUGO);
      Q0 O' M: k! w  `1 b% G. w
  84. module_param(ccnt, int, S_IRUGO);
复制代码

; M8 ?" `8 `- c4 `1 |
7 S( L# o3 i: L! y* x( L; i  }      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ t2 j6 t! r9 w) O  x. @! Uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 n% l' S2 z1 j) r
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 I0 H1 N' N( b
, y. U9 b% k, }8 U6 w( o' \4 Y
4 n1 _, \, R3 M+ M# V
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-6 19:34 , Processed in 0.037040 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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