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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, t+ w: \4 g9 x3 B1 a; g
  1. [code]EDMA sample test application
    ; i" e% T" Y4 O2 q4 \7 R
  2. /*0 ?+ k; I; U& H8 q6 v5 b
  3. * edma_test.c" D* U3 R1 N& K7 R; g& j
  4. *7 G- a9 i$ r% s; C" W
  5. * brief  EDMA3 Test Application5 Y' ^0 U  [* [$ u6 O
  6. *
    + e- p4 U: a+ i7 J/ a: D
  7. *   This file contains EDMA3 Test code.
    0 k0 p$ r- U% |6 K- G. M( j7 p  w
  8. *
    : |7 ~# O5 F7 B- Z, l5 Y5 `1 O4 n/ i
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 @- y  Z: Z$ U
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 {( @3 c: p# a- m
  11. *         TO CHANGE.6 b4 N; N1 `' {# Z3 d5 ^
  12. *+ k! Y) o# E/ ~. t
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* p. j2 S1 f) v4 {
  14. *; S( h6 e. G7 j5 u: i1 i
  15. * This program is free software; you can redistribute it and/or
    & w1 b5 H2 |! b
  16. * modify it under the terms of the GNU General Public License as
    . y' M. ^: J: s0 f
  17. * published by the Free Software Foundation version 2.
    1 _0 A; s# S: R: z
  18. *3 d2 }: y* H0 i' V0 l5 u
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 g" o" S% t" h0 v
  20. * kind, whether express or implied; without even the implied warranty
    / o6 \& x, e& G% K( w" R. G& D
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the6 w  _9 z1 C$ h5 I" D3 Y
  22. * GNU General Public License for more details.
    ; P# C5 g5 V# X2 {0 x" N
  23. */
    $ U5 K  }5 G# C; r9 `( i3 E6 U0 B( t7 l

  24. 0 T0 Q9 z0 J/ H: p8 |! v
  25. #include <linux/module.h>
    ; ^: j' w5 y# }  b% L* W3 ~- J
  26. #include <linux/init.h>
    ) C" E0 @0 Q1 i
  27. #include <linux/errno.h>! |  o: q2 g+ `8 q2 t1 T$ w
  28. #include <linux/types.h>
    # M. N" j1 P, y" t5 [
  29. #include <linux/interrupt.h>
    6 Q$ C" T) N1 d  x$ q
  30. #include <asm/io.h>6 l1 n9 D5 k. Q" n5 |* A" z
  31. #include <linux/moduleparam.h>: N  `' R4 C2 r& ^8 ^; @1 b. h1 ?
  32. #include <linux/sysctl.h>0 Y4 y9 |, ^9 z3 g
  33. #include <linux/mm.h>: c& b( k, S3 x7 r
  34. #include <linux/dma-mapping.h>5 J0 B3 l  h, y$ ~+ ]. m- A
  35. - M( T! W0 Z7 [9 S1 \+ i4 L/ ]
  36. #include <mach/memory.h># d  B. U+ a# [! Z' r- Z
  37. #include <mach/hardware.h>
    - ?9 Y6 O1 H7 t) u
  38. #include <mach/irqs.h>/ Y6 L5 L. P# G' b! c; g; u
  39. #include <asm/hardware/edma.h>& D6 {9 A& a; u# d% W- }

  40. 1 n+ [$ s. O! r: f+ B; w/ ?7 s6 l
  41. #undef EDMA3_DEBUG
    % ^! B$ _; L% K9 f
  42. /*#define EDMA3_DEBUG*/0 S" r6 b0 [+ F) L
  43. . s& ]- `' Y5 d$ v$ }
  44. #ifdef EDMA3_DEBUG% I1 _. [: |& n/ t
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - Q7 M, L1 Y4 d) \7 c: n" S
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ' ?% L1 B: U& ~0 t3 P" K/ v
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- b( O$ r& t+ \, y& Z, \
  48. #else/ Q" F! e- S9 s8 `% [! h' V
  49. #define DMA_PRINTK( x... )& l$ q) a! B7 u+ z8 w
  50. #define DMA_FN_IN8 w. X6 f: u  ^& ]: P
  51. #define DMA_FN_OUT
    3 k, g4 P' u: e6 S
  52. #endif
    # R6 Q5 H; k2 x2 C

  53. 7 q: D3 C7 |. _: ^4 c
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ m, h; \1 L, |+ `; s
  55. #define STATIC_SHIFT                3
    6 R8 G, V9 x1 M) G
  56. #define TCINTEN_SHIFT               20( t* @' {3 M$ h9 I/ T+ j
  57. #define ITCINTEN_SHIFT              21
    3 a. V* Z5 p  I( }0 N
  58. #define TCCHEN_SHIFT                22# M# T- {, v6 o8 {" m, d
  59. #define ITCCHEN_SHIFT               23/ o: S" x4 _, S3 S5 y) F
  60. ! U. u8 u: {5 C9 [7 N+ F$ f
  61. static volatile int irqraised1 = 0;
    : }) Q5 m( m5 \% k: I
  62. static volatile int irqraised2 = 0;7 J2 z8 u7 Z9 `: ^/ i
  63. ( V: g' r1 v; P7 }; V
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" z2 U3 J% t* Y5 K! }9 n
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 f' b& `5 ]( S! K9 z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 p' E1 Z/ W8 V
  67. + g$ g9 O: j% m2 @1 I
  68. dma_addr_t dmaphyssrc1 = 0;8 B' v( N8 ?; `2 Z' A
  69. dma_addr_t dmaphyssrc2 = 0;# i. G% ]* j6 e
  70. dma_addr_t dmaphysdest1 = 0;  S* @# U. i# N% g# X8 _7 g
  71. dma_addr_t dmaphysdest2 = 0;% }+ h& l$ r! O  t7 ]+ q) A) q4 W2 e6 n

  72. 9 U4 |" ?1 ]1 }5 i- J+ s, i$ d
  73. char *dmabufsrc1 = NULL;
    : C* C3 V" y: g; C
  74. char *dmabufsrc2 = NULL;
    4 _3 @- _5 C) i3 O4 A1 \
  75. char *dmabufdest1 = NULL;; ~4 ]# \2 t0 v$ L
  76. char *dmabufdest2 = NULL;  D( ~1 W$ |" L' ^  n

  77. 0 r9 f# ?) o6 p  D3 |+ y6 J( p
  78. static int acnt = 512;# P3 V7 C" U# {4 w* ]8 S
  79. static int bcnt = 8;: F* ]+ G5 n0 g  J& C. ^' ]
  80. static int ccnt = 8;- ?9 D. J" f: w, `0 }! |; l
  81. , R& b. N$ A" G! F! |' R5 M
  82. module_param(acnt, int, S_IRUGO);
    ' s+ r/ E* ?4 _' H6 j) i# ^/ Y
  83. module_param(bcnt, int, S_IRUGO);3 V3 ~; [7 _5 Q" U
  84. module_param(ccnt, int, S_IRUGO);
复制代码

. t( I, H- x: E' m1 s# H# y* j8 L5 n
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" R. ]) o. U5 J( L9 Q1 y9 Rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' M3 A3 @( k5 V  l& l% Q
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ i! s% o( t6 K+ r
; b2 [: ~- j" f& c! `9 V$ X
) A+ v2 M0 C8 w
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-7-8 17:53 , Processed in 0.038823 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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