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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & w0 W, ^1 Q0 W4 v# y
  1. [code]EDMA sample test application+ |; o4 C: ^! D% w) V. p
  2. /*# W: d/ ^# L8 F" Y+ {# e- W8 o' {
  3. * edma_test.c
    ( N+ `0 W/ Z& B
  4. *
    ) l. p1 A% o6 r7 R' g( Q
  5. * brief  EDMA3 Test Application& A3 k1 \4 K. A% j9 P6 B" r
  6. *
    # h; D1 C1 x# L3 d( I" f
  7. *   This file contains EDMA3 Test code.
    # I& L( Q  @6 X4 ]6 ?
  8. *
    ! o5 B2 j3 ]( [, n  o% s
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + E( o, T+ ~/ C0 [) F' p, b
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + X+ D9 u1 d& e. C2 K
  11. *         TO CHANGE.& O7 D2 x# V: i8 b. P8 c6 n
  12. *
    ( a  C( N1 R% q7 r4 |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. B4 J, F, w2 }/ i( m
  14. *0 ?& m5 m! J* l3 B  a
  15. * This program is free software; you can redistribute it and/or
    ) N; [4 O% `( P3 O$ s
  16. * modify it under the terms of the GNU General Public License as
    . I8 }: Y1 e3 j' S0 v8 ~' O" X8 V
  17. * published by the Free Software Foundation version 2.  Q' W' N' a& Y. b( a+ M, H
  18. *$ j4 G& L' f1 f% }$ o
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    5 p1 F8 W6 S$ k
  20. * kind, whether express or implied; without even the implied warranty5 X$ N3 p  x+ Q2 O6 c$ g! j
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / i0 l& ?# |* k! P  R( j# d
  22. * GNU General Public License for more details.# a) l+ P! {; e7 R+ }% C
  23. */
    5 N; j5 m- ~( [& w4 y6 L" x: [! O
  24. + Q. {; |/ O9 N
  25. #include <linux/module.h>
    % q3 n- D' X2 L4 `' {9 M+ \
  26. #include <linux/init.h>7 {* C% m" i# G2 i- a( u
  27. #include <linux/errno.h>
    2 e. N7 ~; C/ v# L* I- P
  28. #include <linux/types.h>
    6 m3 l: y. I: }6 [8 p
  29. #include <linux/interrupt.h>
    1 N) c. y- t1 P6 J. ^
  30. #include <asm/io.h>
    ) Q, g0 F! v2 E9 y8 J
  31. #include <linux/moduleparam.h>6 ~" V8 v; L; t9 E$ w
  32. #include <linux/sysctl.h>
    $ N: p; a& \5 I% q
  33. #include <linux/mm.h>& U# Y, w8 e/ Q+ c
  34. #include <linux/dma-mapping.h>, n: L- F# j4 K6 Q+ ^* C) D4 |
  35. & m( I4 N4 S4 Q# [2 p: W$ l$ V8 n& ~) ]/ |
  36. #include <mach/memory.h>
    ' S: H/ ^7 V  b
  37. #include <mach/hardware.h>) G0 g1 `& ?0 c' V; E
  38. #include <mach/irqs.h>9 Z! g) L5 {) B3 E) [+ {* q* J
  39. #include <asm/hardware/edma.h>
    4 ^' D% w% A# K8 e1 \
  40. ' h$ [2 \  P6 T& E
  41. #undef EDMA3_DEBUG1 q/ ^" N4 {9 x7 M; k, u7 b& K! A+ N
  42. /*#define EDMA3_DEBUG*/, V/ V) n/ o4 b/ }

  43. ! }  e! j. _  @/ ?
  44. #ifdef EDMA3_DEBUG
    ; `6 G6 f  _: }7 \) z1 K
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% Y' n: E+ R3 k; `! Z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' b% i. e9 S: U0 Q3 Y8 U6 ?
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    2 L% m0 {- d! B$ |3 @# W  F7 }$ f
  48. #else3 I# T% v; K3 ]1 d- {
  49. #define DMA_PRINTK( x... )8 B  L4 C! ^2 w% E6 N" Z) r
  50. #define DMA_FN_IN
    8 z; H4 [7 f. j( f. H
  51. #define DMA_FN_OUT2 E/ u3 t* d. ?5 [; ~$ s* V
  52. #endif
    : O# g& B5 `/ u) W2 b' R& k
  53. 6 {1 ^4 k, I: y' K' C
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); i: L9 C% e: j1 n. h
  55. #define STATIC_SHIFT                34 W" O9 v* W# Y- C1 t
  56. #define TCINTEN_SHIFT               209 p0 v# K3 Y1 Q
  57. #define ITCINTEN_SHIFT              218 `1 T5 \! X! L8 g' D
  58. #define TCCHEN_SHIFT                22
    2 C" |5 w; v& G2 ~! P0 ]8 P
  59. #define ITCCHEN_SHIFT               23
    . p) o( r" I! n  y: z

  60. + k  F' A* N5 v. k
  61. static volatile int irqraised1 = 0;$ U2 O( U; l; B, e
  62. static volatile int irqraised2 = 0;7 ]1 _7 v" G$ P% z( U7 D, e

  63. ' x0 K0 a% j0 N7 y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + M5 q, r7 P  d' `" ?0 K/ p2 d1 `+ c
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) O2 m; |5 O7 L  s( ^
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 i% q  r8 h8 o0 E2 g% d

  67. 9 v$ z8 c, I! A1 X( H3 h
  68. dma_addr_t dmaphyssrc1 = 0;1 B0 W' L& j* ~( \3 N
  69. dma_addr_t dmaphyssrc2 = 0;2 N' `, G! ^; A% g9 m; L
  70. dma_addr_t dmaphysdest1 = 0;* x- r- m) Z4 l! T
  71. dma_addr_t dmaphysdest2 = 0;( X' B0 c6 P  n) d, {

  72. ! N: [  i8 _4 }. v! \7 D
  73. char *dmabufsrc1 = NULL;
    # x5 \6 }/ H7 p9 `! D" U
  74. char *dmabufsrc2 = NULL;
    2 }: M# W7 h  c8 I" r
  75. char *dmabufdest1 = NULL;
    1 H: T$ u% n4 M0 V# O/ Z$ q" L; o
  76. char *dmabufdest2 = NULL;. _+ }: T/ c1 v3 Z- p2 b5 W

  77. 9 g5 s4 y; _# x
  78. static int acnt = 512;  ^5 x4 Z; j6 ?
  79. static int bcnt = 8;
    4 {( h6 f3 N7 m" r
  80. static int ccnt = 8;0 I% C+ K0 g( w3 _- O! T

  81. 9 \% t( ~6 Z7 T9 I$ g. t$ |8 z
  82. module_param(acnt, int, S_IRUGO);
    ( O. J  z( s& }5 f3 }- y
  83. module_param(bcnt, int, S_IRUGO);
    3 ^! P9 K1 l+ T) h3 _' ?" Y
  84. module_param(ccnt, int, S_IRUGO);
复制代码
( x0 b4 D# C6 e2 a7 ]9 ?9 Q
7 a$ I& J! y5 R+ @" }( ~1 F8 o6 Q
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& Z. b! f* ?3 X4 H( V7 [
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" x0 B$ G' O2 [     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: e$ r( i% U" H0 Q

6 s- I! z% k9 H7 `' I; L% L9 s: q; y! R  L7 v2 R
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-14 11:15 , Processed in 0.041656 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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