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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 x- K8 e  h. k. y  q- \4 M; V  t
  1. [code]EDMA sample test application
    & A/ {9 b5 P2 Y" }8 V
  2. /*
    & ~+ B5 X6 x6 ?( N
  3. * edma_test.c
    4 O# N/ |" c$ W& U3 R% X0 E6 ?
  4. *% u/ O  ~" m' J+ ?& ~
  5. * brief  EDMA3 Test Application
    $ x4 I% @( c4 b- ~3 z; k4 y/ V# W
  6. *
    # H- `. Y5 `/ R( J
  7. *   This file contains EDMA3 Test code.! x( X( t  i  p8 L
  8. *
    # |* X6 |3 f; [$ C
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! `# l2 U" `5 |
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% {5 m4 U# x3 F8 {" P! b
  11. *         TO CHANGE.( }- j# T5 B$ A0 v$ J
  12. *- c, A' W6 R# E
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    & m/ _* K+ C2 c8 ]
  14. *7 K$ Y4 l0 [7 h' G
  15. * This program is free software; you can redistribute it and/or
    3 ?( `6 q6 h7 u2 e9 o
  16. * modify it under the terms of the GNU General Public License as6 D# c* H" O: V9 m
  17. * published by the Free Software Foundation version 2.) p+ i# P, l' I6 ]. f8 s2 X
  18. *
    ! x& i* v6 u/ Y, |) l' Z) ~' Q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ ]# {" e# M2 g9 ?$ T
  20. * kind, whether express or implied; without even the implied warranty" |  g. J2 `( W0 i  Y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. y5 k" H$ D, z, B9 H8 S
  22. * GNU General Public License for more details." \4 g1 C9 i, m/ z. o' R2 ~/ @9 H
  23. */. o8 R- m0 b+ ?3 }
  24. 3 W3 T. D; z/ ]( U1 r
  25. #include <linux/module.h>: a5 c' J$ Q. u) D, R2 A6 @' w
  26. #include <linux/init.h>
    4 h% {, _$ |( P" ?& x0 ^# L2 m( z
  27. #include <linux/errno.h>3 H( D/ b: N9 ]: b; R: Y
  28. #include <linux/types.h>5 m, [) g3 U$ D1 {9 U2 I% @. M
  29. #include <linux/interrupt.h># |/ b4 B* n! u0 w/ h, j
  30. #include <asm/io.h>
    : M* G$ ?* z8 ^% |" c) f1 A6 s" t# S
  31. #include <linux/moduleparam.h>9 y% U3 P" ]/ ~5 J' w
  32. #include <linux/sysctl.h>' L" V  a* z3 ^0 {
  33. #include <linux/mm.h>
    & f+ x; W' o! N" a1 f
  34. #include <linux/dma-mapping.h>
    $ u2 J" O+ A) y: v0 P
  35. : w( l5 S  T: v: x" \! A7 c
  36. #include <mach/memory.h>3 L2 L" u: z8 x2 O& E( C3 b* s. z% P' {
  37. #include <mach/hardware.h>
    * o+ E3 {8 b) o' a
  38. #include <mach/irqs.h>. ~% ]- H1 N6 Y2 h" q' P
  39. #include <asm/hardware/edma.h>0 L  h% [9 U3 z" s2 F

  40. . e& D5 c1 `7 x
  41. #undef EDMA3_DEBUG& d0 G! {) m6 c0 w0 ^: N
  42. /*#define EDMA3_DEBUG*/5 A3 P6 G% v7 B0 G0 }

  43. ; F8 ]3 s$ V4 G/ x
  44. #ifdef EDMA3_DEBUG0 `3 J3 c5 f% |( E% d1 S' k+ \
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' `; f) l: a. {( m# d! l/ A( ~
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & n2 l% j7 j4 S
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ C& C  @$ i8 a% F+ C
  48. #else* ^! t6 G5 o) H( u7 ^; l' z
  49. #define DMA_PRINTK( x... )8 t# c3 ?2 l  s* k+ h
  50. #define DMA_FN_IN5 T" B9 x: b- ~
  51. #define DMA_FN_OUT7 C0 N* ~  }* f) [
  52. #endif
    , E2 o  `' e/ V) D' K: e2 J0 m# p! k
  53. 4 [5 k2 w! l; z. f- T; x$ a/ N. o
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 q9 v8 C1 b; A2 @& t6 O" `5 g
  55. #define STATIC_SHIFT                3, Q" Z+ v! a5 C6 V, X
  56. #define TCINTEN_SHIFT               209 v- w7 j- x1 B0 G
  57. #define ITCINTEN_SHIFT              21
    * f: ]) w8 ^6 ]* \
  58. #define TCCHEN_SHIFT                22$ Y8 p6 x8 P7 u  A* c& U, |; x
  59. #define ITCCHEN_SHIFT               23
    ; K8 Y9 p9 n1 l! ]. o( M

  60. ; v" o; t- d; K% S
  61. static volatile int irqraised1 = 0;/ d% @' h7 M2 d0 W
  62. static volatile int irqraised2 = 0;
    1 j* d* `6 ?9 l4 F7 Y
  63. 7 e. g! _* t6 {2 \! W9 }
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      _' t5 z4 v3 h& C" l
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / {/ g5 ?. T6 i3 z. q6 w
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . z: B* i- I5 W- O( b- V
  67. . }+ C, ~9 V1 R; ~6 `
  68. dma_addr_t dmaphyssrc1 = 0;3 I" G( F2 }6 B6 E0 U
  69. dma_addr_t dmaphyssrc2 = 0;6 @: `% K. `! F6 D; e! r
  70. dma_addr_t dmaphysdest1 = 0;
    " d: o; Z/ ?" K8 w0 q; \1 _7 N
  71. dma_addr_t dmaphysdest2 = 0;
    * \" C" x3 @% ^! z! _" A6 Y9 w
  72. 7 O) o/ X) @- P7 n
  73. char *dmabufsrc1 = NULL;3 @1 P* k4 H# F* T
  74. char *dmabufsrc2 = NULL;
    * {" y* d# Q, H; z8 k& D
  75. char *dmabufdest1 = NULL;6 m% I) a/ C! L: J4 L
  76. char *dmabufdest2 = NULL;$ |2 e4 ]* \4 X- w" d$ k0 x
  77. / m. i8 K! K# F3 k% U$ l. v
  78. static int acnt = 512;: a( [+ C* m7 N; U+ d  y
  79. static int bcnt = 8;# E, M6 D1 E5 N  U; K2 f( d
  80. static int ccnt = 8;
    2 c  I, ]8 j; `) I  _
  81. 0 N. h; c1 p0 C1 _: ?7 S
  82. module_param(acnt, int, S_IRUGO);
    - G7 Q( ?- w1 |7 x1 X4 D5 D  y
  83. module_param(bcnt, int, S_IRUGO);
    * [. ?; P8 b7 ~
  84. module_param(ccnt, int, S_IRUGO);
复制代码

/ B6 ]* m7 b; _( e9 v, V
8 s! h+ z( s$ z0 c9 s6 u2 U      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 q6 O0 V: j: F% E& |9 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' f6 c4 c* p% h
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: d$ `5 B4 X$ r- l6 n
6 r+ H1 t4 K- A3 @( u3 \4 Q: u2 O( N0 C
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-4 01:03 , Processed in 0.068494 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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