OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 y$ L, E9 k5 s) e3 B1 W' @
  1. [code]EDMA sample test application$ I- g9 i: I3 K) w: _/ G' K0 u8 \
  2. /*" S' T) ]/ r6 Q$ I8 c) `' O2 a
  3. * edma_test.c
    0 P; }9 I( y( q1 P3 ~
  4. *8 o0 x4 y/ i7 ?! v& F( G& z% @7 \
  5. * brief  EDMA3 Test Application* |$ ?& u' {7 C( U
  6. *
    2 j( z1 u. H  ~, v
  7. *   This file contains EDMA3 Test code.
    + Y; [; C$ t2 `2 V
  8. *! i  L4 [* i/ y/ a2 I9 ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    4 Y, ~, \2 c( P7 K" D
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    1 o; U' }$ h# \3 c5 p3 ^, E
  11. *         TO CHANGE.. e9 u. G) c  Z) @2 _2 z
  12. *
    2 w( J0 x( j( r
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    - ~+ x0 I* y7 K8 M. P; o- {" o) n: x
  14. *
    " k! n% P9 P* g  z) X6 d" s' Y
  15. * This program is free software; you can redistribute it and/or
    * g8 ~1 L9 s6 ]1 M3 j$ c7 _! B
  16. * modify it under the terms of the GNU General Public License as
    6 i6 a1 `" Q% f6 ^; f# i- @
  17. * published by the Free Software Foundation version 2.8 @) a% O# Y. v* i
  18. *- G7 L: |/ a+ e5 v2 ?/ b( ], h: E6 p9 B
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any! _! G, |9 {5 G5 ?" G4 i
  20. * kind, whether express or implied; without even the implied warranty0 n; X% q7 A6 M; M4 a) A9 ]9 r3 z8 a( s
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the" b9 F7 Z9 ^8 B8 k( G' T, f& o
  22. * GNU General Public License for more details.
    ; c1 u9 l$ w( h
  23. */
    * g: E$ l7 q2 C! l( c

  24. # ?. W5 M  b  v5 m! }2 y
  25. #include <linux/module.h>
    : ^; n" C- X+ t7 s8 m7 T
  26. #include <linux/init.h>& c/ N: Z8 T+ _) ^* h
  27. #include <linux/errno.h>: ^3 h! ?2 M5 o* W
  28. #include <linux/types.h>
    1 ~4 C0 Y: c4 |
  29. #include <linux/interrupt.h>  u( ?) \. v9 K0 M$ s1 P. d
  30. #include <asm/io.h>2 N* j& U9 G- A: }' v! i' y
  31. #include <linux/moduleparam.h>
    5 P6 c1 F$ Z/ N: v% i
  32. #include <linux/sysctl.h>
    6 V! U7 P2 |8 ~, f" `& Z" ^$ k- b
  33. #include <linux/mm.h>
    : L/ [- ~$ B0 _& S$ }+ G( c2 S
  34. #include <linux/dma-mapping.h>4 ]4 W% B; l$ Y
  35. * L6 u' U% i( p6 F6 @8 T
  36. #include <mach/memory.h>) a  r4 {; o( b! d' ]& D$ m
  37. #include <mach/hardware.h>7 w0 p0 @) q* [" R! F& t& ], C3 z5 t4 v
  38. #include <mach/irqs.h>) z/ W3 i4 k/ R9 _
  39. #include <asm/hardware/edma.h>
    7 [8 b9 j6 c6 e6 g  ?

  40. / r, m+ D$ g0 {) d, f3 U6 k
  41. #undef EDMA3_DEBUG
    1 D( y; @" g+ ]7 X; ]; B4 w  v
  42. /*#define EDMA3_DEBUG*/% s2 H5 y) {) J0 a& @

  43. ; o, M5 A) h4 t1 k3 J) X7 f7 m
  44. #ifdef EDMA3_DEBUG
    / V: d, x7 D5 S
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& o, {. i: }0 v/ g& N3 \+ x3 ~# K
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( x4 E0 p3 j5 ~- i0 K) j# |$ A
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ! S& }6 E7 q9 A
  48. #else
    ' u, A3 n  f, m, z& I. \) d9 ~
  49. #define DMA_PRINTK( x... )
    3 e6 k* M% i8 i( e2 c
  50. #define DMA_FN_IN- G/ ?( H& J3 y2 I  `, ?
  51. #define DMA_FN_OUT
      A3 Z7 |) I* [( o* \, y1 w/ ]
  52. #endif1 s4 H4 d1 D7 U
  53. ! @) Q6 q% p3 e, I0 q- b" g5 C
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)* _( U1 y# y# c$ c- H/ z8 P  m
  55. #define STATIC_SHIFT                3% F# U9 m+ }9 j7 P' m
  56. #define TCINTEN_SHIFT               205 B, ^6 r- t/ b8 J$ v7 p3 k# F
  57. #define ITCINTEN_SHIFT              21, M" E1 \8 H1 i4 g' a9 ]! c
  58. #define TCCHEN_SHIFT                228 C5 u, H( y2 q8 X  ~" A' N
  59. #define ITCCHEN_SHIFT               23' w3 _/ \& K8 R& V1 N7 z) U/ B; s

  60. - j- {, z" N( \% J1 k  |5 O! D3 A
  61. static volatile int irqraised1 = 0;& o) v9 d+ n' a9 N3 b2 r
  62. static volatile int irqraised2 = 0;  I; b" j" k3 h5 b
  63. 9 h. T% a+ T, z' r: e( W
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & n4 `% L9 X# |& j! e$ u
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& Q; r$ Y6 E; ^) `5 v$ h
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 T$ @3 k( j$ Z( i& z% ?
  67. 8 m3 ~4 P9 |8 e3 e2 j+ d5 L; o. V- Q
  68. dma_addr_t dmaphyssrc1 = 0;
    - v* E' }1 E' a3 {  J! [5 H3 `
  69. dma_addr_t dmaphyssrc2 = 0;' o5 u8 y) n' |
  70. dma_addr_t dmaphysdest1 = 0;8 M' @5 {; a$ s* a% R4 G
  71. dma_addr_t dmaphysdest2 = 0;( m( s# V( k6 a/ ~3 S1 ]# S

  72. 1 P! W6 f* z9 `
  73. char *dmabufsrc1 = NULL;
    8 c- ?7 A/ k- ~& m9 H+ |
  74. char *dmabufsrc2 = NULL;; }! }8 S2 n; ~
  75. char *dmabufdest1 = NULL;
    ! H! N5 a, e+ a. R, h. G
  76. char *dmabufdest2 = NULL;; K9 M. l  m: \

  77. 0 N+ j$ ?: Y% D+ ?" V
  78. static int acnt = 512;
    2 n" @. P/ v9 g1 d
  79. static int bcnt = 8;9 r8 ?6 ?3 @1 Y' X3 s( V" |0 Z
  80. static int ccnt = 8;
    9 D+ Z& o5 k0 |  N4 F- K0 M9 Y

  81. 1 V: F! K- ~1 R6 x) j
  82. module_param(acnt, int, S_IRUGO);
    6 w. @7 m7 s, L5 C' n( P+ H
  83. module_param(bcnt, int, S_IRUGO);( L2 _8 l% l. B4 z
  84. module_param(ccnt, int, S_IRUGO);
复制代码
/ s% k: b: @- k& y( V7 V2 N
% y. r/ u" u  Q  K) P% l' @. O
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- F7 z4 @* ^2 x% k% n
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' z+ n8 }& e2 f     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( A4 x6 X5 Z3 a5 C$ P# k, x

( |9 ~$ N3 i9 C4 y) c4 w4 o' ^8 _, `3 M; k4 I' k. n. W( b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

点击跳转“创龙科技服务通”

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

GMT+8, 2026-9-2 05:54 , Processed in 0.046881 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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