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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; g/ D! y. W/ {/ N5 e
  1. [code]EDMA sample test application
    1 v" ?# e0 I  S* `- E; Z4 ^; T) g" x& L
  2. /*
    7 C( ?! M( N5 \, X
  3. * edma_test.c
    0 X+ D, T1 ?) n' y3 q5 K5 b
  4. *2 I/ d* y. a9 G6 y1 g( B
  5. * brief  EDMA3 Test Application
    4 B) r1 Z- k# L7 D# e) E$ \
  6. *4 Y* D5 Q& g3 J* M- g" a7 R
  7. *   This file contains EDMA3 Test code.) s3 N3 N" }% E3 U
  8. *
    ! ~& D- A, H9 P! B1 G# `6 Z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 ^+ z+ ~# {5 o2 W. C" i
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# [! C; n! [$ y1 `
  11. *         TO CHANGE.
    ' F2 A6 c+ i! ^& S/ p( h
  12. *
    7 P4 H, @5 O7 S- i% W
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, K) d' _+ K" r) J. Y' y0 S* F( @
  14. *
    1 O3 K& F8 {/ Q/ \( p+ [
  15. * This program is free software; you can redistribute it and/or- |" ], m/ Q9 g
  16. * modify it under the terms of the GNU General Public License as/ {& |/ b* l. V7 L0 l0 r& p4 L
  17. * published by the Free Software Foundation version 2.9 Y' ]0 J2 F5 t( g$ E
  18. *" Q# e3 ]( t( I$ U. S
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any* w, O* @  I% l0 R
  20. * kind, whether express or implied; without even the implied warranty
    0 L- S6 {/ s. L: p
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % z( Y# I2 S+ W$ t6 {* y* O  @
  22. * GNU General Public License for more details.) N6 f& Y8 d6 U$ B
  23. */2 _! F% B) c  e0 ~1 U  z

  24. ( L( H8 o# R. N1 N( h" B
  25. #include <linux/module.h>1 C# }* B# ?, K; [
  26. #include <linux/init.h>* C5 W3 i& J: t0 Z
  27. #include <linux/errno.h>
    % T% G3 y5 @1 y: l$ t
  28. #include <linux/types.h>6 J' J* C  Y& e9 F
  29. #include <linux/interrupt.h>  ]! b  f+ D4 S7 N" |
  30. #include <asm/io.h>
    4 o2 F! u  Q6 z, I
  31. #include <linux/moduleparam.h>
    " ^' u. T) a3 W( _3 E7 f: V
  32. #include <linux/sysctl.h>
    9 c; W8 o6 t5 J7 e/ z+ Y
  33. #include <linux/mm.h>
    : l5 z$ M4 r7 M
  34. #include <linux/dma-mapping.h>
    : P) ^! f/ D4 c  A4 J

  35. 5 {+ c! X9 A0 V" ^" F' ~6 G/ W
  36. #include <mach/memory.h>' d( G6 y9 F1 ^  {; U4 G6 ~2 d' {
  37. #include <mach/hardware.h>
    & D% f2 H- p6 c# H, _$ y  T# x2 N! A
  38. #include <mach/irqs.h>
    7 y1 @5 b2 _, k' ~
  39. #include <asm/hardware/edma.h>
    ; n/ ^7 n$ `. }/ H/ s; z8 g0 v
  40. $ g' {4 `# y5 I4 f0 t; p* q
  41. #undef EDMA3_DEBUG
    9 R' C9 j& ]' g9 g9 |
  42. /*#define EDMA3_DEBUG*/( T6 v/ m" t+ m6 F

  43. ; ^9 B- H; `! l" \: U
  44. #ifdef EDMA3_DEBUG- F6 \, l" p! F* `& Q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) \6 x9 U: H6 ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 o! Q; i$ W- K! |3 |- o0 q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 L2 [: b; C9 v0 J
  48. #else
    $ w9 o/ H4 X- j  s3 l% ]) d9 \) W% d
  49. #define DMA_PRINTK( x... )
    ; j: B  u7 u- H$ n
  50. #define DMA_FN_IN# G& Z. U0 k3 {  {9 A- \
  51. #define DMA_FN_OUT
      ~- k+ w$ l- c* O/ L/ m
  52. #endif2 X. s) p' M" m1 w
  53. ) r0 M" u8 s& e9 N2 w
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    & p" ?5 O6 a8 {
  55. #define STATIC_SHIFT                3; T% v/ m; s1 O2 @& z$ f
  56. #define TCINTEN_SHIFT               208 K4 R3 ?7 h) H5 z, G
  57. #define ITCINTEN_SHIFT              21/ C" m$ h# c( c  a
  58. #define TCCHEN_SHIFT                22- y5 \0 H: Z% z+ u3 ~( R# t
  59. #define ITCCHEN_SHIFT               23. ~  z! S. T  i! F. ~! Z

  60. 6 ]; j9 ~6 [5 v. N  U
  61. static volatile int irqraised1 = 0;
    - T# ?' k1 @* C& {
  62. static volatile int irqraised2 = 0;: D" c/ h! {( m/ h! t6 Y8 E
  63.   O2 T& \( m$ T) [+ r
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + S0 L* d9 L' U6 P
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 P5 ?/ j8 r' a3 p0 @
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ a7 a/ p, J/ x' k, ]  @0 @
  67. 8 A, o8 x+ Q' J- j" s4 v: p, e
  68. dma_addr_t dmaphyssrc1 = 0;
    % U9 g' T2 Z0 `2 S0 v+ i
  69. dma_addr_t dmaphyssrc2 = 0;8 M2 Z$ f1 d' d8 o- Q9 s
  70. dma_addr_t dmaphysdest1 = 0;
    * D& U% Q, w1 |7 j4 o2 p, ~1 R' w  d
  71. dma_addr_t dmaphysdest2 = 0;
    1 w; Q/ T$ b& K- D0 I& Z/ E0 I: v
  72. " L/ N1 x. p& d  F1 u* _% S
  73. char *dmabufsrc1 = NULL;
    6 V- ]: u" I8 L2 D  d. w7 |* Y
  74. char *dmabufsrc2 = NULL;
    ' x, f3 E3 ~0 R
  75. char *dmabufdest1 = NULL;
    8 t; [. d! L' e! y* W, K
  76. char *dmabufdest2 = NULL;$ m2 B; Z: @$ u
  77. / s5 O/ F+ i( s) m! [0 a' ]
  78. static int acnt = 512;
    % ]3 \- h  \8 Q; W5 {9 q
  79. static int bcnt = 8;5 s/ o$ Y4 d" o, `) V  P# _. m( i/ X2 e
  80. static int ccnt = 8;
    % N6 F8 c% C2 T

  81. : Y) f" z' [; K' D8 [% _0 O
  82. module_param(acnt, int, S_IRUGO);% @9 ?! l# [7 i. F4 D1 X" f
  83. module_param(bcnt, int, S_IRUGO);+ e& G$ c  s* P6 d- I; M4 U( t
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 X, `  @# R4 f& {- S) f  _' Y+ j6 P

: K: Y1 b4 S% B      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ V, ^; `* c: U; m& z! x
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- I- o+ O4 e0 E! \, q* j& ~     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ e' g% y+ L3 |; Q/ t+ g: c" G3 l

( `; _% q( N' D/ j7 m( ~8 C- L: G% c$ J/ w% z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-15 18:10 , Processed in 0.041238 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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