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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ X# z/ o3 l$ y0 V9 L' g3 P( I
  1. [code]EDMA sample test application7 j2 _* e& ]6 S: G$ I  q5 r+ ?
  2. /*
    ) _' g6 F0 K( V2 ?
  3. * edma_test.c
    7 G" m7 Z* g$ L  k& O
  4. *. G" G5 A3 {+ ~* w. @6 }- |$ M9 ]
  5. * brief  EDMA3 Test Application
    5 ], j9 b4 m- ~$ c' |
  6. *1 _) H8 g! e' S
  7. *   This file contains EDMA3 Test code.
    2 ^! }7 g1 s# g6 g! {! Z9 I- y$ }0 O- K! Q
  8. *
    : c; R% h7 i9 `1 S
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    # r0 ?% W0 t( q1 a& \& x" A# ]
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" `; g/ `* V$ r2 B% {8 n7 o
  11. *         TO CHANGE.
    . j/ I/ ?6 U8 T
  12. *
    # O1 X& `7 z7 _2 R2 S+ d* j
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ G1 D- e! w, v
  14. *
    # D; j: X: `7 {# |2 j& y
  15. * This program is free software; you can redistribute it and/or, N' A+ ?( c% c/ Q: B( N7 n
  16. * modify it under the terms of the GNU General Public License as& s$ n8 I& S3 G: K; N
  17. * published by the Free Software Foundation version 2.
    ) M+ W/ v1 C. e# X9 i9 {1 n& J
  18. *
      F& i* V( F: q& [! G: d1 N
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 ~  O0 k* I5 J. _% o1 k+ ^1 h- W  J
  20. * kind, whether express or implied; without even the implied warranty9 x) L& L/ T& K
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ X! ^1 C7 X7 q/ N+ V
  22. * GNU General Public License for more details.
    ' Z% C5 U3 ]1 v  `  X; Q' a' `0 n) f
  23. *// @5 p- M! V- j. Z

  24. & [2 O& p$ ~; u5 D8 d% l2 X+ n
  25. #include <linux/module.h>0 z3 m, z, Z/ E# U
  26. #include <linux/init.h>
    / v7 r9 L& X& p& w8 q
  27. #include <linux/errno.h>' O$ R. g% z* Y; X9 i4 ^# G
  28. #include <linux/types.h>; V. Z4 c" k( G: P, c; G# e8 W
  29. #include <linux/interrupt.h>
    $ h9 `# M' N: K
  30. #include <asm/io.h>
    . B  P+ I$ L9 U7 t, j/ G* U8 u
  31. #include <linux/moduleparam.h>% {4 X4 \6 ^, M3 p( l- P; c
  32. #include <linux/sysctl.h>
    , ?2 E$ A6 f: B8 a+ ^) v
  33. #include <linux/mm.h>/ |" L7 K9 `5 x9 s9 L; T
  34. #include <linux/dma-mapping.h>% `! m4 i0 i: w" i4 g7 [
  35.   H2 O" a! o7 d% f
  36. #include <mach/memory.h>
    0 `1 y* _+ d9 u2 t
  37. #include <mach/hardware.h>" R" l! B( B5 z1 i0 n1 Z; A% k
  38. #include <mach/irqs.h>; y4 _1 R. R/ y
  39. #include <asm/hardware/edma.h>, D4 t9 e" |! [1 e4 |# e, d
  40.   m1 I+ p0 I$ W
  41. #undef EDMA3_DEBUG
    - E* `( U: d0 ]6 U5 {
  42. /*#define EDMA3_DEBUG*/6 D$ z' V. Y1 W
  43. ( e/ F" O* R; E8 P; ^& l
  44. #ifdef EDMA3_DEBUG  G" |! J* @) ]3 Q1 H
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    # v. j2 v6 O$ P& [0 Y" \( ~" [! [7 I
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    5 }- |0 x/ D" @1 ^$ u' ^6 |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% S9 Q% X0 x9 i
  48. #else
    1 l' _* Q6 Z' u4 t
  49. #define DMA_PRINTK( x... )
    ( T/ O8 v( {# t! {; `& T( h
  50. #define DMA_FN_IN0 F* R; M' {( Z# {. ?
  51. #define DMA_FN_OUT
    - E, L, |9 b) o! C2 |8 b
  52. #endif
    - Z) r# V4 U  g' a
  53. 1 x% \5 i, f' x. r0 V
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)% ]  v% D% [6 I% T' \1 A
  55. #define STATIC_SHIFT                3
    # x5 M- t- T' K% p3 K
  56. #define TCINTEN_SHIFT               20
    9 N. g2 c7 n% d' s" g4 x; o' s
  57. #define ITCINTEN_SHIFT              21
    * M& |& a- r/ q9 T0 a$ \" o
  58. #define TCCHEN_SHIFT                22
    & P& I1 U+ M4 N1 d* m( O
  59. #define ITCCHEN_SHIFT               23/ S3 W& a. l; W; [2 [

  60. ( {  G. e5 T' b) Q$ C4 ^5 S
  61. static volatile int irqraised1 = 0;
    % S2 j) V$ P" K7 M
  62. static volatile int irqraised2 = 0;9 F5 r+ q8 u% G0 a3 W0 d) d
  63. 7 x1 @8 P- M3 E; I8 Y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( S( n3 F4 h" u1 O
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, {& X1 ?4 b* R# Z$ S; m
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 L7 F# A% |5 B" b1 ?# M" I
  67. , H* k  Z  j  [
  68. dma_addr_t dmaphyssrc1 = 0;! p# z) s2 a9 Z
  69. dma_addr_t dmaphyssrc2 = 0;
    ! }  u4 X; I! c
  70. dma_addr_t dmaphysdest1 = 0;) L" y1 L# @) t! R7 {7 R2 B: ~
  71. dma_addr_t dmaphysdest2 = 0;! |0 c# t. }/ ?/ C& H4 F

  72. * |# |9 t0 d' E( [! E  q% n
  73. char *dmabufsrc1 = NULL;
    . U+ e7 n( c2 p- o( N9 w, t% O
  74. char *dmabufsrc2 = NULL;
    9 x) d) q) q) u. N" j
  75. char *dmabufdest1 = NULL;9 ~8 e& [0 s  v9 I4 t
  76. char *dmabufdest2 = NULL;& |0 _/ o! n4 g, \
  77. , |8 b9 w! L! \+ g- X7 s
  78. static int acnt = 512;9 ^) D( h5 ]& |( C1 `
  79. static int bcnt = 8;
    ' c# c6 P+ b3 g8 t
  80. static int ccnt = 8;
    * |6 u/ o6 v8 M5 q4 o/ c

  81.   E) U3 i: d4 X3 E2 f! J
  82. module_param(acnt, int, S_IRUGO);* o% \8 I* M% v! ?9 T8 T) P
  83. module_param(bcnt, int, S_IRUGO);2 D( w( K! a1 s7 q' _/ f2 i
  84. module_param(ccnt, int, S_IRUGO);
复制代码
: ?8 r) R5 g. Q# p4 t

3 i( r: W% u5 \6 u- Z6 M* m      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# M- Z" O' `1 Z9 D+ n2 Iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( T7 P" z; Y  l  S' E
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: C) a; h0 K$ d' w8 q

$ x4 k& d. r- ~( w' B3 T( M
. P# c0 f# d8 f+ D
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-28 13:17 , Processed in 0.036241 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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