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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ H- I. V9 w) m& |* |
  1. [code]EDMA sample test application
    : J0 B  v+ A1 V2 m; x/ H' X+ e4 y
  2. /*
    1 O3 F' S4 E, T  D- h7 r& h/ r
  3. * edma_test.c
    ; |1 q7 e7 Y5 ~; l
  4. *
    , \' b: e, L' ~) q
  5. * brief  EDMA3 Test Application' D+ f( |( Y, g
  6. *  d0 T/ M' i2 x7 x, c8 O2 ^% T# B
  7. *   This file contains EDMA3 Test code.6 H0 {/ d& e5 X1 g: ]" ^5 f
  8. *! f; Y" u! d. y2 {1 T9 Q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' X) F( T' g  c8 i8 \0 y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 G; n# i/ s- R
  11. *         TO CHANGE.$ |2 Y% a: H* H; o
  12. *
    ! S4 x, m, O* `% ]
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 f  p* J  }2 T7 N
  14. *
    0 \6 W  ?- h7 S) }& u4 x
  15. * This program is free software; you can redistribute it and/or6 c5 k: N% n: `! y# ^
  16. * modify it under the terms of the GNU General Public License as8 M( I; H7 t1 k# {, I
  17. * published by the Free Software Foundation version 2.# E3 H4 {% H$ o, }0 B4 n& u
  18. *) [' Q- X- C4 Y9 Q# V
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ' ~$ v% j% y( j0 z: b
  20. * kind, whether express or implied; without even the implied warranty
    : K4 C3 D1 {5 j. T! N: E. v
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the" I: [; y! V6 d
  22. * GNU General Public License for more details.
    : x1 c# ~6 R/ V6 I2 k# e! C9 d* \
  23. */) `$ w! h! b: G' a1 I
  24. ( I( T. R, L  S% S5 B
  25. #include <linux/module.h>" t$ R; V7 N* M6 o; \
  26. #include <linux/init.h>. }7 d0 V3 p4 j& |
  27. #include <linux/errno.h>
    - ?6 F7 V% F* A  u* L' Z
  28. #include <linux/types.h>
    # }; Y  o4 `; I
  29. #include <linux/interrupt.h>3 C' Y% W6 Q* q. @# U; L* o9 x! V3 F
  30. #include <asm/io.h>
    * |: N0 F& `2 m& k
  31. #include <linux/moduleparam.h>
    3 T! V+ G% J2 u% J
  32. #include <linux/sysctl.h>
    5 f6 B3 b7 W# I/ V
  33. #include <linux/mm.h>$ E9 p" W  V4 D* V% V
  34. #include <linux/dma-mapping.h>$ F. G: W3 U- I4 @, h* n* N% Y
  35. ! `* g2 n) N6 A% b4 }  J
  36. #include <mach/memory.h>
    , B9 r; {+ L, Y/ V
  37. #include <mach/hardware.h>
    " Y% w3 Q3 a! n' R/ [9 }& |+ {$ {
  38. #include <mach/irqs.h>$ K2 t# Y6 e! T  {/ t+ l
  39. #include <asm/hardware/edma.h>. j$ J/ ~, A. t* Q( }
  40. 3 l8 {# r& l* B9 X! S5 |
  41. #undef EDMA3_DEBUG
    % |7 P6 v% I4 n  |; j
  42. /*#define EDMA3_DEBUG*/6 _1 M6 J$ T; \; \: W6 G
  43. . a1 q0 q5 X& w9 ~& Q9 ]: b$ I
  44. #ifdef EDMA3_DEBUG* _, r2 j$ J8 J! L$ ~% u  @
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    . d" X1 Q6 Z3 }4 z  U- P
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ g! B: p! n( {' G# l2 n0 r
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 s* H( h& j4 Y4 V* m1 B. ^
  48. #else
    ! r2 J9 i# ?, W9 H& Y7 y3 m
  49. #define DMA_PRINTK( x... )
    ) m' h* w1 j& j$ K+ v$ b
  50. #define DMA_FN_IN
    . x0 e, u) k) U6 Q1 ^# A, b
  51. #define DMA_FN_OUT
    % C( X  H8 s! s2 C6 z
  52. #endif; x! b8 i+ A& ?$ f' W

  53. " m" q" M* M9 r  R6 F# t
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)/ L1 }7 I! ~8 v, ~4 D9 G
  55. #define STATIC_SHIFT                3% ^* @! Y' J9 V) h( [" _* [1 r
  56. #define TCINTEN_SHIFT               20. G# ^8 H2 M; k) K# o1 M
  57. #define ITCINTEN_SHIFT              213 W" s/ b* L' n# W
  58. #define TCCHEN_SHIFT                22: s! Q/ b* T9 u8 ^6 b1 j7 r4 j* Z
  59. #define ITCCHEN_SHIFT               23; `3 x' S( ~9 ?7 W% o# i" H3 ^4 @- W
  60. 1 t6 N5 \+ I5 D' @# ~, g
  61. static volatile int irqraised1 = 0;  F5 I1 [; N: N2 e( f5 ~8 _$ r0 F
  62. static volatile int irqraised2 = 0;9 o+ h' x/ C  a- B, N3 c0 @# n1 |

  63. % E! ]; U- _  n1 _
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  ?, ^+ e: X2 J3 |6 ?) k6 C
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! S* [& j4 d1 Q: i
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 Y2 R& U8 r9 |- v
  67. 8 Q/ M: F, @6 s7 {+ S2 V
  68. dma_addr_t dmaphyssrc1 = 0;
    # ]; N; Y3 b3 d
  69. dma_addr_t dmaphyssrc2 = 0;4 {- }" g8 l" @: w) w1 l6 e
  70. dma_addr_t dmaphysdest1 = 0;0 p; Y2 i5 O* a
  71. dma_addr_t dmaphysdest2 = 0;
    3 ~' h5 b1 a4 `5 b2 k+ g
  72. * d2 v3 {, p$ @3 S2 Y( n9 [
  73. char *dmabufsrc1 = NULL;
    ) W' y/ v0 Z) D" U3 ]/ N
  74. char *dmabufsrc2 = NULL;
    % o3 F  K& [- `# u( C
  75. char *dmabufdest1 = NULL;
    : j$ c6 w& D- v* S, x, n4 g
  76. char *dmabufdest2 = NULL;  c" n% i! Q5 Y$ c5 F

  77. ) Q/ q) p, j- R$ A- s
  78. static int acnt = 512;
    , q3 j4 `( _4 y/ Z. {
  79. static int bcnt = 8;
    ' H% o& O# V; g# D+ h* r
  80. static int ccnt = 8;
    2 C! S$ w; Z' r* m- J6 ^
  81. - ^$ i2 l. W$ g3 |7 J  o# W
  82. module_param(acnt, int, S_IRUGO);  V0 |( L* S% M1 S' P+ @# D$ [- n8 P9 B
  83. module_param(bcnt, int, S_IRUGO);7 R& t4 |) X4 _- C! x8 F! Q
  84. module_param(ccnt, int, S_IRUGO);
复制代码

; t4 x* C  c5 Z) J8 R. E  w) t1 ], `8 z2 r$ E
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( l* s/ t. J% y0 g5 J$ zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: x8 j( j, G# k& p     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 }! K& M7 d  Y. t: U8 `8 r
. g$ S1 V# w0 l2 _% k0 n  A/ W0 O7 Y; N4 w1 E6 O! m6 n8 O* t# j* [
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-14 06:09 , Processed in 0.037368 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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