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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 h, C: ]1 ~( _( u$ G3 ]
  1. [code]EDMA sample test application
    * J- n) k. D0 Y
  2. /*
    3 i, L$ ^1 S4 D2 B0 J
  3. * edma_test.c4 n. P2 N3 ], q( A+ ]
  4. *
    3 }, I' H3 ]% G8 e) D6 X- ~0 C( |
  5. * brief  EDMA3 Test Application0 ^7 Z1 q$ {4 T% [5 M$ d
  6. *( I" i% F! U* D
  7. *   This file contains EDMA3 Test code.
    . r6 L' [, y; N: `
  8. *
    0 x4 T0 {' p5 H4 f
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    3 [3 X" K- n: B- ?8 `5 e  H" `3 d/ J
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# u5 k; c: J9 g& _! J
  11. *         TO CHANGE./ t4 E- c: t5 F1 P9 K$ U
  12. *% h5 m' q" n' n
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ `; S( G3 o' Q2 N1 M; k
  14. *2 w) f2 n8 _3 y  s* f
  15. * This program is free software; you can redistribute it and/or3 W6 j6 j% f; ]8 e; ?8 p# r& S
  16. * modify it under the terms of the GNU General Public License as1 Q8 g3 e) J! |
  17. * published by the Free Software Foundation version 2.
    7 N3 S  ^; [) v6 x
  18. *+ z4 |, Q0 ^* G6 O# F  r
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    & r7 |; h5 e; T
  20. * kind, whether express or implied; without even the implied warranty
    / b- j; q+ Z, h9 ?& u
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2 |1 R; R3 f8 i: U' b% w9 m; R
  22. * GNU General Public License for more details.
    - @1 q% O) N& J3 d7 x
  23. */, o" A7 @; ]% {  c  U! G

  24. ! B* ^# y7 a# b0 f; l# m4 k8 g
  25. #include <linux/module.h>1 E+ c9 r/ P. S! V
  26. #include <linux/init.h>& |( B! t; m) f  P
  27. #include <linux/errno.h>+ D/ I7 L1 E& b' }" M
  28. #include <linux/types.h>
    - s; j4 a8 }* A7 U5 L) B( \
  29. #include <linux/interrupt.h>: R) ]7 P( i- t# C3 P4 X
  30. #include <asm/io.h>
    & \! z( `% f( |% X4 m  w. x% C
  31. #include <linux/moduleparam.h>6 G! g" }" E( X- N
  32. #include <linux/sysctl.h>
    , h& E+ y" |" I6 Z1 e, K9 r5 I: b
  33. #include <linux/mm.h>
    7 j' z- Y; l$ o$ e
  34. #include <linux/dma-mapping.h>4 q6 ~) E; o* E

  35. - q" ]+ |3 f) @9 e. @) b
  36. #include <mach/memory.h>
    0 H8 E: q1 _' }) ^
  37. #include <mach/hardware.h>
      l0 V0 W. w1 [$ h: ]/ I  i" V  {
  38. #include <mach/irqs.h>
    3 {/ J7 o3 z! _
  39. #include <asm/hardware/edma.h># B% {/ Q- t0 y) m2 L
  40. * @7 F  h4 U! R% d* a
  41. #undef EDMA3_DEBUG3 a# H5 o) ^: N* m
  42. /*#define EDMA3_DEBUG*/
    6 j' t2 l' n+ I5 D6 ^

  43. + I0 a* n/ j6 f/ K0 ~
  44. #ifdef EDMA3_DEBUG
    & f6 Q. `7 K, x
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# _  [+ f9 v$ d8 y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 E$ O8 c/ F5 x2 O# y* p) C
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - [$ _7 q; t1 \. p# \4 G! z
  48. #else: F! [# w9 W' ?9 U
  49. #define DMA_PRINTK( x... )
    * ?. W2 {/ Z' ^
  50. #define DMA_FN_IN
    : p: P$ n9 z* b* }8 y  f) Z
  51. #define DMA_FN_OUT
    1 B; x) s4 [' r/ V( q4 Y
  52. #endif
    $ b! s, u1 H* W0 q1 T( T4 a

  53. ) Z1 f$ b2 }) E; z5 I) [
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ! Y; F8 n; Y6 u+ p
  55. #define STATIC_SHIFT                3
      t; E2 v1 j# Y3 i8 w
  56. #define TCINTEN_SHIFT               206 w( a/ E& u# [8 M3 z& U5 f; e
  57. #define ITCINTEN_SHIFT              21
    + h" b7 G; y0 p0 |7 e
  58. #define TCCHEN_SHIFT                22' G2 T  P  X, f1 o4 S, X
  59. #define ITCCHEN_SHIFT               239 p& B" f+ L6 K/ ~# r9 s6 @8 C

  60. ; X0 |  T& W) b" D7 k
  61. static volatile int irqraised1 = 0;
    3 W' q0 C& l7 d$ J. W  ]& I  k/ v
  62. static volatile int irqraised2 = 0;
    ) R8 P  ^3 f  E6 R4 ^: [& _

  63. + |: C+ S* q  ~/ N
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * e, x* j% p$ g* z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 q8 A9 _5 ?* a+ Z; E4 u
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 `/ p% l4 c2 a0 Q( y
  67. 0 n0 X4 \3 {# Z8 o
  68. dma_addr_t dmaphyssrc1 = 0;" H0 k: N& b- M9 D- [# u" s( r8 ]
  69. dma_addr_t dmaphyssrc2 = 0;
    ) Z4 Z& w6 R. S4 P; \/ b) I
  70. dma_addr_t dmaphysdest1 = 0;% N. d- m" P/ P2 q4 L
  71. dma_addr_t dmaphysdest2 = 0;
    6 h2 ?6 K0 J7 v& H% r" K* L
  72. 7 g: ?2 {# [4 y3 Z; n
  73. char *dmabufsrc1 = NULL;
    : E7 r0 ]1 Q" S. ~8 O+ b
  74. char *dmabufsrc2 = NULL;
    . |5 z9 P. C% k, }. U. z% I
  75. char *dmabufdest1 = NULL;
    2 g6 P. s& y6 {- v% r. ^! i
  76. char *dmabufdest2 = NULL;$ C' I1 W! v' c- t3 K1 T0 o+ d
  77. ' W# {7 |- }8 P& l% L0 v
  78. static int acnt = 512;
    ) U9 W$ i0 K7 m  n3 h$ C( z
  79. static int bcnt = 8;
    * s8 h3 ?4 H* K
  80. static int ccnt = 8;
    1 ^* \8 r+ c& W7 p. K4 H

  81. 4 O" K1 E5 j4 I# B  J) P% k
  82. module_param(acnt, int, S_IRUGO);+ F  b! P/ `' i6 u
  83. module_param(bcnt, int, S_IRUGO);* G% g* f4 a- k# ]: H; z
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% Z' }. t7 [5 X( X  M" H
' i. ~$ t/ r# D1 `* ]      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ L9 \4 g0 c4 `: Q8 Y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" O# Y; X1 g7 C. E     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 [: G5 F0 h0 e- B
  O: F& @$ n+ [7 O- G- g

! I; j1 a$ Y: k3 w7 G$ L0 e
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-3 20:12 , Processed in 0.039367 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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