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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ e6 k% l+ m; h
  1. [code]EDMA sample test application
    0 i) k" f* G, v; _2 T! t
  2. /*
    ! Y' {. K$ o  V
  3. * edma_test.c
    ) L' l" G: s+ ]* C5 J* H: {7 o( F
  4. *' ^4 \8 N" d) c) a# b
  5. * brief  EDMA3 Test Application5 w( M! Z) a) g4 p
  6. *- j3 A8 g: P1 V: a. _) E- U5 s
  7. *   This file contains EDMA3 Test code.# C! @3 [. A# h$ N( y1 b9 n
  8. *) D9 d$ c8 S8 u5 N5 _5 L, m, e6 @6 @
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    9 r( m6 b# ^( y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 ]. \! q& m4 E+ K& {
  11. *         TO CHANGE.
    8 w$ I7 c* b. g! s2 Z) u
  12. *
    3 k# P( h: I; s
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % s2 J/ `' q- ~* V# k; Z
  14. *, F' ~. @7 [' b1 j# x$ B: \
  15. * This program is free software; you can redistribute it and/or/ P) h% V. T5 C& ~- Z$ O1 H
  16. * modify it under the terms of the GNU General Public License as3 |. T$ S9 K4 u9 ^& e; f9 c1 r
  17. * published by the Free Software Foundation version 2.6 f6 N5 k5 I- W, @3 t6 v* [6 U9 T
  18. *7 X' X# h3 h$ k) I
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any" W6 ?; f2 W' B! {9 l1 K
  20. * kind, whether express or implied; without even the implied warranty0 L. Y: e! H3 X) J$ z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7 D" E( G- P8 V. A2 K
  22. * GNU General Public License for more details.
    ! _+ K. N7 f+ ~. B9 R; `6 ]+ M3 v
  23. */
    9 h7 U# S6 H# l+ J4 c
  24. . c0 R( J( R1 }7 d. m
  25. #include <linux/module.h>
    * G5 a, r' R, s5 w. F$ g7 Z' w' ^
  26. #include <linux/init.h>
    - X4 C, L6 s) }5 d% W& q8 t
  27. #include <linux/errno.h>' b1 H$ B* O- o) j5 g' b
  28. #include <linux/types.h>3 X) z9 \+ B! e6 ?8 P+ u
  29. #include <linux/interrupt.h>4 O; {6 q4 r) [
  30. #include <asm/io.h>
    4 N/ f" C' B/ a4 T
  31. #include <linux/moduleparam.h>
    & r2 r+ L4 f. {- {- n7 \, X/ |
  32. #include <linux/sysctl.h>
    ! q& f" `( R1 N  p" F8 H3 f
  33. #include <linux/mm.h>3 K( h: l9 `, t3 F
  34. #include <linux/dma-mapping.h>$ [1 H' W- E# L1 z  S

  35. 5 O. R+ j5 [2 ^, h$ P( L; S
  36. #include <mach/memory.h>
    5 i  _2 E6 N! \8 a
  37. #include <mach/hardware.h>
    8 x" A# b, R" H/ C/ V
  38. #include <mach/irqs.h>. S& E( X2 ^  t
  39. #include <asm/hardware/edma.h>5 J" ^" g% I4 w- a4 _8 w( ]- b# K

  40. " }# T5 J1 S3 H7 }! c* }8 x' s
  41. #undef EDMA3_DEBUG. B% U6 ?; g' d/ b/ x/ D
  42. /*#define EDMA3_DEBUG*/* g' ]* ]! [( o) V! z

  43. 1 F" J4 k5 a7 C; h% I8 Y' D3 s; J7 Q$ I
  44. #ifdef EDMA3_DEBUG+ }2 ^( ~- j) @7 V( x% S
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    , o5 F0 \" H; `7 K6 V: s2 h
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) @* I; d9 K" N& _4 L3 k& ~: U8 g
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 {- M3 w4 `. ?$ s8 A% o! U+ X
  48. #else
    2 D* w" L: y; W; k& m% ~
  49. #define DMA_PRINTK( x... )7 R0 [8 a+ K; `5 v
  50. #define DMA_FN_IN2 r4 B! B3 j6 S/ R
  51. #define DMA_FN_OUT2 X# F1 I  o- A* K! K; T
  52. #endif
    0 X) h/ ?, y! Z6 J# W, n8 y, ]

  53. 6 A) s6 a7 w9 ]. N  i" H+ ^' {
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ' l5 u, A3 T7 H2 {/ Q
  55. #define STATIC_SHIFT                3
    & K8 Q, M+ a% }1 n8 E& I
  56. #define TCINTEN_SHIFT               20
    5 S% ^4 ?0 V% h8 N1 k) x
  57. #define ITCINTEN_SHIFT              21$ t; i0 E$ b$ v6 i( |
  58. #define TCCHEN_SHIFT                22
    " `! F/ |, u5 b3 G! u3 E, s$ `, u! e
  59. #define ITCCHEN_SHIFT               23& Q: W5 Y4 J7 x) x* ~

  60. * `6 z" R! F9 y8 z6 j
  61. static volatile int irqraised1 = 0;
    % l( x' s( {$ Y) T( w4 k' A
  62. static volatile int irqraised2 = 0;9 k( M% m0 l8 g4 U1 b2 @

  63. + d4 ]" _( B) |
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' ~- I& P; v! f: }9 z3 M: x3 M4 ^6 }
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 w" _0 P* H( X% `0 l
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( _- [1 H( j) K7 N

  67. : f6 z  z! p' B- i: N$ Y
  68. dma_addr_t dmaphyssrc1 = 0;
    . [+ J( O! }! H1 H& f+ }
  69. dma_addr_t dmaphyssrc2 = 0;
    9 C* e' _+ o3 T) b/ d$ c) J$ w
  70. dma_addr_t dmaphysdest1 = 0;8 O9 C$ v5 k0 K) c
  71. dma_addr_t dmaphysdest2 = 0;  W5 e, ?; S) V: m) p: h+ R5 Z
  72. - ]" C7 d( z6 @9 N7 e3 Y' p
  73. char *dmabufsrc1 = NULL;
    / r/ j! [) t9 Q" N
  74. char *dmabufsrc2 = NULL;
    9 j5 l6 J) x9 R1 D9 n
  75. char *dmabufdest1 = NULL;
    * ^) J; }. g' l$ [$ y$ }
  76. char *dmabufdest2 = NULL;
    ' U1 B% V$ G1 z$ e1 o
  77. " x2 E3 I$ I1 i2 s% D3 k; u
  78. static int acnt = 512;
    - O6 a- b4 r' n! w; x$ F( j% I3 u& G
  79. static int bcnt = 8;
    5 j9 C5 O( V2 `7 V
  80. static int ccnt = 8;
    + j$ h# Y" E: d$ @5 x' F

  81. $ M) Q2 Y- C2 g2 ]- f9 A, G
  82. module_param(acnt, int, S_IRUGO);$ X7 ?# B. y  d( q: ?
  83. module_param(bcnt, int, S_IRUGO);, X7 D9 S* D  ~: t( M' W2 K0 H
  84. module_param(ccnt, int, S_IRUGO);
复制代码
! j; {* m1 J- H, A! y5 R

! N# c# L# f3 k/ m      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! }* ]. `4 }, c6 E1 i$ ~
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。  U! q8 h0 b/ k) ]: V* g
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
  g  ^, q8 ~6 C- E# }& d- ~/ t5 P& p+ o

+ a4 ]( e, `1 b4 ~1 M
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-1 20:14 , Processed in 0.040296 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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