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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) g- |" D$ Q  h
  1. [code]EDMA sample test application
    0 ~  x* N* T6 E! z2 b/ @' n
  2. /*
    4 X5 c/ h/ A- r, _& O
  3. * edma_test.c
    3 K6 c" k* O9 v! }8 L( p. O
  4. *
    : K+ K4 m6 g3 a" C
  5. * brief  EDMA3 Test Application
    0 o7 D% @. R8 C4 b) Y1 y7 ^; }& b  [
  6. *
    $ ~, T3 ^: @( I, T! H
  7. *   This file contains EDMA3 Test code.% w/ R6 g% Z; m2 p0 K# `$ N
  8. *
    7 j/ `) q2 t9 L( W4 S6 u% t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ I& z! c9 p5 M" G) `* y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! s& k; z( G  W8 R# g- ]  P/ ]
  11. *         TO CHANGE.5 v: z3 A+ \7 X3 j
  12. ** ~0 ^! u# \5 D# q6 [# V+ _
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# Z, n8 K# D- E1 f! q5 k  @
  14. *+ o4 W6 n$ `6 ]6 O" [& Z& Z7 e; g
  15. * This program is free software; you can redistribute it and/or
    , z/ S) k' ^( A: J+ n" N5 V; x
  16. * modify it under the terms of the GNU General Public License as
    1 @: Y4 }) k* l1 E- }- b$ ?
  17. * published by the Free Software Foundation version 2.
    8 q$ [2 Q8 C* y+ y
  18. *
    ) ?& r) O; _7 C
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 ?; |$ m+ \0 I1 d' @( I
  20. * kind, whether express or implied; without even the implied warranty
    # P% [' q% O6 U0 c: v+ ~. _
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & H$ M9 i& l8 N$ z. j
  22. * GNU General Public License for more details.& _3 N* t7 G' G: e0 k
  23. */. V" a9 ]# Z4 P

  24. # B' F8 [/ N! h! ?1 |  @. D3 S
  25. #include <linux/module.h>
    $ x( d" j7 I6 J- F$ s) c% M
  26. #include <linux/init.h>
    ' [1 w8 k1 T; l* E4 J
  27. #include <linux/errno.h>! B) L% M4 C! L; t* ]
  28. #include <linux/types.h>
    , l7 p4 d- r! {* y0 ^0 r4 v
  29. #include <linux/interrupt.h>
    , N. }) P0 t$ M! C* o
  30. #include <asm/io.h>
    5 U4 v: a' d* y. K. v
  31. #include <linux/moduleparam.h>
    8 ^: B# {. v# L+ P) [6 ?
  32. #include <linux/sysctl.h>2 g3 w( r9 H6 u' W( f. G
  33. #include <linux/mm.h>
    1 k  Y0 a/ j7 M3 }9 a
  34. #include <linux/dma-mapping.h>
    # N; K, w% m4 A7 X
  35. & t. K! r# l) V3 x1 w8 o, q- _
  36. #include <mach/memory.h>
    7 l5 P- Q. B( z8 g& E# U8 U: X
  37. #include <mach/hardware.h>
    + ]0 P9 D9 w. z; e; F
  38. #include <mach/irqs.h>
    % R" @2 i$ A5 H# s( P! g% N
  39. #include <asm/hardware/edma.h>  ]2 z; j' k8 v  ?
  40. 8 h: E* Z+ Q  v' U7 O$ T; M0 @
  41. #undef EDMA3_DEBUG
    3 j  ~+ w! O3 A
  42. /*#define EDMA3_DEBUG*/
    ' p' E4 D: Q( `8 a" X2 l* ^; W

  43. 1 v' R' c* H) [6 o2 P+ X; ]
  44. #ifdef EDMA3_DEBUG8 d, y- l* P/ J' a' b) F; M
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! ]3 A1 y9 z, T& H6 `& ?( n
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# x: w5 E* _: m- N8 W9 n1 H8 Y1 N
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! @" @, Z9 }# R3 J: `" V
  48. #else0 ?3 q, p( f. a( v- c6 J
  49. #define DMA_PRINTK( x... )
    . W3 y. V  }# a# e' Q: k- N
  50. #define DMA_FN_IN
    $ Z5 n" Z* `7 [9 y1 L. ?' K3 Y  f& Y
  51. #define DMA_FN_OUT
    ' ~, N/ }; j- K5 Q- w
  52. #endif
    ( y1 \, H' }3 n+ q% e  T

  53. . L: e7 w& \$ k" t
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ! W6 \% X. ^' R
  55. #define STATIC_SHIFT                35 }" l: F  o) D, X5 L, q# `3 h3 K
  56. #define TCINTEN_SHIFT               20
    ( U0 T# h6 O4 f
  57. #define ITCINTEN_SHIFT              21
    ( I# y; W0 p- y" D3 q4 ]% P: @) c
  58. #define TCCHEN_SHIFT                22
    ! E" n! y( p8 K$ M* E- F
  59. #define ITCCHEN_SHIFT               23
    / h+ I7 n: t$ x* Z
  60. 4 h. [4 e1 ?2 b
  61. static volatile int irqraised1 = 0;
    . w* S$ O$ m' \1 Z0 x" T
  62. static volatile int irqraised2 = 0;, d0 u) Q/ o% t

  63. * f3 r+ \% M* @4 l0 \% H9 c( V! L, ^& j* F
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " n) I/ o! S# A, V9 Y5 \
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . S1 z' B0 P, D; T" G/ p2 N
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" Q1 d) H1 C8 w: [' W
  67. ' ^2 n$ y0 I: Y- L& @; _" z0 b
  68. dma_addr_t dmaphyssrc1 = 0;
    1 q# ^+ Q% [) @) t- Z  i6 S
  69. dma_addr_t dmaphyssrc2 = 0;1 w# `6 u+ g; J2 A
  70. dma_addr_t dmaphysdest1 = 0;! y- t% M+ B; z5 h
  71. dma_addr_t dmaphysdest2 = 0;
    ! Q; @. k" g4 i! O' o# K( E

  72.   d9 Q4 a. j% E8 S& X$ |4 d% F
  73. char *dmabufsrc1 = NULL;) M1 _. r* L% V3 z! A/ X2 u
  74. char *dmabufsrc2 = NULL;
    " s1 {' M2 j0 ~' |9 w
  75. char *dmabufdest1 = NULL;+ R0 o8 M) H, s% J4 n
  76. char *dmabufdest2 = NULL;2 ?, Y+ ?* T8 A4 X
  77. - ?) @# G; \6 q. S7 K
  78. static int acnt = 512;
    6 F' x7 R7 c* E/ j# f
  79. static int bcnt = 8;" V2 Z1 H; J1 K- A# }
  80. static int ccnt = 8;
    ) W5 F# o' K0 ~$ ]" c( C

  81.   ?  l% a: ]5 i# D. T
  82. module_param(acnt, int, S_IRUGO);$ s; c3 g" N5 c$ h; C- X
  83. module_param(bcnt, int, S_IRUGO);
    / E# C; |! u6 d+ g: E
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, @9 p: R; V% Q- J4 Z) i
5 t" e3 t" ~( r+ ~. \7 ?8 J
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; E9 u$ N0 P& b  _* o1 n
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& V" \; l( [/ N6 A2 M# L     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 ^$ i" v$ C# ~: P" V
! y8 ~5 S/ Z0 Z
( |& p6 g9 r0 X7 v! [7 ]; ?! g
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-26 08:23 , Processed in 0.042846 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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