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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( X" q) t2 x# D0 E4 k
  1. [code]EDMA sample test application8 C7 [  T& i2 s/ w+ S
  2. /*
    : J+ l5 `7 n0 N& `, v: D
  3. * edma_test.c4 d9 |; z: I1 t/ h; l3 {- R2 ]
  4. *" F1 R5 e7 w! A7 X! f
  5. * brief  EDMA3 Test Application: k# \% r6 f6 T, c2 V4 R9 J
  6. *0 r) I! J8 A: r) ?/ j- y2 A
  7. *   This file contains EDMA3 Test code.
      B8 \, r$ y( z9 W
  8. */ ?/ m5 L% x. E1 v% c7 K# t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' S7 M6 [8 n" t% q8 p
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    9 u  u/ ]3 _% H$ w, A- {
  11. *         TO CHANGE.+ Y8 n3 ?* W2 T. w/ d( [! H3 E# x4 B/ J
  12. *) |) c( v3 ^, V" F' f
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 a  Z. ^" m% V4 ~: d! i
  14. *
    ! G: T) _+ Z2 _; i' d% k
  15. * This program is free software; you can redistribute it and/or! N7 w' x0 [4 C7 m' x! c
  16. * modify it under the terms of the GNU General Public License as# _9 l( T  u# E# h
  17. * published by the Free Software Foundation version 2.8 q1 p. d% t: {  s
  18. *5 Q' ^* r( H) F; o
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    2 f: e! Q/ C7 j  B/ y5 Y) c
  20. * kind, whether express or implied; without even the implied warranty
    & K0 x* u7 P7 X1 }
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  J1 Y% g( }. U0 F6 a
  22. * GNU General Public License for more details.
    : y% @$ m- B8 N9 N% i
  23. */
    / l7 [5 V- A! z  u9 w6 p) A

  24. ' i2 N% J" H! _" D3 A6 G7 h3 R7 d
  25. #include <linux/module.h>
    1 G0 A# s* J# f
  26. #include <linux/init.h>
    5 K) L# \  I1 I- {" T+ _+ @1 V
  27. #include <linux/errno.h>6 W# |7 {& j& Y& p' \2 E
  28. #include <linux/types.h>2 G  q( p* k7 o6 W) P
  29. #include <linux/interrupt.h>
    % h3 L4 C; L7 C% r9 X( k' X! P
  30. #include <asm/io.h># x8 {4 K5 M% q! w8 ?  y0 y& Q
  31. #include <linux/moduleparam.h>* D' u. J1 M  ?) Z1 K  p& h' g
  32. #include <linux/sysctl.h>* k* q- W; C3 ^# J+ p# S/ S( O- E5 C
  33. #include <linux/mm.h>3 K, [) [. s( S0 M0 M
  34. #include <linux/dma-mapping.h>6 b. e8 ?. M- y. S9 U" f: m
  35. 9 X* R* f2 \/ w/ C8 N- E& s
  36. #include <mach/memory.h>& b" t2 k. X* b8 u. s# f* {
  37. #include <mach/hardware.h>
    . _0 ^! s; T( q$ a0 ]
  38. #include <mach/irqs.h>* x9 E/ Q, L! K; ~/ M: u6 D
  39. #include <asm/hardware/edma.h>( |/ I2 z% K8 B# K: {: P7 E( o

  40. 1 G: Y, ~: R2 M# ^4 z# N9 \& O
  41. #undef EDMA3_DEBUG
    $ q$ `3 }' r+ u  h
  42. /*#define EDMA3_DEBUG*/
      w$ [$ F  k0 s7 M( T
  43. ) R* h/ L- J* Q' F' @6 S1 H
  44. #ifdef EDMA3_DEBUG- Q  ?$ z9 k* J
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 V, Q# W9 `6 P$ R& w, R5 t
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; u. X: _. {3 g
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" s0 X  S3 n( S! e+ v, ^
  48. #else9 m2 _; F1 l  a' s0 N1 ~
  49. #define DMA_PRINTK( x... )  e9 _9 |) D7 S6 Z/ @& G
  50. #define DMA_FN_IN1 P& K- c0 B9 ^" n' g
  51. #define DMA_FN_OUT" Q% Q  `# L! _2 O
  52. #endif* }/ U/ m( X+ y

  53. ; ^& R8 f' j" r* ]/ b  x- {( z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)1 s, `8 Y% u% e8 h% s6 N/ \0 q
  55. #define STATIC_SHIFT                3
    2 \$ s8 E: `* `! ]
  56. #define TCINTEN_SHIFT               209 A/ @6 {8 X) A4 b2 t8 u# J, i) L$ `
  57. #define ITCINTEN_SHIFT              21
    # z  Q) s+ e4 r: D/ Y" }6 R/ `7 L: O
  58. #define TCCHEN_SHIFT                22
    9 g9 u/ k! c* A) o8 q3 C
  59. #define ITCCHEN_SHIFT               23
    # o8 |; l' @' F# h$ y  [. G# T. a
  60. 9 {. n: D/ `( D  L# E4 Y
  61. static volatile int irqraised1 = 0;
    7 [, X1 A) k1 @/ D
  62. static volatile int irqraised2 = 0;
    ! L0 p& N$ G% p8 r
  63. ! Z$ K) {# O1 U3 b9 j
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 }5 h; ~6 L7 W9 p! Q8 `
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 Z- W& X8 S+ \5 h' N
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! _& c. y7 r. n8 O" l7 Q6 b
  67. 2 ]( _. o8 i. c9 t  h/ C. o4 T9 G
  68. dma_addr_t dmaphyssrc1 = 0;6 v* Q& e- Z# L! T( k% j; T
  69. dma_addr_t dmaphyssrc2 = 0;$ B9 }$ w5 M& S
  70. dma_addr_t dmaphysdest1 = 0;
    3 x, O# |  q9 |: `3 X' S* M
  71. dma_addr_t dmaphysdest2 = 0;5 q+ l1 C8 z# N; x: L3 G

  72. 1 A9 c& P  @8 L6 f
  73. char *dmabufsrc1 = NULL;
    " O# a* M% _5 g( W8 F3 A
  74. char *dmabufsrc2 = NULL;
    % ?9 k1 e4 E; R9 c1 U* m! z
  75. char *dmabufdest1 = NULL;$ a' [4 B6 e7 }4 D* _" C( g" d
  76. char *dmabufdest2 = NULL;4 t) A- y3 F* q3 t: h" u

  77. 0 p. f3 V% [; T  }8 i& n- {
  78. static int acnt = 512;
    8 P; ?0 l6 X8 W' u$ @, U4 T1 r
  79. static int bcnt = 8;! o6 T; R2 m- |: R
  80. static int ccnt = 8;
    + e) c( C3 V! p' r$ {

  81. % J9 X' B0 {. _* a: Q9 q
  82. module_param(acnt, int, S_IRUGO);8 \+ Q8 B" b% D0 C5 G1 [% I
  83. module_param(bcnt, int, S_IRUGO);
    , U% A+ S1 h" F+ u
  84. module_param(ccnt, int, S_IRUGO);
复制代码
/ k! ]: {# c# C3 `* V- _$ E

! Q% l( |7 `2 E3 t1 x      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 C2 s+ A5 @; p+ e4 C1 Q4 Marm-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 f' ]% x& x$ G3 V0 E9 l
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 p1 D  `+ B  |% u
0 `) G" o. o* P' Y# R/ R7 \3 b7 F
) S+ y6 K' I6 `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-8 04:23 , Processed in 0.039973 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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