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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑   q% s; i3 D: m
  1. [code]EDMA sample test application
    + x& A: k2 G' [8 Z! R7 ?
  2. /*
    " {* u& l( u( [  I" Q. y
  3. * edma_test.c( x; a- ^+ Q1 x6 M# ~( r& l
  4. *" s4 p- ^$ V6 z  W# r1 F! k$ |
  5. * brief  EDMA3 Test Application. H- {( ]# q4 Z7 l) {/ ]8 `
  6. *
    , H0 L6 E% n/ e1 L
  7. *   This file contains EDMA3 Test code.
    ' a/ {4 v% ?7 ^
  8. *6 i8 g, i5 v+ C- I
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% \! R+ F2 z7 H1 X$ r* y* I
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& F2 E7 k/ l+ k1 x( j
  11. *         TO CHANGE.
    / A. M6 N, O7 B  {
  12. *
    5 [3 R- ~1 a: h
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; A" p! U9 r* x8 d; v: {/ H
  14. *- p5 B! o7 i2 ]# @( V
  15. * This program is free software; you can redistribute it and/or& z% d' L! ~' s# V% K# s
  16. * modify it under the terms of the GNU General Public License as
    " I; g% J% p' d' ]* Q, I
  17. * published by the Free Software Foundation version 2.
    7 ]! |2 q0 N0 [) r2 ]
  18. *
    ! ]3 c$ }, d0 x. y" G3 e
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 N$ J  `( Q+ ^+ f+ k  u
  20. * kind, whether express or implied; without even the implied warranty5 ~: f# L% f: K; l* {1 @6 f1 `
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 x; y3 a- {" g# f% G5 W& @# Z. l
  22. * GNU General Public License for more details.
    % k# l% h* V6 H( @% A
  23. */
    2 k/ Q0 K) s! I1 j" h

  24. $ @* T" p4 f, c, O5 j: g
  25. #include <linux/module.h>
    ! y' a: h* c: F$ [1 R% @) z
  26. #include <linux/init.h>) s- T( a! {/ ~' v$ ]( t
  27. #include <linux/errno.h>
    . H# p& c  ]8 W* P4 N2 D
  28. #include <linux/types.h>
    ! K" J' J) C' J% q
  29. #include <linux/interrupt.h>% b2 h+ ~  f9 U$ Y# `
  30. #include <asm/io.h>* |) H% e( g+ l0 t& t
  31. #include <linux/moduleparam.h>
    5 A. @; _& [+ H- i$ O( y/ y
  32. #include <linux/sysctl.h>3 E# r, |0 c, C* r7 v8 ]  O7 \8 z( `
  33. #include <linux/mm.h>) f2 g) u; j$ _" G
  34. #include <linux/dma-mapping.h>
    + ]- \6 m; E# Y% f- Q
  35. . s! f9 |5 R" h0 |
  36. #include <mach/memory.h>0 W% [# R4 W5 F, ]# |# }
  37. #include <mach/hardware.h>
    * y  r  G) O0 Q# f; E
  38. #include <mach/irqs.h>1 o/ R9 E$ D/ l$ a- ~
  39. #include <asm/hardware/edma.h>
    * q# H1 R' V4 h$ h0 j, G2 _
  40. # d: |1 C2 `" x0 v& Z; n
  41. #undef EDMA3_DEBUG
    - W9 |' x  X; a: S3 K: j
  42. /*#define EDMA3_DEBUG*/
    0 g* ~. J7 ?. E% {

  43. / m. Z$ M! N5 l: v) f1 w
  44. #ifdef EDMA3_DEBUG
    8 |- }. m5 X# c8 u) K$ D
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 B0 b* b) E; M* l' O, t
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & i# I) ~0 j( N2 a( @, d* a
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( m9 w  E* H2 B: f  T5 N  x: }9 p  `
  48. #else4 ]9 r, T9 I, g5 h( i  m' ?
  49. #define DMA_PRINTK( x... )" u5 |  M- {: ~: j& ?
  50. #define DMA_FN_IN
    0 D0 ?4 S6 m" b+ k+ y$ x! L" V' X+ M
  51. #define DMA_FN_OUT- n  N6 K7 d4 I4 H, V& p- S
  52. #endif
    9 \9 J+ Y$ V) Y' x* b* G+ M0 e

  53. ; o1 f$ z( \& [! G  s5 d+ a
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  |2 L" N2 V  c0 L
  55. #define STATIC_SHIFT                3
    % ^4 p1 a0 b: Y, N
  56. #define TCINTEN_SHIFT               20
    ! S/ R. h/ p& Z% H
  57. #define ITCINTEN_SHIFT              21
    / U/ i$ t- O( Z! K
  58. #define TCCHEN_SHIFT                229 J) x! r3 ^. G9 {
  59. #define ITCCHEN_SHIFT               23
    : O* [3 r) `2 h- H  I6 `; e

  60. . P: K% N2 s% ?, b4 {- Y
  61. static volatile int irqraised1 = 0;
    1 I! d; @, B8 r
  62. static volatile int irqraised2 = 0;
    8 g. t  r* N" G0 ^% N/ B0 W

  63. 7 Q9 ?8 y1 j3 z% ~
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # v5 W) Y8 u5 \  d9 S
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 g  q2 m1 U5 p: n
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, p( o( Z0 B" N5 Z
  67. 5 D( H2 |1 W0 A9 R- x
  68. dma_addr_t dmaphyssrc1 = 0;1 t1 y+ j; G5 d$ w( X
  69. dma_addr_t dmaphyssrc2 = 0;" F6 H6 x& [& M3 z" x" q+ x, g/ A
  70. dma_addr_t dmaphysdest1 = 0;. k5 q& u1 m2 v8 U: }# M
  71. dma_addr_t dmaphysdest2 = 0;7 o4 D# W# ~# t
  72. 0 X! O) V1 k; a/ \! y! E  a" I
  73. char *dmabufsrc1 = NULL;& U5 g8 R; V& z: S7 R) M
  74. char *dmabufsrc2 = NULL;
    9 E2 P0 |: c1 ^
  75. char *dmabufdest1 = NULL;
    * B  V1 d  i! a6 U2 p- M
  76. char *dmabufdest2 = NULL;
    8 Y8 X/ J( X9 e4 w# v  u2 q9 U

  77. 8 W5 X8 m" Y- |) N& d! `
  78. static int acnt = 512;
    8 o# \- E( x8 ~6 [5 Y; L( j- B1 z
  79. static int bcnt = 8;
    $ H6 a6 a0 H6 D9 s! ]
  80. static int ccnt = 8;1 H/ _3 X9 H; k1 ]: U$ v
  81. $ @$ l4 \, b# U% \! y% O' _8 x7 O" T
  82. module_param(acnt, int, S_IRUGO);
    ' O& b- [6 o5 H) L6 [) c% a
  83. module_param(bcnt, int, S_IRUGO);
    ! U" T: @4 Z$ |0 V
  84. module_param(ccnt, int, S_IRUGO);
复制代码

4 {0 R2 K# n+ a% |. n4 N, {8 {4 U2 X, R* P" e3 m
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 `& S1 N' S; j) y) l5 Y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, |& a& b0 k. v2 u     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 t( o. R1 n" p1 I1 S
# q! ?/ d& w% `. {' p
- w3 e/ h4 `3 ^& p
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-9-28 21:58 , Processed in 0.039152 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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