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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 v+ a: u5 L! t( I" U: _2 }9 A
  1. [code]EDMA sample test application
    & }0 ]! B+ W: D$ ?9 i8 [# n
  2. /*
    4 q  N6 }) S5 @0 \! ^8 h6 B
  3. * edma_test.c9 E6 m; M! x9 P  N% H
  4. *
    + h8 W: j6 P" I+ a0 e4 U; t
  5. * brief  EDMA3 Test Application' S5 H" o0 p, F4 S; `9 @& p" ]" I
  6. *
    : r3 D* h8 g2 M9 [( M
  7. *   This file contains EDMA3 Test code.
    $ n* u$ C% d# v) A% P
  8. *
    6 D/ `" d% F8 B, H7 B' i
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ' M9 B* ^3 L  X. i8 q; w: r. v' E
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    $ a  L* q: Q- U1 B+ ]8 V
  11. *         TO CHANGE.
    + f  q4 S, Z5 A% K% D. `
  12. */ g# Z! ]- X5 k6 }
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    2 ~6 ^* b. K8 }. w- B! g9 _( t
  14. *, B) @3 P% C5 i0 U. F! z6 k* m
  15. * This program is free software; you can redistribute it and/or# |( O  [$ ?* r3 ]3 |
  16. * modify it under the terms of the GNU General Public License as9 D' A% i. c  o; U6 [
  17. * published by the Free Software Foundation version 2.
    8 Q/ r1 _5 F0 d- `( j
  18. *& i) j  J, ]; ~# n' \& r
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    5 K- _* O9 x0 N" x  _% g, R5 @0 e
  20. * kind, whether express or implied; without even the implied warranty( P% m3 {' ~) V! a4 d
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 u5 ^6 `- h( j
  22. * GNU General Public License for more details.( h  R0 c1 ?( o) u& c) u
  23. */  g/ _  R5 G4 F' j* N
  24. % M5 ~4 G: i. R. e- H# t
  25. #include <linux/module.h>
    + a  z4 \; K2 i- |5 Q
  26. #include <linux/init.h>0 c& |9 z* Q: L6 {3 e1 V+ p
  27. #include <linux/errno.h>( t+ S' A' R6 T; T7 K
  28. #include <linux/types.h>
    # l% y$ @( E1 \7 G3 S8 B! `1 D
  29. #include <linux/interrupt.h>. s* h1 a* V9 I1 G6 G
  30. #include <asm/io.h>* c6 B/ n5 R. R& O$ i* Y2 Y& L- S
  31. #include <linux/moduleparam.h>
    7 V1 Z: D9 d* b& C+ k+ X
  32. #include <linux/sysctl.h>* g, E% D! p* I! l% B) [8 r
  33. #include <linux/mm.h>' l! K5 k8 b% ]1 _" j9 g
  34. #include <linux/dma-mapping.h>/ v0 P5 V5 V8 W" o$ w0 ]
  35. + o1 R5 q, B9 ~0 H; a
  36. #include <mach/memory.h>
    ( y% w2 O# F$ g, E/ N2 c% I
  37. #include <mach/hardware.h>7 u2 h; d+ b. O/ m) Q6 @* D
  38. #include <mach/irqs.h>+ w( e" B8 h( m
  39. #include <asm/hardware/edma.h>
      J6 s- |; Y4 A/ a+ X; s

  40. / f' @2 E# S( S# y( K
  41. #undef EDMA3_DEBUG. {9 {* S( d7 r$ S
  42. /*#define EDMA3_DEBUG*/
    / k0 {/ d6 C9 r; K1 P* L2 }
  43. - [8 D$ u6 [, W4 v$ P! E2 e; F
  44. #ifdef EDMA3_DEBUG
    * \, d5 t, f& l' H' }
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    5 ^+ T' }" n: H  f
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    6 `) B. V9 o; R, N1 q8 M, c
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ N, h  [, Z8 p; _  k
  48. #else
      ]: r5 g0 p3 d
  49. #define DMA_PRINTK( x... )( Q7 p* J0 T) L3 g# s/ Y: M
  50. #define DMA_FN_IN
    / l9 p% g8 H& i
  51. #define DMA_FN_OUT
    ' T# W3 O  r0 ]8 T3 y
  52. #endif8 N$ [' L6 ?2 q9 n; o, R
  53. % ]7 u# ?( w1 B5 a( A
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    6 c( \) X3 V2 h: q# b; I
  55. #define STATIC_SHIFT                3
    ! t' U1 l" l" o9 f6 m
  56. #define TCINTEN_SHIFT               204 s: H8 k: y/ A
  57. #define ITCINTEN_SHIFT              21) u; c4 w  s9 i! d  K# y0 b+ I, o
  58. #define TCCHEN_SHIFT                22+ @7 ~6 v6 @$ n' j  h0 Q3 e* P  @
  59. #define ITCCHEN_SHIFT               23
    . v/ p/ G% g9 @  b& i! s, j

  60. 5 _* [: Q( f9 O4 E" ?% ?; o
  61. static volatile int irqraised1 = 0;' E9 Y+ U9 R/ I; ^, D
  62. static volatile int irqraised2 = 0;
    8 b4 |& O  i4 w- K1 z/ o. E& G

  63. 9 g5 u9 k9 O9 g
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # D- d1 g2 @3 j0 P6 F
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 ?$ ~- z5 O9 L) \9 y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 P" o+ g5 s  a$ |' a

  67. - X9 e1 D& C$ \9 a: h
  68. dma_addr_t dmaphyssrc1 = 0;
    * j' ?  n0 W* T0 h
  69. dma_addr_t dmaphyssrc2 = 0;; H+ I4 K: |- M: u; G. \. Y( e
  70. dma_addr_t dmaphysdest1 = 0;
    * ?9 z8 o; W/ d
  71. dma_addr_t dmaphysdest2 = 0;  s' H; }/ x! b& ^

  72. 2 r9 C) _" B/ e0 y# V! ?
  73. char *dmabufsrc1 = NULL;
    # e6 s+ H7 n" T6 F; Z
  74. char *dmabufsrc2 = NULL;5 Z# x  e1 \6 l) [  A; I; d* L& h
  75. char *dmabufdest1 = NULL;
    0 J/ ?/ Z% b) c3 V! C  r* j
  76. char *dmabufdest2 = NULL;
    ' |, M/ C/ Y8 p; s! f/ x( e* X
  77.   C3 X- p7 G# q2 r
  78. static int acnt = 512;
    ! ]2 j* H6 i. _4 t
  79. static int bcnt = 8;" X  S: v* y: ~: c1 M; R  m3 M
  80. static int ccnt = 8;( ?5 i4 M; _# x8 R

  81. & t( m5 f  M5 V* |) E$ t
  82. module_param(acnt, int, S_IRUGO);0 t2 B; u& _' Y- ]3 L8 C
  83. module_param(bcnt, int, S_IRUGO);
    2 l6 `6 q/ Z' ^4 o( g
  84. module_param(ccnt, int, S_IRUGO);
复制代码
& a/ q! {  A# D1 z. O' T) [0 v
; m7 B7 Z" l7 }+ ^* M
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 w7 ~( m9 K1 W. ?9 C
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 T  r+ O; g7 O: ~! p$ N! @- j     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! g/ i& O( z% u/ m
: D% u$ _( W( R3 D
' j# C$ g8 U9 ^. i) T9 {
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-7 17:24 , Processed in 0.037859 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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