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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% `2 `9 }7 a1 k; Z+ d, p! k
  1. [code]EDMA sample test application7 r' Y, {1 O& E+ D+ H; [
  2. /*
    ' y& Y, m4 [* r" [" o8 z* M0 L
  3. * edma_test.c) R- C+ r, K5 n0 v3 H, q! }
  4. */ F0 p+ H! ~6 t* E1 H
  5. * brief  EDMA3 Test Application
    - P& s4 @' u$ a5 ?% L0 t. ~
  6. *9 \4 @1 P) V; e3 K' V( B; P1 X! f
  7. *   This file contains EDMA3 Test code.
    3 E5 }  B  q1 K5 t+ g
  8. *: p# k* V' z) o9 K! K4 t) ]
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    9 y# b/ J: e- W9 C5 E2 m- U
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ @( u; H( A" v, b1 K
  11. *         TO CHANGE.
    2 I! j) ~/ M4 a) |
  12. *
    / P$ ^* U  x% A  C- m8 a: T! R+ y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  }% S3 |) k% {
  14. *
    8 s- d7 y/ b! }# h
  15. * This program is free software; you can redistribute it and/or0 g6 a1 j! c  i6 ~+ V& b8 o) R. T/ p% m6 {
  16. * modify it under the terms of the GNU General Public License as
    0 O0 A$ F7 u0 v: G+ H
  17. * published by the Free Software Foundation version 2.
    6 K  |6 ~$ \1 @; G- e6 Z
  18. *% Y: k' w% p' ?* h2 c+ }4 L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 |8 p3 K" d! N8 O
  20. * kind, whether express or implied; without even the implied warranty! `" p+ {- g1 R
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # V4 s! T* G9 [
  22. * GNU General Public License for more details.
    " ]$ z' h8 D- T0 d3 L
  23. */
    ' Z4 r0 y3 j3 N) {. S, C

  24. 7 T8 }( ^% p; B$ I7 x5 q4 L5 q3 P
  25. #include <linux/module.h>
    ( p! d% C3 k5 E  @& S" ?6 n
  26. #include <linux/init.h>
    . j- V0 _' Q* H5 O, r
  27. #include <linux/errno.h>$ B4 i4 R4 O( j* [
  28. #include <linux/types.h>% C, }8 K* y$ N4 e% S
  29. #include <linux/interrupt.h>/ ?7 d' n4 k4 M. x; o7 `9 V; ~
  30. #include <asm/io.h>
    % `/ S5 a4 p) A0 x
  31. #include <linux/moduleparam.h>
    5 D; s+ z( J; V; F- _0 D
  32. #include <linux/sysctl.h>" j3 x) M0 e8 y' U3 I$ L' @+ Y: g
  33. #include <linux/mm.h>, j3 K6 I4 W. N* c3 W# u
  34. #include <linux/dma-mapping.h>$ G6 N/ Q5 c3 S

  35.   q1 q* R3 t6 C, a) O+ o! S
  36. #include <mach/memory.h>
    4 @' m: ~- a# H3 D4 z
  37. #include <mach/hardware.h>
    4 Y2 s; ~  w) c
  38. #include <mach/irqs.h>
    7 S4 F! y: X4 g8 b" \2 m3 |
  39. #include <asm/hardware/edma.h>
    , c) j2 m4 s" J3 [2 l  |
  40. / ]% B+ [5 q9 w5 W& F
  41. #undef EDMA3_DEBUG' i' [2 K" X2 b
  42. /*#define EDMA3_DEBUG*/
    1 v0 x* H( w# L4 o

  43. 5 V8 J4 \$ A  `" j( P( ?
  44. #ifdef EDMA3_DEBUG
      i, M! R' Y4 x# x7 i4 N
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 L% f. `( U  c  }: u/ w1 z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    $ Q  z3 a1 v3 q. \
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- b3 J+ n9 J; i
  48. #else3 Z4 y8 O1 O- {4 q$ ]
  49. #define DMA_PRINTK( x... )6 \( I6 p/ o. a
  50. #define DMA_FN_IN
    : Z& w7 K& v- a8 _- S2 {
  51. #define DMA_FN_OUT
    ( d/ A+ Q% ]  f' ]  p/ t0 F
  52. #endif
    % [9 [+ k& X# h
  53.   h5 L3 k% ?. _. x. d. O# d
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 z5 \0 Q, S& g8 ~& m
  55. #define STATIC_SHIFT                33 m4 b/ ?% A9 W5 b
  56. #define TCINTEN_SHIFT               20; g* d' a: S0 x8 W
  57. #define ITCINTEN_SHIFT              21
    . r& y8 ~) ^- P
  58. #define TCCHEN_SHIFT                22, v+ }2 K' I. ~: g
  59. #define ITCCHEN_SHIFT               23) b/ \4 w! A  w3 P0 {
  60. 0 m! M7 S, j0 |7 }" z" V  z5 S8 T
  61. static volatile int irqraised1 = 0;- \2 c/ p( r; M( q
  62. static volatile int irqraised2 = 0;
    - u7 a) `% c; T
  63. * k3 Y) p  U8 i( a. B% l% Q$ m$ R- Z: G
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & Y8 X+ p. p& p, L% [
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, Y0 e$ j0 S9 U9 K' z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ B" W4 m- K4 h! @+ X0 |
  67. 2 w6 a0 G, F" D% q# a0 Z; P9 y
  68. dma_addr_t dmaphyssrc1 = 0;
    / h0 c5 c8 h3 I8 B# o, h/ _
  69. dma_addr_t dmaphyssrc2 = 0;
    . W9 s3 B# B  b" {
  70. dma_addr_t dmaphysdest1 = 0;. ~( n, c7 K2 i+ S8 U% h
  71. dma_addr_t dmaphysdest2 = 0;
      ?5 ]- U6 x4 G6 x. H
  72. * ?. K( K, G! ]3 M
  73. char *dmabufsrc1 = NULL;5 O# o' K: W2 z* a; C1 g5 U
  74. char *dmabufsrc2 = NULL;
    2 H8 J+ G: f8 ]; H" |7 f* b+ t
  75. char *dmabufdest1 = NULL;
    , q/ i( ^5 b( j, Y5 j
  76. char *dmabufdest2 = NULL;
    . Z3 U1 U; x4 T7 I  c& o, m
  77. - n. l* h! i. H9 N& Y
  78. static int acnt = 512;
    , R1 E. a8 _- ]: `5 K
  79. static int bcnt = 8;
    - I& |3 X4 c* [! D& z
  80. static int ccnt = 8;
    2 E/ X3 ~, _0 r' H
  81. # |+ D; {+ t! U% y
  82. module_param(acnt, int, S_IRUGO);
    * W  _) O' v" P9 A+ ?. P
  83. module_param(bcnt, int, S_IRUGO);& Q) h: H  Y* M0 V. g  S
  84. module_param(ccnt, int, S_IRUGO);
复制代码

4 \. W: @  |* j' k% B1 S+ m% w- I3 q( p3 q: m) T6 c- Z( C
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, q) x( G7 @+ l. x# X9 Narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- t' n$ F9 S3 l9 e     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% e% ]8 C- K: x6 |( B5 Z+ g0 f6 f
# x8 F: ^8 C4 S, b: F, n. x( L; D
" b8 O8 I" j3 c4 T2 n
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-21 02:20 , Processed in 0.036635 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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