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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 f/ y2 E' N. M; L" S' K8 s
  1. [code]EDMA sample test application
    0 Q$ u$ v& a, l  S1 t8 c
  2. /*
    ! Y9 [  V; d; D
  3. * edma_test.c; d4 m0 K0 P& M- {( K7 {$ h/ O
  4. *
    9 \6 n5 X5 [4 Z2 w
  5. * brief  EDMA3 Test Application, B" s0 H: e( p' M. F' b: N
  6. *
    $ Q9 @) s. [3 O' D: H
  7. *   This file contains EDMA3 Test code., c. V( H& m7 z% o5 _" m3 v, c
  8. *
    ; x7 t6 T$ o3 }
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    2 M. T1 I! c/ L$ _' W, B7 x' s9 _
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    9 I* z$ n' r. A5 e- E
  11. *         TO CHANGE.8 H( b, c- U/ ]7 ~9 |
  12. *
    & z- H/ y4 g7 N$ [. N
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. i7 B1 f0 K2 B* i. U$ S' X
  14. *2 T' V9 f+ }9 ?7 @/ x* a* n; C
  15. * This program is free software; you can redistribute it and/or
    + o" ]* }+ B3 z, X+ g- K5 K* }% i
  16. * modify it under the terms of the GNU General Public License as$ y1 I- S9 C# r
  17. * published by the Free Software Foundation version 2.
    + l' _) c5 @# I) G" s
  18. *7 H0 N- N% c3 x/ L1 y) o/ h
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    % D+ T, B$ i3 F. [1 d
  20. * kind, whether express or implied; without even the implied warranty, Q/ V! {$ ^) c$ n' o* s: Z( J
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the% m" M9 A! {0 |* D8 J: \) {$ }
  22. * GNU General Public License for more details.
    , W) ^& `% ~/ J! G4 U8 O
  23. */
    2 J" D6 a9 [' S+ N+ d  P6 q
  24. ; P7 ^7 M9 l2 w  @/ ]% N( Y) w% w5 ?
  25. #include <linux/module.h>
    6 S% p1 `- C! M, p& S4 m; b; f
  26. #include <linux/init.h>
    ) A1 u+ K: z* K, F0 u% {, S8 c
  27. #include <linux/errno.h>
    9 d1 ?2 u* d  T! ^) R, o6 R
  28. #include <linux/types.h>
    - ?- P2 h+ x% N6 u- }
  29. #include <linux/interrupt.h>
    : e. H/ T# A) y$ \. y
  30. #include <asm/io.h>
    9 B' M- A& V+ Q0 K7 S/ E- E
  31. #include <linux/moduleparam.h>
    $ X, s8 P! ~: h5 @' Q- I
  32. #include <linux/sysctl.h>
    6 S8 _/ k9 u5 ]3 k
  33. #include <linux/mm.h>4 F( z3 z2 p5 w: P6 w7 I
  34. #include <linux/dma-mapping.h>0 U9 E" c' P; W# `& ^) k; S) ~

  35. 1 y1 w/ L4 A* {/ h; ^
  36. #include <mach/memory.h>7 C; M  O3 o0 x8 T
  37. #include <mach/hardware.h>2 j. s$ t" N5 H
  38. #include <mach/irqs.h>+ N% Y  K! F7 B) r# V6 m2 J
  39. #include <asm/hardware/edma.h>
      a* H4 L, s. v
  40. 4 @" _" O8 W- X) l- x0 D0 G/ s+ v
  41. #undef EDMA3_DEBUG
    9 k" y4 l( V3 Z
  42. /*#define EDMA3_DEBUG*/; ~0 T: v' }! D' t2 H9 s* f

  43. % `/ k# j! N' [8 t  c& E( T
  44. #ifdef EDMA3_DEBUG! P. U; d( ~" |1 l
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 G9 }$ `+ N6 I( F3 W* W
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    : A4 @8 M4 S- ^6 {, N
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    4 r4 ^& t# ^+ d" I  X! |* H! k0 {
  48. #else
    - b$ ]8 X6 B+ S  ^. }0 k
  49. #define DMA_PRINTK( x... )
    ; O  v. _4 L* r6 d. O2 r7 d- t
  50. #define DMA_FN_IN
    : s. ?/ A7 ?* ^
  51. #define DMA_FN_OUT9 ^" C- H, p: p6 G5 @/ V# A
  52. #endif
    1 f* m2 K9 i" ?

  53. ' I4 R. A  K; f: y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ' L8 ?& H' X- G5 r$ ]
  55. #define STATIC_SHIFT                3. V/ ^: g% p( }7 q" q; x! v8 L
  56. #define TCINTEN_SHIFT               20
    ) w& o: ?0 p: G8 R2 T
  57. #define ITCINTEN_SHIFT              216 L; G; s9 Z! {1 ~$ F
  58. #define TCCHEN_SHIFT                22
    % C) e% q1 f8 V6 }
  59. #define ITCCHEN_SHIFT               23# q8 m2 f  m* X6 G4 ~$ M0 L4 |

  60. 8 \, l) f: d7 M7 O, r
  61. static volatile int irqraised1 = 0;
    6 n& y8 {' C& p
  62. static volatile int irqraised2 = 0;3 [1 h, ~# ?* _2 Q. O

  63. * w2 U# O. o5 M8 h6 X
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % `! X& L3 @, O# C/ M. N6 Q& ~) D
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 _: m* d: g7 _6 j
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ A  i* G8 ^% E
  67. 0 H$ O, z4 G  `' e
  68. dma_addr_t dmaphyssrc1 = 0;1 U  d3 b" S' Z9 [6 w) E
  69. dma_addr_t dmaphyssrc2 = 0;) R0 Q9 H6 b; s2 O/ p4 P. L
  70. dma_addr_t dmaphysdest1 = 0;8 J8 a, @4 U0 g* T, {1 @4 |: t3 r
  71. dma_addr_t dmaphysdest2 = 0;
    3 z! U) T3 h5 v) \

  72. 1 _7 H6 @9 H% p5 W( p1 `3 s
  73. char *dmabufsrc1 = NULL;
    ( @9 Q/ m5 A; A5 S5 f# t/ d
  74. char *dmabufsrc2 = NULL;  r- Z, h+ b5 f1 E# V
  75. char *dmabufdest1 = NULL;) H1 R- H7 v. l" m# b- B2 j
  76. char *dmabufdest2 = NULL;
    7 R; l' n* C. a* D! ~
  77. / E8 }& b& S3 O6 M" i2 M
  78. static int acnt = 512;. C9 r1 @( y3 U, p8 i
  79. static int bcnt = 8;+ h6 a6 [" c4 o6 ~
  80. static int ccnt = 8;
    3 O2 }, Y6 V! L/ U+ T$ F; B, P

  81.   X: i+ c6 X0 x% Y
  82. module_param(acnt, int, S_IRUGO);
    ; N+ i3 e: j0 X0 _3 m/ Y& L" u
  83. module_param(bcnt, int, S_IRUGO);
    0 y% p$ @4 X6 U
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; ^% r2 p4 I. I# T' v
! x' M* l9 o! I5 p
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* I' w6 w  q- r, warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 w1 x/ u. r$ Y$ H0 q
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# [: F/ s6 o+ n
: M- k1 X4 R, Z, s& \; {
1 m) T* s8 h& I! M
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-9-16 02:51 , Processed in 0.036000 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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