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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( x1 p2 b* |: l+ n
  1. [code]EDMA sample test application* z0 J3 Y% l* G
  2. /** m0 M& Q2 U6 K9 f. ]
  3. * edma_test.c
    4 [  S) {. v& I& v& g% |6 }5 @9 ~3 m
  4. *. D! M( m- x6 R3 g6 ^% a, d8 \, z3 K
  5. * brief  EDMA3 Test Application
    $ X% q2 E4 {/ i! v; {3 Y
  6. *
    # ]" E- |* I6 U- m6 M* P
  7. *   This file contains EDMA3 Test code.# S8 U. [4 d6 J4 l
  8. *
    9 M! {3 l/ E/ Q9 V
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 v* f3 u$ @% ]/ Y2 t+ e( D) ?5 ?
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 O; ?8 [. R7 j/ q3 @- W
  11. *         TO CHANGE.
      d7 J9 b9 [4 Z
  12. *
    ! i" g- A2 ^9 r/ m6 d
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    4 I3 }) ?* w3 c( q8 S
  14. *
    " i" X' G; ^) Y  }* B9 Y
  15. * This program is free software; you can redistribute it and/or6 @8 v  |, P1 p6 n1 Q/ q
  16. * modify it under the terms of the GNU General Public License as
    & e% q( l9 W& |
  17. * published by the Free Software Foundation version 2.; R$ f% c* t7 U) L8 E
  18. *
    9 @7 z- }0 V9 r
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    5 y5 o) [/ U% c4 H- B* a7 s
  20. * kind, whether express or implied; without even the implied warranty
    + q8 N6 s- t, R" X& i1 _" h
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! Z/ @5 o# i: X; ]( c$ I; r
  22. * GNU General Public License for more details.
    1 C- `7 ]$ h, K5 k
  23. */
    " i6 z, F, J3 U% W

  24. ' W. T. o% U% V/ Q  _% R  T
  25. #include <linux/module.h>
    2 y5 O% e. {8 G
  26. #include <linux/init.h>/ ^6 @9 G5 W4 D) U6 c; E
  27. #include <linux/errno.h>- G0 M3 o- Z( S8 P
  28. #include <linux/types.h>
    : M  X% e6 ]2 ]6 h
  29. #include <linux/interrupt.h># I0 Z& e1 Q* N& P! o" ~" X# |+ i
  30. #include <asm/io.h>: q6 h; G1 |9 N3 @
  31. #include <linux/moduleparam.h>
    5 R* [& q# n) n, D
  32. #include <linux/sysctl.h>
    4 r5 p& S8 ^: f# e/ S4 x' i
  33. #include <linux/mm.h>
    & b% n9 G* Z5 L8 y$ t0 c6 i
  34. #include <linux/dma-mapping.h>
      k+ o, G4 \2 Q3 l7 e$ S
  35. ' [0 b. k$ u$ _6 I% v
  36. #include <mach/memory.h>. z, L- s1 x! l& c# T* S* t
  37. #include <mach/hardware.h>* t1 T% e' I! K0 u
  38. #include <mach/irqs.h>: p; M  A* P( u# z( Q2 D! a
  39. #include <asm/hardware/edma.h>; q0 |% _+ b0 M0 L
  40. + T3 v. ^; z0 p5 Y% c- v
  41. #undef EDMA3_DEBUG
    5 c. W, H3 {5 S* q& a% l/ k; h
  42. /*#define EDMA3_DEBUG*/2 w% r8 a5 Y1 Q5 G8 \( q
  43. : C1 q6 [, M3 {$ O+ Y6 B* H# f0 B
  44. #ifdef EDMA3_DEBUG' Z$ N5 o5 ^  g# s+ b4 c! G2 O4 ~# S
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    0 w  W1 n  g% R) H. N. o$ ^0 M
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 h  p" B" x" S
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ \( m) j, S8 G; ?
  48. #else7 I* \' d  w$ f3 ~, P
  49. #define DMA_PRINTK( x... )% j3 w1 y' ]+ ]: F+ C/ h
  50. #define DMA_FN_IN& P$ G2 P, M3 G& H4 K
  51. #define DMA_FN_OUT, P* H) |8 ?+ u
  52. #endif
    # C& T7 R4 l# ?! n' D: z: C

  53. 5 ~) s" F; _! [. ]6 w. A
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)* F3 H: I- Z$ ^
  55. #define STATIC_SHIFT                3% ]/ |- Z9 h" _0 t2 b! |
  56. #define TCINTEN_SHIFT               20
    . b# `, W* ]  Q, S' \, B# s
  57. #define ITCINTEN_SHIFT              21( h9 j% k$ E9 i
  58. #define TCCHEN_SHIFT                22' X: e! T  W1 A2 q) p% }5 |0 Q
  59. #define ITCCHEN_SHIFT               23
    0 T$ N+ y  l5 B, o
  60. , ?7 p: q- C9 @/ \
  61. static volatile int irqraised1 = 0;
    " k- ^) G2 n2 U
  62. static volatile int irqraised2 = 0;, Y/ y4 ~% t; ]4 r
  63. ; H! Y$ p5 M* q' c
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' S. K8 i, `7 O( x
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( Q. `; L' k, k7 d" {; [4 Z- v" a  u
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - F- H9 I1 `: U" b4 y6 W( z
  67. 7 p: ?+ ^, r( B) Z, p& K0 A2 y& S
  68. dma_addr_t dmaphyssrc1 = 0;
    7 S' Q! a; d7 ^. ^6 a. B
  69. dma_addr_t dmaphyssrc2 = 0;
    9 N4 A* o4 g, ]' E7 z+ F. V
  70. dma_addr_t dmaphysdest1 = 0;
    & r- V  F9 l* \5 s7 l. _
  71. dma_addr_t dmaphysdest2 = 0;
    : B9 _. Q$ D+ K) w" h
  72.   x+ _' t# I+ j/ W% Q2 g% }
  73. char *dmabufsrc1 = NULL;
    5 |( q/ f% u: d4 ?( `
  74. char *dmabufsrc2 = NULL;
    9 C: J+ |$ V* T
  75. char *dmabufdest1 = NULL;
    * L% P- G. k2 i; x- O- n
  76. char *dmabufdest2 = NULL;
    . d; Y; F% `. U# @2 f( K0 o9 z- v9 G
  77. ( _% o# v' I4 K" f
  78. static int acnt = 512;& |( g6 A: o: ^: S; M, x/ k5 m. l
  79. static int bcnt = 8;; ^" i! f  m) j7 g
  80. static int ccnt = 8;
    ! i" @! w- z5 w9 Y& Y

  81. . @* R# e" k, j; c
  82. module_param(acnt, int, S_IRUGO);
    ( L& Y! h. P  h7 s* h8 U% l
  83. module_param(bcnt, int, S_IRUGO);
    # S! _. x) p! W
  84. module_param(ccnt, int, S_IRUGO);
复制代码
% S" e  n+ l! u# P5 @  o" a

! D( i% c/ p' A7 V) R      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 t( T2 l6 g: O1 C, y: z9 @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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
  w" ~- A  V' I% k" y7 ~/ g) O     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。  e" {1 `+ Z/ l7 F6 W

2 Y9 s* R5 s/ V+ ]' `
1 {: F2 c% o; S! e3 o5 F, |
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-15 06:30 , Processed in 0.040973 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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