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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' Y6 P- W* v. `
  1. [code]EDMA sample test application) ?3 V: V) E6 e
  2. /*
    + s% n& [4 v2 M7 s8 e
  3. * edma_test.c
    6 \2 f/ q  R: V
  4. *
    7 x7 t# m- z- Z5 Z
  5. * brief  EDMA3 Test Application
    8 ?) ?# z  [: R$ J5 J6 _' t4 V
  6. *
    ' L2 d8 K8 M6 g; z; |$ q
  7. *   This file contains EDMA3 Test code.$ J/ c  ^& i' s1 C5 m: ~7 c
  8. *
    ( V- O' S# o! ~$ L9 t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 _9 @: K: i+ Y- f; ?
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& u1 c5 y% Q$ o! r, P7 s' g( z
  11. *         TO CHANGE.2 r3 E" S% x- e# t4 z9 H: g/ L% n
  12. *
    9 S" H9 {6 [: }: x0 f" I
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) @# h2 w5 [1 |0 A5 Y/ f1 G9 C! @4 M  l
  14. *! u" p- x5 X7 f$ D% N- A' ^" ]
  15. * This program is free software; you can redistribute it and/or* S- n: f5 L+ ?# Z) w
  16. * modify it under the terms of the GNU General Public License as, D' U; d( R8 e0 L2 r6 V
  17. * published by the Free Software Foundation version 2.2 v: ?5 Z8 s* ?7 z
  18. *+ c% ^3 N7 x  `4 m
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 i. q& Z- z4 Y! |0 Q
  20. * kind, whether express or implied; without even the implied warranty
    6 |. k0 j7 H* }( h
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the/ c& n  t1 ~$ Q
  22. * GNU General Public License for more details.7 U" m% o" \3 i# s. L& Y* G
  23. */
    2 d# u& s& n+ }: Y& K0 t% i9 x
  24. 3 P  t2 a) |* L2 d1 o. d
  25. #include <linux/module.h>
    ! N) U9 r' I7 z5 A) o) g
  26. #include <linux/init.h>4 d# o# s* I2 g' r5 Q, ~! X
  27. #include <linux/errno.h>3 I% h) Y1 j- b( U; v/ p
  28. #include <linux/types.h>
    # z4 h3 |9 `3 Z: t4 f% b5 W# D, F4 ?! O
  29. #include <linux/interrupt.h>! e1 Q$ E7 D3 e) z
  30. #include <asm/io.h>0 T0 K5 b! D% r9 @' X/ d8 b0 n
  31. #include <linux/moduleparam.h>, O- O1 W# k4 j' B/ \
  32. #include <linux/sysctl.h>
    + T& ~) _- j0 q, w! N
  33. #include <linux/mm.h>
    * [4 \  e# T' J# Q6 J: m
  34. #include <linux/dma-mapping.h>
    ) K. u- e2 l  G: n6 K. @5 D: o. l
  35. 9 [; e' t/ M7 G- g: q- Z
  36. #include <mach/memory.h>
    $ e1 D. _# ]3 i6 \- ~
  37. #include <mach/hardware.h>
    # f$ J! V5 }$ x+ }+ M& H0 a9 K$ x9 I
  38. #include <mach/irqs.h>
    ; L+ X( a2 B* P: g
  39. #include <asm/hardware/edma.h>
    8 m2 @8 j5 e$ `4 F" b% G) S. _

  40. $ h2 N* d7 R1 k9 I: R0 v+ _- i
  41. #undef EDMA3_DEBUG* q9 h  f" \( b( d0 E
  42. /*#define EDMA3_DEBUG*/
    ; Z1 i6 @; a# W6 a$ ^$ T( T

  43. - o& ^$ d4 i+ T- S" |
  44. #ifdef EDMA3_DEBUG& n! O$ ~7 D, M  Q& j' h2 B* C
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 @) s" c  M* ]1 ]# n
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      B: T) a' J  W. @
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( h5 q% o- g- x( ~" S
  48. #else
    8 o  M1 j  g$ R0 w6 t4 U  m# W! u! B
  49. #define DMA_PRINTK( x... )
    . g2 i7 z6 Y3 I8 b( W9 U
  50. #define DMA_FN_IN
    7 j* l/ \- K6 [4 f# ], q( q* [0 K
  51. #define DMA_FN_OUT
    1 T, U; N- ^8 Z; Q. g
  52. #endif
    0 V# W4 _7 c3 k3 X
  53. 9 ~5 w% ?+ Q+ d" x( D  F
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)! k" ?- W8 M9 l" x4 H: |4 |
  55. #define STATIC_SHIFT                3: J' X8 c& V$ }" Q
  56. #define TCINTEN_SHIFT               208 N* P$ |2 B% q6 _  w
  57. #define ITCINTEN_SHIFT              21' J: E3 s3 [. X8 u
  58. #define TCCHEN_SHIFT                22, l) @$ Y# C2 b- m8 N1 \
  59. #define ITCCHEN_SHIFT               235 a3 B  e1 G2 y
  60. & M( A) o6 H  [, e  {+ J2 @: @
  61. static volatile int irqraised1 = 0;* y1 h5 @/ m- v9 i  n% T
  62. static volatile int irqraised2 = 0;8 [% p9 o' w0 z" a1 o+ V
  63. / j" |/ `4 N  b! Q6 q2 C
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 k* X7 e% d* m' Q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . G+ _+ A. J* e2 q2 t
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! I* h9 X+ ^. @. y) W0 P7 `. A$ _6 K

  67. 0 V1 m: b; N3 o8 z) r
  68. dma_addr_t dmaphyssrc1 = 0;( }. @! H* _$ h' F; r# e
  69. dma_addr_t dmaphyssrc2 = 0;
    " @8 R( o) c8 Y/ q
  70. dma_addr_t dmaphysdest1 = 0;# `* n1 @- l, I( V+ z/ N
  71. dma_addr_t dmaphysdest2 = 0;
    - y$ J: V% X) z" l7 g: I

  72. * O0 y' H3 \  A( b
  73. char *dmabufsrc1 = NULL;5 E( p* \) M) L
  74. char *dmabufsrc2 = NULL;
    7 i& S6 ^! d& H0 p
  75. char *dmabufdest1 = NULL;( r2 w2 K& Q3 A1 J( M8 N% B
  76. char *dmabufdest2 = NULL;
    0 _# h/ @0 O5 Z- [( a# Y6 \, g& q
  77. . \2 K1 y& b# V/ \( u+ I, z/ g
  78. static int acnt = 512;* @- `" y- m2 w! c0 T
  79. static int bcnt = 8;
    ! j4 B2 Y- H8 t
  80. static int ccnt = 8;
    # S% M9 f% `7 s* U. S3 M9 A& d* h
  81. ! Y1 o! L, K+ O! O) h+ L
  82. module_param(acnt, int, S_IRUGO);3 t. i* E4 A7 U) ?3 S
  83. module_param(bcnt, int, S_IRUGO);( C! Z* N- l/ I' x0 [4 A& ?' |
  84. module_param(ccnt, int, S_IRUGO);
复制代码
7 V3 k1 G# ^" a% i# M! e1 x) i4 h

* X- x- V- q; [- m      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( d) @2 w( _9 {4 z& larm-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- e( S; H- i7 W: x# B+ C( p
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, u  d, t+ o2 \+ B% Q" ]4 F
9 E5 x: e# L6 o/ P1 M( s7 w" B: |) a8 z: a) c
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-3 17:38 , Processed in 0.049533 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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