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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑   p' d1 c! j) B7 j$ l
  1. [code]EDMA sample test application
    7 v# ~% r" v: a& x/ Z
  2. /*
    8 [( u. G% @& Q0 y) h2 p, v
  3. * edma_test.c
    , }8 p) s# V5 E1 A# n$ V
  4. *( `8 G0 {1 c% I! ~: O4 ^0 {
  5. * brief  EDMA3 Test Application" M" J) V; m3 R$ w/ N% j8 Z2 I. f9 d
  6. *
    : J7 n% ]0 @+ d0 C
  7. *   This file contains EDMA3 Test code.: P- V- s2 P. @7 w
  8. *
    " \5 U6 p9 d# C7 T, L6 Y: E
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    6 X- c& j# h: @; i0 Z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , X) d1 b- O' a/ D/ E! G
  11. *         TO CHANGE.7 F* N/ \" K4 G7 e0 N
  12. *  X% V  N' g7 L! w) f
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 t3 U* E7 g$ O" P5 v% N) y9 A: K% Q
  14. *" ?4 W5 e" x3 C! {3 D5 c& W3 S
  15. * This program is free software; you can redistribute it and/or
    - t! {, v6 I  i' U6 j: Z% n
  16. * modify it under the terms of the GNU General Public License as
    % l6 a  ]# |. d2 j5 e+ C
  17. * published by the Free Software Foundation version 2.
    : n: V8 p  H- ]) G+ u) z# [, d1 V
  18. *
    + a/ [! [6 o1 ^9 ^
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ) i% `8 d! [1 j7 A+ J, R+ @. C
  20. * kind, whether express or implied; without even the implied warranty
    ! F" d( B- G& |6 u6 u$ A2 u4 w( d* `
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' a7 V% Q+ B" B1 _3 r
  22. * GNU General Public License for more details.4 y- }$ q9 v6 i$ Q
  23. */
    # W: F5 r* @. q" D$ ~( {

  24. $ V' A! [) R$ D; K# [. `1 y
  25. #include <linux/module.h>% ~: E$ B% V( {! L" ^# G5 B
  26. #include <linux/init.h>! L: h! J6 x+ H1 ^
  27. #include <linux/errno.h>  Q. j, n. N+ E6 {
  28. #include <linux/types.h>
    % _: n, Q; h( E! k! T
  29. #include <linux/interrupt.h>
    2 b4 l) |! T8 H4 I, g1 D
  30. #include <asm/io.h>1 H1 x& K) B$ b6 @  F
  31. #include <linux/moduleparam.h>1 E& ]( C7 \. }7 i- \" f
  32. #include <linux/sysctl.h>3 B  L4 K0 f; {2 g9 T0 D* n9 |2 f
  33. #include <linux/mm.h>& ~7 n0 E+ N: I$ g# k
  34. #include <linux/dma-mapping.h>
    3 V. H$ n, q1 i+ Y) w1 c
  35. ! X" h  m5 O( {: w2 H' U0 c* ?) l
  36. #include <mach/memory.h>
    3 n, A# E0 m% {5 z
  37. #include <mach/hardware.h>
    % _+ [6 A+ A4 `6 z
  38. #include <mach/irqs.h>2 ]! K6 S+ y  v$ D% s. s2 W/ U
  39. #include <asm/hardware/edma.h>; r5 A8 ?; O9 e) o

  40. ' K, N( W- F6 U  e
  41. #undef EDMA3_DEBUG% q5 Q. y" a7 V5 k# ?
  42. /*#define EDMA3_DEBUG*/
    7 G# t' u9 T6 O4 {
  43. : h7 V" a( z) n
  44. #ifdef EDMA3_DEBUG3 ]% ~8 n4 t9 F" X' ?
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 @' h4 _+ `- D1 W( Y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) T$ F+ x0 f3 A" x9 d
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % U& `( E- x( ^$ _) ^8 M
  48. #else& {* I- ]( E4 V" ?5 o& C. p+ j" ~9 k
  49. #define DMA_PRINTK( x... )1 D8 P! Y  v4 a0 I. G$ g
  50. #define DMA_FN_IN
    ( y* }3 r0 l  U9 l5 C8 l1 [
  51. #define DMA_FN_OUT
    " ~( b2 P& r2 ^9 X8 Q
  52. #endif
    - P: l2 P0 P: W) J4 S- G
  53. $ t' f7 Y, e+ g& d' X5 J) x5 ]
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    & F- c+ l% _- O+ j! }" F5 @* W$ [5 Y" Z
  55. #define STATIC_SHIFT                34 B* G% t! y8 A! B
  56. #define TCINTEN_SHIFT               202 x7 @( g8 Z9 t  q0 e5 x
  57. #define ITCINTEN_SHIFT              21) U# y) H0 e( _, t  U# ]
  58. #define TCCHEN_SHIFT                22  O1 h! b8 H+ Z
  59. #define ITCCHEN_SHIFT               23( K, e, k( @$ @* R

  60. : Y! J4 |) H! {, V! u
  61. static volatile int irqraised1 = 0;
    1 o$ X7 q% `" ?- V9 }3 U! {
  62. static volatile int irqraised2 = 0;
    + \3 U2 J" L3 s& a. e

  63. ( K9 d3 M' R$ c. Y' w" ]6 p
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , C) u$ @1 c0 w, s6 H' ~5 a2 Y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 g8 ^1 l. d9 f! ]6 ^. \: ?2 R
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 T8 H8 m3 b4 v$ T
  67. ( m: ?: O  Z% E5 v6 |- }% L1 _/ j
  68. dma_addr_t dmaphyssrc1 = 0;# f8 s; _4 j9 R  T9 f9 |8 y- o1 A  X
  69. dma_addr_t dmaphyssrc2 = 0;& q- o# V. R0 E- |( M, c$ n/ G
  70. dma_addr_t dmaphysdest1 = 0;
    ' b4 S  V- U+ W" y
  71. dma_addr_t dmaphysdest2 = 0;  v5 h6 i1 K8 l- H) j
  72. , `  V6 D4 P2 t3 c8 ~4 q( \
  73. char *dmabufsrc1 = NULL;9 z* [9 n" Y1 A' Z  n
  74. char *dmabufsrc2 = NULL;& v) t1 O! R! \  K  r. b/ g- r0 P
  75. char *dmabufdest1 = NULL;* n0 |% J# P4 D3 O; K6 r- N/ P1 [
  76. char *dmabufdest2 = NULL;
      k# Q) N7 D, ]/ v) Y8 ]
  77. , X0 @" q0 c3 }% c: b" B4 h
  78. static int acnt = 512;
    % P  |( s* P, d2 n2 W8 U2 R
  79. static int bcnt = 8;3 w- L0 i, [% S/ H7 _% @1 o# i+ l
  80. static int ccnt = 8;- x3 F0 }% V; I: K" e

  81. 1 u& U; f* B  ^$ ?+ ^+ V# W
  82. module_param(acnt, int, S_IRUGO);5 Y8 }6 _! ~  U; P
  83. module_param(bcnt, int, S_IRUGO);
    $ I+ J9 D/ a6 c( h( l8 ?5 f
  84. module_param(ccnt, int, S_IRUGO);
复制代码

0 m- e# c9 J! ^& B8 i
  s- r/ b6 ^+ n/ w$ \      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( h6 J9 O/ C  B* k) S
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 ?# v. n2 m5 Y. o
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 g1 B" g+ ^: n! L

% ~, o$ l9 ]" v/ J, `& m, c9 g# L: b% ^2 z) y7 {
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-20 02:52 , Processed in 0.049346 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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