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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 `6 s% ?7 q+ Y( k; [! e0 A
  1. [code]EDMA sample test application" T/ J8 o; N3 O* c2 W
  2. /*
    ! W, p4 M. i+ r9 P
  3. * edma_test.c
    : K+ {9 v& A0 f7 q8 k) {' I/ P0 J
  4. *" C( n8 G$ z" P) I7 x
  5. * brief  EDMA3 Test Application4 p/ B/ ]( G0 g* w$ S
  6. *: }% @  U3 f, W$ {- r& D8 b
  7. *   This file contains EDMA3 Test code.
    1 r! {/ A0 z6 M9 O9 S# H5 H) ?
  8. *
    9 Y% E' \# j/ q: x
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 `. Z9 |% @2 p. `# P
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ f7 h1 q4 v- {/ T2 T3 A
  11. *         TO CHANGE.
    ! H7 {- L/ x9 @0 l
  12. *
    ) r! G5 _8 \9 S0 y& N* {) U' B
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ) `( V3 z; ?  r# o
  14. *- m- R+ }3 T$ H2 t4 K: }/ R+ F
  15. * This program is free software; you can redistribute it and/or& u$ a9 |% k/ V' X  a' h
  16. * modify it under the terms of the GNU General Public License as
    " C# u9 Q: o* Q
  17. * published by the Free Software Foundation version 2.; u; |/ B4 N7 m, ~3 R; L+ g
  18. *
    , A. R; B; C) Z  M6 o
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    % R6 j: T; g! Z/ s5 }# w! Q' h4 l' Y
  20. * kind, whether express or implied; without even the implied warranty
    2 C  e/ z. ]% \# X. N
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0 W4 ]/ O6 }- B" I
  22. * GNU General Public License for more details.2 m  J9 E' m* L) S
  23. */
    0 m2 l, x3 O1 S% c
  24. 3 n1 \) l3 c/ e8 p" o  p1 A' e
  25. #include <linux/module.h>1 W: ?8 k# l  q$ l" }
  26. #include <linux/init.h>+ q6 w& O4 t9 I; [4 u% s7 W: n) }2 w
  27. #include <linux/errno.h>
    $ J3 o3 P: Q6 c3 X, p
  28. #include <linux/types.h>* c& V6 B! Z) E1 G1 `  [# X9 Q
  29. #include <linux/interrupt.h>
    ) J$ @% L6 c* a5 x: V& [
  30. #include <asm/io.h>" f. `% d# I4 X$ t
  31. #include <linux/moduleparam.h>
    ( _; g$ Z/ p# A3 c, f
  32. #include <linux/sysctl.h>4 f' `+ y! @9 o
  33. #include <linux/mm.h>
    % J! U5 ]- b2 ~; n5 @9 W3 p4 @
  34. #include <linux/dma-mapping.h># V% k9 `$ T+ S5 P5 O0 m- E' }

  35. + H" N# i( O' j' _% Y' T
  36. #include <mach/memory.h>/ N* a. D2 K" |0 N2 t2 ^
  37. #include <mach/hardware.h>
    ) a7 W4 ~$ g/ i% @
  38. #include <mach/irqs.h>
    : E5 z. m/ r. w) U5 \( H+ @
  39. #include <asm/hardware/edma.h># @1 r, X( u- Q* _9 L6 J' R

  40. + ^2 v% D4 W5 r- n$ ~
  41. #undef EDMA3_DEBUG9 F' L2 I1 b. \: b6 M0 c& V# j% d
  42. /*#define EDMA3_DEBUG*/- V9 W+ e1 ~; m3 i- v
  43.   t2 h, ?2 |5 r9 k" c' h4 E! c6 h( H" r
  44. #ifdef EDMA3_DEBUG
    1 J* c- R! P1 f
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 ^' ^2 P0 f2 l3 I  _
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); K% H# u( S- J# |1 h- X3 Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 M1 r! L% B2 w( _* D5 h# D6 O( s
  48. #else+ [) ~, E' b/ k8 P
  49. #define DMA_PRINTK( x... )
    7 n# I1 X/ S! N) J1 R* K
  50. #define DMA_FN_IN5 g8 n* [# I( ^# l6 l" n; i
  51. #define DMA_FN_OUT
    % |0 w! e1 W$ a/ z
  52. #endif
    ) s: D  r9 x6 O. ?9 U2 O
  53. % s/ K* _1 ?0 y& S8 O4 ~
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    9 h7 \4 l9 y. U8 C" {/ @" `  O
  55. #define STATIC_SHIFT                30 j& o' V* b3 N# ^1 r, F. r- p
  56. #define TCINTEN_SHIFT               207 Q: g2 Q, Q. v" L+ G0 [, o+ c
  57. #define ITCINTEN_SHIFT              21
    9 |+ i$ |* o8 M% r3 a+ N
  58. #define TCCHEN_SHIFT                22
    * Y( ?! T5 ?- `+ W
  59. #define ITCCHEN_SHIFT               231 L* ~' x3 o- J2 h$ Y3 C5 g
  60. 2 U8 }, E5 d" h; X- @% B
  61. static volatile int irqraised1 = 0;
    6 W2 {3 \, b# T( O) y
  62. static volatile int irqraised2 = 0;- g) h6 G. d! Q! U9 v) M' s$ J

  63. ' h" @- t# c) o
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; p; o( W! Y& W. |* u9 d( D1 H
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # r( |4 R% {' y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 g5 c5 b& Y- ?* ?- g

  67. ( p# Z9 C9 {$ W9 n3 ~
  68. dma_addr_t dmaphyssrc1 = 0;# o, \: f6 P2 q" T+ {% _4 O! `9 b# [
  69. dma_addr_t dmaphyssrc2 = 0;* V% V* P( [. B& O& }! U# f) T
  70. dma_addr_t dmaphysdest1 = 0;- d4 |# t4 G2 t% h  N6 @3 U. R+ i' N/ `
  71. dma_addr_t dmaphysdest2 = 0;: K6 T7 k- F5 @1 S8 ?

  72. ( S: ~5 y( G! ]+ L, r3 t
  73. char *dmabufsrc1 = NULL;. R; M) |" w9 ?' b7 R% X
  74. char *dmabufsrc2 = NULL;' ~1 x6 b# j/ T  g. B
  75. char *dmabufdest1 = NULL;" r/ b$ q. W5 l/ }3 p; C- Y+ @0 k
  76. char *dmabufdest2 = NULL;# Y% i, m+ d" a' w8 y
  77. , L( o7 U( x+ b
  78. static int acnt = 512;; S, ^# ~+ ^/ o4 J/ d3 x  z
  79. static int bcnt = 8;1 z, N9 e7 w5 P6 F" c) ^
  80. static int ccnt = 8;
    $ j) k7 s, _9 L& \6 ?
  81. 0 c6 R3 v: x$ ~* U5 u/ |
  82. module_param(acnt, int, S_IRUGO);7 z1 F6 v7 B5 s' H. k
  83. module_param(bcnt, int, S_IRUGO);
    3 U# s7 v) @! p3 P
  84. module_param(ccnt, int, S_IRUGO);
复制代码
* [+ c- d( r9 B$ t2 m

% x! k; i( M5 z& h* ]+ g9 |# T      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 Y! i; i  ?7 I: J1 Y/ harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 l7 M- P* O- P, ~0 D     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 R2 \7 K( y; N1 C- \9 c5 q' @( Y

1 ~, o8 D# J& v9 h3 G1 s7 q# u' P2 G: r$ Y6 F
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-23 15:05 , Processed in 0.044107 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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