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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 C1 ~8 j" U  H5 f* M7 B
  1. [code]EDMA sample test application
    ! J: g( ~( Q3 W! k) W7 ?
  2. /*
    % q/ Q5 l. }9 p% }' Z0 u4 w5 }1 y
  3. * edma_test.c
    ' X: q1 v5 g9 S+ {7 m
  4. *# f5 w7 v( y7 t! a0 H% j: k
  5. * brief  EDMA3 Test Application1 b  e3 l9 L# r) a! M) f- H- u
  6. *
    4 _7 l+ k+ D; @
  7. *   This file contains EDMA3 Test code.
    6 N. h' }' }8 p. X) g8 _: q
  8. *3 o  B$ g; s: i+ H8 G5 u
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    , c# h. S5 W' Q0 l9 _' N
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" g4 W8 H0 y% n9 e( v
  11. *         TO CHANGE.0 P8 L; H  P5 B$ b
  12. *! Y$ @& X, N" B# a1 W( A
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 {! i* D: B; u6 t3 m
  14. *
    ' z- f  u; B& _# k
  15. * This program is free software; you can redistribute it and/or
    & c4 p# h8 L+ b9 n
  16. * modify it under the terms of the GNU General Public License as# `9 Q3 o, W3 ^
  17. * published by the Free Software Foundation version 2.7 k( _* ]# g, k8 F# X
  18. *1 q: c& T5 H1 b' `8 p3 D$ r
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any* }' l  h0 F2 M7 y! W2 \2 F0 h8 }
  20. * kind, whether express or implied; without even the implied warranty
    $ i- K* k/ L8 `" c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the& V; J( m4 R% s5 t- |
  22. * GNU General Public License for more details.1 y0 I1 n3 p* O+ F( r5 |
  23. */
    - @: P9 W6 ~  i# H2 U' y
  24. ' h9 `, \! X0 Y6 V9 E
  25. #include <linux/module.h>
    8 s2 R% r$ g, J( d* z. w2 M
  26. #include <linux/init.h>
    6 I9 C! n, Y4 I& {0 a6 i& [( B
  27. #include <linux/errno.h>
    ! v' u/ v, y% j0 z6 |, u* O
  28. #include <linux/types.h>
    6 j" w7 Z% I& I$ j& z
  29. #include <linux/interrupt.h># C" J9 z' |* N  k- a$ `, A
  30. #include <asm/io.h>
    " p: }' M4 F/ j" O/ Z- u9 M0 R% d* U
  31. #include <linux/moduleparam.h>
    $ m: v+ ^. I5 I/ _( O/ x
  32. #include <linux/sysctl.h>
    " _3 b! G  e; Y5 y
  33. #include <linux/mm.h>
    0 Q0 I' }" f9 x+ p' V6 D) Z% U
  34. #include <linux/dma-mapping.h>
    / r  H  `% [0 T* w
  35. 9 o" z1 P: ^4 M: G
  36. #include <mach/memory.h>* A: P# R$ g# k. S) @. z0 {
  37. #include <mach/hardware.h>
    / e0 l5 J& _. |
  38. #include <mach/irqs.h>; o) V: {  `: k1 V1 d, F; L
  39. #include <asm/hardware/edma.h>, Z! |: P" d  a( c

  40. ! t, B7 m! b' Z  y+ r- |
  41. #undef EDMA3_DEBUG) S& ]! y  k0 Z6 G/ ~
  42. /*#define EDMA3_DEBUG*/# V0 o. o/ r' f; d) T- N

  43. 0 c& E# V. M" {, M
  44. #ifdef EDMA3_DEBUG+ D9 D* Z1 h+ m& b. b
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 Y9 e' I7 V/ @6 k4 I
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    1 t6 h: c6 |/ L/ p2 Q3 |3 W
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    4 w, Q! ^/ \4 i& q7 r
  48. #else
    / e: m9 }. z+ r" K6 K" W
  49. #define DMA_PRINTK( x... )4 h& Y+ V+ G' o# E- B+ D
  50. #define DMA_FN_IN$ K/ \1 @2 i! u% e7 y! X
  51. #define DMA_FN_OUT. s8 e. S  a: Z" F# n
  52. #endif
    2 M( _! |$ S: f0 s" s

  53. 3 z# E. y" y8 \# X
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  I; A  ^# e4 T
  55. #define STATIC_SHIFT                3
    9 [2 ]' ~. |: G$ O
  56. #define TCINTEN_SHIFT               20
    5 H" D) Z* b7 O- }8 n0 G: E+ ?
  57. #define ITCINTEN_SHIFT              21; ]' N  N1 R8 ^! P
  58. #define TCCHEN_SHIFT                22
    ; Z( C5 ]1 {, a7 ]
  59. #define ITCCHEN_SHIFT               23
    * ]; q8 G- I* c- z
  60. : I- }+ H1 u$ F6 f& `3 E
  61. static volatile int irqraised1 = 0;/ @, y) O3 P8 r. O) s
  62. static volatile int irqraised2 = 0;! E/ M: _% y9 \. C
  63. 1 O9 x7 [* ~0 o. x" T6 v3 V3 y2 u
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * o! K% u7 |5 c9 ?% C. }3 C
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) o; d# \0 B+ b( c7 V6 e8 u
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( D2 E, N. C+ r- `
  67. 8 I( W, `1 T) {. Y( U: o$ E4 _
  68. dma_addr_t dmaphyssrc1 = 0;
    * W5 f6 ?% r; K* Q. \
  69. dma_addr_t dmaphyssrc2 = 0;
    6 z2 d8 D: H- O1 j+ b0 b% n0 ~" {
  70. dma_addr_t dmaphysdest1 = 0;
    , o5 \6 E2 Y$ S4 s
  71. dma_addr_t dmaphysdest2 = 0;1 X% z* V+ H# U3 r/ x

  72. : D9 N( ]% E! h
  73. char *dmabufsrc1 = NULL;
    : x( i% L7 c3 M: y. ?: O: N/ n
  74. char *dmabufsrc2 = NULL;
    3 B+ l- @3 |3 A3 {$ P! V
  75. char *dmabufdest1 = NULL;
    - W8 O. M, B% K  |5 S) ~* F
  76. char *dmabufdest2 = NULL;& d: r- ~# N. x/ M6 `( u
  77.   O- Q( Q, @1 e( q! B, b1 i
  78. static int acnt = 512;
    7 r; r. o; m/ d; O
  79. static int bcnt = 8;
    ' M2 e& s& x: j$ w8 n3 M% D/ h
  80. static int ccnt = 8;! M2 h! C" a) _( j7 @
  81. : [. H3 I4 B; o8 K# W: \
  82. module_param(acnt, int, S_IRUGO);
    2 z& S% n! W. r$ u, \' c
  83. module_param(bcnt, int, S_IRUGO);
    ; D- B* ~# k: R0 K. f
  84. module_param(ccnt, int, S_IRUGO);
复制代码
- Z- }1 f7 N: \1 \; Y) O' j

# E6 Y6 g  h$ O7 S7 x; l  h      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: p# `4 ~  K' Z, `1 Sarm-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& A% {3 A" }/ I; U     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 G, v2 `) S: g5 _1 H4 t

  Z+ B# Q$ o$ M
* _7 p8 g3 _, O6 W) r1 G9 J4 r+ S! v
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-12 05:20 , Processed in 0.037527 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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