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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. O1 U+ d& N1 d2 X
  1. [code]EDMA sample test application+ y' e* v: d& |. G0 F' e. z/ w  s/ g. g
  2. /*
    5 R! R- v6 l1 R1 C( {
  3. * edma_test.c
    3 c7 ?& l  q7 `. W. J. e- l
  4. *
    ! P' {6 t+ `$ Y
  5. * brief  EDMA3 Test Application
    , O  I2 @, `2 x
  6. *
    ' u  _1 o) ~! I* I
  7. *   This file contains EDMA3 Test code.
    1 p, b) J( \! P( M+ M
  8. *' B9 X. f1 R$ t- z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 ~3 S& q# q$ B7 _5 r" h5 e
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    3 ~. e/ @1 s7 F6 |. q. D, k
  11. *         TO CHANGE.
    6 A2 X: H; z* \1 O) [5 a# y& [% `
  12. *) w( Q. I- s3 N& [8 b5 s( W4 N
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ s( p6 M+ u# A! y# J9 |
  14. *
    9 r3 J9 ~. n; F! a- D5 e. |
  15. * This program is free software; you can redistribute it and/or& R- B; b$ a- `4 @3 M( ?) I5 c
  16. * modify it under the terms of the GNU General Public License as; ^; f2 M5 m# b7 i
  17. * published by the Free Software Foundation version 2.
    % V3 q3 e* Y/ b6 e) u6 s1 G  i
  18. *
    7 C7 e) K; t! f. t8 ~" ?
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    6 {& G3 `$ B* S: H* }" H- w& a! k
  20. * kind, whether express or implied; without even the implied warranty/ X  g  f, X" E7 I) `
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - w# ]  x/ \3 D) f4 n& C: \" d
  22. * GNU General Public License for more details.
    " x( t% y3 N& i  w6 J5 k9 T# g
  23. */  {* o  U' i. m: V9 z1 O. J
  24. 9 @+ q$ o4 V, y
  25. #include <linux/module.h>
    & T) e; N5 G$ [- U, K# H
  26. #include <linux/init.h>% }4 y: M# ~1 N, y
  27. #include <linux/errno.h>* r0 L4 _. r$ z- Z
  28. #include <linux/types.h>
    : z# j  f, j& [
  29. #include <linux/interrupt.h>
    + D! t: o" R# @. n- U. a' y/ n- K
  30. #include <asm/io.h>
    5 V; h2 `* n: e9 w& l' i
  31. #include <linux/moduleparam.h>
    7 [5 H; w0 |3 L- a2 l& W1 n' A% @
  32. #include <linux/sysctl.h>/ I- ^+ d3 p+ t$ B* r( e+ B6 B' M
  33. #include <linux/mm.h># A0 d2 @7 R" F
  34. #include <linux/dma-mapping.h>
    " y: E- t/ p; y7 X- E1 j

  35. 2 K% R5 `. U1 s2 C
  36. #include <mach/memory.h>' h# n" M3 o2 d+ i
  37. #include <mach/hardware.h>9 N" s9 U" u0 `! w& o, o* X
  38. #include <mach/irqs.h>: `  S6 k  }2 }, p( }. {
  39. #include <asm/hardware/edma.h>% ?1 \" Y9 g6 ~. ]8 O
  40. 5 _7 I' |6 V, G; A4 g/ d- L" q( _
  41. #undef EDMA3_DEBUG' i( _6 ?  _  y  p5 p( D, j6 e& e
  42. /*#define EDMA3_DEBUG*/& L) u8 I4 l6 U- H

  43. ) Q5 m# _& F8 ]& x# F' U& L/ j7 G
  44. #ifdef EDMA3_DEBUG3 F7 f+ E9 ?# k' D9 J2 L! s) q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    & u8 J. C' J5 S5 g
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    - _$ B' Z- b. [- R+ r2 |5 c6 I
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ Z& M. c3 [+ c3 ~/ s
  48. #else
    $ Y8 H5 S6 O, |2 b1 ~" D; d
  49. #define DMA_PRINTK( x... )& K- Y3 W) T* C6 {! B/ y
  50. #define DMA_FN_IN1 y9 t* V5 r& t) O% b4 S
  51. #define DMA_FN_OUT
    + J( p. y' x9 a) J* ^" w2 x& \
  52. #endif7 L- t+ ^, w& }# P1 J
  53. ( ~) y' f$ e& O/ H6 ~
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)% j& W9 N' [: f
  55. #define STATIC_SHIFT                3! t  b# l: Y4 P! Q! j( ^! `
  56. #define TCINTEN_SHIFT               20
    $ N1 e+ x) f. q1 j7 |$ }3 H
  57. #define ITCINTEN_SHIFT              21
    - I% d- f  f2 J' X
  58. #define TCCHEN_SHIFT                22, f; R$ |9 t% Q
  59. #define ITCCHEN_SHIFT               23: p* e! X) o! n% L* O
  60. $ }1 s+ ~2 H2 e2 G0 W. |: q, x
  61. static volatile int irqraised1 = 0;
    : W, y3 G* y) S
  62. static volatile int irqraised2 = 0;8 F6 f3 t: G' M

  63. ! ~* l4 G6 C+ {, G( }
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, K- b; K3 `6 o) \6 U+ e
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; S4 C/ K2 k0 w: ]( y* R0 {) L; d
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! [& r- A3 Z- \

  67. + Y! M5 k* B: B& q9 T2 _) {
  68. dma_addr_t dmaphyssrc1 = 0;: i" U8 a! T/ d( d4 c* d5 I5 f
  69. dma_addr_t dmaphyssrc2 = 0;9 ^( q8 n" S' o. D. y  X3 _5 @
  70. dma_addr_t dmaphysdest1 = 0;) h$ u0 t- L- ^7 _
  71. dma_addr_t dmaphysdest2 = 0;; Q7 t% H5 O2 F" ]1 Y& T
  72. 5 Y# j, _$ `8 g+ T
  73. char *dmabufsrc1 = NULL;
    ) {8 U% _/ h( ^$ f. n
  74. char *dmabufsrc2 = NULL;& @* z2 f9 H% [( j, O& F
  75. char *dmabufdest1 = NULL;
      O" D3 x; z% p+ n6 h- D. d5 H9 d
  76. char *dmabufdest2 = NULL;
      M; L) K+ w( G  h' n1 |4 x

  77. 3 G. L3 X2 M+ M6 a
  78. static int acnt = 512;
    6 o1 d' ]7 U, D7 ~' B
  79. static int bcnt = 8;
    ' ^; T) |4 T* X/ |( M
  80. static int ccnt = 8;+ G+ e- N& {' N
  81. 0 j3 i# R5 u2 z6 o* U6 W
  82. module_param(acnt, int, S_IRUGO);
    8 @0 v/ z  x$ F( w6 s& u7 y2 b4 a' d5 Q* F
  83. module_param(bcnt, int, S_IRUGO);% k7 W/ y! F" ^; L9 }- x! k0 l
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% s1 P' h# q" ]' g9 b9 j+ t+ {; V5 |
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) I: @7 c) U! J/ j! `# Z; ?6 h6 `: warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ B2 S# k9 F1 `2 Y9 C) T
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) N6 f. t- B" z' B7 s& M" `# q  G* y' E& q  R# R4 G' Y5 K
, ?" m0 {5 e* F1 |* e. X
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-16 07:53 , Processed in 0.043451 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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