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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, D9 c8 y; j2 d9 S
  1. [code]EDMA sample test application
    * R+ L. ~% u6 A$ Q; _9 j
  2. /*% O6 ]( I# P" l: J
  3. * edma_test.c
    . r2 Y) u  f5 \! X" ^$ I
  4. *
    , {* g; u# ?& e, g/ z: c6 e
  5. * brief  EDMA3 Test Application
    / R* i! A2 X8 C
  6. *, q9 Z; e- e6 j
  7. *   This file contains EDMA3 Test code.
    ! \8 e/ V: h7 x" g( X6 i
  8. *
    2 \& w5 h, }) d, R  T4 Q5 A% o
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    2 @9 {( E3 Q" o; T/ O; P, h3 E$ p
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. P$ f, u8 V1 G0 T- P8 F2 g
  11. *         TO CHANGE.. E( t! Z' J' R/ e5 q1 y
  12. *2 f+ J" V( J+ Y1 o! ]5 D
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( P! d  Q. @* C: a0 @6 A) f8 W
  14. *
    6 d. i1 v- B; T1 m( G% _$ A6 e, `
  15. * This program is free software; you can redistribute it and/or2 o0 N8 b% l" {, H
  16. * modify it under the terms of the GNU General Public License as$ i9 q4 |( T% h  ~  }
  17. * published by the Free Software Foundation version 2.
    3 a, H7 K: X* ~& Z
  18. *" b2 b. F" S+ V/ _% ^% l
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    . r. d$ c, {, u. z5 S" Z
  20. * kind, whether express or implied; without even the implied warranty* M' I7 `1 w, E- d9 q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) c8 e; X* X1 M0 i+ L
  22. * GNU General Public License for more details.# o2 t$ \$ ]+ q6 A, V' M7 @* [# C
  23. */3 K  f. M1 W! p

  24. 3 N% D7 q0 L$ o7 `* S  y% d: A
  25. #include <linux/module.h>2 e% U7 J* f$ J7 v7 G( _5 H
  26. #include <linux/init.h>
    + _( ^4 f# c+ _. t1 s3 g  Y
  27. #include <linux/errno.h>. ~$ {- ~; T+ D: Q5 y
  28. #include <linux/types.h>
    9 ]: m0 m  _# t8 [# _. I
  29. #include <linux/interrupt.h>! R- ?9 j0 I3 J! u9 B: _
  30. #include <asm/io.h>3 c: x9 d/ ^/ Y! M) L4 p( f0 U5 E
  31. #include <linux/moduleparam.h>
    + e6 W. A3 P. `  j
  32. #include <linux/sysctl.h>" Z1 E' W0 @3 r% H5 o
  33. #include <linux/mm.h>
      i  D; U/ h" s" J  p
  34. #include <linux/dma-mapping.h>
    ( x- v9 v; A  Z5 }  b# B+ J
  35. . |4 `0 N. ~% F, d- s& H
  36. #include <mach/memory.h>) _# r' B. N) [/ T' \% ]# N
  37. #include <mach/hardware.h>
    ' }7 j# |9 {* j# Q8 v
  38. #include <mach/irqs.h>: q6 l6 r5 t4 C
  39. #include <asm/hardware/edma.h>/ m, m1 m4 Z2 o  j
  40. - K, H' r7 ~% y0 o1 h
  41. #undef EDMA3_DEBUG( l: P# \2 _& v. |7 y5 R
  42. /*#define EDMA3_DEBUG*/
    ! [2 [+ ?6 ~" f* t) j) d& z
  43. & e2 }# h" y& ]7 i
  44. #ifdef EDMA3_DEBUG' R6 \4 O0 U: {$ {' E
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 R/ h! P/ N( V# H1 R0 C$ f
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    9 j% p4 z7 d  E3 `- @
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 z5 ~; h- U7 D/ s+ o
  48. #else
    . d  l2 o( l; C% N. ~# R
  49. #define DMA_PRINTK( x... )
    : S( b0 X8 X$ n+ N$ k
  50. #define DMA_FN_IN
    8 y0 O0 C0 q3 G# y  w( `: }
  51. #define DMA_FN_OUT
    / Z6 L# Y0 t  M* P
  52. #endif
    . H) J- z! y: @  K" l* }/ o

  53. 3 z  U) Z4 e! L4 o
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ p, r7 O& W; h3 ?6 U. h2 f5 t
  55. #define STATIC_SHIFT                33 |6 O. L' t6 s8 C  z4 R
  56. #define TCINTEN_SHIFT               20
    " e5 N/ q" m3 ^8 y9 [
  57. #define ITCINTEN_SHIFT              21. c$ J) u+ d" r) H& B- E
  58. #define TCCHEN_SHIFT                22
    / \. C. J  C8 q- `  G: D7 Y
  59. #define ITCCHEN_SHIFT               23
    , u+ u- ^6 P4 y/ @: G  d
  60. / S8 L$ \' a! J$ a  _* q& M
  61. static volatile int irqraised1 = 0;# _" K7 l9 Z% k  A( }. K
  62. static volatile int irqraised2 = 0;
    . _/ Y$ T5 o- @) V9 E
  63. . B4 z2 {' A  x) j: \
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / o6 G3 E% `' X. F9 S
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 k4 R3 l# D$ _
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ Q' D# P8 b+ \2 ^- ~! g, u, @' U. r5 S

  67. . }" n5 P: N: [6 @: o) _: u3 \) g
  68. dma_addr_t dmaphyssrc1 = 0;
    8 f5 \5 f5 S# K( K/ z
  69. dma_addr_t dmaphyssrc2 = 0;: K; N+ E+ H+ |- l! a6 U
  70. dma_addr_t dmaphysdest1 = 0;
    6 y; C- X5 E# W; |0 P) ?
  71. dma_addr_t dmaphysdest2 = 0;! L* d8 g4 \& H7 ^, o: U1 O% z

  72. : B/ x3 }: ?0 _( E' f! {5 V
  73. char *dmabufsrc1 = NULL;+ J/ K" H# t! d+ y+ `
  74. char *dmabufsrc2 = NULL;
    % S/ Y# w4 p9 {' w9 I
  75. char *dmabufdest1 = NULL;
    2 y" O4 w5 k7 _+ }  S2 L/ P
  76. char *dmabufdest2 = NULL;& V9 w& I8 j0 W% d! j9 R+ x
  77. 6 _/ k7 Z' u# F1 l. |3 @
  78. static int acnt = 512;" K. h% D/ C- E: [; d  _
  79. static int bcnt = 8;
    ; S: k" }3 \( f* W: x% x% j" x
  80. static int ccnt = 8;6 N1 X6 q! `9 ]9 \3 Y: P2 D

  81. % o5 I2 S1 E$ s
  82. module_param(acnt, int, S_IRUGO);9 V! s  L1 [6 g
  83. module_param(bcnt, int, S_IRUGO);
    ( k6 A5 r; ~$ d- D7 D
  84. module_param(ccnt, int, S_IRUGO);
复制代码
$ f* G4 N. m: C/ r

' K9 E2 g: `; Z      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ {) J8 R1 K, yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 ?) h- @2 w" E" F6 i. W     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 [# G! Y8 O0 H4 \! G# G
7 a! T, L7 C) E2 K. w0 f# S, u/ Q3 t* R$ H3 j3 d
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-23 06:11 , Processed in 0.038664 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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