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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " c7 a& b5 S  q1 F' M% R. L% h
  1. [code]EDMA sample test application* I( r8 P$ x, P7 h: n+ M
  2. /*: n9 r( }! h- M# R
  3. * edma_test.c
    & s" B( V# b) @8 v
  4. *
    % F( U; z# Y4 g$ G
  5. * brief  EDMA3 Test Application% I8 V4 }0 ?: `8 h4 H
  6. *
    4 H  i; q2 G; c  |( s: N% N$ Z4 O
  7. *   This file contains EDMA3 Test code.+ _( `8 s$ @( [( {8 I! x/ A% _
  8. *
    , G5 J8 I( u! O" b: k8 {
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. W  c* P) I/ U+ U3 ~5 z9 v+ k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ [$ X, T* t4 m
  11. *         TO CHANGE.# Y, |, t" |" E$ E: C
  12. *
    . m' |" K4 u, L2 z, J
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- ?0 d* r+ X, G1 }9 n( S
  14. *
    7 f$ F' ]4 ]; U6 B. @: X% p- l
  15. * This program is free software; you can redistribute it and/or
    ' e( J; ^$ r( C: c* j
  16. * modify it under the terms of the GNU General Public License as
    % P2 B7 J# H: C. `0 e
  17. * published by the Free Software Foundation version 2.& `5 S* M/ @" E# q" @" w
  18. *
    , c( a$ d) y5 e" M
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ; u! E5 A+ J! A+ `- k
  20. * kind, whether express or implied; without even the implied warranty6 `2 m1 S1 i3 C* j4 V
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0 F1 m) o! x$ j1 t% G. x
  22. * GNU General Public License for more details.2 m7 X# M+ ^# }) F" g
  23. */
    5 U$ E* ^, ~: g# {/ ?9 a) H

  24. & I$ o+ ~- P8 E4 u
  25. #include <linux/module.h>
    * K) s9 \9 t( R: g* F0 F$ O- Q4 w
  26. #include <linux/init.h>
    & G* `5 J; a( E* O2 g
  27. #include <linux/errno.h>
    ; c) A/ P2 u/ z1 k: [. W% X
  28. #include <linux/types.h>2 [& z7 b0 Z( V1 g
  29. #include <linux/interrupt.h>
    * f1 k- Y' O/ [3 p
  30. #include <asm/io.h># H5 M) l7 @" ~. ~' I
  31. #include <linux/moduleparam.h>
    * Z+ Y2 Y, C- _% x6 ^
  32. #include <linux/sysctl.h>
    3 Q  }6 J& ?0 ^+ g; l1 I1 O
  33. #include <linux/mm.h>5 |- T/ m; F- e* e% Y& }
  34. #include <linux/dma-mapping.h>
    " C( k0 ~- ?) R% Q. D4 p" Z
  35. 8 L5 @$ S6 y8 R0 o
  36. #include <mach/memory.h>1 z0 g) D  a) `) S( l4 a, h
  37. #include <mach/hardware.h>! c+ q& V% D1 P+ \
  38. #include <mach/irqs.h>: z. Z: O# E9 x! Z
  39. #include <asm/hardware/edma.h>
    ( R1 ~2 V2 Q- a2 Z# ?; k
  40. 4 }; Z3 I3 L/ T  v; ]9 A2 b4 F
  41. #undef EDMA3_DEBUG% C) ?! K& I% q1 s* |/ x- W
  42. /*#define EDMA3_DEBUG*/
    0 L) [& I3 X8 J! P3 ?

  43. % K6 S/ J- _8 D' G( v9 H+ `9 |
  44. #ifdef EDMA3_DEBUG
    ( V$ W& o# @7 J$ x% T4 u/ W0 `
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    $ I  @0 a+ N  p1 t$ ?
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), Z2 ^) \$ o- b8 N. r( ~1 d3 V7 U
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 l) R" b, }0 |6 L, g1 v& T/ X; N! @
  48. #else
      c/ r( |6 U1 N" m& ]5 p' _
  49. #define DMA_PRINTK( x... )6 _  q" k8 ~; @+ F+ v
  50. #define DMA_FN_IN! {9 Z: e5 u* l7 y  h! {1 K# U
  51. #define DMA_FN_OUT8 Y1 @* D8 f+ \) V2 A8 [# P
  52. #endif
    5 F, _" H& S3 K- d) G- v) W  x! {
  53. 6 f% v: [* r6 d% ?( x8 G
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    + ^4 o3 U3 f/ o8 n* S9 U2 n
  55. #define STATIC_SHIFT                3
    8 Z: S8 P, I. N, f) X. W
  56. #define TCINTEN_SHIFT               20  Z* P6 j: q) g# D+ j# F* h
  57. #define ITCINTEN_SHIFT              21
    : N7 J3 G5 `7 ^! f
  58. #define TCCHEN_SHIFT                229 p  |3 u4 W. p8 C5 {4 v: _3 O
  59. #define ITCCHEN_SHIFT               23
    6 T* I- d4 c  R( i; x  o! `

  60. 5 R9 `8 A, [! n& l& F7 e! B
  61. static volatile int irqraised1 = 0;
    0 a" j+ w6 E/ m' g, a, x2 ]& L/ C
  62. static volatile int irqraised2 = 0;; R' N3 ?# a# s& b$ u0 J' S
  63. + n( `8 ^; K( \6 R3 ^+ g5 K6 y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 {/ Q7 m) v8 s/ T0 v  \
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 P( O/ L6 v+ `
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 K8 `( a% \6 U1 Q* I( @! Q4 f

  67. ' A& j4 ?8 g9 t+ H6 s3 R) o
  68. dma_addr_t dmaphyssrc1 = 0;0 E! f2 `5 K0 Q% w; y
  69. dma_addr_t dmaphyssrc2 = 0;/ S+ e' m8 B# {' u
  70. dma_addr_t dmaphysdest1 = 0;% r2 _* y0 C9 s9 `* c$ |
  71. dma_addr_t dmaphysdest2 = 0;
    ) Q7 X/ H" A2 o  e, C' y. K8 H+ _) E
  72. . m* `" c4 r5 c5 Q3 d( J
  73. char *dmabufsrc1 = NULL;
    / }0 {: H4 n/ y) C. n
  74. char *dmabufsrc2 = NULL;3 i& ?- j( G7 P9 R7 a% ?" i# c
  75. char *dmabufdest1 = NULL;6 {1 S! h9 W8 o1 [9 `! P
  76. char *dmabufdest2 = NULL;
    / g* n9 U$ t* x$ d) y+ n/ I  C) o

  77. . o% p& w: J8 s5 M* C9 [' J
  78. static int acnt = 512;
    ; K3 T& R4 m; u9 m+ l. E6 t
  79. static int bcnt = 8;/ |8 k6 }) c' b3 a7 s
  80. static int ccnt = 8;  T' i, M- I; }: f( m

  81. 8 ?) R4 w; E2 `) q+ f/ K, \6 t
  82. module_param(acnt, int, S_IRUGO);
    / M/ d  _) f+ I# r4 |
  83. module_param(bcnt, int, S_IRUGO);
    . a, v* L* u6 C" G; e! ?" ~2 ?
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( I0 Y( f$ {9 N; D" Q1 ], q1 G+ D
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 u- W" p1 B  X
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) ?. i7 Z- y, [3 Z% B     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 `8 r& Z5 o2 M7 N8 P

) b* k  [9 m! S5 d9 `5 ?3 g4 F; A+ a
/ h) _' L& ^% @1 s+ U1 N8 w
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-11 10:03 , Processed in 0.037897 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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