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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 _' J1 ]5 u* t' B
  1. [code]EDMA sample test application8 M6 c- X+ f5 W8 P' A: C( e
  2. /*& G% C3 \; P( F" D4 N
  3. * edma_test.c4 N1 [) z) c: A" V5 U
  4. *
    + ^' H( J! D& X) K2 r- I4 d
  5. * brief  EDMA3 Test Application
    ( ~, y! d, H- x+ V
  6. *: k/ V) v7 M6 e- m
  7. *   This file contains EDMA3 Test code.* I* h& B+ C4 P
  8. *
    ( Q' j+ Q  t9 ]* E; L/ `4 F
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ s+ i6 P* o, U- H/ f% u
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 m; U$ v7 i' R
  11. *         TO CHANGE.) x# `! P1 M' V. |6 m' L
  12. *
    6 B# X9 Y% @+ R' [
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) Z; C$ g2 g" h& j
  14. *
    . h2 J2 p6 t" S' q* v
  15. * This program is free software; you can redistribute it and/or3 V- w$ W! H8 U3 ~4 r( t9 N. S
  16. * modify it under the terms of the GNU General Public License as
    6 S3 z: T9 E9 O0 f9 K
  17. * published by the Free Software Foundation version 2.0 M. T7 e, e0 }1 x5 P
  18. *  k. c# k3 D( O- v6 Y9 {
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    7 M; y, {: c8 [7 U% [3 ]
  20. * kind, whether express or implied; without even the implied warranty
    9 b. @6 P* _, e( p0 H( T, o
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3 E+ k8 _" H9 a. H! `" f" O+ U
  22. * GNU General Public License for more details.
    9 y7 V2 L9 p; }
  23. */
    7 b6 E& s+ _, ~( r/ v. D1 N

  24. 8 z' v7 r3 X3 U4 q" P& q3 @6 A
  25. #include <linux/module.h>
    & w  t8 W+ e* g9 W0 o
  26. #include <linux/init.h>: p1 X4 Q0 g; Z! y' M0 C7 i' G
  27. #include <linux/errno.h>
    : |5 U2 H* F' u5 [
  28. #include <linux/types.h>; f  W; T: {5 \, n3 a& B" g
  29. #include <linux/interrupt.h>
    7 F( M/ s$ Y3 I
  30. #include <asm/io.h>. V: p) _/ K7 ?9 G* X" ]( `! q! Y
  31. #include <linux/moduleparam.h>* E; b7 k) s1 U" B6 r) n
  32. #include <linux/sysctl.h># G: ]' r3 \" W$ P- B  B' U
  33. #include <linux/mm.h>+ g) ^; t/ U+ Q2 F
  34. #include <linux/dma-mapping.h>$ j  R, B: B) A% R
  35. ' M+ w) \* T! x# K, m7 i- q" a4 ~: F* ~
  36. #include <mach/memory.h>
    9 {; S8 W# n3 Z2 x# N
  37. #include <mach/hardware.h>9 \  W$ S9 Y: ^, `. P1 n/ q3 @3 M0 {
  38. #include <mach/irqs.h>  ~' k( p6 X# k5 t2 ~5 R# d
  39. #include <asm/hardware/edma.h>% l9 g: x! P& Z! C
  40. 0 M# ?) A) S2 J+ u) z5 ~% h: U
  41. #undef EDMA3_DEBUG
    % Z4 x8 e2 ?5 @, w
  42. /*#define EDMA3_DEBUG*/8 L/ p( |- J1 R

  43. $ z7 S* R  q. t; _' |8 k
  44. #ifdef EDMA3_DEBUG
    3 k# p3 X! w. K8 b
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): `; A' V7 W( @  d
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" k7 S$ K* H& ~  _/ G; i
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    & ~- _3 O  |  l9 |' w5 `
  48. #else
    & W  Z3 u3 \) w7 _( v) J' F
  49. #define DMA_PRINTK( x... )% q$ g" V7 `7 t6 B3 t0 V/ b. i1 @
  50. #define DMA_FN_IN( u! R9 `* |9 x3 e+ |  {! }
  51. #define DMA_FN_OUT
    $ \0 |$ d+ R- c5 Z6 t  Q
  52. #endif
    ' i1 a% l; A1 E' V3 t& |0 |2 w  l+ F

  53. 8 [1 P8 n) F* j- a3 d
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( i9 J+ c3 ]& J9 Y- J7 S. g4 u/ J  d
  55. #define STATIC_SHIFT                3
    * n" S8 \3 k3 ?$ z  K
  56. #define TCINTEN_SHIFT               20) n' x: f+ y" ?
  57. #define ITCINTEN_SHIFT              21% N6 l7 z* r+ |1 P4 x+ u
  58. #define TCCHEN_SHIFT                22$ |7 A/ i% }4 c" _' m
  59. #define ITCCHEN_SHIFT               23) E6 ]! L* }% I; `
  60. * h$ z& Z, e2 r- y% ^5 M) H
  61. static volatile int irqraised1 = 0;4 |7 @% k% @! g- [, ^2 W
  62. static volatile int irqraised2 = 0;" |) @& C5 z) J! Z

  63. 6 m  f, i4 Q3 t' v, ?
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; `" p! t9 g/ {
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& s( J7 f3 G0 Y' C* z2 F# b$ l
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 U& y" h# e5 g  A% x) ]  k5 A

  67. $ T5 P8 q5 z) x! s" s
  68. dma_addr_t dmaphyssrc1 = 0;. X6 `1 i; T, O& [% @) B7 W6 Y
  69. dma_addr_t dmaphyssrc2 = 0;
    . Y# R/ B8 R' M& U2 P; ^2 F
  70. dma_addr_t dmaphysdest1 = 0;
    4 v. [% d  g6 }& {. h' b
  71. dma_addr_t dmaphysdest2 = 0;) G( B  P# @" i4 M
  72. ' P. s5 F" h. ]
  73. char *dmabufsrc1 = NULL;
    : M( h( q+ j% c% m9 r
  74. char *dmabufsrc2 = NULL;
    - I2 q4 C) Z! s
  75. char *dmabufdest1 = NULL;0 }( K! a+ u6 ?3 _& _
  76. char *dmabufdest2 = NULL;! X1 ~* ]" H% a3 k8 I5 Y" k
  77. - t- n3 T: h- I2 s
  78. static int acnt = 512;# t' R9 t2 v( |1 _' ~
  79. static int bcnt = 8;) ^, H  M' b3 p% d2 {, y
  80. static int ccnt = 8;+ y5 w3 t) L$ ]9 h
  81. 0 R6 M' p. F# a2 g) q+ b
  82. module_param(acnt, int, S_IRUGO);
    , x9 N+ ?" i; \% j' l
  83. module_param(bcnt, int, S_IRUGO);% O9 c0 C0 P& N2 f/ g' ^
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 l+ ~1 f5 x3 |! P$ R: ]5 B
  I" g8 w$ ^6 W      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% r# n9 C" w8 U, N9 H. Q9 @
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" ^( G+ t$ \$ Q+ I     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; {  m' k+ Y$ L" ?5 {& ]/ c
) [$ q0 K3 \+ L! e# f+ Q) d
) z& G- {: W& w; ~
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-22 22:52 , Processed in 0.037277 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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