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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" @  O9 K. Q7 L$ T9 v  v# F0 y
  1. [code]EDMA sample test application
    $ s3 H+ U& X6 P( Y/ f/ P) @2 ]1 f' r
  2. /*3 D) h' ^$ G! V; }: s
  3. * edma_test.c
    . n* Z) D+ e3 F
  4. *( E" r* C! ?6 e* J& I' f0 j& E
  5. * brief  EDMA3 Test Application0 u& `% z. A. g0 w; s/ u
  6. *' I) b, F4 V& h5 k6 M* [
  7. *   This file contains EDMA3 Test code.
    ! v; e$ t7 }3 P/ n4 M% n2 ]
  8. *
    ' ]) @5 x* V5 S3 {9 B' }3 u
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    2 W; U1 K; o& i1 }1 P, S
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + {( H2 G2 S, X- g
  11. *         TO CHANGE.$ U5 o# P# d, s
  12. *2 y1 C5 h& {3 a) \2 M
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    : e  @# f& P2 S8 _7 A" v; Z, [6 [
  14. *8 t  i6 g$ l9 n3 v: ?
  15. * This program is free software; you can redistribute it and/or$ {- t* P" `+ @" R; k4 N7 c6 }
  16. * modify it under the terms of the GNU General Public License as) J4 m" b& e. P& q
  17. * published by the Free Software Foundation version 2.
    # k( U4 X5 s  D/ Q! b' I2 s' q/ g- ^
  18. *5 A. F& i1 }7 C4 {
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ' _% {8 H" a9 K- H1 I8 U0 a
  20. * kind, whether express or implied; without even the implied warranty
    * c0 \. R7 n# `  c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! O: u6 ^- Q  K; ]" q, N( n* K3 S
  22. * GNU General Public License for more details.
    2 z* R* g% V- Y
  23. */2 B! S5 |# ?6 F$ {3 L
  24. # T0 p8 O. `4 ~7 k9 ]) b/ v
  25. #include <linux/module.h>/ g1 y- b9 ^/ |* E3 y6 [
  26. #include <linux/init.h>
    6 a1 l; r, f: y7 \8 Q1 _- q
  27. #include <linux/errno.h>3 k; [: C6 ]' H7 |
  28. #include <linux/types.h>5 H2 |( k6 Y3 B! l& B( r
  29. #include <linux/interrupt.h>
    * L: m* P% L2 |  k: ~' U
  30. #include <asm/io.h>4 Z" q8 ^3 J% S& Y2 F. e; ^
  31. #include <linux/moduleparam.h>( h& u3 c! a! q6 Y
  32. #include <linux/sysctl.h>
    ' X1 R- g* N9 Q
  33. #include <linux/mm.h>8 f, K) g9 h# z& [( T
  34. #include <linux/dma-mapping.h>
    . X1 ?4 M( u+ H5 c2 I0 \2 z8 `" i
  35. , L, x8 Z! o: t% y6 \
  36. #include <mach/memory.h>
    / T& I7 M" b4 U$ e. g
  37. #include <mach/hardware.h>
    7 a& }1 I. P. }1 r( j. v' c
  38. #include <mach/irqs.h>
    & U- U4 ]8 R" G
  39. #include <asm/hardware/edma.h>
    : w  I! [  s& b0 g: P3 v" k
  40. ; K0 U3 \$ K2 c- e5 o7 ~4 B. B. Y0 h
  41. #undef EDMA3_DEBUG
    / T0 D/ T( Q, d; W2 i! J4 ^
  42. /*#define EDMA3_DEBUG*/
    * y% A1 ^$ g, {
  43. / O' `  T7 ^5 T. a
  44. #ifdef EDMA3_DEBUG
    4 h2 f8 K4 n8 A2 c* M( R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), p- z, y9 Q& V/ r' Z) K
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    3 o% v6 w, S. q8 b
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    0 O" W* @! P) }1 E2 ?
  48. #else
    + g2 v  D- r( t( Q
  49. #define DMA_PRINTK( x... )1 V/ G6 [* o; _1 ]* f3 b$ d2 M
  50. #define DMA_FN_IN5 Y2 x0 ]" N5 o$ H- v3 k$ D# T
  51. #define DMA_FN_OUT; H  O/ v. m$ U5 ~4 e
  52. #endif
    ) S4 Q6 @5 B& P4 L8 V' K9 Q. z( e

  53. 7 M& i6 F4 X4 E' G" Z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    0 o" }2 A2 h9 \: b5 O
  55. #define STATIC_SHIFT                37 ]% ]3 s! q6 Y' z
  56. #define TCINTEN_SHIFT               20+ E3 o% j6 P' s7 Z" h& q# V7 L/ w. K
  57. #define ITCINTEN_SHIFT              21# q; }4 [. ^9 O1 z# Y
  58. #define TCCHEN_SHIFT                22
    ' F# U$ W7 e' i
  59. #define ITCCHEN_SHIFT               23
    # m) s! O* ]* ?, l8 w7 [

  60. % x  [8 k5 w- }$ x4 A
  61. static volatile int irqraised1 = 0;% b, ?9 b. g" I3 c$ w9 ]! R) U! s
  62. static volatile int irqraised2 = 0;+ H1 ^( f& D$ I$ N  Z6 Y- ?
  63. 2 F. w7 P8 R9 x' N' q' z5 D; ?
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 A, A4 b7 ]$ t  @1 v
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      B0 m' Y+ w. B. ]+ a. X
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 j! d( @3 G& N- @$ r) f2 F

  67. . d: T6 {7 W: D# [
  68. dma_addr_t dmaphyssrc1 = 0;
    2 v8 [& e8 S. }! `1 o
  69. dma_addr_t dmaphyssrc2 = 0;
    : P, ~6 `* S, `
  70. dma_addr_t dmaphysdest1 = 0;" o( d$ g' t% P  t
  71. dma_addr_t dmaphysdest2 = 0;# n# m$ I" e. `1 ^7 b
  72. " Q5 C; v0 K4 h$ ~! u& D! I2 C$ @: U
  73. char *dmabufsrc1 = NULL;
    * W3 p2 V4 R* y* f2 p& w
  74. char *dmabufsrc2 = NULL;
    # g, ?& ~: T$ h4 v) s) n
  75. char *dmabufdest1 = NULL;4 L; C# E% B0 i4 J
  76. char *dmabufdest2 = NULL;
    / ~7 E9 H0 Z  M0 M

  77. 0 I6 l/ B5 s( L. Z
  78. static int acnt = 512;
    8 Z) C* M6 c6 D8 _" J! M
  79. static int bcnt = 8;
    $ s; {" ^. A. L
  80. static int ccnt = 8;
    ( @( D3 v: i  C% K- H6 \

  81. * g& |& A6 A& [, J' F9 }
  82. module_param(acnt, int, S_IRUGO);, B/ Y! k% O, m7 Q) s% V
  83. module_param(bcnt, int, S_IRUGO);* S4 x. C  n+ E( G7 W4 v
  84. module_param(ccnt, int, S_IRUGO);
复制代码

- S' u1 b8 K8 J# c$ P# s* q* u* o" J2 X5 g/ G1 s4 ?! \: P
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" F. U- ]$ y3 v, i- L
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 s$ Q. m) `2 Z0 O* O0 B" q. r     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& z' U6 v# {* \1 l) h, I
9 \9 I) g0 |. x0 k
0 y+ p# O& ^# g+ C6 w/ |, o# Y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-16 12:41 , Processed in 0.037560 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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