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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; U7 g( M$ l4 M" I# l5 f; \
  1. [code]EDMA sample test application
    ; S6 ^, J0 N' l5 q9 l
  2. /*
    . E9 H( Z, C4 q9 J
  3. * edma_test.c
    ! }" x+ R& M$ j3 \
  4. */ U. V; l1 B) G+ n, [, b) L7 J
  5. * brief  EDMA3 Test Application6 Q, G+ s7 B' c/ [- c. H7 S: B2 F/ c
  6. *
    ; k! e* ~& X7 i- h+ R- b
  7. *   This file contains EDMA3 Test code.
    / r% Q) L/ S" L6 T
  8. *" }# |0 \" T9 U/ _: [! ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * u7 ?/ j+ J7 s* S/ X2 e  X
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 _) q8 G/ d+ O
  11. *         TO CHANGE.
    ( |' i" ^* @/ d% F
  12. *
    4 G3 i9 }& Y6 [+ D! K# }/ i+ O
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 P* g" l' Y" A, _
  14. *' F- b) m' i4 K2 l" g/ {+ b4 H
  15. * This program is free software; you can redistribute it and/or
    4 L/ d0 m+ s9 C( \- k$ b4 t
  16. * modify it under the terms of the GNU General Public License as; r2 }4 N/ P+ h4 l1 x. K) r2 F
  17. * published by the Free Software Foundation version 2.
    ' e  z! j) y7 B4 [. [" m- A
  18. *
    3 [) ?) ~/ x6 B! `- U
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 C9 S. m( \7 y' x% P. [
  20. * kind, whether express or implied; without even the implied warranty& `; b/ U* t, {! E
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % H: x" h$ u5 V3 V1 ]6 N
  22. * GNU General Public License for more details.4 r0 G5 v' M9 D: a3 F
  23. */
    2 x# |. T& t* o" ?3 n! [) M
  24. 4 ]1 R# U+ Q5 u" S
  25. #include <linux/module.h>4 K( h) d* s* O! A, W6 q: [- Q
  26. #include <linux/init.h>
    0 T$ {0 f& w1 ~3 v2 V
  27. #include <linux/errno.h>; V0 @' t- N  n* @) X9 i
  28. #include <linux/types.h>
    : v9 m# D+ d/ S( h2 ]: i# i
  29. #include <linux/interrupt.h>
    / X0 I" |7 n& t# y6 y0 c. l  V: B
  30. #include <asm/io.h>; C% _. n9 V: @' u" x' n$ ~5 A
  31. #include <linux/moduleparam.h>! L2 w" e$ r6 Z7 ]) a2 E
  32. #include <linux/sysctl.h>: G- Q7 b  |' I- H  I  U7 p: S
  33. #include <linux/mm.h>5 J8 V& S" Q  @# d, \7 Y7 Y+ V
  34. #include <linux/dma-mapping.h>
    ( L0 K6 p8 T( m+ f, d4 S1 J2 ~
  35. - I! c$ _7 c- {( C. o
  36. #include <mach/memory.h>: _6 K0 u( S; ~4 d5 L1 k+ F
  37. #include <mach/hardware.h># O4 @4 V& j$ P4 R% A# g1 e* ^3 T; h
  38. #include <mach/irqs.h>1 f) O1 k) @" v3 L2 z, a
  39. #include <asm/hardware/edma.h>" W7 x+ M5 Z' p% {

  40. 9 M8 i$ I. G) I) ?) R
  41. #undef EDMA3_DEBUG
    ( a* \) S5 W0 s
  42. /*#define EDMA3_DEBUG*/8 `, [0 C6 E6 W8 J  K4 F4 H4 b

  43. + S3 R( B: `* P7 h, e4 j8 L
  44. #ifdef EDMA3_DEBUG
    , H9 Z) N$ n2 I1 i3 D' Z+ y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - M. q. h# k2 O3 i3 [; G! g
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ V8 l7 O/ N! d; G1 D' G4 i( i
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    / ]; V8 [; V  U! s0 O
  48. #else6 S0 Y; ^6 `. [, O
  49. #define DMA_PRINTK( x... )/ v8 v8 h3 T  S1 f) m) K
  50. #define DMA_FN_IN' ]9 G+ N' c' r* ^2 m
  51. #define DMA_FN_OUT6 f* o+ B: _+ ~- S
  52. #endif
    / L6 o6 I' A! _& r# c

  53. 2 W: |" H8 ]1 ?
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " z) b: P5 l3 H/ g: g1 P+ S8 I& R# B
  55. #define STATIC_SHIFT                3
    ! q/ ?! c: i; w- _: m8 s: K. q
  56. #define TCINTEN_SHIFT               201 U& k$ k- Y* m' W( Y' u6 {; o
  57. #define ITCINTEN_SHIFT              21
      `8 L) @# @+ x% y/ h% D# Z2 _
  58. #define TCCHEN_SHIFT                221 T0 R+ l! n, u
  59. #define ITCCHEN_SHIFT               23
    $ b" l0 c2 H% M5 u1 I2 T
  60. 2 T6 n+ ]( o% P* G- ]! p' A1 l, h3 i  J
  61. static volatile int irqraised1 = 0;' g+ y) _4 J4 t0 [- R
  62. static volatile int irqraised2 = 0;
    & X  }5 J7 J: A$ @4 c2 i% `

  63. 8 \0 T3 Q# Q; a5 i8 b- ]8 }
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . }. R% H  V8 n' d7 @, r. |/ K
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, |8 r& K  @1 I; l6 d* Z, H/ N
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" Q& [% s6 I- p" [4 [0 {

  67. ) ]. d2 E. `0 C+ x* ?4 ^
  68. dma_addr_t dmaphyssrc1 = 0;3 p/ l+ [7 M+ F/ T
  69. dma_addr_t dmaphyssrc2 = 0;
    . Y' X8 `5 |/ j0 H" g. v
  70. dma_addr_t dmaphysdest1 = 0;
    3 X$ A) d2 v5 t2 U8 H8 }* ]9 l
  71. dma_addr_t dmaphysdest2 = 0;+ l& t9 q4 A! ^8 c
  72. 8 z3 ]$ [6 g2 X4 ]6 D: k
  73. char *dmabufsrc1 = NULL;) [; w  a: n( t: W* C
  74. char *dmabufsrc2 = NULL;, @- s! I& i2 ]7 a* t/ I- d
  75. char *dmabufdest1 = NULL;) ^1 ?* t/ a9 ~' Y# j! H' Q# E
  76. char *dmabufdest2 = NULL;
    - l. [% g9 T( P6 X. l) {, `! M
  77. & r7 E0 O" T. s
  78. static int acnt = 512;2 d! M% S& L! l  j  w
  79. static int bcnt = 8;& ^  l) e1 v- B1 X0 o# i+ k
  80. static int ccnt = 8;$ h4 p9 O8 N$ i7 N) g, f7 ?

  81. 3 w5 w7 _; z% V/ F7 y# e. h
  82. module_param(acnt, int, S_IRUGO);9 |. s; B' V" L9 M0 i  n
  83. module_param(bcnt, int, S_IRUGO);: c$ q) n7 k* a* G5 B! }+ u6 I
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 E/ y) Q$ A* {9 s

1 k: B6 n" T2 t      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 r4 H; z! B$ f0 s0 _# ^) d3 `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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& q9 t9 c  B1 `
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! I2 H& d2 Y1 |0 _/ ~8 O+ P

4 ?/ X' z( \# N, Y/ r- S+ G
. |) a& p- @. S7 `; r7 p; ?( M
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-4 22:58 , Processed in 0.038258 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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