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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* U6 A( Z/ f% G2 a4 ]7 {
  1. [code]EDMA sample test application
    ; {/ [6 p% `" V2 w, B
  2. /*
    , |! e- a* d3 ^+ q
  3. * edma_test.c6 N6 [$ W# M6 @: G
  4. *
    " r8 g# f  E. i' N& h1 Y% `
  5. * brief  EDMA3 Test Application, `% y7 ?. i* J" V! D2 l# A
  6. *
    2 j& r/ a/ X. l9 f; e0 ^
  7. *   This file contains EDMA3 Test code.
    - f& U+ X. X- {0 P+ p
  8. ** j1 a, B2 e9 M# C* E- Q$ ^
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* D' I, }. [5 [8 D+ o  c
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    $ f+ M3 r9 \9 `' G' Q3 O. y8 b' ~# z
  11. *         TO CHANGE.
    , L9 P( X9 Z( }8 ^. H- S3 M
  12. *
      Q3 u7 ]8 k9 N- w2 Q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % K9 J; a6 l& D2 ^7 B. p+ s
  14. *' i: Y! g4 O' P" ?
  15. * This program is free software; you can redistribute it and/or5 {! y# Z( p2 l; @7 e; Y( ^
  16. * modify it under the terms of the GNU General Public License as
    1 n: {6 K4 g: u
  17. * published by the Free Software Foundation version 2.  X% A- F& b; C, a% j
  18. *! k$ T0 I9 F& D& V1 ^
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    7 `' x6 q9 D- ]# o# e+ i
  20. * kind, whether express or implied; without even the implied warranty% Y) Y! X2 F; s, B4 M" T
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) @" M. G9 F% F  O, ^+ w, R) F
  22. * GNU General Public License for more details.
    1 m" G6 O' u  ^1 E  ^! B
  23. */& K# B; j5 Q- P) q8 R0 A" v+ ]' l/ i* R

  24. , Q# F4 c* U8 {9 Y( f" c
  25. #include <linux/module.h>
    / m) ~' Y, @' N) B* r
  26. #include <linux/init.h>
    8 y. n( M4 Q% c% `$ P1 a
  27. #include <linux/errno.h>3 x9 Y! }* o. I$ p9 y/ H7 [
  28. #include <linux/types.h>
    ; h9 B3 E- S- Y: U
  29. #include <linux/interrupt.h>6 B/ q. `+ @% o; M8 \0 ^; `( P
  30. #include <asm/io.h>
    ( k3 }0 G- m" Z$ {& ]/ |( k
  31. #include <linux/moduleparam.h>
    4 ]* l. w7 m: i) J7 N  R; E  \8 w
  32. #include <linux/sysctl.h>' x+ m1 k4 y$ S
  33. #include <linux/mm.h>8 k9 p, ?+ Q8 B7 U$ k% I/ N" Q
  34. #include <linux/dma-mapping.h>
    - n5 o* P% ?# z/ B4 m6 {5 B1 q
  35. 5 {. g6 D. j( }4 m! {" z8 z
  36. #include <mach/memory.h># A# n, h/ ]$ G8 D. i
  37. #include <mach/hardware.h>2 B8 H+ ~, [; {; B/ O! k6 \
  38. #include <mach/irqs.h>  [* u5 t" b  A7 A& A
  39. #include <asm/hardware/edma.h>& y. d6 B4 S7 U# J
  40. ) o& k* g+ X, g5 G+ M, c/ X$ P5 H3 r
  41. #undef EDMA3_DEBUG
    9 e2 [6 z( g; g; G
  42. /*#define EDMA3_DEBUG*/
    ) M% a+ h6 ?/ m( E% n

  43. ; a3 {9 _. k# U% [6 r6 D: a
  44. #ifdef EDMA3_DEBUG
    ' r2 t9 p! _0 t+ F  q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 W8 y! o5 D; u
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    1 s5 s( J% Q, A- l' }
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' n/ U$ y7 B& K4 C- ~
  48. #else
    - D- @( G- W: ?: e( M4 |
  49. #define DMA_PRINTK( x... )* e$ f1 K. @; n+ g2 T9 |( O
  50. #define DMA_FN_IN
    2 J3 b# ~9 g% z' p0 B: S
  51. #define DMA_FN_OUT
    5 i0 v) o# G/ e1 H4 g6 j4 Y
  52. #endif
    $ I  W/ H# \5 ^5 s" Y5 {" g

  53. 7 V# _1 z6 y' x  E3 q% u- E7 A5 d9 k7 H& `
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    & |8 G1 G+ G, Z
  55. #define STATIC_SHIFT                3, }6 {5 V2 H* I" R' M' v+ U
  56. #define TCINTEN_SHIFT               20
    , n) Y8 s% H. B2 ?; {
  57. #define ITCINTEN_SHIFT              21+ F& p* j3 g1 J# Y' W5 H4 S
  58. #define TCCHEN_SHIFT                22
    + G5 _- h! ~! P# J, [4 ~0 R
  59. #define ITCCHEN_SHIFT               23/ X2 u% c  {4 G
  60. 1 I8 }' `0 ^* D8 f" q9 T8 s% d+ A8 S
  61. static volatile int irqraised1 = 0;
    ! e' C+ m/ e% A  {- v+ p
  62. static volatile int irqraised2 = 0;
    : z, K, c. r3 B
  63. / y  h" Y2 ^$ M7 r6 q7 r
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 k" n8 H: {& x1 F( v/ `* N; b, o7 {
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) G; e7 Y% s* p, |, V
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " I( X' a  [8 T5 P* Q
  67. ( A. Z  O9 R2 T8 h9 H, t, A
  68. dma_addr_t dmaphyssrc1 = 0;
    # D4 J  e1 L, Z5 T% B
  69. dma_addr_t dmaphyssrc2 = 0;
    " q9 _. `' K& t( z8 c$ e3 |
  70. dma_addr_t dmaphysdest1 = 0;+ ^+ R8 `9 a. ]* N& `! R
  71. dma_addr_t dmaphysdest2 = 0;% S3 I7 {+ p% H7 [
  72. , c+ W( M0 y; n( s* _" b% p. L
  73. char *dmabufsrc1 = NULL;
    % \  j2 m. y2 V1 D3 G9 @
  74. char *dmabufsrc2 = NULL;. _7 l. U& I. w7 x3 a$ X
  75. char *dmabufdest1 = NULL;) Y3 @0 x/ d- C
  76. char *dmabufdest2 = NULL;
    4 W: a9 j5 I& Y7 z) H

  77. # m7 _! G* i* r4 A
  78. static int acnt = 512;
    , r$ g0 E! I( K0 k/ t" u; I+ u
  79. static int bcnt = 8;$ ]+ g8 ^& }& Y
  80. static int ccnt = 8;( u; @) l% L/ `. p2 P. |" F

  81. 9 x4 @! f' @8 [, F8 K* k
  82. module_param(acnt, int, S_IRUGO);
    ( Z9 f1 t$ Y( A* G/ P( x; m; F
  83. module_param(bcnt, int, S_IRUGO);, u! E* i) x* `* q1 C7 e
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, R# x% O6 ~  s/ [; d* X* }

( a2 Q/ \$ C. V- {/ {      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* {6 f& [/ C$ H, b5 xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% F. j& l' M' ^2 o1 Y     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: V  o* m0 i. |" E' E
+ b, K: y# K$ A: o4 ^

- p5 N9 Y- i: Z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-8 02:01 , Processed in 0.040124 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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