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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & O. g; R/ d# Z; |9 v3 `0 D
  1. [code]EDMA sample test application. v7 T5 N  q) [& @% [7 {
  2. /*
      k" \/ _0 k# J) N. V% J( D) u
  3. * edma_test.c+ s) _+ C+ i9 M% Q- |0 x& V
  4. *9 U/ d) B" O5 n8 t
  5. * brief  EDMA3 Test Application
    / C( v  y6 ~( @
  6. *
      r/ U% F" c4 J1 W7 I
  7. *   This file contains EDMA3 Test code.) w' W' B7 a9 y+ ~0 E
  8. *
    + r5 E6 r( s; N1 h7 ?, O) D: B+ O
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + D5 f. C' [/ y$ I  b8 O7 t
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. `2 W% f* s8 q- @! C2 K2 F. E" l
  11. *         TO CHANGE.
    9 L% w! W8 ^: N! B
  12. *
    ) W( g6 z6 F9 D4 m7 u/ f
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ; V" {0 w* L; ^4 q1 u) @
  14. *+ j$ a- j/ a6 h
  15. * This program is free software; you can redistribute it and/or& Q, B$ d& [: x: {( U8 w8 }
  16. * modify it under the terms of the GNU General Public License as
    ( J1 J% ?; }3 x
  17. * published by the Free Software Foundation version 2.! j4 M6 _! `$ {% A! s
  18. *
    & @5 Q4 S/ Q4 V# a" G2 V# _
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, H; H) w/ a, `& c4 H) j  y8 z7 e
  20. * kind, whether express or implied; without even the implied warranty) F4 l- g, E' A! f
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- v+ T- z# ~1 M1 Z/ K1 X
  22. * GNU General Public License for more details.; Y, N% A# ?9 V7 c! ]4 Y
  23. */
    , b, {5 W6 V- z) a

  24. + ^" o+ ]- j# k0 M; J8 ~' w3 P
  25. #include <linux/module.h>6 p# u3 P: _' A5 |$ T
  26. #include <linux/init.h>
    # l+ R4 a8 e  Z! o; @2 [( g
  27. #include <linux/errno.h># W4 Q& m# R( U: D8 M# J
  28. #include <linux/types.h>
    - {8 b* \! x$ c9 }7 q" `$ ]
  29. #include <linux/interrupt.h>
    - [9 N% @5 V) b% Z* S
  30. #include <asm/io.h>
    4 H1 V7 W7 F$ R' s6 S
  31. #include <linux/moduleparam.h>
    " q; r6 d$ c0 |: c  |4 ~
  32. #include <linux/sysctl.h>* c3 V/ A. y. H1 `/ G$ |
  33. #include <linux/mm.h>
    & l( _/ H# k# w) ?8 n/ H7 a& {0 Z
  34. #include <linux/dma-mapping.h>
    * [' H, Z% a* G: _, C: R0 ~1 U1 Y
  35. 5 B: y/ z- p; C
  36. #include <mach/memory.h>" ]0 k; w6 f, j" w. |2 r8 e
  37. #include <mach/hardware.h>
    3 X+ [9 a, f+ z! _8 E
  38. #include <mach/irqs.h>
    5 \7 h1 }4 G$ P- I
  39. #include <asm/hardware/edma.h>
    5 i: Q/ _+ N) O- d0 z9 B7 ?2 `

  40. + A  A5 L6 q; i$ n# R% g
  41. #undef EDMA3_DEBUG7 J, e& G4 ~  S
  42. /*#define EDMA3_DEBUG*/  Y6 }: [$ r" v: a: H

  43. 1 b& d# e( Q+ b
  44. #ifdef EDMA3_DEBUG* F2 u- M' O1 u
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 `* n' d& V5 i! J% J" G0 F! `
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ Y/ j1 P9 M6 P8 S- r! n3 O
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( Z( i! Y+ d! C3 ^1 u5 R) k& i* P
  48. #else
    $ v0 s" T- M8 D& u" ^9 R
  49. #define DMA_PRINTK( x... )
    / I2 u& {* k$ _
  50. #define DMA_FN_IN6 ]; A/ R7 M9 @7 @) Q- c
  51. #define DMA_FN_OUT
    8 S1 d: U* M0 [6 h) b4 |3 X
  52. #endif
    ( e/ H" b. H. b4 d* a/ {
  53.   E/ L# @, G+ K9 O; l# Z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( t) \( g* R0 d8 L
  55. #define STATIC_SHIFT                3
    ) j# ?# ~$ c- W7 g" _4 e% ]9 a7 c
  56. #define TCINTEN_SHIFT               20. f- i$ k. c+ Z8 a
  57. #define ITCINTEN_SHIFT              21
    % @0 [2 Y; X6 ]' G8 N3 a
  58. #define TCCHEN_SHIFT                22. p- M! M0 z7 L% R9 k' X) A" A0 B
  59. #define ITCCHEN_SHIFT               238 Z) c, D5 L& p! s6 X, A2 M2 [

  60. # T* q0 H5 X" e. b/ w6 L
  61. static volatile int irqraised1 = 0;# H" \- ^" ^; _. m
  62. static volatile int irqraised2 = 0;+ n1 U7 F0 a8 R8 f& `- @1 a

  63. ) i2 p2 d3 }+ \* Y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 y5 A6 a6 v* W/ t) ]* K
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 ^% E7 ?* x# e! V6 b9 o; h
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 i; a- H* c( e& J1 Q8 f+ x7 v
  67. 8 X+ U2 ~# R7 G. j7 `& @" E% T. x
  68. dma_addr_t dmaphyssrc1 = 0;
    $ ]2 X) H7 k; e$ {' E
  69. dma_addr_t dmaphyssrc2 = 0;
    9 }+ b8 u0 ^2 o8 Y" n
  70. dma_addr_t dmaphysdest1 = 0;
    % Q6 D4 G& L9 w" g
  71. dma_addr_t dmaphysdest2 = 0;
    " j) J: g- v  j% _$ J1 f1 Z

  72. 5 ?7 t% k" t# E7 P6 L2 p* l" C
  73. char *dmabufsrc1 = NULL;7 n# j& q4 ]6 }
  74. char *dmabufsrc2 = NULL;$ s% Q+ M# V$ p# Z  P1 X0 f
  75. char *dmabufdest1 = NULL;+ z  _& l0 Q& P; \4 ]
  76. char *dmabufdest2 = NULL;/ G% o+ q0 Q% T% C/ ~, j, v' V

  77. ) K& a: {( p$ x6 A) w5 i# X
  78. static int acnt = 512;
    & Q6 C: E* p7 ]1 m2 c/ K' X
  79. static int bcnt = 8;
      o1 A' Q; L9 z1 l" `7 j
  80. static int ccnt = 8;) T0 R- Z6 |. E& l
  81. 6 Y" w9 h  T7 X; B$ ]
  82. module_param(acnt, int, S_IRUGO);
    + Z" z4 s0 n6 ?/ m
  83. module_param(bcnt, int, S_IRUGO);
    0 k7 P8 e5 O. X0 _6 _3 A: x
  84. module_param(ccnt, int, S_IRUGO);
复制代码
1 V( V7 f# J$ ^6 O1 W

4 o/ D0 t! u6 c/ m9 f      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- |8 Y6 {, {$ e4 |3 \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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 t( h. C5 p  |9 z% e
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 i7 o* m8 v7 H
: F) z+ N# J# m

1 k. S$ T1 ?/ [$ R& a
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-28 08:20 , Processed in 0.052329 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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