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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & H8 r, c# y4 E9 q
  1. [code]EDMA sample test application
    ) x  ~! E: U2 V" X/ @4 @
  2. /*, _! W4 E8 x7 s6 F! X- c
  3. * edma_test.c" t9 @; Z0 A; c8 J
  4. *  u& O" V  r+ g& ^# k: k% M, K
  5. * brief  EDMA3 Test Application
    / E2 V) D1 w% c2 C" Z
  6. *
    , F% Q+ a: F" T' F4 t" i$ p4 j( }5 P
  7. *   This file contains EDMA3 Test code.( G; `, z: s' a: V% V$ F. Z
  8. *8 ]: a; c1 F/ v4 C2 {8 h
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    8 k. |5 O1 N+ h% ]2 O0 m7 Z8 a
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 w0 Q1 V' R& h% I, y
  11. *         TO CHANGE.; v, N" r! J5 v( B+ n6 ?
  12. *
    ( W; T1 _, g0 G# i* A, u! T
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: B+ j$ ^9 `: C! @4 u
  14. *
    # M/ D  \, q/ i9 r; h, a
  15. * This program is free software; you can redistribute it and/or! H. G% c2 i$ t
  16. * modify it under the terms of the GNU General Public License as
    , s' u, n; ]# c3 \- U/ D0 |
  17. * published by the Free Software Foundation version 2.
    * c& t7 M, N) A. }* y( g
  18. *: w4 W" H5 m- u. q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ! @5 g) Y! `( h8 i
  20. * kind, whether express or implied; without even the implied warranty5 ^- {) c, U- e0 @/ e9 O7 |7 c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the6 Z( j$ E  L+ H3 a+ ~0 C4 e5 W
  22. * GNU General Public License for more details.% |4 X# V! \) L: H! e/ V# G+ X, p
  23. */2 w1 ?8 r% M+ \
  24. 8 G; ~/ U7 Z1 \% K+ a, g
  25. #include <linux/module.h>3 ^- m$ i. m" U
  26. #include <linux/init.h>8 L) ^5 ~4 @5 m% p5 w
  27. #include <linux/errno.h>
    % K5 T3 I! U) P0 g5 {3 n
  28. #include <linux/types.h>
    . G' ^' ]) d: k' N# s
  29. #include <linux/interrupt.h>
    2 P, C1 B1 ^( L8 i
  30. #include <asm/io.h>
    4 V0 Q& ?2 p& Z/ M" Z
  31. #include <linux/moduleparam.h>
    3 ]* f: w. h8 }% ?( ]7 k$ t2 N
  32. #include <linux/sysctl.h>8 j) ]2 E1 h- I# |% Y
  33. #include <linux/mm.h>  a1 K8 S' V9 K0 K/ a
  34. #include <linux/dma-mapping.h>& Z2 o. j) v( D4 v  Y

  35. * E2 z5 D9 C- Q$ V' e  R
  36. #include <mach/memory.h>
    / ?2 B/ D6 n. y+ m* t
  37. #include <mach/hardware.h>5 |5 w. Y* ^. u; L
  38. #include <mach/irqs.h>
    ! W! \% h8 D7 H( _6 D
  39. #include <asm/hardware/edma.h>
    . B) m1 Z. H7 X
  40. ' X2 w) U" N3 U1 e7 ]
  41. #undef EDMA3_DEBUG' L" H' {) l3 C3 n" e
  42. /*#define EDMA3_DEBUG*/0 U; D5 K1 ~+ j0 _+ g4 R
  43. / C' H, Q" {1 M: ]* Y) S2 }, d2 l
  44. #ifdef EDMA3_DEBUG
    ! h' n$ r5 Y+ O. ~2 B" n
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). u6 q' f9 w8 Y/ u6 i0 n
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    5 T1 `9 `/ X, m( P7 b8 R* _
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) ^8 n! Z# D5 a
  48. #else& G# X) B" c0 u/ V- a  a, y/ t
  49. #define DMA_PRINTK( x... ): _& c1 O% x: P! r5 a  c. D4 V7 ]
  50. #define DMA_FN_IN! N1 ~% r! U9 K2 d' S+ {
  51. #define DMA_FN_OUT
    ! D; N2 T  u8 a3 R% d  X. o0 {) m
  52. #endif
    / Z1 l* c( R7 R2 m: k4 R

  53. % P; ]- u/ w/ J& d( Y& c
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . q# A  _7 @0 g7 k( R
  55. #define STATIC_SHIFT                30 F0 o# D! \% @
  56. #define TCINTEN_SHIFT               20, c. P& u5 i, K9 E' K
  57. #define ITCINTEN_SHIFT              21
    9 s- X* A; R5 F  O$ Q, M& R; P7 b' N
  58. #define TCCHEN_SHIFT                22
    6 Z, `6 g( _1 ~- i5 e# h- o+ ~9 q
  59. #define ITCCHEN_SHIFT               23
      L1 P3 w  d# Z' d* f3 P6 ^3 T4 y

  60. 4 \, `1 f' ]' ]7 K0 O
  61. static volatile int irqraised1 = 0;( c$ z) `0 P6 S8 n) w8 X
  62. static volatile int irqraised2 = 0;
    ) A' z6 Z& p9 i( h6 @$ u+ u, z

  63. - x6 @: o, N, w' T, V% H
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ ]% y0 D2 j- m7 W6 j2 y' p9 A
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      j2 t8 n% B1 j, h1 J
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" U/ W$ p$ M" b) o, {, W
  67. ' c! ]4 r& q0 }% ]; }1 @
  68. dma_addr_t dmaphyssrc1 = 0;
    4 S5 m4 K$ ^; D: I0 v4 D$ |
  69. dma_addr_t dmaphyssrc2 = 0;1 Z" D0 K2 {! B2 a, S$ C
  70. dma_addr_t dmaphysdest1 = 0;5 {: i  f* f4 W% p# @/ H: ^
  71. dma_addr_t dmaphysdest2 = 0;" Y+ r. z. m* p1 S# j3 Q/ }$ f0 f: r5 L
  72. 6 @$ b& I' t% B. j
  73. char *dmabufsrc1 = NULL;
    5 b5 g' b8 L! E  [$ Z! n! R! D& {, [
  74. char *dmabufsrc2 = NULL;$ q9 w- E/ Z) F+ p+ H
  75. char *dmabufdest1 = NULL;
    0 e6 V  j0 d$ D4 g- h
  76. char *dmabufdest2 = NULL;
    3 Y- B  M5 K; L/ j5 U% i

  77. ; {- [5 @1 g& y5 F8 U
  78. static int acnt = 512;
    4 @! h3 v* F0 V$ Z3 o
  79. static int bcnt = 8;3 b5 Y4 U  a( G" S
  80. static int ccnt = 8;' Z) V) D4 T9 Z/ B* U+ U
  81. * ], T; z, H# Q/ l, D+ o
  82. module_param(acnt, int, S_IRUGO);
    * t+ y6 h9 k/ t" B/ j  U5 ^
  83. module_param(bcnt, int, S_IRUGO);
    ; p: S! O9 D, t2 N( ?
  84. module_param(ccnt, int, S_IRUGO);
复制代码

4 m" Q. z: P8 @) O+ {
7 b: Q8 `3 o' K' {$ O3 ~      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ ^5 D; m7 P  J) V( darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- `- b* v) s9 R! b$ g     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! L- G; |. @* o
( K/ R/ Z7 _2 C7 F8 c) R
- s/ p" U0 Q$ v1 @( s' c4 O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-2 21:32 , Processed in 0.037630 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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