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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 k+ |8 C6 y( O( d
  1. [code]EDMA sample test application# q* d9 j, t, h( c8 y/ o
  2. /*
    ! q- `3 n! D5 t
  3. * edma_test.c+ p( H' F- e) w1 R$ t, D
  4. *
    ) o$ V$ V- f# D0 x0 F% X# q9 T
  5. * brief  EDMA3 Test Application
    5 l; t! F/ x; P7 T' M* e! B
  6. *
    , G: `% [) q6 R% W$ L; ^
  7. *   This file contains EDMA3 Test code./ w8 b; j+ `: G: ]" a* O. w
  8. *
    : I7 B" _$ [9 P% w9 |
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    2 a2 A2 {6 {2 G; G' F5 B% _
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 S4 e/ O/ N! ?/ W& ^3 R
  11. *         TO CHANGE.) i1 e0 t6 n" p
  12. *
    5 c: T" @& v( H, w2 s- M! o
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& i* _+ J. A4 M6 `
  14. *
    * r- p& f) T, K+ o' l+ R( k: c" d
  15. * This program is free software; you can redistribute it and/or
    $ P( c% p0 B) a1 X5 Q  i; r
  16. * modify it under the terms of the GNU General Public License as  z! {4 _' A( v" W  K
  17. * published by the Free Software Foundation version 2.
    % v! E* L* @* H3 ~1 c% l
  18. *9 X# J9 U9 G: Q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    + [1 l  ^/ P, ^/ Y. u
  20. * kind, whether express or implied; without even the implied warranty
    , U+ h) s/ C- e8 U
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2 ]6 @0 t1 \" v8 \' W# }' N
  22. * GNU General Public License for more details.
    / [1 C, K# K8 q# k  V; r6 I
  23. */0 H2 V3 q" {5 U1 `

  24. # U, j/ }* k) Z! X
  25. #include <linux/module.h>
    9 l; L" u) H5 _; E
  26. #include <linux/init.h>  G7 c2 X5 m. N! ]* G  w/ \4 F! ~- U
  27. #include <linux/errno.h>
    * {) B. F( Q0 O. n
  28. #include <linux/types.h>
    ' ^1 b- t) _' p! D$ z- }! K" i
  29. #include <linux/interrupt.h>& C8 C- c: ^/ K/ d1 d
  30. #include <asm/io.h>% A, o: i$ E9 z- g5 r( X8 j; P
  31. #include <linux/moduleparam.h>
    9 I! V* ]+ \  s. c+ N3 w
  32. #include <linux/sysctl.h>5 @0 ?, l$ f6 r4 J
  33. #include <linux/mm.h>
    + t5 j: g  b+ _" _2 G1 ]( i
  34. #include <linux/dma-mapping.h>
    ( }/ f9 p$ n7 f9 o) v8 N
  35. 1 g. j: N# N2 F% I$ R5 ]
  36. #include <mach/memory.h>* s" F) f+ ?5 e0 Y) B2 C: w
  37. #include <mach/hardware.h>
    / T+ S% {6 I7 d% e4 `4 R: _! y) g
  38. #include <mach/irqs.h>' V% C* W7 w5 ?0 Y% p9 i; Q
  39. #include <asm/hardware/edma.h>
    0 n0 N' |0 u8 t; J5 @
  40. 5 p; _& [3 M- `  B1 ^' y- U
  41. #undef EDMA3_DEBUG* `5 ~/ x! q  K+ n  c
  42. /*#define EDMA3_DEBUG*/5 U* B; c% X9 ^( Z5 |2 A

  43. : L$ _: i- }% e" e! Z7 R
  44. #ifdef EDMA3_DEBUG5 o* ?) {) `% W9 F
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- ^1 S' m9 w" {: W
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! c0 H5 c7 J9 P/ ~  |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    . @: P4 B- Y3 L7 w
  48. #else
    " z" b2 a$ }  r
  49. #define DMA_PRINTK( x... )
    & v! h( m) Q5 ~& C1 K$ Y
  50. #define DMA_FN_IN
    5 _4 j) J! y' ?+ x
  51. #define DMA_FN_OUT
    " U3 B- c& q8 D9 p+ K
  52. #endif
    , n) g' x6 {* [, P& G$ `1 D

  53. 0 Z& F# e0 e# U6 z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  w. ?& w! J+ p' B$ U
  55. #define STATIC_SHIFT                3; y4 p4 i5 j0 Z( L  Y/ r: P2 I
  56. #define TCINTEN_SHIFT               20( \* S8 v# s" g: @# O1 ?
  57. #define ITCINTEN_SHIFT              217 V  W) J" B( P) w* |  J6 j  o: G
  58. #define TCCHEN_SHIFT                22  A, `% t  H; w: Z
  59. #define ITCCHEN_SHIFT               23
    2 Q$ A1 u! O) ]# K6 T9 W" q

  60. " m! F6 |: }) g9 c* d
  61. static volatile int irqraised1 = 0;7 {  _# g% x( A. g
  62. static volatile int irqraised2 = 0;4 b1 E* q- d0 {! H9 p; j! K( J0 v

  63. 6 F7 a/ h, w. A( l- ]% a9 p
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 w; {6 j0 x& f( S  O
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 P' k# v0 Y! V- A' l! X* ^% [7 t  D
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 s: @& K0 B+ v% C" J' K

  67. % x& D4 ], [# L; I8 B
  68. dma_addr_t dmaphyssrc1 = 0;
    , E6 u5 e5 E; ?
  69. dma_addr_t dmaphyssrc2 = 0;8 d( d' n( ]  G$ G
  70. dma_addr_t dmaphysdest1 = 0;3 K9 o. W0 e' M1 B# U. V
  71. dma_addr_t dmaphysdest2 = 0;9 |# L+ x4 W, ^2 R) I8 E- k
  72. . I% u7 F$ c& F) k' Q/ H7 \% e. X
  73. char *dmabufsrc1 = NULL;
    $ i0 q# i: x- k" w' r; w
  74. char *dmabufsrc2 = NULL;: T! Y& j+ ?, F/ n( c0 G
  75. char *dmabufdest1 = NULL;0 O, z! d1 C) H  L# {% `
  76. char *dmabufdest2 = NULL;
    5 G6 T. I. v1 i' h* o+ ?
  77. $ n" u. `9 v2 J' S/ |' [- q
  78. static int acnt = 512;8 e( g4 S" C3 a9 z4 w7 C' y  Q
  79. static int bcnt = 8;
    4 S/ [; c* ?/ w& `+ @9 n7 ?
  80. static int ccnt = 8;
    ! y* o! `3 \' M! [- b
  81. , ~! G2 M1 E8 w- j- R1 n" m
  82. module_param(acnt, int, S_IRUGO);6 V, i/ d7 s. q& t
  83. module_param(bcnt, int, S_IRUGO);
    / a! c. Y, D! L8 p  Q: L
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 B( o( T% P5 O, l: X; x
1 ^0 ?$ i5 w- m- S
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& V2 U5 z! m4 D. c7 z" A/ _2 D
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" P9 r! P3 A" K8 C
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* n( F2 e9 o" W4 P8 e4 b# K  Y2 I( w" o/ W# k" [' E7 x* f- y; Y% ]. a

. k' P6 v6 Y+ v# m3 r, a" X5 B
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-10 15:58 , Processed in 0.037202 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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