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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % G& b) M; R: J2 W' I- c
  1. [code]EDMA sample test application
    7 p* z( |" _. r/ _5 I
  2. /*
    3 G8 ?( _1 y9 }1 Q7 k4 E. A7 ?
  3. * edma_test.c
    5 I" m( D& |( G9 o3 J# ?% u& ^! w
  4. *+ B* \& v+ W# d
  5. * brief  EDMA3 Test Application
    9 n$ [7 K) W  |
  6. *
    0 c3 j; F; m) y- L! [, w8 x
  7. *   This file contains EDMA3 Test code.
    * q; Z+ ^, D- O
  8. *
    : k. b9 |9 }3 S0 h* s  T
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 x% V3 i% E* z  D5 c/ I' A
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & P, o! o5 D3 ^
  11. *         TO CHANGE.+ H) E7 B7 f9 k- L( J" f
  12. *2 D8 l' B; ]- j1 a
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    7 o3 q' h* k; \) C
  14. *6 @$ N* Z+ s) E
  15. * This program is free software; you can redistribute it and/or
    ! @$ ]& t. \& r6 R2 U" _* O
  16. * modify it under the terms of the GNU General Public License as
    6 i0 z1 w; z) z
  17. * published by the Free Software Foundation version 2.: ^- f3 q4 ?; P% M4 M* H: G- \
  18. *1 ^7 D7 P5 c# G, p% }) v
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 c0 F2 u* |$ ?) C' I& n/ K
  20. * kind, whether express or implied; without even the implied warranty
    " T& L! P9 Y( {/ g: d% t
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the/ @8 f' C* s; ]
  22. * GNU General Public License for more details.
    " _! N9 n. u) e
  23. */' A$ o9 q( c. R* S

  24. * a# T" K7 a, x; f$ h; j3 J
  25. #include <linux/module.h>
    . g! Y' _2 G" H0 Z6 d
  26. #include <linux/init.h>
    * V! b4 f: }) Y/ o1 D) w$ m
  27. #include <linux/errno.h>
    , C2 N# B4 h  ~: s, a( P* Q
  28. #include <linux/types.h>% |0 m8 m3 h; f# t6 Y
  29. #include <linux/interrupt.h>$ k2 [; J# H, T6 p% [% G
  30. #include <asm/io.h>- x$ L2 G1 w! A# f
  31. #include <linux/moduleparam.h>
    " a* T6 ], A3 n% z
  32. #include <linux/sysctl.h>
    # Q$ `! i- H% O7 {8 \
  33. #include <linux/mm.h>
    ! l* K: i6 s& [
  34. #include <linux/dma-mapping.h>
    ) c( s3 a# ]1 s8 K4 m
  35. + v5 p4 j# o7 G% C; [& U" z. B6 V+ L+ }
  36. #include <mach/memory.h>1 Z5 x' q) M) D- e
  37. #include <mach/hardware.h>) ]  q& n2 z8 ~: e' p
  38. #include <mach/irqs.h>. ^" I0 I) u' r/ v
  39. #include <asm/hardware/edma.h>
    ' c9 ?# G" t: G) S* o- k
  40.   j+ w% C4 L8 s2 @; d' C* h( S
  41. #undef EDMA3_DEBUG( |2 }! e- q; `2 l, Y
  42. /*#define EDMA3_DEBUG*/
    3 F" }) u& h5 o2 i
  43. 0 c) ]; t- G  s9 D( l
  44. #ifdef EDMA3_DEBUG
    8 i8 @( |7 a. F
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ M$ Z2 z( W: Q4 ~2 J, y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    % M1 V% _& c1 w# N- G9 W4 f
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 t( `1 g' t, Q, d/ H7 L
  48. #else
    . y; m, W3 l; e( E9 m: e
  49. #define DMA_PRINTK( x... )
    , ~" w# K) B; I
  50. #define DMA_FN_IN
    3 [( b3 b4 X. [5 X
  51. #define DMA_FN_OUT
    ! U8 u4 J, K% o5 t4 V5 r/ _# @
  52. #endif1 W! z+ z$ ?1 T2 e) R! e( m; X
  53. 0 L& C9 u! K2 _% A8 t1 i9 g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 U5 P+ {+ ~) b# A* L/ g
  55. #define STATIC_SHIFT                3
    " T% d4 e! n; |- x" F) \
  56. #define TCINTEN_SHIFT               20
    * H5 a# D' l$ m0 [* O
  57. #define ITCINTEN_SHIFT              21
    / l1 C% z. A" m* _) U; S+ \
  58. #define TCCHEN_SHIFT                22
    % l/ B0 o6 k: Q! v- N' N5 p' d4 N
  59. #define ITCCHEN_SHIFT               23
    % j' C/ s  p9 c+ i, l0 S" i0 d3 S

  60. % X' t: g# ?" Y: b$ g
  61. static volatile int irqraised1 = 0;
    + h  v* t3 [9 j5 r. g2 r& H
  62. static volatile int irqraised2 = 0;  s/ {- `7 z$ U; q. w" D0 _

  63. + a% R7 c, {5 _
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 x6 ?9 P; U& m! d
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 W6 _4 Q2 z% `: Z- t
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * m$ p' K6 {6 k
  67. 4 m; K5 ^0 V  e: ^& z4 o
  68. dma_addr_t dmaphyssrc1 = 0;
      _9 ?* r* X$ C' m8 I
  69. dma_addr_t dmaphyssrc2 = 0;% b4 v4 x$ T0 r8 g2 P
  70. dma_addr_t dmaphysdest1 = 0;
    ; ~$ D- o  w/ z
  71. dma_addr_t dmaphysdest2 = 0;
    4 }- m; v0 U" F# s; B4 D
  72. & W& U5 h& p1 b5 S' o1 H! f1 o6 }
  73. char *dmabufsrc1 = NULL;
    6 H4 d3 n  G4 @, L5 G- ]; {. v4 o
  74. char *dmabufsrc2 = NULL;. k8 j% X0 ^( A0 A
  75. char *dmabufdest1 = NULL;
    % W' s0 U0 j5 c: b
  76. char *dmabufdest2 = NULL;- l( Y  g4 p4 n6 q+ A
  77. 4 B( k4 S. n! b1 R
  78. static int acnt = 512;
    ; [0 o# S6 a. h
  79. static int bcnt = 8;
    $ g& o9 W- G" ?& t
  80. static int ccnt = 8;
    . U: p) D0 H. u# ?- X
  81. & O- L7 s: R7 Q: X+ {. ]( F3 P' c/ ]
  82. module_param(acnt, int, S_IRUGO);5 `9 v9 W. D" p8 m! j
  83. module_param(bcnt, int, S_IRUGO);! S% _/ Z8 F  s! ]; b4 h
  84. module_param(ccnt, int, S_IRUGO);
复制代码
8 N$ Q( A6 @3 y, n+ y
0 v6 }* X/ C3 Z6 M
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. q+ ~% G9 l8 n( darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: Q+ A$ V/ z4 F! C
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ M; l2 P  p9 m6 b
  u+ r/ O5 F& R, V

) a8 j) S- J& L2 b( J' A5 @
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-22 15:48 , Processed in 0.036809 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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