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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- E/ `: ]( y* v' T2 S
  1. [code]EDMA sample test application
    ' W8 M1 ?( A" b3 a1 g
  2. /*# O% P! l. x" b. n. A+ E
  3. * edma_test.c
    1 @7 ?/ T/ [3 |  R# L1 X; s  D3 {
  4. *
    6 _' y7 P; c- `1 M
  5. * brief  EDMA3 Test Application
    ; q4 S, \! ?& ~7 Q# H& a* I
  6. *0 f( p1 W- _& _' ~# }8 \
  7. *   This file contains EDMA3 Test code.
    . F0 T: ~. |, A- }8 ~6 S
  8. *
    9 X& N0 Q9 K5 ]  @$ h: \' q& F8 {
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 p$ `! J/ e# J# |2 I2 D
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) m6 W2 S; v5 B
  11. *         TO CHANGE.; c2 n; S2 e9 ], a
  12. *. ^9 X' k! k3 Q- u9 y0 U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( V4 M8 b! l1 ]" P9 l' t
  14. *! Q6 N) Q! a; e
  15. * This program is free software; you can redistribute it and/or
    - B: u  @, K4 z
  16. * modify it under the terms of the GNU General Public License as$ l- o' {/ [5 Y, ?4 _
  17. * published by the Free Software Foundation version 2.
    & }% {- K; C) N
  18. *: [2 J% l/ ^% U7 q) q& a
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; a, V# |% L0 h7 d
  20. * kind, whether express or implied; without even the implied warranty
    ) l' Q4 K  r) u) n3 _
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the# v8 T5 R5 C; W0 K" m  B
  22. * GNU General Public License for more details.
    ) f4 R- U3 k$ N
  23. */$ a5 {6 a2 P5 P/ s1 z. E" K

  24. & B! Y2 z, O# ?
  25. #include <linux/module.h>
    % F$ Q( `/ r, y6 o
  26. #include <linux/init.h>3 s9 q4 w& F* c, Y" E2 d8 S2 p
  27. #include <linux/errno.h>  h$ \% d) @! f- p6 i
  28. #include <linux/types.h>* ?) }. s2 j, e! S! z
  29. #include <linux/interrupt.h>7 G/ L: t' @  B/ \) b
  30. #include <asm/io.h>
    6 T8 x) C3 _6 k& [
  31. #include <linux/moduleparam.h>/ o' t/ ^- Z3 u8 E
  32. #include <linux/sysctl.h>/ G: G- B7 i6 O+ {" S" }
  33. #include <linux/mm.h>
    + h8 \4 }, j) ?. p
  34. #include <linux/dma-mapping.h>
    6 K6 D* s* B/ G# g1 q# {( K

  35. . e* Y" I/ }9 d. @; E2 @/ D
  36. #include <mach/memory.h>) M) C' c: }9 m. H7 }  Q
  37. #include <mach/hardware.h>
    ) W- v( y7 c* K3 E" S/ h% k- c
  38. #include <mach/irqs.h>% N; m& Z8 T! S8 x
  39. #include <asm/hardware/edma.h>
    3 W6 Z) i% ~3 z/ E9 ?/ k
  40. # H, f) V& U5 f( f
  41. #undef EDMA3_DEBUG
    % A$ P% C5 A$ r
  42. /*#define EDMA3_DEBUG*/* o/ F$ O: Z' ?: O

  43. ' k9 A, [  p/ H3 f
  44. #ifdef EDMA3_DEBUG+ T: P8 M6 z1 O5 k( s
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    % x  B' s/ X( V
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ' |& G( ~( l# o$ e, e& ~
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    * [' ]4 V% m3 i+ ^8 x: |3 m
  48. #else; s1 B1 G  k; J: @+ {6 k
  49. #define DMA_PRINTK( x... )/ j" b, L2 @. L4 V
  50. #define DMA_FN_IN8 e- \+ j; B! o, K' j* L$ S
  51. #define DMA_FN_OUT
    # i/ f' g8 R8 e# k. [
  52. #endif: X; B( k9 y' W5 E
  53. . U9 o) Y' Y2 {/ L5 a* o; p. D+ L2 Z9 P
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( C! v7 [' u) K4 g+ o) S
  55. #define STATIC_SHIFT                3
    4 ]8 T% C0 K" B& ^7 y
  56. #define TCINTEN_SHIFT               20
    ! n# j$ w6 O0 F" u" R) ?# Z
  57. #define ITCINTEN_SHIFT              219 T; \: P& R/ A6 D1 E4 e
  58. #define TCCHEN_SHIFT                22
    % [2 j' c" P  m+ P# A  [1 r
  59. #define ITCCHEN_SHIFT               23
    + R' \4 z3 c3 m2 z
  60. , D4 {- R1 T2 i4 X
  61. static volatile int irqraised1 = 0;
    7 s0 Y( ^- [2 b; E
  62. static volatile int irqraised2 = 0;1 b) f. I+ r7 b; I$ M! c

  63. 7 @* {6 w" K& d; a+ o
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  S2 f$ s4 a6 a+ i( ]& s: X1 G
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% ?7 G' X4 ]3 O% Q! g
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' \8 X7 l2 K% i8 R% Q* f' o
  67. 8 @1 T0 W, ?+ T
  68. dma_addr_t dmaphyssrc1 = 0;
    ! v9 F" r9 ~, u4 a1 j5 H2 ]8 c9 `7 s
  69. dma_addr_t dmaphyssrc2 = 0;( t! U! ]0 v% `5 x
  70. dma_addr_t dmaphysdest1 = 0;
    ( [4 \) F, W0 q9 I4 A
  71. dma_addr_t dmaphysdest2 = 0;4 D; G2 i1 i. C2 W0 X; J  v
  72. + W6 V$ ?/ a5 }" ]- ^
  73. char *dmabufsrc1 = NULL;* E$ b- S( |+ e7 b; f
  74. char *dmabufsrc2 = NULL;# T, S1 x! V# _( U
  75. char *dmabufdest1 = NULL;: j3 i2 d/ U! y" _4 B
  76. char *dmabufdest2 = NULL;
    2 k. g; I# n1 \/ ~" p
  77. + [6 ], s% k7 U3 F5 @' |; ]
  78. static int acnt = 512;0 h  o) K! D7 [9 S2 [; b
  79. static int bcnt = 8;
    8 @% k6 g% V; Z: u: k) O
  80. static int ccnt = 8;1 D/ R' J- g- X- q, R0 e+ Q

  81. 3 n" e& I- x$ R" u
  82. module_param(acnt, int, S_IRUGO);
    ; i0 w# g( T' B/ W( s& X2 m# [
  83. module_param(bcnt, int, S_IRUGO);
    & ^8 S  i& F5 n! Y
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% k, c2 O, s' g3 T& x3 ]- o( M' H( V+ g, o& d+ P
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 _/ X! s7 T; I8 B/ _4 M+ qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( V' a8 N4 O, w  U     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 R3 x3 a7 e# U  K8 w. G
3 {% D' @. q- P
1 ?0 ?, h( ?# F  [, c& M7 q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-2 11:29 , Processed in 0.039259 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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