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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% r* w. M$ P; g2 d3 g7 o: z( l
  1. [code]EDMA sample test application
      R& @5 E( {7 v4 K
  2. /*& l3 ^4 S: s5 w( @
  3. * edma_test.c
      r' ?  o: \2 \  @% S7 X; T6 J
  4. *
    $ V4 B- ?- y5 _) E' ~5 n) ^
  5. * brief  EDMA3 Test Application
    5 r$ ?6 z3 M# e) L6 l
  6. *1 D$ v. ^, {% ~8 c+ r6 P! r8 R
  7. *   This file contains EDMA3 Test code.9 V) L; w; a  r( |4 n6 G- N
  8. *
    9 k. l) Y, v8 \0 O0 e/ O  I
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" |$ E! x) a. h* {4 N
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 X+ V' B, P5 S* @( R" I# B: {/ _
  11. *         TO CHANGE.
    : B$ p! q7 s0 ~
  12. *
    9 O3 r0 t. F4 ]$ y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' y# Y  K# J7 s0 Y6 l
  14. *
    5 ^2 q) Q. d+ ]" a  @* Z4 ]) h
  15. * This program is free software; you can redistribute it and/or0 R  R7 _6 N' g3 i4 R
  16. * modify it under the terms of the GNU General Public License as
    ' O1 d$ v) T/ v0 I, ]$ O  S# S
  17. * published by the Free Software Foundation version 2.
    / F% L2 M- i  ]6 u3 a
  18. *9 H8 ?" i2 o( F3 x
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  M% q9 `3 z$ i7 T" W
  20. * kind, whether express or implied; without even the implied warranty' o2 D' _# I$ x) ~
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . L2 E1 L: Y+ y8 {; @5 |
  22. * GNU General Public License for more details.
    + ]- s( t# X  N( m. ~( `5 n
  23. */1 |3 m5 m" P$ f4 E& c: p5 e0 u: m
  24. + r8 `/ r  t4 O  g/ t3 D- p
  25. #include <linux/module.h>' W) J" D3 T' H# P, [
  26. #include <linux/init.h>
    % T/ U1 D+ F' [
  27. #include <linux/errno.h>" V( O9 K* e. u8 L% N( J- [0 @
  28. #include <linux/types.h>
    & V. n- D, S' ]+ p
  29. #include <linux/interrupt.h>
    1 g9 J# e3 J) C# J8 [
  30. #include <asm/io.h>+ s5 g) J3 O- j' T
  31. #include <linux/moduleparam.h>
    - E4 u+ L4 `* G6 b9 w
  32. #include <linux/sysctl.h>
    + n5 A% c2 P! \- P- g
  33. #include <linux/mm.h>- o$ `1 H7 z9 a' {1 r
  34. #include <linux/dma-mapping.h>
    9 Z( T- P/ }7 B  C  _) G# k" v! g
  35. , Y, n  x1 l. F! Q
  36. #include <mach/memory.h>8 o" i" d* T0 D2 w! T! |; D/ g, y
  37. #include <mach/hardware.h>
    % a# Y- J5 f9 }, c- {8 C
  38. #include <mach/irqs.h>
    / D! l) l8 ~: B7 l
  39. #include <asm/hardware/edma.h>1 j1 u* }4 W1 V/ ~( e$ c

  40. 5 S6 n* u& i: K4 S
  41. #undef EDMA3_DEBUG+ h" m4 O' a" G* l) C! c
  42. /*#define EDMA3_DEBUG*/
    & j% n) ^4 v1 a) M5 ?  |+ Z8 ?
  43. 5 k5 `+ Q) J- K4 l
  44. #ifdef EDMA3_DEBUG$ @  v  O0 F* c  A1 g7 A8 T
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) V; t) e* P6 |; k
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    - ?& V4 X6 w" N. e
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# Q6 v0 u" _# G+ N( g" z( q
  48. #else0 C, n/ V  [  f. q
  49. #define DMA_PRINTK( x... )
    6 [: }6 I& q1 ]7 `5 `, S
  50. #define DMA_FN_IN
    $ R* e5 Q- D2 ~  r; B" E" {
  51. #define DMA_FN_OUT
    5 u; x. W# o) k
  52. #endif. p' Y( u5 @9 x: B3 w& ?( y

  53. + ^3 D6 F1 s3 c7 `$ U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)1 S1 a8 J: v  D
  55. #define STATIC_SHIFT                3; Y- W  b  \9 y1 J! G8 a5 M! i
  56. #define TCINTEN_SHIFT               20
    9 F- Q8 y6 e/ V) `1 i4 s
  57. #define ITCINTEN_SHIFT              218 [# ^) R* P) j/ u3 o5 S: C7 K6 R
  58. #define TCCHEN_SHIFT                220 N! P  h5 B3 [$ c3 |
  59. #define ITCCHEN_SHIFT               23. @0 f- `+ D7 |3 ?! U! N
  60. 4 \. k$ K/ _7 ?1 O0 I; @! D
  61. static volatile int irqraised1 = 0;7 C' \- [+ K4 k: Z6 d" o
  62. static volatile int irqraised2 = 0;  i- x* p% T8 X) m% P
  63. 8 a: o) U/ o  r9 X: e
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# S0 I5 p3 t9 l
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 d! W/ L$ c0 O" s+ B) D
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 n' w8 o) \2 W. W1 n5 ~

  67. ; n6 z: f) L: ^/ G$ D0 M
  68. dma_addr_t dmaphyssrc1 = 0;$ p$ d) c; N% x( `0 r
  69. dma_addr_t dmaphyssrc2 = 0;1 D' ]. D( i" J4 e- ~- P
  70. dma_addr_t dmaphysdest1 = 0;
    $ Z" @3 r8 K7 u* o
  71. dma_addr_t dmaphysdest2 = 0;
    0 q& i2 w0 K% ?- x" v7 ~/ e

  72. 9 X2 l$ Q- K! u  l# E  Y) I: P
  73. char *dmabufsrc1 = NULL;
    $ v; u5 M8 o) D  Y* U
  74. char *dmabufsrc2 = NULL;9 w& J5 a- C0 W+ f0 a
  75. char *dmabufdest1 = NULL;
    * Z6 @- w# R# c5 x
  76. char *dmabufdest2 = NULL;
    1 y/ q+ w1 R2 ]5 j0 I

  77. 1 `) t3 k4 f# |  S4 {
  78. static int acnt = 512;, V$ B! X% |, w( ^( i
  79. static int bcnt = 8;
    1 y- _, X% W; ?+ t+ v
  80. static int ccnt = 8;
    # B1 \' D% ^; G" I6 F. y9 W

  81. / j* o# ^; G9 \
  82. module_param(acnt, int, S_IRUGO);: f- B* D  }; ^' a
  83. module_param(bcnt, int, S_IRUGO);
    8 {# B0 m/ S4 V* C
  84. module_param(ccnt, int, S_IRUGO);
复制代码
* z$ ?' u( ^- B8 [! `5 I

, S* e) Y2 T% A9 v* n5 X      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用  f4 o. |- T. b6 @- ~$ A
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% P8 Q* x' C' T8 w  Q$ c
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 l: L+ g6 S3 N6 s" _# r
( D# _8 `$ W: w; G9 j6 z' v
  {  ~5 D" w1 {9 u5 u/ R
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-29 12:20 , Processed in 0.052326 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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