OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 F* m$ m2 w% b% o
  1. [code]EDMA sample test application
    ) j+ c' W$ I4 }! O' r3 B: ?+ U" S
  2. /*
    & X# R, b; w2 K( v
  3. * edma_test.c
    1 x1 n) Y  i: z( G
  4. *# L; g5 ?0 n7 ?" a" Q. a
  5. * brief  EDMA3 Test Application
    8 W6 q' g! V+ H
  6. ** v  ]) Y' t. I8 O' _  l& H* e/ n* D
  7. *   This file contains EDMA3 Test code.
    * p6 T6 Q& e* z
  8. *
    , ]9 K# E% U- \: _! k& D- q2 C7 s
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 Q) W5 M% b8 \
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% n* x+ H( r$ p3 e9 l3 a7 n8 Z2 G
  11. *         TO CHANGE.0 p) U5 b- M6 i, m# f9 Z" d2 K3 ^
  12. *
    6 V5 ]: g9 z) h8 |; a/ ^
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 R1 F( |5 [: E/ a
  14. *! E2 x  b% l, i# R/ H( m6 }: Z5 ]
  15. * This program is free software; you can redistribute it and/or; J- M' m+ w5 `) Z4 D7 w
  16. * modify it under the terms of the GNU General Public License as2 d( w3 b: G) j# R3 D
  17. * published by the Free Software Foundation version 2.
    : `: U: c% t& s! }
  18. *7 I# c7 o% e7 x5 R: @
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 E' O. w% b5 Y' s
  20. * kind, whether express or implied; without even the implied warranty* V" w" R, I: N+ L% k# @% m
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 W7 y1 a) I% b, P' _: i, f* p
  22. * GNU General Public License for more details.
    # C+ `6 G0 {% Y+ C7 W
  23. */
    & W: F; v- e3 `

  24. ; t# e, v* q% ~  I% I
  25. #include <linux/module.h>
    1 ^7 Z; T2 h& h, e
  26. #include <linux/init.h>2 [. O, P7 k! I9 _6 l
  27. #include <linux/errno.h>
    + O0 R6 X) T6 M5 |1 X2 n
  28. #include <linux/types.h>$ I! l5 _* e9 H$ ~
  29. #include <linux/interrupt.h>
    ! ?6 Q$ B6 ]2 @: w; p& S
  30. #include <asm/io.h>. }% M# a; K3 {+ ]% [9 u
  31. #include <linux/moduleparam.h>* Z& u3 p) n1 h
  32. #include <linux/sysctl.h>
    $ {+ S6 K+ ?2 J0 h8 I
  33. #include <linux/mm.h>
    * [& e& n  n+ l' b/ _6 y
  34. #include <linux/dma-mapping.h>
    ( y& B7 [( W3 {  [5 f5 v
  35. 1 w' s) [! M2 \9 T
  36. #include <mach/memory.h>- L4 r( k& K( t: ~# l7 A1 |7 k& N) `
  37. #include <mach/hardware.h>
    % W2 k6 z' w. G
  38. #include <mach/irqs.h>! k' S9 ?0 @# G, f
  39. #include <asm/hardware/edma.h>* W: U! W& E  n* A

  40. ! y! Y. H; S+ l; E* ^5 P4 i1 y
  41. #undef EDMA3_DEBUG
    # }  F% n9 T& K: Y" |0 M
  42. /*#define EDMA3_DEBUG*/
    $ a  t" H9 w5 _: o* h

  43. ; a4 U" n( E# {8 q+ S2 h( o
  44. #ifdef EDMA3_DEBUG
    9 a$ W; k* M9 _1 O3 L! K5 {
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 h; X3 E9 ~( a5 J2 |
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) Y0 q  ]- O5 X% {/ X1 K
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! `' D9 b  h; n4 J
  48. #else
    : h) X. n& h8 @% g
  49. #define DMA_PRINTK( x... ): V5 w( a* m7 S" P3 l& F
  50. #define DMA_FN_IN
    , i+ ]1 @7 t$ P5 j
  51. #define DMA_FN_OUT
    , h' F- h4 U9 _
  52. #endif
    0 D: y2 H; X4 w1 N% F

  53. ' K! w" N' t; o
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 o, `+ k- x+ Y
  55. #define STATIC_SHIFT                3
    # L1 A- P8 h% d0 r, v
  56. #define TCINTEN_SHIFT               208 ^0 Q& e$ f. k
  57. #define ITCINTEN_SHIFT              213 p% q! c9 R) d
  58. #define TCCHEN_SHIFT                22; g) |$ o" F3 r* U
  59. #define ITCCHEN_SHIFT               23, ?  @" j+ r! I' r0 o
  60. - Q3 m& U& W6 ^1 v9 a. [7 B  B
  61. static volatile int irqraised1 = 0;
    ; }$ `+ C0 |% L+ ]' c8 `
  62. static volatile int irqraised2 = 0;  D- A6 Y6 b1 h, q; i$ x: A/ L
  63.   z0 b) E) _- k) l# {
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 W5 u) Z; s6 Z" G' [. r
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 k4 d2 K# ]% Q1 n% P
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; J# M6 e4 r- G
  67. ) Z. K1 c3 ~+ V9 Q+ W* }4 K1 j
  68. dma_addr_t dmaphyssrc1 = 0;+ |9 Y5 T0 U. F9 p* P: [5 g5 R/ M& Q
  69. dma_addr_t dmaphyssrc2 = 0;
    8 B( \: l  L/ {) I
  70. dma_addr_t dmaphysdest1 = 0;
    / q& H. H+ F0 x
  71. dma_addr_t dmaphysdest2 = 0;% o) {4 O& X( o- {

  72. / t0 Z4 @! J6 i, q& ?9 i& D! O
  73. char *dmabufsrc1 = NULL;5 F3 [$ Y$ f- }. H
  74. char *dmabufsrc2 = NULL;4 ^, S* y) ^$ @9 V+ ^* P2 _5 ]
  75. char *dmabufdest1 = NULL;
    , B/ c/ X/ Z6 o1 V/ i& d
  76. char *dmabufdest2 = NULL;
    - o$ ^5 ]- {( T

  77. - g/ k, c5 V/ e8 b/ K" E
  78. static int acnt = 512;
    : \2 e5 H, u/ R- U
  79. static int bcnt = 8;
    3 A9 |" c. ]) b8 u1 i) y
  80. static int ccnt = 8;0 n3 f: Z' `& z6 h5 z7 T& f) v

  81. ( L& v- q0 G- j' Z% o8 x
  82. module_param(acnt, int, S_IRUGO);
    & T% Z! P3 i# s4 ~3 g) j8 I
  83. module_param(bcnt, int, S_IRUGO);8 ~; N3 o" E7 I7 U2 J: h! o9 ]
  84. module_param(ccnt, int, S_IRUGO);
复制代码

* p# n1 G4 _0 \3 z. W  h/ I" X0 b3 |  t' c* g; J+ ~
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ P8 C3 {. C: o/ ~; Z1 U- Aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* C5 h3 Y4 u; F# Y3 U& ~
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 I; C; ~$ \. n( y! X+ G! e% N2 [4 P9 y
0 f; R" Z; `/ a* M5 E% [
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

点击跳转“创龙科技服务通”

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

GMT+8, 2026-4-2 16:54 , Processed in 0.040526 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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