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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % p: w& F/ t! `; Z+ M
  1. [code]EDMA sample test application' U0 p2 X; e/ b8 j$ g
  2. /*
    , s( z4 M+ t$ k$ \
  3. * edma_test.c. R1 c  ~! q! Y. ~( }! |
  4. *: C3 g7 B: D; d3 A
  5. * brief  EDMA3 Test Application
    / b5 X# b2 K4 B5 I$ A" r( W/ T7 b
  6. *
    * `' [4 x; j/ r) R" h3 l( @4 Q  M$ Z" P
  7. *   This file contains EDMA3 Test code.2 ]; L/ f& c7 i* x
  8. *
    9 k% V9 r- {' C; g
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    : H6 @% i" P+ k% ]/ T( m  }' E
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 m, m  n9 k) v; m
  11. *         TO CHANGE.) W. J' Z& \% ]. y& \+ f9 S: d
  12. *
    9 v  H# I( J% K' ^! Y. G
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    / V1 E1 `- b0 u' H/ v
  14. *
    ' \' s8 S5 o* ^1 O+ ~/ l
  15. * This program is free software; you can redistribute it and/or
    ; L9 Q% W- w  E0 u% J7 S1 t
  16. * modify it under the terms of the GNU General Public License as* Y% r. O  }+ a+ k# }/ G
  17. * published by the Free Software Foundation version 2.
    - T: b" C5 i8 d9 ]) Q4 a4 J. @/ p
  18. *
    ! T" m# z0 a1 b7 y( Z- K2 V8 c
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: ]9 N; [+ ~: r  B5 v& r; v
  20. * kind, whether express or implied; without even the implied warranty! n0 u" L* t$ @8 J5 \& A
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7 |, b* e8 w! w" ~3 R. r
  22. * GNU General Public License for more details.
    ( M2 k. Q2 p1 y7 x% v
  23. */- O6 X! h6 ~. ?6 P; t/ j

  24. 4 i! C6 f( n' M1 @2 R/ ]
  25. #include <linux/module.h>
      ]( y- B* e5 Q
  26. #include <linux/init.h>3 k8 [) O; `0 Y5 K$ r
  27. #include <linux/errno.h>$ V# d! h- _  y6 t7 \  i
  28. #include <linux/types.h>/ i, N# M) G  r: C  e5 e
  29. #include <linux/interrupt.h>
    - T/ f  L* R5 [" E. \3 f
  30. #include <asm/io.h>1 B* W8 e( \$ B+ z* u
  31. #include <linux/moduleparam.h>
    ! v, |0 X' r( f8 O+ M
  32. #include <linux/sysctl.h>2 c! Z3 P; w$ `* l9 u* u8 g
  33. #include <linux/mm.h>9 a1 |: `# U: `# Z! v. m/ q9 X" K
  34. #include <linux/dma-mapping.h>" B6 Y5 }" T1 H5 \, \

  35. / w& a$ I% C9 R' z& {' ^
  36. #include <mach/memory.h>
      S# W' R! N' v0 x, D
  37. #include <mach/hardware.h>
    2 Y  _9 O/ o8 y, Y$ l0 J. `% X- E4 f) j
  38. #include <mach/irqs.h>
    : O: }4 k* }! w; x1 i
  39. #include <asm/hardware/edma.h>
    - V3 p, p3 w- X. N2 R

  40. $ y' T. d: F+ K6 k: v" n
  41. #undef EDMA3_DEBUG. m6 r* k8 h9 k  O# s2 c' h
  42. /*#define EDMA3_DEBUG*/% H! d' ?& u4 k
  43. & r/ I+ E+ F; c5 |4 R0 {9 r
  44. #ifdef EDMA3_DEBUG
    8 l9 L$ Y1 `' B) _' W$ h
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 \3 i. T+ z0 r5 e$ r7 T
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); ^. F: T0 I0 y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 @( u8 c2 w# P5 e- R' g
  48. #else  _& A2 p8 o# V( A
  49. #define DMA_PRINTK( x... )% Z4 `1 K! \' S! [( F, i
  50. #define DMA_FN_IN! {( x* k' i6 m# S/ A3 Z$ ~
  51. #define DMA_FN_OUT0 A9 C0 g. J* T' `. ]) l5 z
  52. #endif
    2 i7 ^" e/ R3 J+ e

  53. 8 E0 P' G# x! ~+ b& {6 E
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 c# k4 s: r; J' K9 q
  55. #define STATIC_SHIFT                3
    9 F# Q, [( {- v1 o/ h
  56. #define TCINTEN_SHIFT               20
    8 F+ n1 D" E. u& H5 a
  57. #define ITCINTEN_SHIFT              21
    . L& |& G8 B! p  w- L( \
  58. #define TCCHEN_SHIFT                22
    ) I3 S+ P( @2 D6 S. ]8 [
  59. #define ITCCHEN_SHIFT               234 l% @9 A; i9 \7 m, b. w8 O

  60. , A4 \5 z3 g  U: p2 H' V
  61. static volatile int irqraised1 = 0;/ A' f' P( p5 Y$ }* s
  62. static volatile int irqraised2 = 0;
    8 i: u' Z) d; A! D1 h" n1 v4 _* `

  63. ) \! Z& Q9 e, Q5 \+ e
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 J1 @$ x/ i7 G7 [; X3 I9 Z3 k
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 o; t/ S0 Z) s* \
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ }4 d/ E7 R" q( Q9 I) ^6 i5 z) O
  67. / S3 [" q/ V1 P/ b  b% _
  68. dma_addr_t dmaphyssrc1 = 0;8 g0 D# Q8 p  v# J5 o
  69. dma_addr_t dmaphyssrc2 = 0;
    2 g3 u; A0 |2 ]/ S3 V6 N
  70. dma_addr_t dmaphysdest1 = 0;  ^9 y' i2 V( c% Q1 m
  71. dma_addr_t dmaphysdest2 = 0;
    9 E: R! `1 G0 r4 p5 l/ S) p
  72.   O4 Y) K0 X0 v8 t  f( {
  73. char *dmabufsrc1 = NULL;" v2 q& A+ w2 d  U6 M
  74. char *dmabufsrc2 = NULL;
    . p7 r& z* l; m3 Z& Z
  75. char *dmabufdest1 = NULL;0 [9 G8 D# c# O/ U" C
  76. char *dmabufdest2 = NULL;
    . r) t2 j! ^: ]1 R& e/ J0 u  C

  77. ' W5 k1 v* a3 u' T
  78. static int acnt = 512;
    , N6 X! |/ L8 l0 N! e. X4 G4 Q% f5 w
  79. static int bcnt = 8;
    8 [7 h, F8 F% T8 w* E
  80. static int ccnt = 8;
    6 ?3 ?& \* r8 y: Q( q1 L
  81. 6 g# i2 s6 e* A
  82. module_param(acnt, int, S_IRUGO);
    4 \3 b$ O. W7 _6 a# I
  83. module_param(bcnt, int, S_IRUGO);
    4 s- [+ \3 y2 R8 }
  84. module_param(ccnt, int, S_IRUGO);
复制代码
& p" S: b9 w* ]5 y5 _* M
  ?7 W, D$ W6 r9 f% j/ v% z* w! F2 ^
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' c" F& [1 }% y* i( 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: `( Z" ?# n5 j2 [- y+ _. ^0 r
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 d& G) q# p3 O  {* Z
4 L$ ]& s2 M5 T: r8 T4 n+ O4 O! y- T* j/ M, C. f
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-15 16:55 , Processed in 0.039993 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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