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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 X- I) w- ]5 q$ r6 C
  1. [code]EDMA sample test application% h7 r" w5 O3 c+ d+ ]' u/ W
  2. /*0 v) Z9 x) _  e/ o
  3. * edma_test.c
    $ {6 N! u( G. u  V
  4. *2 t2 I* f& Y, u! S
  5. * brief  EDMA3 Test Application* X) I6 k9 g8 }! j* \2 G
  6. *
    8 `! k$ F5 J7 g3 p6 t& ]
  7. *   This file contains EDMA3 Test code.
    7 k& P* a0 o' V! J5 X
  8. *+ `2 m9 @! n, N! W3 E
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    9 B. q0 ^, j5 f1 M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 T. F  m$ b% D  m' B# s# `+ M
  11. *         TO CHANGE.
    5 H5 r1 N& O5 M1 P) Y6 s
  12. */ y) ?; C" U1 w6 J
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ q6 _4 I0 i  K* l$ S0 t
  14. *
    2 v: I5 d' {: c6 }* ^
  15. * This program is free software; you can redistribute it and/or
    # T6 q5 T% w6 p5 k- w
  16. * modify it under the terms of the GNU General Public License as5 f. H8 T9 H$ \5 m4 H' W2 ^+ {) p0 \# ]
  17. * published by the Free Software Foundation version 2.* z: i$ c% x/ t/ O  [" U! N; `( E
  18. *
    7 ]& s# P2 ]# S9 L  _
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    . K4 c& w% M5 ]3 k3 L  ]) J$ |' [/ \2 W
  20. * kind, whether express or implied; without even the implied warranty# L' ]3 o- B8 Z9 j' B% Y- I
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      J; L' _% n+ i
  22. * GNU General Public License for more details.
    * o2 n1 G4 j8 f/ Q+ D. A
  23. */  C" w  K; y. T' t6 E! X

  24. 1 ?1 d- Z' J) [; [
  25. #include <linux/module.h>- k/ p, E9 i6 d
  26. #include <linux/init.h>! M% R( F' q1 E0 g& P. q; l
  27. #include <linux/errno.h>5 H  j# C) q: b
  28. #include <linux/types.h>- T4 v! c* k4 q* B
  29. #include <linux/interrupt.h>
    ( a& ^! ]! V; w! q6 P* A
  30. #include <asm/io.h>: A: m7 T9 A0 A4 U
  31. #include <linux/moduleparam.h>. B0 Y1 J4 L+ p2 s
  32. #include <linux/sysctl.h>
    * @  M* i8 M  a
  33. #include <linux/mm.h>" i. a- @" p6 X8 R
  34. #include <linux/dma-mapping.h>) [" P: `, X" @8 ~
  35. 8 A( X6 E+ }! ~. ~* t% |
  36. #include <mach/memory.h>) {/ ?4 s& l8 x3 t9 G- h3 t
  37. #include <mach/hardware.h>& v7 m$ g# T  W. f' p* n
  38. #include <mach/irqs.h>5 v7 X+ P& [; L  I) {1 [' _$ P
  39. #include <asm/hardware/edma.h>
    2 o; K: D. `1 Y$ Q6 x% [0 O: Z

  40. $ E  g+ n8 ~2 x8 {5 L
  41. #undef EDMA3_DEBUG7 {# H3 k4 h# N/ O9 R' t" J" [
  42. /*#define EDMA3_DEBUG*/
    , ?. O5 S0 y: Z  C7 {: Z# y
  43. / q0 ]+ \1 A7 k# H. u6 F8 m+ _8 H
  44. #ifdef EDMA3_DEBUG
    " b" o3 K7 m8 Y6 q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    8 [! W" [% x* a. C/ Z3 t8 B+ ]3 j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ' J1 s8 `3 F+ o5 \
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 L& |3 U2 u1 o7 l6 k# B9 R
  48. #else
    7 w$ C- `7 X! ^! @* ]; X, a
  49. #define DMA_PRINTK( x... )! Z1 n$ o9 X0 U- ^( g
  50. #define DMA_FN_IN
    $ j* \) G4 \& j& x* ]0 @
  51. #define DMA_FN_OUT
    4 a5 n4 R) \6 O0 S; D( ?  b
  52. #endif
    + R7 G6 u: v% K! J; n* |
  53. % y. |; `- W2 [, c
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( G7 X0 r- [" W; b  _& Q
  55. #define STATIC_SHIFT                3
    5 w8 I, {) E0 h: W0 B
  56. #define TCINTEN_SHIFT               20  m5 o+ L; Q; T1 v. G/ ~" Z
  57. #define ITCINTEN_SHIFT              21# |) ~1 X" {: i& J7 p# J* p
  58. #define TCCHEN_SHIFT                22
    7 [& z/ J! _; w5 r6 w
  59. #define ITCCHEN_SHIFT               230 C2 k. R  }% j7 q$ p4 O3 X" |

  60. ; o$ x, s4 M( o5 ^3 d
  61. static volatile int irqraised1 = 0;& ~* y' |$ u8 M5 f
  62. static volatile int irqraised2 = 0;. O; J9 e) `# [" o3 z  U- n0 ~
  63. - p' s5 F: Y- j- {  b% |
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# [  P+ F3 U4 p$ y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 L5 z2 B1 B. z" e1 I4 K
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # h2 R+ P) `$ B6 u: R, x7 L

  67. 2 l, ^$ Z4 D3 \0 O( f2 i
  68. dma_addr_t dmaphyssrc1 = 0;
    . x  F" n  D$ \9 |7 k* h
  69. dma_addr_t dmaphyssrc2 = 0;
    * I: \! U& d; a5 E3 `" ]+ p, V
  70. dma_addr_t dmaphysdest1 = 0;
    * u6 m( S' d4 j+ G4 @& @5 H, E
  71. dma_addr_t dmaphysdest2 = 0;$ R: u* y9 |3 x5 {: G8 S7 I0 @

  72. ' l& O3 a& C  y
  73. char *dmabufsrc1 = NULL;3 \. S6 a" y5 ]9 Z
  74. char *dmabufsrc2 = NULL;. I- A- d- k4 K6 _/ M$ D
  75. char *dmabufdest1 = NULL;
    # f; m! ^1 j3 {$ D0 f/ K) U
  76. char *dmabufdest2 = NULL;3 m' x  J! X4 J4 M
  77. . d& d, J! F8 s( e8 o& b, Z0 Q
  78. static int acnt = 512;7 o: o/ ]- z" w% h
  79. static int bcnt = 8;3 z# y0 ^; n5 e" K
  80. static int ccnt = 8;
    * K' o( `4 i+ i2 Z) Y9 u7 ~
  81. ) A4 N& Y$ b# C  |+ T
  82. module_param(acnt, int, S_IRUGO);
    * ], Z8 A& L7 _
  83. module_param(bcnt, int, S_IRUGO);
    , H/ `6 E. l  Q; a9 \9 O8 x
  84. module_param(ccnt, int, S_IRUGO);
复制代码
: S6 \- ^, [& w( c, t1 U! K
$ V' X+ ?6 w+ j0 R; a4 ~
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 ~. X1 l1 f" y9 {4 Y" P/ z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( L) A2 T6 V2 h: F, ~3 {2 j2 a     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 z6 w2 O- W  m# X

' i9 a, l0 k6 P7 V. o
' i: S1 X2 y  P
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-15 16:27 , Processed in 0.039110 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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