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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( O( d- J6 z* O& ?- H* d
  1. [code]EDMA sample test application: f6 Z4 N1 Y6 r! A# p; w2 Z
  2. /*
    - Z7 M3 e. d. V2 A, ]
  3. * edma_test.c5 _8 x; b2 y  F' P: s( ~- F' a
  4. *
    0 j. C, a. t& l# t) w) W
  5. * brief  EDMA3 Test Application7 R, R5 V+ ~' _/ t
  6. *$ I% b- h4 p, ^
  7. *   This file contains EDMA3 Test code.
    $ c: a; ]. m6 R8 p
  8. *$ \& E2 Y% R5 d/ M, D6 n
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" q5 s' V1 t8 L$ L  V4 V( _5 G* i
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 N- E( R  K! G4 {( ]9 [0 U* F
  11. *         TO CHANGE.4 X6 ^" h$ g7 a5 D- C
  12. *; w. D$ |% @  V3 h
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % v4 u  T) k7 |1 ^! q) o+ z2 C
  14. *
    % B; L; c" U- |- z2 e
  15. * This program is free software; you can redistribute it and/or
    / u! T+ y0 g8 V$ E! `
  16. * modify it under the terms of the GNU General Public License as
    $ J% S/ J* y3 b4 A) O* Z: O
  17. * published by the Free Software Foundation version 2.& I% p' y' i' m3 k4 R
  18. *% H4 V- q* @, f2 t. x8 z) I
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  R7 q2 _% d5 s) F; ^$ H
  20. * kind, whether express or implied; without even the implied warranty. N/ p) Z- J7 e4 _, }. m
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      f3 c# V) [& O! Z% T+ _8 h$ D, h7 F
  22. * GNU General Public License for more details.7 a4 u/ v/ B- z5 z2 W4 u
  23. */* K1 H% X; d; q% a' @) _8 a5 S* ^7 m
  24. 5 n; n  p/ p5 t# M
  25. #include <linux/module.h>
    ! v" A4 ]! w/ [% _, C% H% ^6 r
  26. #include <linux/init.h>2 K8 t# y6 a* i- l# I& O7 F
  27. #include <linux/errno.h>! c0 z. D7 d/ a/ v4 E7 T, D! K- }" p5 T
  28. #include <linux/types.h># b0 k8 Y) ?9 e$ q1 Z
  29. #include <linux/interrupt.h>
    0 y( m3 I8 J0 Z% F! D$ X* \
  30. #include <asm/io.h>% p8 ^/ ?( B) e8 w
  31. #include <linux/moduleparam.h>
    , R6 w0 `" Q. ~7 [. W
  32. #include <linux/sysctl.h>
    - j4 Y$ O  \. m
  33. #include <linux/mm.h>
    ( T; S1 R$ N1 l" l3 T; l" ^; J
  34. #include <linux/dma-mapping.h>
    ! n# M5 f5 X% e. v4 `

  35. , ~6 R- b4 b. {( F- ]
  36. #include <mach/memory.h>
    2 X" e3 r% D& P0 L7 O! E
  37. #include <mach/hardware.h>% j6 @6 o! P9 M% t: X
  38. #include <mach/irqs.h>
    : g! o9 M- N: _8 _6 r. L
  39. #include <asm/hardware/edma.h>" u. j: o+ U. E# ~9 ^
  40. 0 ]9 t% t  L5 k3 Q- e$ \
  41. #undef EDMA3_DEBUG
    * d/ c) w# N* H, w  f
  42. /*#define EDMA3_DEBUG*/
      n) {- `, ~* e& X7 U& w
  43. / n6 I6 C5 z( H6 [5 H% e: _+ f
  44. #ifdef EDMA3_DEBUG
    1 u! T" R1 q; l' u" D+ x
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 Z! s% ?+ O6 \( t8 W# ?6 ~0 c- `8 b
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 ]) J; u% k& ^7 G( y7 {* R' @
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 P- g* K( l5 Y- ?' H# }' u+ @) u
  48. #else/ v6 a/ E$ O( I6 Z% E5 U* I8 Q
  49. #define DMA_PRINTK( x... )
    ) q$ l1 d8 s+ L5 n
  50. #define DMA_FN_IN
    ' }+ u4 U. I' W4 U! Q
  51. #define DMA_FN_OUT
    3 j: N; k  a+ ?" o- w+ {+ m
  52. #endif
    " L/ x% s- Q; w- Q
  53. % r4 I. n' b5 Y# G0 n. }. s0 E; `
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 x6 ^4 f+ Q1 K: g0 d
  55. #define STATIC_SHIFT                33 t9 g1 k; C* [+ A. y
  56. #define TCINTEN_SHIFT               20! g3 ^# n. K! @' w1 g" C
  57. #define ITCINTEN_SHIFT              21. s  @. U% U; U9 ^; p. w
  58. #define TCCHEN_SHIFT                220 x" w( g$ H; l2 b' q
  59. #define ITCCHEN_SHIFT               23
    * F. w5 E  P  r" Y/ z& ]7 o
  60. ; J9 U7 J9 K7 w  c& n+ e
  61. static volatile int irqraised1 = 0;4 O9 w4 m. p6 J; ?5 E4 S  j! O
  62. static volatile int irqraised2 = 0;) P' X1 u; G9 U* N& D
  63. $ R7 ^  y, k; }* j6 o/ M
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, e6 b1 }- b/ V/ N! X: L, Q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 K% j0 b- G0 k4 Z% |) u5 h
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 f) z/ v. y! ?" R9 l" n

  67. , u+ s3 `8 B! w1 V% w  q
  68. dma_addr_t dmaphyssrc1 = 0;1 n3 ~1 V- F  Z; Q
  69. dma_addr_t dmaphyssrc2 = 0;
    + ^) m& X/ u* R& k1 Y6 n
  70. dma_addr_t dmaphysdest1 = 0;2 y& P4 P& L" c$ v8 \
  71. dma_addr_t dmaphysdest2 = 0;+ N) J0 E- e8 f  O. e

  72. - f# f+ E: g/ u$ A" x
  73. char *dmabufsrc1 = NULL;
    , s" D* b  B7 Q8 S  @7 ?' w# l4 u
  74. char *dmabufsrc2 = NULL;! l* E/ a- u8 r9 V
  75. char *dmabufdest1 = NULL;1 Q1 B' {2 V. `; t! S' w
  76. char *dmabufdest2 = NULL;
    8 y. \/ @0 y4 ^( R" K" A- {

  77. , O/ s: ~/ K# N0 ?& D. A
  78. static int acnt = 512;
    # x0 O9 J; p, i
  79. static int bcnt = 8;+ \: }: ]4 q  w9 k8 {
  80. static int ccnt = 8;
    4 t. v# E' e. ]% K1 j# a
  81. 3 V' u* U& x7 y- s# |9 z8 s% E+ e2 j
  82. module_param(acnt, int, S_IRUGO);& c7 o: ?  L  `" X, N3 m1 E
  83. module_param(bcnt, int, S_IRUGO);
    . f, x4 B, l- a; d+ q$ G) K
  84. module_param(ccnt, int, S_IRUGO);
复制代码

/ ^# ?1 H4 ?6 t! Z
  a. A" Q, D" ?6 N      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 e6 a. [. `; L+ X
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 O8 O& ?4 p. u0 m; j& [1 ~; r" x5 Y
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 E# R7 H8 m9 Q. d; o% [
4 Z! b. T7 [2 o/ Y0 `2 |+ g+ e0 n

: [" ^+ p7 ^, ^1 U/ ?6 E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-13 13:21 , Processed in 0.039558 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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