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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* x  y( C7 w. K6 B
  1. [code]EDMA sample test application
    ( o- M0 @. o( J
  2. /*
    4 c- |; @5 m: V$ U1 v7 J; A
  3. * edma_test.c
    ! k6 S( F- N+ U( D7 Z& P: ]
  4. *
    3 P% I3 S) y+ {- ^- i. g/ {+ |7 F
  5. * brief  EDMA3 Test Application# o5 h+ x# F; L* \( l, e
  6. *
    4 }4 M/ G& v5 D, Z: \
  7. *   This file contains EDMA3 Test code.
    . N: g. F& R- r! F) T* ?4 n
  8. *
    5 J9 Q) A( b8 U. F/ s  q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' x" ~+ {. e# Q, L# T5 x  M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    2 k( F. M8 P+ H$ e
  11. *         TO CHANGE.
    / ]% b2 Z6 c3 U& z7 B
  12. *
    . |' C- o; Q' M) U' t: I
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 `" Q* O6 Y: @# E. c1 L+ Z
  14. *2 o* n2 Z. ?6 ~
  15. * This program is free software; you can redistribute it and/or: S5 _+ c$ V, W( f/ i$ M
  16. * modify it under the terms of the GNU General Public License as- @( Q% B1 T* Q9 m" _( l( y7 d( m
  17. * published by the Free Software Foundation version 2.
    9 p3 ?8 q. m: {) J3 s& f: {4 U- j
  18. *
    % [" S8 j! d5 R& z4 b$ s0 }
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    " {6 @0 `+ m6 u- m" @
  20. * kind, whether express or implied; without even the implied warranty) d- Q4 G: o$ g6 Q& k* Q4 K- X
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the9 W/ z& ]& z7 J+ c& Z' H" G
  22. * GNU General Public License for more details.& h+ _) Y; x4 ]. g, E. N
  23. */7 x; O2 K6 r; Y( \
  24. 0 \* H5 j  Y- s6 E
  25. #include <linux/module.h>4 J" i. j& W( h) ?
  26. #include <linux/init.h>; t3 m; R) F/ N/ L$ q# j2 o
  27. #include <linux/errno.h>: C% P3 N2 E, W  \8 x6 W
  28. #include <linux/types.h>  M0 i- Y4 @6 y9 r# H/ w4 u8 D
  29. #include <linux/interrupt.h>
    ' P3 d9 W" P% @. G! \
  30. #include <asm/io.h>
    ' x  a! p5 _, ]
  31. #include <linux/moduleparam.h>
    6 `6 k1 H  w2 X) u8 ?9 v
  32. #include <linux/sysctl.h>
    & P2 ]  P2 }% Y! d% D8 P' p/ s
  33. #include <linux/mm.h>$ ^6 G* ]0 z. M- k* o, a8 N
  34. #include <linux/dma-mapping.h>" S. V( C: E7 y/ V" V
  35. " d; Q8 A0 ~7 r) o8 X# b5 P8 G
  36. #include <mach/memory.h>
    & L5 _: {8 j/ X5 p
  37. #include <mach/hardware.h>
    8 Y  U8 n5 t! `
  38. #include <mach/irqs.h>
    1 p/ {9 V4 j0 Z$ B+ w
  39. #include <asm/hardware/edma.h>
    $ v. q9 a$ b  R

  40. % T) X: c( A. [' {" t
  41. #undef EDMA3_DEBUG6 ?! C$ r+ r! U1 H0 B7 C
  42. /*#define EDMA3_DEBUG*/
    9 S- r, b( x! E5 U( X3 i, G1 `

  43. 8 X7 I6 S2 w. ]! W, F3 R+ t" C; c
  44. #ifdef EDMA3_DEBUG. b2 r0 M. s) W6 W2 U9 J! o
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); S& O9 c$ o9 V* F
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 q' e" {: a9 R% ^, P) `
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      w) _0 G" D6 E$ b3 R
  48. #else
    / ]: w) X! r, o/ {, H% ]0 F
  49. #define DMA_PRINTK( x... )
    2 ]; P+ x1 n4 f3 S. N4 ?6 \0 B
  50. #define DMA_FN_IN, J. ^% g# C( n
  51. #define DMA_FN_OUT
    4 L: M: `7 \0 O  f$ w1 a
  52. #endif
    ' M. J% f( k/ G. |% ~
  53. & v$ }3 v# I, b3 ^- |( C% _# X
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)/ ?# F" E6 r7 w  H
  55. #define STATIC_SHIFT                3" v) m& m% w( l# a  ^
  56. #define TCINTEN_SHIFT               20
    ; d; d+ P- S/ C3 n1 Q
  57. #define ITCINTEN_SHIFT              21
    2 C' `4 o: d0 H3 m7 M
  58. #define TCCHEN_SHIFT                22
    6 x, \6 @4 h4 o& i# [
  59. #define ITCCHEN_SHIFT               23
    + v8 M' o5 X7 h

  60. / E9 o2 F, w: U% N/ X* Q; a
  61. static volatile int irqraised1 = 0;
    / i1 F* _$ V% y% r6 J* `
  62. static volatile int irqraised2 = 0;
    ) U, P# X) I  G
  63. . o# R/ ?: J1 G# K! p' y* v
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 \7 E3 w) P* U2 d* ~* M* K5 v7 @, T
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / a% {( Z8 v1 o) I
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 j! [3 y/ X8 h+ ^. t* G

  67. ! q$ x- }" q3 J* B2 \6 ~7 S% F# V% [
  68. dma_addr_t dmaphyssrc1 = 0;- X1 G1 ~* a( b" c. N5 g  t! Y
  69. dma_addr_t dmaphyssrc2 = 0;( s( d. s+ H/ v. d" V
  70. dma_addr_t dmaphysdest1 = 0;1 C( p% Q- t3 o" Z8 w
  71. dma_addr_t dmaphysdest2 = 0;
    * [5 @" g+ k; U; P# E

  72. ( Y3 Z% F* ~! d/ O+ C2 G. ]
  73. char *dmabufsrc1 = NULL;
    & Z3 l2 [- [8 n
  74. char *dmabufsrc2 = NULL;
    ' e0 N6 K) P" O
  75. char *dmabufdest1 = NULL;/ N) P$ X1 v( W2 O
  76. char *dmabufdest2 = NULL;
    , ^. q0 O5 v8 ?3 L" I9 m9 u! @

  77. % j, A: a/ `9 o/ B6 J
  78. static int acnt = 512;- R( A1 H' E+ Z2 u
  79. static int bcnt = 8;
    ) F2 e8 _1 }# O" L/ M3 v
  80. static int ccnt = 8;! E; v1 @2 E' |+ ]- I- _
  81. 4 }6 d/ r. V  e  d# U& w2 _: [
  82. module_param(acnt, int, S_IRUGO);
    5 J! w6 K' l1 R) c1 N# v4 C0 |
  83. module_param(bcnt, int, S_IRUGO);
    : K, @9 m$ M' \7 M0 R
  84. module_param(ccnt, int, S_IRUGO);
复制代码

9 v' Y$ l* H- A* ]( l' u5 o
+ ?: {( q) l( h% V4 H      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 f9 _& e' x6 z) 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
  ^) K7 x0 ^3 b$ l  D     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. `+ N3 R* r( t
" q- F8 D7 P( d; n6 K# W4 \! b) ]( K8 ^5 I
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-27 00:12 , Processed in 0.040422 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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