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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 m: J5 W" Z7 D5 H
  1. [code]EDMA sample test application" g8 y9 p0 B* k4 B4 D& t. y
  2. /*
    ( C+ y6 O* g; F& k1 q  ]
  3. * edma_test.c2 z) V( C& o' h  `0 R
  4. *
    ) }% y0 R. Y8 o$ ]5 A4 i' e+ F
  5. * brief  EDMA3 Test Application+ _8 |/ A; u- {. D+ Z' c4 ?
  6. *( G& u, U5 j$ o( E1 K. P
  7. *   This file contains EDMA3 Test code.
    3 L8 \4 e# q( a: ?2 }, C6 m
  8. *% q6 D* D  s3 w' @9 r
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 Y- B2 X* w7 }# u! l; T
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    . \7 g4 ~  _7 Y' x/ V6 t, h
  11. *         TO CHANGE.
    1 o0 Z8 n% ?# _0 Q4 {2 P8 G* l
  12. *" V5 Q' d; E4 h5 l7 R% {  L! N
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' F0 A5 ?2 i! ~$ r% w4 {3 P
  14. *) j. o9 m$ C" M4 r) q
  15. * This program is free software; you can redistribute it and/or
    ( E5 E4 i: k3 n0 z. {% K: `$ J- b" N
  16. * modify it under the terms of the GNU General Public License as
    1 k* ~- q( V3 I6 `+ L( Z4 J
  17. * published by the Free Software Foundation version 2.
    * d# H0 Y8 \! R/ Q2 {
  18. *( X& `4 l" f2 [2 M$ D
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 P9 [+ j, q4 k8 p( x1 T
  20. * kind, whether express or implied; without even the implied warranty- s9 X2 e" i2 @. a3 V0 T2 P* v& Y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the: L  h8 ]& c+ f; P- }" z" }# R) O
  22. * GNU General Public License for more details.
    ; o9 x/ ?8 H( Y
  23. */
    , ?. n$ R5 Z4 I; O3 a- H
  24. ' h* n# o7 E! ~& I1 A$ i
  25. #include <linux/module.h>% B) |- |1 t0 o
  26. #include <linux/init.h>0 f, ]! y2 _; e% G2 u$ h
  27. #include <linux/errno.h>
    3 @3 J9 a' y5 h5 Q$ r% o' A/ v
  28. #include <linux/types.h>* S) z) c. v5 e, p6 W; Q2 p
  29. #include <linux/interrupt.h>- F' v( K! S* G1 {0 ?  j
  30. #include <asm/io.h>. r. F7 [/ {0 g  {7 `& K
  31. #include <linux/moduleparam.h>1 g' U% R! _- B5 e0 A3 I7 _9 M2 i
  32. #include <linux/sysctl.h>9 N! U. `+ p) ~
  33. #include <linux/mm.h>
    6 A# ?5 _/ h' g% _- M$ Q% {
  34. #include <linux/dma-mapping.h>
    . M  ~/ U4 w5 @% n
  35. $ _" F/ k0 v+ r7 e4 c
  36. #include <mach/memory.h>, `; C. H7 ~8 T/ j) W5 |) k
  37. #include <mach/hardware.h>/ t* y  _& c; W% o3 M. t- z, j9 H
  38. #include <mach/irqs.h>7 n1 n/ k' Y& W& P% ?9 c
  39. #include <asm/hardware/edma.h>
    ) }; }- I% e, W4 Q1 w% ]
  40. % v. y- b. W! o) Q/ X
  41. #undef EDMA3_DEBUG
    & Q- o0 v( H8 ?  k
  42. /*#define EDMA3_DEBUG*/$ T' E1 s+ O4 I1 z0 E, Q

  43. ' `+ M1 y" h& z' ^
  44. #ifdef EDMA3_DEBUG3 C" U+ T( A# X  y' s! G
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): n3 H2 Y7 B5 z, p: R( n- a& m) n* d$ Q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      P! m* Z+ B; d4 T3 j  f
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    * G& K8 x3 Y$ F
  48. #else3 f  ]; o2 W3 c) Q
  49. #define DMA_PRINTK( x... )9 c9 c. @  D  h. S1 B8 _/ u
  50. #define DMA_FN_IN
    , w5 @# q* f6 @( m* h* y. w3 {$ ~
  51. #define DMA_FN_OUT
    / O, e1 }! o7 L3 N# C6 g+ J
  52. #endif
    & [, x! q. f; ?6 r7 h, y1 H( ~

  53. 2 l7 n' t( \' f/ `: z: i4 e, P' k; G
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    3 r3 b5 ?0 R7 x: h7 Z  q* n
  55. #define STATIC_SHIFT                36 O: E4 H6 \2 J9 i" ~* l6 d" W+ k
  56. #define TCINTEN_SHIFT               20
    7 {. |" J' `* r* j
  57. #define ITCINTEN_SHIFT              211 V+ u" w7 G4 @" ]. }1 V- ]
  58. #define TCCHEN_SHIFT                22
    $ w; r  N+ S' ^9 @& b/ {9 N
  59. #define ITCCHEN_SHIFT               23
    , b, V) l3 [' D& c0 Z( ^

  60. ; c  M# W9 D4 w8 F& N
  61. static volatile int irqraised1 = 0;
    & N" ]" Z5 {4 ]  W  n( z9 ]6 B
  62. static volatile int irqraised2 = 0;' ^  A' z2 x- [$ Q/ E3 E
  63. / a4 U) h5 T  B& @$ K& ^* W8 z( Q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " I( \+ S* G4 X; h) b5 ~# R) s  B
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; e* b2 |3 p" R# \0 H9 m: @/ {
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 n  E. t: t/ }

  67. & n+ }! `& \- D9 D* W: Y
  68. dma_addr_t dmaphyssrc1 = 0;- _. y' d% f4 j, F1 S5 }! n% z
  69. dma_addr_t dmaphyssrc2 = 0;2 n. C0 p/ J# m. D8 H/ V* D3 A
  70. dma_addr_t dmaphysdest1 = 0;
    ; F( z' y  s4 ?8 Y3 Q" _+ r" S
  71. dma_addr_t dmaphysdest2 = 0;" P! c$ _0 f0 {- P# W: L2 i
  72. % T* \! Y2 t- k% t( {
  73. char *dmabufsrc1 = NULL;+ H: W3 [' n( t  @! J! A. l( b  d
  74. char *dmabufsrc2 = NULL;& j, o1 e  s( a" O8 w+ Z1 \
  75. char *dmabufdest1 = NULL;
    8 w4 ]4 F8 a$ p+ q) m9 l
  76. char *dmabufdest2 = NULL;
    # {5 L& f9 ~& w. P2 C  O5 w

  77. , }) b$ O' ?& p) D
  78. static int acnt = 512;2 n. @$ F4 e( p3 I( ~
  79. static int bcnt = 8;, u/ w; j1 H' A0 x. a$ D! l
  80. static int ccnt = 8;( d( a3 X& n, [5 T

  81. - {# }" I% R, ~- Z2 ?
  82. module_param(acnt, int, S_IRUGO);; C, B$ |- o, [& v$ Q
  83. module_param(bcnt, int, S_IRUGO);# B; Y/ a3 ^' e' u& Y1 ~/ ~! T
  84. module_param(ccnt, int, S_IRUGO);
复制代码
8 U  `+ y! n& e/ ~( @2 _8 k

2 `. k& y! O  L$ Y! m+ Y      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' _7 ?- y9 r* H5 N+ o& D; ~; z6 F
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 S0 @0 E: B. w7 i' |2 j     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. s0 a* x, L1 T3 T( W9 t# |: l6 f- S/ _, }5 M! \6 u
* }: \% J% R6 U6 U' N9 ?% C: e+ X
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-21 19:19 , Processed in 0.040143 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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