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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: c6 c3 t9 B' Q9 X0 i! ]. a6 s
  1. [code]EDMA sample test application
    ! ]) k% j' |! d! ]% L- u, Q
  2. /*
    % G8 F2 A  G3 t
  3. * edma_test.c0 u5 j; e: h. w* \+ @
  4. *
    ( V4 x5 a/ [$ f1 V( }
  5. * brief  EDMA3 Test Application
    / e% A% }& G; H6 O0 ?# {5 r0 n( g
  6. *" i( P- g) |! l$ x7 d
  7. *   This file contains EDMA3 Test code.5 B3 G# A1 u/ J& f4 J3 W
  8. *; W: ?+ m' q5 T' W
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    0 `" M! U( Q/ I, E. v8 s+ w
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 x5 ~' {9 K  A* L' ?! T- ]
  11. *         TO CHANGE.
    5 U! ^* f3 d  ~! {' G" ^# i
  12. *0 p/ v) b4 w9 b7 Z' Y7 A
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    - \9 Y6 Z% `; L$ Z: `
  14. *7 N) f) E* I* y( d2 e- D
  15. * This program is free software; you can redistribute it and/or
    $ N" n6 r$ f# i
  16. * modify it under the terms of the GNU General Public License as0 ~  f; T% f* ~5 j' _4 v& q8 o8 T
  17. * published by the Free Software Foundation version 2.
    # _' y( i) o) o' I; o
  18. *4 I8 o+ E8 k' v$ k# G4 c
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    * }8 ^0 a' B! |# y4 e" o8 s4 K8 f
  20. * kind, whether express or implied; without even the implied warranty
    6 X) ?3 j; [; c; R" Q: h/ t; T' i
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    9 q/ a6 O7 ^% }/ X4 q7 H
  22. * GNU General Public License for more details.# I, E7 L; B( v
  23. */
    - {! p1 A. F$ @5 H6 ^1 S4 t" _5 j! U
  24. + k/ }( f) Y9 E$ s0 Z0 Z
  25. #include <linux/module.h># s# f& u. i) [4 z& S
  26. #include <linux/init.h>8 O" l6 D* f. y( g
  27. #include <linux/errno.h>, {, ^4 ^/ M4 |/ S
  28. #include <linux/types.h>! `3 M! T7 H, e' U
  29. #include <linux/interrupt.h>/ ~' i  M- u; T4 L3 x8 H; ~/ j
  30. #include <asm/io.h>" W) Z/ w/ @  k
  31. #include <linux/moduleparam.h>2 |' ~2 W$ U3 {
  32. #include <linux/sysctl.h>
    - B( R" ]: w) G* q4 X0 I/ r, q
  33. #include <linux/mm.h>! e5 b( F4 J$ z6 Z
  34. #include <linux/dma-mapping.h>
    & p) |4 ^( y2 ]8 I0 V* c& C) ~
  35. . }! t7 M# ^1 Z0 U5 ]$ }' |& u
  36. #include <mach/memory.h>
    * y* p/ y+ k; w/ C) T) c+ }
  37. #include <mach/hardware.h>
    , N# d$ p9 ?. q- ~
  38. #include <mach/irqs.h>
    : c3 q/ c4 \0 u1 j9 u. f
  39. #include <asm/hardware/edma.h>
    ; ~! `( c% O8 ?; j, K/ M: W* j
  40.   o2 P0 t5 R& E0 H$ o' |1 M4 D. c$ P
  41. #undef EDMA3_DEBUG
    + m& L" d% [+ d& q1 f" k% A
  42. /*#define EDMA3_DEBUG*/
    * R8 d  m1 b2 d  n2 f- \
  43. ' i5 U1 r8 _- M
  44. #ifdef EDMA3_DEBUG+ L7 M; Z$ {! S
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 P; U$ q: K5 l; S( ?* Q7 Q. G0 U/ `
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 i% N* c$ m  D; x2 g
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( e3 I* v& E6 ^! `9 J
  48. #else, M$ j$ z) s8 d& E/ W; N$ M
  49. #define DMA_PRINTK( x... )0 P: {- M- p: C
  50. #define DMA_FN_IN
    " l4 C3 C8 S( `
  51. #define DMA_FN_OUT4 z$ ?, k4 ~6 y
  52. #endif
    ; L7 `+ }2 z/ B) E+ F& S! K

  53. ! D0 ?& o% N$ Q' `! X( S' r
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 }) b! ^- w& j
  55. #define STATIC_SHIFT                3
    ( k8 f& W! a& l# q4 B( \* y2 h
  56. #define TCINTEN_SHIFT               20- O2 B+ @; A5 K0 n. W; P7 b
  57. #define ITCINTEN_SHIFT              216 r. |' o* `( E5 R1 `
  58. #define TCCHEN_SHIFT                22
    ; z6 P* `2 V2 N, _7 Q
  59. #define ITCCHEN_SHIFT               23* }* t* y$ L0 A; G# b3 t. V; `

  60. 2 [4 R5 ?& P5 y1 {9 D0 }! z" P" g
  61. static volatile int irqraised1 = 0;" r$ z4 ?; x8 h" J1 K
  62. static volatile int irqraised2 = 0;, W) r! Z) [5 p& g1 q2 k
  63. 2 U4 ]* Z" W, F. j, W& S, }1 `
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ @0 \) Y4 O6 f& r2 E7 X( \9 s. ]
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 z2 e' K1 e# ~7 k: y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" i* O1 `+ V9 f# G/ ^" C
  67. * t! z' P' n9 G
  68. dma_addr_t dmaphyssrc1 = 0;
    7 ~0 F1 ?5 F: f
  69. dma_addr_t dmaphyssrc2 = 0;$ F4 P2 e, U" i: H# ~2 M
  70. dma_addr_t dmaphysdest1 = 0;9 V" a& Y) D$ `& ?7 r
  71. dma_addr_t dmaphysdest2 = 0;2 n& L- B" A# Z

  72. 5 d, Q. F: Y, w3 [, `% g
  73. char *dmabufsrc1 = NULL;
    . y+ b. F4 a' B; z  t: g
  74. char *dmabufsrc2 = NULL;2 x- g+ K, j3 j' `9 G
  75. char *dmabufdest1 = NULL;. T5 _, h8 I/ }; b' X# P& b
  76. char *dmabufdest2 = NULL;. e  \  ]8 K4 I7 k- d7 {

  77. % l5 o& O. \" v
  78. static int acnt = 512;
    & d, h0 Y$ V. \8 u2 g. u6 v1 h
  79. static int bcnt = 8;
    5 _9 |% F* O$ V0 }" k: H0 P" _
  80. static int ccnt = 8;, H$ G! U/ W2 D' ]3 b

  81. 5 N7 w3 e- x/ U& Q" N5 c" T) o
  82. module_param(acnt, int, S_IRUGO);. I, \! V$ S6 B0 u6 M3 C' e
  83. module_param(bcnt, int, S_IRUGO);
    ( j/ n$ r' w9 u' A8 N5 \
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 N3 Y, v& k# H5 x8 x% R/ D
2 L. H8 h/ P8 S8 \      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& P7 h0 M( e8 h4 {8 B
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 M/ O/ i/ p$ m* t  p( _
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& D  S; c* P' }2 p4 H# t6 x
4 v! @+ A7 k; Y4 c5 h

2 Z0 l9 O; `: m% S0 b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-5 03:23 , Processed in 0.038756 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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