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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ v6 f0 O+ m1 M: J# d. l" {4 b+ A
  1. [code]EDMA sample test application! h0 Z. W' X: c0 j* l+ ^; I
  2. /*/ h+ ?: p# i: E. ]# h" c% g
  3. * edma_test.c
    9 G; s- H9 h. z/ g6 V
  4. *5 {  H2 s* L  g4 g5 L* d: q* ?
  5. * brief  EDMA3 Test Application
    ; L3 C1 _0 W; p) r$ I2 t* n& I
  6. *. H3 Y% o1 v: a7 W4 O6 c
  7. *   This file contains EDMA3 Test code.
    ' C# d: ]- C/ [% B4 r
  8. *3 G, }; O& }/ e
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 j' \; F4 u0 o
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    . S2 {9 t) A8 c5 v+ W) K7 f
  11. *         TO CHANGE.
    - A" j1 c  V  J) ^2 g( f
  12. *
    5 f. V4 E+ e: g5 n3 N* D' W
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    : h5 b1 \8 y  z1 O9 M
  14. *
    2 _- ?, i9 m1 w' |( x) `
  15. * This program is free software; you can redistribute it and/or0 v" Q# Y- _9 B5 k
  16. * modify it under the terms of the GNU General Public License as; c4 b; f4 O2 g, P5 V% v; i7 H
  17. * published by the Free Software Foundation version 2.
    - O- n% R( V) Y7 y9 a
  18. *3 Q# H2 ^/ h$ `" s) C) z2 J; V
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; x' K, C& I& ]  x: Q. a
  20. * kind, whether express or implied; without even the implied warranty3 R' z5 b4 b1 k7 a' {5 s
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the% N9 t( m: u8 H4 V% \' _0 E
  22. * GNU General Public License for more details.
    7 `! D7 ~* K' f8 L% X% a  f
  23. */
    * _5 m6 k; ~+ ^( T9 D, p* y
  24. # i: D0 {+ l# }
  25. #include <linux/module.h>
    5 r+ M& r3 c% c4 b' S
  26. #include <linux/init.h>3 G4 ^4 `' d; l7 C6 r
  27. #include <linux/errno.h>( u1 p' ?# {' s' \0 y3 U/ ~
  28. #include <linux/types.h>
    0 s& X# N8 `! j# q
  29. #include <linux/interrupt.h>$ {1 ~, |1 C/ T! W8 E: w% e) O
  30. #include <asm/io.h>
    $ h! j& t+ Q2 U5 V% ^! C2 y+ K- B
  31. #include <linux/moduleparam.h>: d! S% p8 f1 w- K* O9 ^
  32. #include <linux/sysctl.h>
    , `+ N* S2 Z; r9 H) ^3 J: r
  33. #include <linux/mm.h>
    & {; I% w! `- x: _' R# u; W
  34. #include <linux/dma-mapping.h>
    ; U9 E) {3 Y4 G0 E

  35. 1 @9 G. ~# c2 I$ p/ F6 |
  36. #include <mach/memory.h>% b! d9 q' i/ A1 W6 h
  37. #include <mach/hardware.h>* M8 G( _, o9 |3 B
  38. #include <mach/irqs.h>- p8 u$ O% d+ M, C# v' Q$ I
  39. #include <asm/hardware/edma.h>
    / Z1 a4 D# T* V: d
  40. & R* J7 p/ j$ N. j
  41. #undef EDMA3_DEBUG9 i3 }" g6 q9 K6 m8 U
  42. /*#define EDMA3_DEBUG*/
    ; m7 r* `) F: ], _, e& u# f

  43. " i; r; K9 E/ w* [! N
  44. #ifdef EDMA3_DEBUG
    * J- c2 s- X+ w# G6 _$ V
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" R3 T5 j- ]! m1 O4 W, J5 ?
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 O3 }  F+ [6 o8 X5 ]+ S
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); |' ]4 O% r/ ~+ J9 ~& W
  48. #else
    " J7 x$ p" t& @( w& v
  49. #define DMA_PRINTK( x... )3 O8 h4 a$ |4 o! z- N
  50. #define DMA_FN_IN
    & a$ F1 \$ @) N9 u6 j4 ^
  51. #define DMA_FN_OUT
    ) B* U% h! U7 g" ?  T* R1 F+ e
  52. #endif
    ' h; b9 P, h" B. N( H+ d% N+ m
  53. ; S! K1 b  I! l. l2 k/ ~, P8 z/ m
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ! `# |6 q5 ]% h, q1 u
  55. #define STATIC_SHIFT                3( V' a. |6 L8 [0 v
  56. #define TCINTEN_SHIFT               20
    0 V* a- m6 L: `: P" M& f8 R" H" W0 L
  57. #define ITCINTEN_SHIFT              21
    + B4 O! T5 |8 V' ?6 U! A6 L
  58. #define TCCHEN_SHIFT                22
    + u1 |/ W2 d' e2 r' ^, t
  59. #define ITCCHEN_SHIFT               23
    " p7 h6 V3 g3 h2 K# {6 D
  60. ! M- H4 R2 w# [; s& c2 Z# Z8 G
  61. static volatile int irqraised1 = 0;
    ' j7 o6 q4 O7 h5 G2 ?2 D
  62. static volatile int irqraised2 = 0;
    7 r' p3 l* a8 S6 |
  63. " i; {4 h: X  Z# F" h) ]) N! v
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. f/ _% P, _' L0 i* a. {" V
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 i- H4 Q* D/ h
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 E6 @/ H+ I$ q; W; K
  67. 5 o) H3 r5 Z1 k8 y5 a2 v
  68. dma_addr_t dmaphyssrc1 = 0;
    - u9 k+ u% a) x
  69. dma_addr_t dmaphyssrc2 = 0;
    4 o2 b. T$ {- j$ p8 ]6 j/ K5 ?
  70. dma_addr_t dmaphysdest1 = 0;
    6 i3 k: t$ f. }  H. I( f
  71. dma_addr_t dmaphysdest2 = 0;# S1 \" V7 S# ?( j

  72. , j8 z# {7 l% @6 T9 e$ Y
  73. char *dmabufsrc1 = NULL;
    8 o7 W+ ]( c- D5 v& b; L; j8 J5 o
  74. char *dmabufsrc2 = NULL;
    # y& s: y' M+ x
  75. char *dmabufdest1 = NULL;& ~! s. f2 A. c" s8 O; a8 \, E7 w
  76. char *dmabufdest2 = NULL;
    8 M- p3 X5 n. q8 _# O$ d

  77. / z" [' ~+ u1 G$ u& K6 `
  78. static int acnt = 512;; ]+ \5 G1 \1 `' C
  79. static int bcnt = 8;
    / B  X: C2 x/ d6 q4 D$ A: R" b5 g
  80. static int ccnt = 8;
    5 ?* O' m! m# f( P, I
  81. % F# U: |+ y, v" J' g
  82. module_param(acnt, int, S_IRUGO);
    . N0 `8 I* E/ Q& ~
  83. module_param(bcnt, int, S_IRUGO);6 a8 E. h0 U* {. j
  84. module_param(ccnt, int, S_IRUGO);
复制代码

7 }) y# F" M# T8 N$ r$ q1 z' `- q$ ~# e/ \+ P( {/ o+ J
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 z8 ~" H8 q' Q: B# D* Y- f
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: I* X  F* h8 E, T4 w2 g4 ?
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( s* g/ S% H  ~) Y7 K
& ^  z. d# |& m+ A# e$ z
- s: [0 `6 E7 o+ F; Y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-12 01:53 , Processed in 0.040177 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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