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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % q" \* m, |( |6 @# O6 n7 d
  1. [code]EDMA sample test application
    ' Z8 C; X7 U! T* D& {
  2. /*
    ' M7 h& G& C( N1 `1 a2 }
  3. * edma_test.c8 ~( O& W! l4 \8 }7 C% G
  4. *
    8 z, ]. ?  Y" o/ Z( ?% A) g
  5. * brief  EDMA3 Test Application
    $ \3 U% N: ^* [/ z% a0 g
  6. *) g2 @: m1 v, D) K
  7. *   This file contains EDMA3 Test code.5 i( L7 `0 X% b5 [
  8. *
    : _7 K; c& M4 s, [
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    0 H. @3 N5 b6 Z; T9 l3 ?, A4 w  c
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( h9 w, d  H  Q3 r. \. ?' `
  11. *         TO CHANGE.* g/ m% Y9 Z3 {' s% m1 s" n
  12. *- h+ r9 n8 c  a& n: L4 Z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ ~) O, g0 \# }/ q' ~% n
  14. *: }. K- Z  E2 s' {
  15. * This program is free software; you can redistribute it and/or
    " N. R* J0 r3 f1 W- g
  16. * modify it under the terms of the GNU General Public License as/ d8 E; Y9 K+ Y: E& J. V+ R4 n
  17. * published by the Free Software Foundation version 2.+ Y- R( y; P# [& |  r$ [
  18. *
    0 Y. y/ K" B% Y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 |6 p/ c) S3 t, @. W( s
  20. * kind, whether express or implied; without even the implied warranty* m: a+ }2 }% e# C" y: K* r& f" h
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the1 k1 s/ u7 m. V
  22. * GNU General Public License for more details.
    ! q2 f/ B. |) U6 E
  23. */
    % ]  T# x; `9 m- N

  24. ( j, H0 `9 l* e, x- `, m. ^
  25. #include <linux/module.h>  u! j! J: i  R* _* Y+ D! t4 I5 K$ w- p
  26. #include <linux/init.h>9 w: W3 ?% l' p) z- j
  27. #include <linux/errno.h>' {/ E/ H  Z" b, V2 m
  28. #include <linux/types.h>
    # k, T& E, s( J
  29. #include <linux/interrupt.h>9 G& S  r' B. f" s- r
  30. #include <asm/io.h>% B& }7 ]: Y$ Z" ~, N, O! t; z: a1 q7 K
  31. #include <linux/moduleparam.h>
    ; S) u% ~0 S6 c
  32. #include <linux/sysctl.h>) {7 K5 u8 h3 u1 R
  33. #include <linux/mm.h>* ]4 n1 Y. B( Z( ^5 u$ W0 b
  34. #include <linux/dma-mapping.h>, @, H8 D( ?- ^
  35. 9 V) ]1 P' [4 M* Q: S
  36. #include <mach/memory.h>
    ) e; E% Q) T1 U: C! O4 i5 s+ D+ B
  37. #include <mach/hardware.h>
    0 _1 B) L$ a& w" E9 p. A: N, D
  38. #include <mach/irqs.h>
    # o( ~! A6 _% c, ~( x) D
  39. #include <asm/hardware/edma.h>
    ! `% W5 k( I" C6 K& h# r

  40. 4 s# r4 a8 j' v" O5 W
  41. #undef EDMA3_DEBUG
    # ]3 u/ i, _/ s7 a# B
  42. /*#define EDMA3_DEBUG*/7 H, ~1 q( I% H# M: f. s2 [
  43. . E% A' t) X4 {5 \# G* l1 t0 {/ S9 f/ x$ F
  44. #ifdef EDMA3_DEBUG* J9 V  l) _, e% y* k& s0 Y( _8 K
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    , s* y; j7 e7 r4 O
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    6 o$ q  N. v( n" e) [4 ?8 W
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    2 [" L) a" t" M4 Y
  48. #else
    2 {( G& X. N9 o4 ?
  49. #define DMA_PRINTK( x... )) }. o) @2 y7 V7 d
  50. #define DMA_FN_IN
      b+ j$ C. _8 H
  51. #define DMA_FN_OUT
    # t6 j2 u5 ~# k' w& E# p% n# R( ^
  52. #endif
    % [* k* w6 o4 O, o7 k
  53. 8 {0 I; i2 J% s; E3 u7 k9 u
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), A. F: o; d5 E# ~4 g
  55. #define STATIC_SHIFT                3% W  O6 N: e. M  T8 k( L  j
  56. #define TCINTEN_SHIFT               20
    / u4 h" D4 u: a" K5 \2 q2 q
  57. #define ITCINTEN_SHIFT              213 }$ {3 [  B) {0 G& _4 _# P2 h
  58. #define TCCHEN_SHIFT                22: W6 g( r  U2 E3 P7 b+ v
  59. #define ITCCHEN_SHIFT               23' L+ w5 z  t/ F6 V

  60. 6 T: [$ m9 H# s0 M
  61. static volatile int irqraised1 = 0;& x# T: _! g% d7 I
  62. static volatile int irqraised2 = 0;
    6 U( @9 [, g2 s! I$ e& j
  63. * e1 b) h- H7 R# G9 j1 Y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! w4 j  i( v7 j4 [
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; a) K) H( I. Z0 f$ b; f
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  X, O- o! m# a+ W* P3 D7 `; l$ V
  67. " L" L( r/ ^% a4 {1 ~
  68. dma_addr_t dmaphyssrc1 = 0;
    : Y" `% M6 [8 K. j
  69. dma_addr_t dmaphyssrc2 = 0;
    3 l& ]% V; _6 _' R8 T8 `
  70. dma_addr_t dmaphysdest1 = 0;
    : N1 w) N- ?8 w8 p+ H( M1 V4 w3 g  u
  71. dma_addr_t dmaphysdest2 = 0;- j/ ~% o) F. ~& c1 c! m
  72. * Y0 f% W; k7 i' V/ A
  73. char *dmabufsrc1 = NULL;7 w9 C  J# q# N7 P
  74. char *dmabufsrc2 = NULL;
    7 z" ?1 n& b; G
  75. char *dmabufdest1 = NULL;  y# m5 [/ {& [$ [) s: r- u, w
  76. char *dmabufdest2 = NULL;
    + a5 B! M7 m6 d5 ~  V) c9 N5 j( _4 s
  77. % B% ~9 l9 m! N2 u2 ]0 o5 M9 r9 Q
  78. static int acnt = 512;
    4 X- z* |/ S, Y7 n/ K8 n$ O* u# \
  79. static int bcnt = 8;
    + j' M1 y& u$ B# n9 }- j5 K
  80. static int ccnt = 8;
    ! b  E+ {7 u2 J; K4 {
  81. 7 b) t0 o$ v, Y
  82. module_param(acnt, int, S_IRUGO);
    7 I& t1 a/ J/ k2 N
  83. module_param(bcnt, int, S_IRUGO);
    , O: z  t+ h% N/ a8 C
  84. module_param(ccnt, int, S_IRUGO);
复制代码

8 f$ b2 V; l8 t7 A$ g* \0 b& P+ [0 }" G7 R) O" P
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( y: \* j: H- D# P5 ]2 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* r! B9 K- T) g: n, J: R! [1 ]1 P     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 B9 x* P' V7 H' y2 t/ I: Y+ h4 j$ d" {0 b" Z/ {+ W

9 ?" n; Q+ ]  d) ~9 L
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-4 20:15 , Processed in 0.038215 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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