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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' }1 r, |, ~: ^6 \# q
  1. [code]EDMA sample test application# u& l' O, D0 ]
  2. /*
    : ^9 V; K7 S6 ~8 Y" _
  3. * edma_test.c2 C: @& W$ `8 h
  4. *5 g9 g* G( Z. S4 S) S2 ?0 t4 l0 S
  5. * brief  EDMA3 Test Application
    . p" Z# V$ p, }, b# @% Y6 T; A
  6. *
    . V1 ]4 E$ H2 N# V' @" {
  7. *   This file contains EDMA3 Test code.  _' W1 ^9 R) k$ h: K9 A% S3 p
  8. ** E! J( h) K. p' |$ p$ b
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# k% i. _- `& H$ w3 }) Z7 o5 u# Y; E
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    1 ~$ J1 C. W. n3 x* x
  11. *         TO CHANGE." L% B; X" Q! W2 s$ f" s0 T: F( }
  12. *
    ( W  a5 q. K4 v* w& c1 [
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) ]) W, K: }: i( R, E' T! \
  14. *
    ( P( U9 {. ?& o* o; Y
  15. * This program is free software; you can redistribute it and/or
    * v$ D' t0 H( h4 e. v" f: f
  16. * modify it under the terms of the GNU General Public License as
    + \2 {6 `, e! ?; s
  17. * published by the Free Software Foundation version 2.2 |* w' h$ d" v5 B
  18. *
    + j: x) z8 o' v5 W( q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    % r7 [% h. C, N8 N
  20. * kind, whether express or implied; without even the implied warranty
    . T0 o, H2 I6 ?( F( D6 ]8 K
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    8 _& U$ i8 u1 m" o# M. P" g/ i
  22. * GNU General Public License for more details.. x2 ?) x* b; a0 T
  23. */
    / Y- v; E, }! ?! P6 ~
  24. . E9 k/ ^! o" H
  25. #include <linux/module.h>2 W4 O7 d. x( w# Q/ {, E/ J
  26. #include <linux/init.h>% T1 G3 P# W/ c7 L9 \9 I: T3 g
  27. #include <linux/errno.h>: y$ @- w- b- F1 {3 h' ^  i
  28. #include <linux/types.h>
    2 C# C, T6 U  x2 Z2 L, _
  29. #include <linux/interrupt.h>
    - H1 s& Y& V+ V6 m: ]4 Z) \+ ?
  30. #include <asm/io.h># d, z: ]9 O: e- l+ E0 m' K
  31. #include <linux/moduleparam.h>
    . O. M  L$ T2 `) M
  32. #include <linux/sysctl.h>
    ; m- X" ]8 |# y* M  |# w6 k
  33. #include <linux/mm.h>2 W9 r) o0 V( t/ a; P# P
  34. #include <linux/dma-mapping.h>$ G/ Z/ m& u, g: \1 C) P
  35.   r# a0 m% A0 n7 N& Q
  36. #include <mach/memory.h>
    8 z2 ]2 P% }0 v+ v+ h) M
  37. #include <mach/hardware.h>& T- d7 J% ]; p* O
  38. #include <mach/irqs.h>
    0 M; o- [9 G& o( L& v
  39. #include <asm/hardware/edma.h>- N1 ~* b& E+ s$ I4 U& ?) V

  40. . R; ]9 J* ?- q' _' c
  41. #undef EDMA3_DEBUG
      m  ]/ @9 D; f5 o+ Z' r6 P
  42. /*#define EDMA3_DEBUG*/$ M9 f& J% Y7 e, h
  43. " `7 [: z' x- ~. h4 ]( c
  44. #ifdef EDMA3_DEBUG& U( E5 B- @0 F3 ?
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    + F2 H" ~# C# s3 I7 Q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 j- \9 p: Q( Z/ ~
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 H9 v# U, r, r7 o$ o5 ~2 Y4 y0 z
  48. #else
    * R% s& ?( q' P/ g+ b/ O; D
  49. #define DMA_PRINTK( x... )
    . t) |/ H. r5 c, ~, b/ ]. Q
  50. #define DMA_FN_IN" s, e9 p+ t  d0 R2 [, V4 B
  51. #define DMA_FN_OUT
    / ^7 l, y- S4 v  H3 x
  52. #endif8 q1 m; W" u; a) `9 W) G7 h8 H& e. _

  53. 5 E' |* K5 {+ t6 b
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 F  U  W$ K& v5 d% T
  55. #define STATIC_SHIFT                3
    1 U$ H2 ]: A2 {5 O' M
  56. #define TCINTEN_SHIFT               20( p7 Z* ~  @  C: |
  57. #define ITCINTEN_SHIFT              21
    & H+ R, }4 i+ j5 @/ q
  58. #define TCCHEN_SHIFT                22( j* F( J5 Q9 ~
  59. #define ITCCHEN_SHIFT               23
    ) I  W  T1 k/ X4 `* f$ ^
  60. # _: I: m- @& M. X0 x
  61. static volatile int irqraised1 = 0;
      n& \7 v0 b) W# ^$ W4 l
  62. static volatile int irqraised2 = 0;
    6 h6 ]# e# W. l( X+ E& E

  63. 0 E" d! O; ]' {! v
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, h9 s3 Y; A+ k- s3 T8 R6 Y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: v  N1 P1 q0 J/ j
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 c: r7 h* X( w; M" f$ a7 _, _5 c

  67. % z* h& r; {9 J- Z7 w
  68. dma_addr_t dmaphyssrc1 = 0;
    8 y& ?; j- ~  f, Z7 l1 Y8 \3 E
  69. dma_addr_t dmaphyssrc2 = 0;
    " E8 C: `7 E% I1 V" b
  70. dma_addr_t dmaphysdest1 = 0;
    ( s* z7 h- Z2 K1 `
  71. dma_addr_t dmaphysdest2 = 0;
    - @9 z# Q! U6 ?! t; P) q
  72. $ @) G/ I( }/ _( g
  73. char *dmabufsrc1 = NULL;
    1 t/ V0 M5 @( g% M. ?- r
  74. char *dmabufsrc2 = NULL;1 w6 D3 _; z. m- |4 y
  75. char *dmabufdest1 = NULL;: y/ B+ e3 p7 [& j% t: Y
  76. char *dmabufdest2 = NULL;; U9 M" E& `; j6 M1 H% `

  77. - D9 ~& E, r  b' h/ m6 q
  78. static int acnt = 512;9 U# a8 \8 d8 j( g  I% s
  79. static int bcnt = 8;3 {- s% _. {4 F, s' L/ w/ s
  80. static int ccnt = 8;( ~0 J0 Y% B4 s4 h

  81. / m: \& D% d/ E) X) r1 u+ t
  82. module_param(acnt, int, S_IRUGO);5 w( w1 P. P. t) }4 Y- S
  83. module_param(bcnt, int, S_IRUGO);. y* H7 h4 r+ p5 ?5 s  J
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 B5 O2 N6 ]) [5 M  I$ V: C- i3 y* l% g
3 ^' }+ a4 P7 K0 K/ u2 b. o' p* a      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% o; p! w& Q9 z' K& c
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 K, @+ R" d: g7 c
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! n+ N8 I  g+ _! m' x4 y
% u# z/ h# o' ^
3 V3 t3 U; o0 ~
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-21 10:48 , Processed in 0.041296 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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