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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: D# X6 y5 {8 W$ B: I5 `
  1. [code]EDMA sample test application8 z4 p8 m  t$ ]
  2. /*7 ~. x8 E0 d! J3 @
  3. * edma_test.c
    8 d, P0 Q5 x( V
  4. *. b$ |8 Z! Z7 M7 A( u$ V4 D% f
  5. * brief  EDMA3 Test Application2 U1 _1 m0 @) Z' k& z: l5 ~7 @
  6. *
    9 _+ n9 w: M8 k, M
  7. *   This file contains EDMA3 Test code." ]: F* d8 f! x; r5 H
  8. *( z' d& R! v( E! G  j- Q$ H
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    2 [1 ]  b7 d  x8 ?- Y# j# g: d4 N: X
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! m$ ~% C' O- L4 v+ v, h/ z" m
  11. *         TO CHANGE.
    : ?3 `3 L' K$ @3 W+ F0 w0 l
  12. *
    ' z9 n, r  v* p4 V! P0 U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    # X3 ^/ c4 N. [- u# L& h
  14. *- Z; a4 b) Y. H% G9 R) l5 K; F
  15. * This program is free software; you can redistribute it and/or
    0 f" D2 k' X  ~; {6 U  G, f
  16. * modify it under the terms of the GNU General Public License as
    4 v- U4 [6 p. b5 o" d) J
  17. * published by the Free Software Foundation version 2.! I- {9 F# x! s
  18. *
    : N- Z5 g* R4 [2 M/ M
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- B- z, s" M; o
  20. * kind, whether express or implied; without even the implied warranty) X1 X. j% m0 V: ^1 J/ F
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the0 G' j9 _: E, G
  22. * GNU General Public License for more details.
      D) e) I6 j0 i  J
  23. */
    : K7 N' k$ w) |8 W3 K3 |8 @0 A
  24. ; B4 K2 h0 ^$ j- U" e
  25. #include <linux/module.h>; Z$ t( V6 ^* F* h& W( V
  26. #include <linux/init.h>' i0 g; U9 ^: s2 n
  27. #include <linux/errno.h>
    2 f1 Y: s  k. A1 l5 w. q0 O. o" R
  28. #include <linux/types.h>
      e- V% _0 f- N, l" h8 b4 q4 j' u7 m! b
  29. #include <linux/interrupt.h>
    ; |$ {, F. l( f/ H- j9 _
  30. #include <asm/io.h>
    * k& u) P% V5 R  v
  31. #include <linux/moduleparam.h>$ M3 j) \/ e4 Y9 X9 P* |0 k1 M
  32. #include <linux/sysctl.h>
    ' h' \2 n, [5 j7 B# d
  33. #include <linux/mm.h>9 r: t& y3 ^7 |
  34. #include <linux/dma-mapping.h>
    ) R1 r% M* {2 X* i: {, J/ B

  35. . e& `& v2 T# \
  36. #include <mach/memory.h>
    1 C; F. [( [  i: d+ z$ V+ I6 P3 L3 ~
  37. #include <mach/hardware.h>
    3 l& s5 @: y0 l# e3 ]/ E
  38. #include <mach/irqs.h>3 E' a8 m5 w9 ^  k" {1 e
  39. #include <asm/hardware/edma.h>
    1 M/ D1 R* c( A

  40. ( N( I$ l# b2 b1 ]% [5 _1 i9 g: H
  41. #undef EDMA3_DEBUG
    * D+ ^6 H% q4 I1 R' \
  42. /*#define EDMA3_DEBUG*/$ p$ F2 p. V; B

  43. 3 b; c8 B( Z- @8 [+ v* X
  44. #ifdef EDMA3_DEBUG, K% N( q. D0 p4 z- m
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    6 d, Z4 c! H' i' I
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ) P5 v+ [6 Q* Q9 w. s" p
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % q: f( |9 h2 s3 r2 B$ h3 a
  48. #else5 G6 x, `- [- y" j4 P: T' p) l
  49. #define DMA_PRINTK( x... )
    & g0 c1 w6 ~4 h) c$ |9 U
  50. #define DMA_FN_IN
    8 D* V% @  n. d2 D7 ~2 K( s( _
  51. #define DMA_FN_OUT
    * }% B$ S- `; J7 H; ^* i
  52. #endif
    - }9 X% y' B" D' q

  53. $ y! d  O# x" J1 [
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)5 }+ d2 t3 {( O) \3 C. v+ r" e  x
  55. #define STATIC_SHIFT                3
    3 e9 S, q1 e1 ]* f# o
  56. #define TCINTEN_SHIFT               20
    + B) b' P0 _, \2 t* p8 e8 A
  57. #define ITCINTEN_SHIFT              21
    0 `) J+ C& v1 P' F8 }' T  \
  58. #define TCCHEN_SHIFT                22# B9 {- p7 F/ j  j
  59. #define ITCCHEN_SHIFT               230 L$ ]" H" _6 s) h# o
  60. 9 {; d# U! G0 O  D) ^
  61. static volatile int irqraised1 = 0;
    $ x0 h0 D8 I, V) L" G
  62. static volatile int irqraised2 = 0;
    / K/ w3 E: a( P+ V
  63. 2 w: t. D4 \5 m7 b: E
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ \! Q/ e' |# y. @9 D
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 |( C1 o2 M- e( s1 E' }
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' n5 O0 w8 k# W) d. }  @; W
  67. : j1 \( o- ]" U( j
  68. dma_addr_t dmaphyssrc1 = 0;
    ; _4 P( _9 X+ d/ v% H
  69. dma_addr_t dmaphyssrc2 = 0;
    3 M. c1 U4 ^3 ]! m) o8 T
  70. dma_addr_t dmaphysdest1 = 0;  z* e7 N" ?% C1 k9 C
  71. dma_addr_t dmaphysdest2 = 0;; v6 o0 D; c- I& V, Q

  72. % [& }& B7 I  `( B4 [6 ?
  73. char *dmabufsrc1 = NULL;
    # l$ c9 @- _- ~5 ~) \' M% K9 K
  74. char *dmabufsrc2 = NULL;' W& l3 ^7 \) H
  75. char *dmabufdest1 = NULL;# h% j; n$ E; N  r# v
  76. char *dmabufdest2 = NULL;' A  x9 I: I+ L8 r5 Y- m
  77. 3 L: _6 O$ @) @1 h
  78. static int acnt = 512;
    ' l% A  z  j; K# R& _' z9 o8 w5 Y
  79. static int bcnt = 8;7 X; N3 M( M* ]7 V# i
  80. static int ccnt = 8;
    " S) A7 ]8 n' ]# r7 e7 U- J) P
  81. * V* i3 a/ C7 n5 W9 n) P0 z5 d
  82. module_param(acnt, int, S_IRUGO);
    7 D( n( O3 g# n# T6 q: C4 J; b
  83. module_param(bcnt, int, S_IRUGO);
    4 A, T% M+ }; I7 q* Z
  84. module_param(ccnt, int, S_IRUGO);
复制代码

2 }; w+ [! w: j- ^2 w! q
4 `( i  Y( |: }4 M& K3 i! k7 X; I. x2 F      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ g; \- j, m0 a+ c. W8 ^9 Q. W+ w$ n
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* `1 H7 l) D' b; E     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 e* G: q$ N0 |( s& C. s/ u( u
% _, j9 D" U* c

( `4 I4 }. ?# x# ^9 s7 J- c' B
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-9 18:53 , Processed in 0.042413 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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