OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 ^: s& b* c  n# Y+ ]4 `
  1. [code]EDMA sample test application4 _& x) Z8 B4 B" j
  2. /*
    , i7 x0 {& ^: a# F7 ?6 ^( W
  3. * edma_test.c
    + @6 a: ?6 u# N$ q
  4. *
    9 ^0 c, F. t" R4 t" y& }* H) J
  5. * brief  EDMA3 Test Application) Z' Q1 E( q2 R+ l
  6. *
    & B( l2 c: P- E+ n" ~3 s
  7. *   This file contains EDMA3 Test code.1 [) X7 _  }9 p8 @" ], Z
  8. *
    + Q/ ^$ U' n% [1 x3 F! y7 J/ W7 a/ {. V
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 N, \1 ?0 Y" s0 r% K2 l! t
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 E4 l. F" i' A% E
  11. *         TO CHANGE.5 D- L' Z! l' _/ J
  12. *% c- B6 Q0 R; J" W
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 D2 h0 I8 E9 A' C- M4 m, j
  14. ** w5 u( {; ?0 i5 Y
  15. * This program is free software; you can redistribute it and/or  f8 S# N! l- ?& A* t: w1 B
  16. * modify it under the terms of the GNU General Public License as7 u2 W7 q: a; O" {# b; C
  17. * published by the Free Software Foundation version 2.
    ) h8 W% W$ Q  Z' ]8 c0 x4 i) D
  18. *
    ( i8 k! V0 ?2 K! }4 {7 [3 o" j
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ) |, f& O7 e2 l( T- W7 u: T
  20. * kind, whether express or implied; without even the implied warranty
    3 |/ M6 g; l: U
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    , G3 P3 m1 H. T  |
  22. * GNU General Public License for more details., n0 a" K1 Y# w( l& C
  23. */% G) n$ z: B8 y5 Z. g

  24. % p& i, n! q4 h4 T
  25. #include <linux/module.h>
    % r. D/ f$ |3 ^- O
  26. #include <linux/init.h>
    $ h+ M+ [- q8 |/ X! j* g
  27. #include <linux/errno.h>6 r# ?. v3 D- B; ~! x+ d
  28. #include <linux/types.h>
    7 h. c( V" Z% o6 b7 _
  29. #include <linux/interrupt.h>
    - }$ `: R- j. f5 _( i; |: e
  30. #include <asm/io.h>
    5 ]+ z% n# _% E9 n/ a
  31. #include <linux/moduleparam.h>- r) x3 \4 q, V* o# c# X; j3 p; m1 |; ?1 l
  32. #include <linux/sysctl.h>. d) \3 Y9 o, ~* C3 Q0 x" s
  33. #include <linux/mm.h>
    7 r, B* q# Z2 Y. W2 X- v7 O0 T# `
  34. #include <linux/dma-mapping.h>2 j+ v: \8 S% ]) c/ @# w$ c$ }

  35. ! M( Y+ H, w$ c2 L8 ?7 X' b' M& G
  36. #include <mach/memory.h>$ @$ t; X  R0 w& y8 T: j; u: s  A& u
  37. #include <mach/hardware.h>) t. b$ {! m5 Z* l* i2 }' v( \& J
  38. #include <mach/irqs.h>2 j  t2 {, Q5 O- ~
  39. #include <asm/hardware/edma.h>3 E8 n- r4 R. L. G! {& P

  40. 3 R9 [% Z  r) W0 J
  41. #undef EDMA3_DEBUG2 h& _. N- ?3 |  l
  42. /*#define EDMA3_DEBUG*/
    7 N& @0 K& K$ ]+ j* t4 x8 W5 e

  43.   W3 A8 J6 t/ l& i) C$ \: I" h! y
  44. #ifdef EDMA3_DEBUG6 K2 a1 @: y8 L
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)  J, p) t" e, O0 M! z; i
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    . b' K1 _% B; c* F
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , ]& C8 I/ C1 C: ?2 V
  48. #else
    1 l4 S% g" P+ n2 x2 Y, c
  49. #define DMA_PRINTK( x... )
    5 G2 ~) ]1 O: s* I( J
  50. #define DMA_FN_IN# y! \' g* R9 C1 f( X) r7 p
  51. #define DMA_FN_OUT% K; E- h: o% U3 L8 _
  52. #endif
    " s  r5 T: g) Q! A

  53. 9 g5 K# b9 y* ~6 ]; S9 g4 v
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    + W3 y8 H# p! u: m7 ]: P2 E
  55. #define STATIC_SHIFT                3
    . q+ }/ Q/ A( y( Y1 ?% a: p
  56. #define TCINTEN_SHIFT               20+ u5 w, k# b  z% W+ G3 F0 r7 z
  57. #define ITCINTEN_SHIFT              21
    2 c. n. }; _0 ]/ i! \2 Y
  58. #define TCCHEN_SHIFT                22
    ; D6 j# [+ x5 G; T8 B. W6 a
  59. #define ITCCHEN_SHIFT               23, b. e" z, c$ {: U# p  I

  60. " Y0 ~! N1 s  p2 l5 N: j. R; l
  61. static volatile int irqraised1 = 0;- W! E  p! s) z. s: `! K2 o
  62. static volatile int irqraised2 = 0;) Q* ?% D/ M) j( s* K! |

  63. 4 `8 A9 [( @# I) M
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " g* X; o6 p' F6 s6 T
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 e. L3 v. P2 q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) z/ V% \% F1 B7 s- ]2 N* p5 t

  67. 5 _. X2 e3 m  s( r
  68. dma_addr_t dmaphyssrc1 = 0;
    $ C5 A' b$ q* R9 H# |
  69. dma_addr_t dmaphyssrc2 = 0;
    ) N2 u$ Z! c  [' _, T  o
  70. dma_addr_t dmaphysdest1 = 0;* q& p& D  c; ?/ r. L6 }
  71. dma_addr_t dmaphysdest2 = 0;
    3 U5 e" w8 P( E% G' U, S7 K9 o

  72. 4 b$ M3 M* Q4 u7 a; Z! D
  73. char *dmabufsrc1 = NULL;4 n) @& I1 o8 j' T4 y
  74. char *dmabufsrc2 = NULL;6 |' D0 M7 f3 l' O/ B2 u
  75. char *dmabufdest1 = NULL;
    ' m( L4 `; {2 V  X# b/ K" ?* ^
  76. char *dmabufdest2 = NULL;
    ; c1 m) [) o" I0 Y

  77.   A- v% p- A7 H1 S7 ~8 G
  78. static int acnt = 512;
    ( @( y' N* d* `. e5 W3 d$ f
  79. static int bcnt = 8;
    * v' {7 E3 L/ H: P% C0 H
  80. static int ccnt = 8;
    5 F, q* e- C& R4 u3 @$ _9 H. Z
  81. 4 x5 F& S1 C/ O1 e7 n: z0 u9 X2 ~
  82. module_param(acnt, int, S_IRUGO);; z  u$ U& y! R) [9 F; M* B3 Q; E
  83. module_param(bcnt, int, S_IRUGO);) r7 Q! v- o$ x7 a
  84. module_param(ccnt, int, S_IRUGO);
复制代码
% |9 v$ M, |  ?3 T: P! I
; O2 t" a2 Z7 C0 i) x1 n
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 y) }, p5 _" U! e, T4 `
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 n6 p3 @6 b7 A, G) {
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& j1 O% J* E- o

+ L6 B6 e6 E' k0 D& U) S
, r7 Q6 t5 \9 R4 c& ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-2 11:30 , Processed in 0.038193 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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