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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 ]* C3 j, l. p" b) z. j: r
  1. [code]EDMA sample test application6 Y( ]. q3 r. G& {7 d
  2. /*
    0 Q- L/ Q0 {1 j) b$ ~- Z- U
  3. * edma_test.c
    ) ^! K2 A6 K( G2 X/ H, c. Q
  4. *
    ! m! r: p7 l$ V' j/ K
  5. * brief  EDMA3 Test Application
    7 ~% D2 B6 z: F5 e1 N( X- M5 ?
  6. *, V5 R) C9 o# ?. r6 |! ~3 |
  7. *   This file contains EDMA3 Test code./ }0 `5 C3 P$ H5 ]
  8. *
    ( N8 |. Z7 Y  y" T* ?
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 Q% w+ u, R) e. c. e1 z7 Y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    * @+ U& j2 j! ~1 t5 V
  11. *         TO CHANGE.& K+ L3 ^1 z; q( G2 `( P, Y5 s
  12. *
    0 B7 }% A+ Q% W9 ~# n
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. u% d, X# I" F2 ~$ [6 k' F0 k- C
  14. *
    0 {* t0 y# Q* P% u' o
  15. * This program is free software; you can redistribute it and/or
    8 C2 q5 l% j/ ^/ p
  16. * modify it under the terms of the GNU General Public License as. I* y% O4 e* [7 b& K! j( J! s
  17. * published by the Free Software Foundation version 2.- o! L# a% W. t- i& G" w4 f
  18. *
      d4 p8 r$ q+ u: j
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    , ^- v& A4 y4 I" z" o
  20. * kind, whether express or implied; without even the implied warranty* ]( P8 ~- m# t6 C& _
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * M9 i- p7 |9 ^" V. L# d- |+ _
  22. * GNU General Public License for more details.; F! E4 Z5 |. y5 c+ H
  23. */0 `1 R% l/ Z: I8 y! v

  24. . \1 p% o$ ^5 W% R
  25. #include <linux/module.h>
    : a8 f6 w& P3 b0 v& D$ ~
  26. #include <linux/init.h>
    2 r( Z& y; F# [9 o; k
  27. #include <linux/errno.h>2 K$ B) g, [8 [, ]0 M* X
  28. #include <linux/types.h>
    ; n. b9 N! W# z# a! {' J8 p4 R
  29. #include <linux/interrupt.h>
    + V3 d* H7 |1 ^# H
  30. #include <asm/io.h>* ^4 z7 L7 e# a/ U
  31. #include <linux/moduleparam.h>6 Z, a8 g& L, Y" h- j% T# U) Q
  32. #include <linux/sysctl.h>
    $ l2 _. T: ?3 Y" N/ w& U. K; D. G; v
  33. #include <linux/mm.h>' S. W* r% |" r% y# ?, l
  34. #include <linux/dma-mapping.h>) t% z/ a* s8 M" h
  35. 4 ]& J4 E$ ^; S$ |
  36. #include <mach/memory.h>
    . z/ H5 W# K- V
  37. #include <mach/hardware.h>
    , X* [/ W) V( i9 Z7 E
  38. #include <mach/irqs.h>
    - r1 L2 e  ^! c/ q4 o/ D" y
  39. #include <asm/hardware/edma.h>
    + w: N: m& o. }6 E2 R
  40. 4 b5 G6 K$ ~' P  y
  41. #undef EDMA3_DEBUG
    , P6 }1 I, P7 I% Z' {& M5 r$ C
  42. /*#define EDMA3_DEBUG*/
    ) H% f0 Q& `/ o, m$ L

  43. : ?0 D2 Y8 j- \
  44. #ifdef EDMA3_DEBUG
    4 [- ?( t& Q* V& |# g3 y# w
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); d. u, V6 q, `8 M6 U) G1 y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 c  T3 G; z  W3 ]8 w
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    4 s& H9 O) V' }' W
  48. #else+ R: Z0 p5 k  C
  49. #define DMA_PRINTK( x... )) E- _- S7 p4 t0 q- d9 a
  50. #define DMA_FN_IN8 m/ z, P$ K2 c
  51. #define DMA_FN_OUT7 Z/ Q$ @+ H6 n$ d
  52. #endif3 w' V5 {& x4 @- T5 T, \

  53. ' Y) N" @6 X. C- j6 R' R- B
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)* p% K+ w6 V1 W0 H5 _% I
  55. #define STATIC_SHIFT                3
    / ^9 A4 O# ]/ B
  56. #define TCINTEN_SHIFT               20' v0 B3 a. O- }
  57. #define ITCINTEN_SHIFT              21. ?# q3 K1 X& }9 c8 _
  58. #define TCCHEN_SHIFT                222 N# n# E( G% |  l- K& q1 K
  59. #define ITCCHEN_SHIFT               23) }; [2 @4 C4 ]2 {  J

  60. % \% m" N6 I2 |) c- Q/ O: J. s: k
  61. static volatile int irqraised1 = 0;
    , M8 s0 h5 F" G4 K4 @# L
  62. static volatile int irqraised2 = 0;
    6 F% k5 M$ V( a. }

  63. , Q7 V0 y3 g& u9 ~
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 W3 F6 X  c, x2 g4 |
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * q3 B0 w; B: G, L/ J
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% E  Q6 A" ?6 l( [
  67. ' A  z9 i; C$ S/ L1 B+ A4 G# I
  68. dma_addr_t dmaphyssrc1 = 0;
    ) P$ k' k/ R- Q( M  R5 U1 [
  69. dma_addr_t dmaphyssrc2 = 0;" Z$ m! S; c  z( u' z5 d' j
  70. dma_addr_t dmaphysdest1 = 0;
    / h7 h4 c( E; D, F# o3 m
  71. dma_addr_t dmaphysdest2 = 0;
    2 A* `& n7 a2 `% u) {  G
  72. ) I. A# p2 q: B$ Y7 ~! ]  s% L
  73. char *dmabufsrc1 = NULL;4 B! J+ e2 I  K# U( a9 x2 i$ T4 \
  74. char *dmabufsrc2 = NULL;
    ! I" E# r0 g( E9 T
  75. char *dmabufdest1 = NULL;9 j# s8 L! o. E; @% v* t! i
  76. char *dmabufdest2 = NULL;. D5 y/ J+ H5 }( O" Y& K% H" h

  77. / M+ z( t" M- I3 t* c
  78. static int acnt = 512;- i9 r( S  y/ K: X5 G. T* M
  79. static int bcnt = 8;6 t9 c5 j: o1 n2 f1 L
  80. static int ccnt = 8;
    / y$ e0 n! L- I7 O& U
  81. 5 E+ B) Q9 E! I. \  b9 C/ z
  82. module_param(acnt, int, S_IRUGO);' r% w/ ?- q& n% a9 n  b( T- z% f
  83. module_param(bcnt, int, S_IRUGO);- ^$ m" ?0 n2 c% D$ ~
  84. module_param(ccnt, int, S_IRUGO);
复制代码
/ N& W9 `: ?7 Q* I1 e" e; n# M8 L

4 Y  v3 G2 e0 q7 F: S0 O8 O2 Q      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# z$ I  @& c8 R1 g0 E" N" e: 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* h9 m/ I7 O" r) I
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ c$ B3 s8 ~) z& @* e. C. T& G1 Y
1 e+ b$ g  f* ]. `3 b7 P/ T" j2 Z, ~: j5 p5 g  w3 I) ?, B
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-9 16:49 , Processed in 0.040533 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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