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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - p! `4 A7 j9 ~- l- f
  1. [code]EDMA sample test application+ f5 [( Q5 p( |* l5 x
  2. /*
    & s  E, a+ M4 U, n
  3. * edma_test.c
    - }+ c- k, i" `5 Y
  4. *  u8 S% u, k- N2 J0 [( K
  5. * brief  EDMA3 Test Application
    " e- P0 N0 s- e: s* Y6 d0 I
  6. *
    2 G; C) n: @5 @4 L
  7. *   This file contains EDMA3 Test code.
    ; ~6 _# x5 S  y1 F* G
  8. *- P$ z, W8 L/ o1 G* ~- t! U# f5 }) R
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( `) O; r/ K! p% t/ t
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    $ T+ v$ Q. Y" C$ ]  B& i
  11. *         TO CHANGE.* h. {( `9 z0 Z0 S+ d) o9 \
  12. *
    ' k. y! S1 ?( a% {. c
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 P0 Y; b+ T( P5 M; o2 J5 C
  14. *
    % C  y% `. V- f" {; t+ H/ f
  15. * This program is free software; you can redistribute it and/or
    . X; h, }! ~! M: `# Q
  16. * modify it under the terms of the GNU General Public License as5 ?8 y- U0 v- _6 n1 t4 k! w
  17. * published by the Free Software Foundation version 2.
    . r+ ]; u. {4 w6 r( @
  18. *; f  n3 Z$ ~. m% n1 r- j5 h3 f  i7 _
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / V& c2 X5 p5 N
  20. * kind, whether express or implied; without even the implied warranty
    7 c* k& Z' z1 G* ]9 u
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    8 j- P7 W7 y( R5 T/ _( S
  22. * GNU General Public License for more details.. M# M2 H9 j% X8 ]( h
  23. */
    # u+ v- p* y* T2 b  G% c
  24. $ ?) }2 g8 m. s0 k; s/ T
  25. #include <linux/module.h>0 O$ F1 C1 A( F9 R  c
  26. #include <linux/init.h>% k6 C! A2 K2 y  y
  27. #include <linux/errno.h>) B/ {' \/ R$ Z  ^  Q6 l
  28. #include <linux/types.h>  x! D& c$ S# \/ p' B; A: p% u8 F+ t
  29. #include <linux/interrupt.h>, N  S0 W& D( i+ E, `6 ~. {
  30. #include <asm/io.h>; v( J4 z/ N! Z$ V# [3 ~
  31. #include <linux/moduleparam.h>
    / F& y% {- t; V0 O$ n
  32. #include <linux/sysctl.h>
    6 F- v/ a5 A( f: k6 f2 x
  33. #include <linux/mm.h>
    . c5 r  [. }, i% q* E
  34. #include <linux/dma-mapping.h>& a. Y2 t( n' z$ W4 Y2 m
  35. 2 f2 j! l4 y' y, w! U
  36. #include <mach/memory.h>+ M4 v# R# c& u- b
  37. #include <mach/hardware.h>
    0 \0 u+ r# c/ Q2 n- N
  38. #include <mach/irqs.h>3 Z9 V# u3 \$ W5 _% `
  39. #include <asm/hardware/edma.h>
    - C" s2 {2 V( `  k* E* @

  40. / a/ b$ _: V. S( X" ^
  41. #undef EDMA3_DEBUG
    6 L! `' i2 l" Y4 f
  42. /*#define EDMA3_DEBUG*/
    : V6 _" T# q# E' |, a; C2 m) S! _
  43. 0 n* m* \; B- O* c& H9 k( n! c
  44. #ifdef EDMA3_DEBUG
    ; F: O" Q6 u) B, ?
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    4 P2 E* m! V" @
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 [- O' z. v4 w. u) Q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    7 n( s. h) D/ U( Y" I2 u4 u
  48. #else( J% v9 [) U+ e1 ~6 J; g
  49. #define DMA_PRINTK( x... )
    ( m1 X7 ^5 k1 @7 Y) {9 n( a
  50. #define DMA_FN_IN
    9 q& E$ y. Z! p) S8 h# L
  51. #define DMA_FN_OUT
    # l# g6 s# Y$ Q# U: y
  52. #endif
    0 l* d* L* N& z8 H" f/ c
  53. 5 w- J6 i) C; ]) a( Y; A
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    5 M1 C1 l6 \  [; k9 H
  55. #define STATIC_SHIFT                3/ R5 C- a( U) L1 z& R$ p
  56. #define TCINTEN_SHIFT               20, Q+ w8 O5 O+ {. \6 D
  57. #define ITCINTEN_SHIFT              21
    . K( S6 j$ p9 Q  u  T6 T, D+ U
  58. #define TCCHEN_SHIFT                22
    1 V) R# R( w* C2 d' q' Q
  59. #define ITCCHEN_SHIFT               23
    ; q8 u! V- }# R0 t% x
  60. & w  [! C- u' I
  61. static volatile int irqraised1 = 0;
    / @, b: R* Q4 b: b  s# x
  62. static volatile int irqraised2 = 0;
    % q" `3 J. Y% D9 P8 ]
  63. 7 Z" L, D' @% U: e" R
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : p7 s8 g* ]3 U" P
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" R  p2 c$ S0 g! _2 L7 R
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ b) N! V+ u. H, g

  67. ' w7 f$ X: Y+ }8 t
  68. dma_addr_t dmaphyssrc1 = 0;: `  L9 U) M. A/ w* O
  69. dma_addr_t dmaphyssrc2 = 0;, `) l* X1 X+ `5 b6 n! ?
  70. dma_addr_t dmaphysdest1 = 0;8 t3 ^; N2 v: F) r$ }! a
  71. dma_addr_t dmaphysdest2 = 0;
    0 S; D4 {* o/ d+ I3 z  [

  72. 4 a& j' F0 [6 i4 S; u- i2 A, |
  73. char *dmabufsrc1 = NULL;
    : F1 b- h5 s9 R: J% u
  74. char *dmabufsrc2 = NULL;
    ! l9 l8 z1 g* ~+ `/ b% ^% e9 q. s
  75. char *dmabufdest1 = NULL;
    8 W, v0 A7 b7 x# Q% o
  76. char *dmabufdest2 = NULL;
    . n9 q, a3 G& w' h$ @; _2 N

  77. + H+ ?- t0 ~, T% U
  78. static int acnt = 512;3 k1 \, T2 w! ~
  79. static int bcnt = 8;
    3 l& B" }2 l+ x' T% n
  80. static int ccnt = 8;: a7 o8 C  S+ q, i' R, d6 e
  81. / w6 ^  q( k1 n( _
  82. module_param(acnt, int, S_IRUGO);( C: `) s5 o7 ]% z
  83. module_param(bcnt, int, S_IRUGO);
    2 G; M  {# Y4 {5 T4 l
  84. module_param(ccnt, int, S_IRUGO);
复制代码
+ u3 u2 h: m7 i+ g; s

2 R) N: K' j( ^6 P  B0 {  ]      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ J: m7 N# x, e3 d3 @' G
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 b3 M& R) v. W5 g% u5 `1 m
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 S( r" i& X% k% x  a  K- K  R
! }: P! m, b. K3 {) D1 n

2 u3 T- K4 R+ R1 T9 k5 q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-10 14:58 , Processed in 0.040157 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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