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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 n# l7 C" v, R% t( D
  1. [code]EDMA sample test application" X8 _: R" L, T- V3 L5 o$ s8 d  H
  2. /*# X: G" Z0 S) n
  3. * edma_test.c: l, w0 }9 w  M' L$ j
  4. *0 G% C4 j) C9 r5 ]& N; {# u
  5. * brief  EDMA3 Test Application$ v' C  K# A9 P6 T* i0 `
  6. *2 s4 s7 {# ^: [
  7. *   This file contains EDMA3 Test code.1 s  S5 l( I7 O6 S, r! P9 s
  8. ** l0 x) C3 _' Q1 R! ^& h/ T' `. B
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: O* ?! e9 U- O0 k" H) \3 e
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    # |3 Z" e. Q" D/ |7 c$ `. L; }
  11. *         TO CHANGE.
    ' b2 U% N+ q( k3 E/ a4 X
  12. *
    7 L" a' }" n1 w% _5 _5 f" c7 T' B
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    - {+ M4 d: `9 }$ [* D
  14. *  O( `# c: x% F4 r5 P4 X
  15. * This program is free software; you can redistribute it and/or) a+ D# v. G, S1 s: A  M% X
  16. * modify it under the terms of the GNU General Public License as5 [6 E+ y" Z+ J
  17. * published by the Free Software Foundation version 2.6 P8 ^, J- Y$ {, i0 \$ j- x  w
  18. *- n3 n  W4 B% V( [9 n
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 d8 r8 r7 G8 w0 T- }) v: }) l, D
  20. * kind, whether express or implied; without even the implied warranty
    5 }  Z* `$ Z) T: I) Z: b
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the7 C( g! l9 K% e, E
  22. * GNU General Public License for more details.! B. z+ P, Y4 R/ F
  23. */
    ! Q# ]' X" Q) F" e# q1 t
  24. 8 I/ ^6 q! Q$ [: K; S; r4 x1 E
  25. #include <linux/module.h>+ r* e3 y3 P5 Y9 w0 i
  26. #include <linux/init.h>( q+ m7 k! F* ~. M3 D
  27. #include <linux/errno.h>/ `' I4 ~! ~- Q3 w; t; M
  28. #include <linux/types.h>
    - I2 ?# q- q& J
  29. #include <linux/interrupt.h>
    % s' O3 d9 f- @6 A, C
  30. #include <asm/io.h>8 L) s+ a7 W9 s( w9 Y% L
  31. #include <linux/moduleparam.h>8 E. M! J- r/ K5 F
  32. #include <linux/sysctl.h># E4 {- E' F4 H4 L! A" V
  33. #include <linux/mm.h>
    ' i' b3 P( T" u! Z0 D! n0 |
  34. #include <linux/dma-mapping.h>; s, p3 y; J0 q; ~

  35.   X) _/ W$ c1 Z6 g4 e
  36. #include <mach/memory.h>% h- O9 b: \& Z* _
  37. #include <mach/hardware.h>
    9 l7 W0 z: R- U& p4 O! z* [7 ?
  38. #include <mach/irqs.h>* ~, p5 B# H" a" p( ^+ S
  39. #include <asm/hardware/edma.h>
    5 P/ h) z' _+ V  t- X5 I' V
  40. 1 @# k6 G5 F2 p# o5 }
  41. #undef EDMA3_DEBUG; z) |) y3 n+ {& u6 _3 V9 h9 E
  42. /*#define EDMA3_DEBUG*/" n, F* s0 k" c  ]; M
  43. 9 d( V9 B, z  X( j$ S( k# y
  44. #ifdef EDMA3_DEBUG
    & k8 j7 i* R+ b( B! c1 n& ^: C* b0 V
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
      V/ x5 D9 e  Z5 g" X/ }9 V/ m
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ g. C4 y8 [% U" n
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - V9 l# y8 c" d9 s$ z8 m# w) I
  48. #else) J  h' i$ `4 Z+ j/ O2 w. T# D( o
  49. #define DMA_PRINTK( x... )9 n! ~! ^2 \8 m% t
  50. #define DMA_FN_IN
    / |% \% W% g  w% c$ C  c- ^8 ]
  51. #define DMA_FN_OUT" i$ N( h" Y5 O( h# p
  52. #endif
    5 ]5 d# e1 W/ o

  53. 0 a6 p* B( t4 C
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    6 \0 D* o& u, q, B# G) z
  55. #define STATIC_SHIFT                39 C8 o5 e2 w  v! Y) L
  56. #define TCINTEN_SHIFT               20- ]" {6 ~4 t  Q% M) P! C( i! q  V
  57. #define ITCINTEN_SHIFT              21" g/ X# y' {9 R5 E- W
  58. #define TCCHEN_SHIFT                228 w- _+ H, ]" ~2 B& r9 s/ v
  59. #define ITCCHEN_SHIFT               23
    / z! e- B8 T. ?7 T

  60. ! |; X# R; s+ ?( Z" L, m5 g; k
  61. static volatile int irqraised1 = 0;
    ( m0 {! y" ]- {# ]& ^
  62. static volatile int irqraised2 = 0;. K: N9 k. _3 Y$ S1 v# U- l

  63. + m1 [+ t: }! ~" Y, T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. S' }$ M4 F, U# z' t& p! u6 y% W
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) A' H- v) \( o8 ?; q3 Q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - W( D5 T/ s- N/ s

  67. / Q% n0 R$ k$ r- c2 S, U
  68. dma_addr_t dmaphyssrc1 = 0;* R5 d' _3 g* y% V
  69. dma_addr_t dmaphyssrc2 = 0;
    0 u6 _) J' k9 C! S2 z; O* e
  70. dma_addr_t dmaphysdest1 = 0;/ |. u* ]: e8 @) I" }
  71. dma_addr_t dmaphysdest2 = 0;9 {- B2 C, s0 ^+ j: S! T

  72. $ U- X9 r" x- m: F( f4 T
  73. char *dmabufsrc1 = NULL;
    7 t. \5 F3 h( ?8 Y
  74. char *dmabufsrc2 = NULL;- y# ]7 {; l" K7 d6 B9 ]0 s# y
  75. char *dmabufdest1 = NULL;
    ' I+ ]3 x, h( j# K6 B. q8 J% C
  76. char *dmabufdest2 = NULL;
    " a( m) h. ^1 ?/ ~, d! e
  77. " v, ^' R0 [! X: n
  78. static int acnt = 512;6 k1 q2 f  M6 H6 N; W2 u" g
  79. static int bcnt = 8;
    % m& W3 e2 y1 t" i5 x
  80. static int ccnt = 8;4 x! T+ s" I. Z* l& L
  81. 5 A; G  m7 a6 _" l' |. z$ Y
  82. module_param(acnt, int, S_IRUGO);
    % ~6 X7 C9 p7 f2 C4 F/ W+ H
  83. module_param(bcnt, int, S_IRUGO);2 d: O* S2 B% h0 Q9 z8 s
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 K% _. e2 |; y" ?$ G- b  W7 r. E

, F" n5 j4 r0 y# b$ I      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 R" r- ~; n) d; B' b- s7 ~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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! F; c  D0 l' @/ C$ T$ B
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! c  o# S  w+ @" O
0 c, `0 S5 k% {$ ?* h. d6 M
! h! S3 L6 d: U1 A. X
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-7-2 11:03 , Processed in 0.036538 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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