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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( g0 J4 ]2 t& y8 `. y
  1. [code]EDMA sample test application! \! X% Z3 d! _# ]
  2. /*5 S& P1 M" ^) a
  3. * edma_test.c% a7 A7 M- z  y, C  t- q
  4. *" I2 K+ p- f6 m) F+ M
  5. * brief  EDMA3 Test Application
    2 i9 K4 s8 M: y0 M. U4 y
  6. *' j) J7 w- A  ^  v
  7. *   This file contains EDMA3 Test code.5 N2 e( P; I# ?9 o: ^9 Z0 g+ v
  8. *
    7 Q& I: R, l% f' f: D
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - a; R2 A* ~( A9 V  {  M6 l6 ]
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    - r" F  ^3 R/ t. N, d
  11. *         TO CHANGE.
    % N  Q8 G- G- X# e
  12. *
    # W* t; W! h% h6 X3 F
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! U; y  q; S  S4 ~8 e; [/ ]% }% j
  14. *6 l% k# Y" P4 f4 c4 a: c
  15. * This program is free software; you can redistribute it and/or/ P( n$ C$ [1 ?5 }" d; Z  p0 [
  16. * modify it under the terms of the GNU General Public License as
    : Q1 H: t: Q  u* k* B( H( c* u; l$ H
  17. * published by the Free Software Foundation version 2.
    ! G# j( X1 E4 j: h
  18. *
    ' F/ R! z5 a" `9 Q5 \/ f
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 ]* F% h  V3 ?% R. k
  20. * kind, whether express or implied; without even the implied warranty4 {3 l. f$ h1 m& N
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - E0 i# \0 p% o- h6 ^1 z4 b' E
  22. * GNU General Public License for more details.. T& k( H- \+ h# R
  23. */9 }1 _- W( d( n$ ^- f

  24. 9 a" E; J& W. K+ z5 T; r- \9 X
  25. #include <linux/module.h>
    5 d7 t, k2 Y4 w/ K( ~
  26. #include <linux/init.h>
    - E# h1 m# ~7 v+ ?  W1 k
  27. #include <linux/errno.h>
    ' q$ D  J+ s& n1 d
  28. #include <linux/types.h>
    ) \. I% N5 |2 `5 m2 [3 M
  29. #include <linux/interrupt.h>* g, u! r3 ^# x: ~
  30. #include <asm/io.h>
    2 N* J: q. L# z6 {" r' F$ f) Y
  31. #include <linux/moduleparam.h>. e6 T# e  G' h
  32. #include <linux/sysctl.h>. J) C, B' {$ o  k: ~- D4 G
  33. #include <linux/mm.h>: e3 o- |8 G. t
  34. #include <linux/dma-mapping.h>
    ' [/ s: k! j% f
  35. ! s  x  p! R3 X8 [: o
  36. #include <mach/memory.h>
    ' Y1 r1 n$ F( K* O3 m1 c3 k; Y4 w
  37. #include <mach/hardware.h>
    - ^* @& o' q/ V1 X( @
  38. #include <mach/irqs.h>
    6 M, u* Q' w- ]5 _+ y0 Y" e
  39. #include <asm/hardware/edma.h>
    6 I$ T2 w0 O4 q9 R5 d  y9 c7 O
  40. : t: q0 \/ b, u( v9 u2 d8 S
  41. #undef EDMA3_DEBUG
    $ f- g2 S9 g% o1 Y6 {* M5 I2 M
  42. /*#define EDMA3_DEBUG*/
    , M& |: H% {, A( A0 V! \: r* A/ Y4 H
  43. % z( L9 l, V! ]% I5 Z
  44. #ifdef EDMA3_DEBUG
    ( M" i0 K9 ]% `. ~
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 ]) o$ T4 R% ~* n; c, ?
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " C0 j+ B$ w5 [7 j
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)  {5 e, l/ d; y( g8 G
  48. #else
    8 G( Y0 F7 h# Q# N# K" c' H( |" ^
  49. #define DMA_PRINTK( x... )( L1 E1 r" l6 @( `& M# H9 K
  50. #define DMA_FN_IN  p* v% h6 X; p3 Q8 w3 U
  51. #define DMA_FN_OUT
    . Z" A/ \1 b/ ^. Z* P
  52. #endif, `) i- A, t6 e6 M0 [
  53. 3 O- d9 ]6 e* n% h& F( S# C
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; U: E& u- J- H/ `, Q9 d
  55. #define STATIC_SHIFT                3( W/ D" K$ U( X+ [9 M8 y
  56. #define TCINTEN_SHIFT               20: I9 \9 A* b1 i; t. }+ n+ o
  57. #define ITCINTEN_SHIFT              21( q/ ?7 a0 z& n' Z5 @2 g, Y
  58. #define TCCHEN_SHIFT                22
    & U8 d; {, E4 E" R
  59. #define ITCCHEN_SHIFT               23
    + B3 l: G) ]. S  T# s3 e8 f
  60. . G" r( z4 G) k- n* C9 L
  61. static volatile int irqraised1 = 0;
    $ }) ^: Y. r1 x  u
  62. static volatile int irqraised2 = 0;
    0 h! u7 k# T  w
  63. 8 C& w4 ~$ Q, m  L! [3 r* {* r
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( l9 v8 X3 \/ l! X% S" Q9 v
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : ?4 h# H; ?" u
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 l8 G5 f9 v4 R% O- e4 |1 V
  67. & t$ ]" Z; {- n4 j) J; d( V
  68. dma_addr_t dmaphyssrc1 = 0;6 H4 p7 ^3 ^; ?7 G1 Z
  69. dma_addr_t dmaphyssrc2 = 0;! E7 F2 d. I: V
  70. dma_addr_t dmaphysdest1 = 0;( N6 D; b$ r" Z5 C
  71. dma_addr_t dmaphysdest2 = 0;
    6 `' [6 ]3 |" b' U' i* V  r2 F
  72. 6 E, f3 q; u, w. `- C, P% O8 x
  73. char *dmabufsrc1 = NULL;6 t# {5 A5 ^+ _* F8 i8 _, b. t
  74. char *dmabufsrc2 = NULL;2 T; M+ b8 ~8 O' @
  75. char *dmabufdest1 = NULL;
    7 U8 n0 c- R; U
  76. char *dmabufdest2 = NULL;
    5 }8 a% C" Y6 F# K/ G9 I

  77. + w2 ~1 o  a/ t: J2 l2 m" u# i
  78. static int acnt = 512;( \1 p' q3 r2 o  a9 G# n$ }/ V
  79. static int bcnt = 8;- v& }+ r3 \  G
  80. static int ccnt = 8;  z3 z& T/ z) N( B( B0 S. S

  81. * I! ~* P. C5 ?0 N1 G( J8 M
  82. module_param(acnt, int, S_IRUGO);
    8 X! H+ y% X6 |2 \! K
  83. module_param(bcnt, int, S_IRUGO);6 P! u% {: p5 P3 R( @$ L
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 R0 B7 U' y& b4 [; x* o, d+ \

6 p( w, n) @% S: a      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 P0 E: N4 A  P0 W& uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 }' f7 @8 y( l1 t& ?7 k6 \     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ G# S4 }# T( i5 R, N% ~1 k
& m. c8 Q5 l8 a( k6 D& ^8 B4 M/ N
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-31 04:26 , Processed in 0.038322 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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