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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, S! [  o2 ~. d8 w
  1. [code]EDMA sample test application
    % ?% G- |# B6 U& l* m/ h6 Y
  2. /*& z- Y) t% K" ~1 ?5 z' c- T% [' ?
  3. * edma_test.c
    / ?( R3 i- |% X7 M" |: V
  4. *
    ; g# H/ K* M- W' S# n0 [% W
  5. * brief  EDMA3 Test Application
    # u8 o; `' r2 I* ?' K. ~: E  j6 o; M
  6. *
    ; |: p5 F6 i8 d$ P9 ^
  7. *   This file contains EDMA3 Test code.9 i9 L) t& `% ?3 V
  8. *
    " q& a+ ~6 E+ I3 |: o/ m9 U, O
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    9 T+ ~8 m; k2 c, o$ f: s6 n$ i
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 [. y7 o) I- M1 F
  11. *         TO CHANGE.0 B8 s7 w, W6 I
  12. *
    " T6 C* q& s( ~# w( n
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 I  j" E0 f$ f- s9 W
  14. *" w# }) F" p: s; p
  15. * This program is free software; you can redistribute it and/or
    8 L9 B! n9 h7 I' B5 C, l
  16. * modify it under the terms of the GNU General Public License as
    - P# \, E3 U& X: H8 i: e) H$ g
  17. * published by the Free Software Foundation version 2.4 S& d2 R. Q1 I% K; P
  18. *8 x+ a# U2 E( C) B# F! I: k
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 t3 k8 g6 k4 [/ g% h
  20. * kind, whether express or implied; without even the implied warranty
    6 B9 |/ U! _% n  w" B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . y3 r- m5 H  n3 J7 \
  22. * GNU General Public License for more details.- t/ ?: u) s. o
  23. */# x. m6 e6 H. H1 n9 z) f
  24. $ G% C; m, p+ U2 I: y, [3 p7 A
  25. #include <linux/module.h>
    4 `1 k6 h+ `  h! C# [  A
  26. #include <linux/init.h>; ?' ?7 W1 f; S8 t4 B
  27. #include <linux/errno.h>6 |" U+ I- I* {0 j! Y% @4 B8 d
  28. #include <linux/types.h>( R) s) x  h& l" @. b
  29. #include <linux/interrupt.h>. f8 e2 M) R) c) B
  30. #include <asm/io.h>" c! ]2 H5 d; d- A
  31. #include <linux/moduleparam.h>
    1 x: E6 B) K5 [* Y
  32. #include <linux/sysctl.h>4 ]1 x0 L0 A* y
  33. #include <linux/mm.h>. p3 e, |1 E$ x3 K( t
  34. #include <linux/dma-mapping.h>+ Y' [, N# O5 S7 q
  35. 4 e4 |6 G# q! {$ v/ T
  36. #include <mach/memory.h>
    3 \- J: @. \4 ?" u5 C: W" k
  37. #include <mach/hardware.h>1 D" ~( e9 f/ C3 A! N( d
  38. #include <mach/irqs.h>9 Q5 I  b& @! @2 E
  39. #include <asm/hardware/edma.h>
    ) |" _; s) e# f! c5 \: {8 ~  T
  40. ! H) H' m6 T: ?0 M
  41. #undef EDMA3_DEBUG: l, {7 r' K6 C) x
  42. /*#define EDMA3_DEBUG*/) W* O" E3 M" K. `
  43. 8 O* H' C* g1 J# D+ m+ s& D
  44. #ifdef EDMA3_DEBUG
    2 @" g# g) S# U4 G  W9 F
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    * h1 ?* a0 ?' }# ?- X2 B7 m: h, q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    / X: D3 v4 P: R5 }* Y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 o+ g3 r+ W1 Q+ T8 t  h5 n: c
  48. #else, u( W& t. e% o6 v9 D6 O8 l
  49. #define DMA_PRINTK( x... )1 k1 Q+ f# d/ ]% s; X
  50. #define DMA_FN_IN) z/ h& g$ C( d$ |( J
  51. #define DMA_FN_OUT
    ! O" R0 |) x6 e
  52. #endif* {" s0 i/ f/ j% N; ^2 O* z
  53. / M5 V' X9 P/ a" T9 |
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    * T/ B. f; X9 e( q; I8 W$ Z
  55. #define STATIC_SHIFT                3
    ! z2 d  [+ H+ T5 {
  56. #define TCINTEN_SHIFT               202 {0 {" I( O7 p8 X; o
  57. #define ITCINTEN_SHIFT              21# ~  I+ O- B% _1 G4 w3 I
  58. #define TCCHEN_SHIFT                22
    , N5 Z% C% g* l# S  u; p6 }5 }  e
  59. #define ITCCHEN_SHIFT               239 k' D  T! F. i0 k+ u' i. f0 r
  60. 1 I7 q" ~, P* h' k
  61. static volatile int irqraised1 = 0;2 J0 {, {& \! I. B+ u4 N! p
  62. static volatile int irqraised2 = 0;5 E2 h( Z0 X+ i
  63. 9 u1 [6 g1 g3 x: Z0 {4 R
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . n1 }6 O$ Q" r# R0 s) _2 M
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" k3 k  Y2 ]) ^* O* B6 G
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' m2 a5 i: u9 T! O$ v  q
  67. . v1 X: {- X! w9 e
  68. dma_addr_t dmaphyssrc1 = 0;
    & C, D$ E7 q# m1 `2 E- A' o
  69. dma_addr_t dmaphyssrc2 = 0;" N; ?- V* d/ H' Y
  70. dma_addr_t dmaphysdest1 = 0;
    & B5 H% ^9 n" M! @0 z+ R3 |- H
  71. dma_addr_t dmaphysdest2 = 0;  b) V' v0 ]2 Z% y1 `9 k# x( M3 z

  72. - f3 B7 f! d- k* B) `
  73. char *dmabufsrc1 = NULL;
    0 O- @& f! L9 ?9 H% m
  74. char *dmabufsrc2 = NULL;
    ) q3 c5 e- C# f: x
  75. char *dmabufdest1 = NULL;: h( \# ]6 u' w4 b# Q6 F: S* `
  76. char *dmabufdest2 = NULL;
    # g4 B' G, C3 D/ x
  77. 7 h# b! A8 R2 C6 @" F
  78. static int acnt = 512;% C4 u8 j# L( U% k' ^1 K
  79. static int bcnt = 8;
    , B" }2 C% }& D/ x9 a: o! E
  80. static int ccnt = 8;0 G- f5 g+ D* T& _7 D

  81. 9 z) }" V8 V1 y9 U2 t* }
  82. module_param(acnt, int, S_IRUGO);
    2 Q2 C8 M% w8 B8 K9 F
  83. module_param(bcnt, int, S_IRUGO);
    , @# m; b1 F' w, ]( x
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 E! {/ ?! s3 v# y; r- t3 D/ G
9 M- f$ C1 ?3 l/ p4 C
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ u* D+ \/ o; P$ u/ O2 \5 C9 q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 u3 h; _* H( N6 q: }
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 A) n1 H+ `/ i" z8 @( ^
; Q. d& I" `# `1 q, N% `( e& ^4 L: S) {2 r
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-2 01:31 , Processed in 0.055120 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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