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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 v* q" u" y8 s5 N2 ^( `. L
  1. [code]EDMA sample test application7 s8 q4 q3 A% }* {
  2. /*
    4 K, B" M  c% v( n5 F
  3. * edma_test.c
      [) G. Q$ ]. z
  4. *
    2 W0 k" k9 |9 ?9 b% m: K1 l
  5. * brief  EDMA3 Test Application
    ! Y$ @4 p: \( H$ L+ L
  6. *
    . d5 H% v8 J* R4 b: r3 }# Q7 E
  7. *   This file contains EDMA3 Test code.
    ! w) f4 r6 Q0 M$ l, ]+ G! h9 C
  8. ** C4 H( X) N1 f  X/ W
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ' {* U& G) u: a! h0 B. M4 M2 @( r: b
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    3 {! R  |  a; e3 i& Z
  11. *         TO CHANGE.3 G+ o( U( }5 W
  12. *# S$ G$ f" L* T4 q' R% b4 @
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 U( X: ?0 R; c! Z
  14. *8 u3 R5 F! e! _/ g* T8 R0 U) ?
  15. * This program is free software; you can redistribute it and/or9 A3 A! p, ?, L2 J3 H
  16. * modify it under the terms of the GNU General Public License as
    / e; k/ F+ m  x; R* b- m
  17. * published by the Free Software Foundation version 2.* |/ W. g$ W  Z: m% X
  18. */ q7 `4 G  S4 D
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    , \7 r- p9 G/ \+ ~* `0 I0 B
  20. * kind, whether express or implied; without even the implied warranty9 f! s3 u2 g0 m6 u
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5 J1 ~* @7 ]; }- L/ p& W3 S( V- Q* i
  22. * GNU General Public License for more details.
    3 q  z3 n- G  y9 q: B5 O
  23. */# N" A/ \5 g& ]1 S0 z5 G

  24. " }$ r7 i6 J5 \0 Y- h& l
  25. #include <linux/module.h>
    / E% x. _0 d# `0 B, c  Y
  26. #include <linux/init.h>
    ) R3 r3 l0 Q5 w6 ?( |+ V; \
  27. #include <linux/errno.h>
    1 C# a. W) O+ }% ~, ]
  28. #include <linux/types.h>
    ' j6 E7 r  x1 l
  29. #include <linux/interrupt.h>: b: [: g. y4 o' C* N
  30. #include <asm/io.h>3 D2 w$ ?1 F. F7 Z  S
  31. #include <linux/moduleparam.h>7 }; \7 Y' `3 T* u9 T6 o
  32. #include <linux/sysctl.h>" {1 l7 s9 @3 R4 P/ K  \* J, G
  33. #include <linux/mm.h>
      U- \% H* _) [4 N3 z8 B8 d0 p5 u
  34. #include <linux/dma-mapping.h>
    : j" H, V& X" F$ }' Y7 g/ N3 L
  35. + J! G' _% P4 `
  36. #include <mach/memory.h>9 P/ h/ S& t0 V" Y
  37. #include <mach/hardware.h>
    ) [3 H2 I( X0 \: g& }( h, ~5 M
  38. #include <mach/irqs.h>
    " D5 U" [5 _0 }" u9 S% ?0 [( u
  39. #include <asm/hardware/edma.h>% g# c& |7 q# [' f( m+ B  F4 T
  40. - z7 m1 g' f  |) q4 |5 q, P. M. S
  41. #undef EDMA3_DEBUG- r5 Q' F: r5 g- b9 e
  42. /*#define EDMA3_DEBUG*/
    , G/ x6 l* m. a' t
  43. 6 |: f4 A; _9 J1 F4 m. t$ s
  44. #ifdef EDMA3_DEBUG& ?! O: |/ N4 ~
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 u. C+ ]8 o# g) Y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! ]# B" f+ g+ [7 U4 |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 t6 i( a7 E# Q, j# e7 |
  48. #else
    / |8 S' r- n/ m& ]1 r4 d8 P$ I' [
  49. #define DMA_PRINTK( x... )
    ( K0 @3 f6 h; a3 G4 J# h) R# W
  50. #define DMA_FN_IN2 Y' ^4 l: k; [% |* e
  51. #define DMA_FN_OUT
    0 e2 ^1 c6 ~& @, W' W4 p
  52. #endif
    9 w5 B$ d' y$ s6 W& Y+ i& s% F. A

  53. / ~4 q7 f1 ?8 B: v" B
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)/ X0 w" U% ]& X0 A
  55. #define STATIC_SHIFT                3. W6 g) ^& L( K/ D$ |, y- L0 {. ]
  56. #define TCINTEN_SHIFT               20
    * i- b; E% l- V. i7 R! [" o
  57. #define ITCINTEN_SHIFT              21+ Y, Y2 z. L; v: j( G6 C
  58. #define TCCHEN_SHIFT                22
    * F) j8 G- y. i  [) [
  59. #define ITCCHEN_SHIFT               23
    & t- M& d- f4 l  F9 K+ i- Z: f* X( j0 C
  60. 1 i% I7 A5 K- z, I% @8 R+ T
  61. static volatile int irqraised1 = 0;
    3 P$ x7 I0 t5 s2 q" n' `
  62. static volatile int irqraised2 = 0;0 N# ~. L+ R" T

  63. 3 C) {) ]* ~' z8 G# i
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 C) v9 P0 v0 o; Z5 P. w/ I
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- E1 E0 O9 Z9 O& W; n
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( [, r- ]; h( C
  67.   M* v/ w- g6 E/ Z: K. l! L
  68. dma_addr_t dmaphyssrc1 = 0;" v  l$ H3 _5 Y/ S
  69. dma_addr_t dmaphyssrc2 = 0;
    # R$ c7 h8 U' x% |0 O, _
  70. dma_addr_t dmaphysdest1 = 0;
    $ h# a& O! x* ^; d
  71. dma_addr_t dmaphysdest2 = 0;& b- Q. m5 [( ]. B

  72. $ L) e) V4 |# d  B
  73. char *dmabufsrc1 = NULL;( p& N' _( c" j/ u& q4 ]
  74. char *dmabufsrc2 = NULL;
    9 s# ~$ I, f% i8 `" w- w  Z
  75. char *dmabufdest1 = NULL;3 T: d$ v* ]4 I% g) D
  76. char *dmabufdest2 = NULL;
    2 c5 Z6 w: F0 r# F
  77. ; G# H, y; q0 [
  78. static int acnt = 512;& ~. l4 y' r( z0 q
  79. static int bcnt = 8;7 O' r+ |/ b( o- T6 O' V$ i
  80. static int ccnt = 8;
    1 [, R# v& @* q8 l* g. ~
  81. . b9 j2 Z1 f7 t, M" {) o
  82. module_param(acnt, int, S_IRUGO);3 D, U% a) i. c  l0 L
  83. module_param(bcnt, int, S_IRUGO);1 H- P; m: M# B$ P; I: n) M  K
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 f; B  N5 e1 v( u% x" C4 o" V/ Q5 V$ U: h
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ E" X  C: g; ~- m( X: V
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 `# t. X! U& m$ [& `  m
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 d# ~: j0 x2 v/ a" [$ _" `1 {1 J4 p
. D: G& L! Q* E
, S! O# _. ?( k- Z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-7 18:29 , Processed in 0.040450 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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