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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ k5 |, `' p2 d# X/ \) e; j( {5 ?. f
  1. [code]EDMA sample test application
    ' }- e. @$ `8 @# R7 M
  2. /*
    4 k) \" K$ R2 F4 h1 M$ I
  3. * edma_test.c2 K; W( d+ U! Q
  4. *
    # A. a8 j) m* e3 X2 |
  5. * brief  EDMA3 Test Application  z% U" A2 ^3 k6 r3 q8 K
  6. *# C6 [) s' ?* h" C0 {2 L- k
  7. *   This file contains EDMA3 Test code.
    ! R  O% ^7 t( z: n4 A( Q4 F# B
  8. *
    # @! ^$ ^5 L4 b# P( i& W' l
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% V2 Q& ]6 c- |# r( _5 F
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    % C3 C6 e: S; [0 h1 P: T
  11. *         TO CHANGE.
    $ |' R; y- `, j, I& ?
  12. *
    * h1 m0 @# {: [3 z8 j- u# `$ P2 U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 K& h' E; {* {
  14. *7 w9 Z  O3 X1 A) A. S; m
  15. * This program is free software; you can redistribute it and/or
    " N* t& n7 I$ V) ?# Y& y& m
  16. * modify it under the terms of the GNU General Public License as* L* R+ r) G$ u, e' x- f) S
  17. * published by the Free Software Foundation version 2.' M0 z+ T: R, P$ R& B3 Q
  18. *& l6 O# c$ E! Y; i: t4 n
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    6 z$ G! ^6 H4 Z2 w: j
  20. * kind, whether express or implied; without even the implied warranty
    ; z: j3 `# R. `
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) }! ?. f* j" j3 V+ Y$ N7 m/ |3 |
  22. * GNU General Public License for more details.: @: I$ ^4 M6 T% Z: c5 k
  23. */8 t& b% [; d5 R7 M

  24. 4 \( c% I2 v1 V3 |. s0 [' I9 b
  25. #include <linux/module.h>
    - G2 M) R& |6 }2 j0 T6 j$ |
  26. #include <linux/init.h>* ^6 y1 v9 ?3 o) {* B9 l
  27. #include <linux/errno.h>
    7 H( Z4 r. i  t3 b
  28. #include <linux/types.h>. t1 l1 K; k0 c4 K4 U' x/ }
  29. #include <linux/interrupt.h>) D( |5 O: E: [- s5 w3 ^2 p+ p( U% o
  30. #include <asm/io.h>9 ?& N: `6 R, R$ }
  31. #include <linux/moduleparam.h>/ Y$ t% J' U" T' H9 @& L" m& ^
  32. #include <linux/sysctl.h>
    6 V# p9 }) A& F
  33. #include <linux/mm.h>
    4 b  n$ V2 }5 f
  34. #include <linux/dma-mapping.h>3 ^9 t4 e! }/ ~

  35. ; N/ g5 |+ g- c
  36. #include <mach/memory.h>
    . Y$ T( S# d. @7 R# ^
  37. #include <mach/hardware.h>
    % O8 L' k8 {2 ~- U4 W9 M% h3 e
  38. #include <mach/irqs.h>& z6 k0 e0 N( Q# G, F
  39. #include <asm/hardware/edma.h>7 N2 b- _9 F% }1 F

  40. * r( v1 ^1 y2 F( {1 B9 ?" r
  41. #undef EDMA3_DEBUG/ h2 c+ B0 V9 R5 Y2 N
  42. /*#define EDMA3_DEBUG*// Y( r& K+ q; ?) F, Q
  43. 6 U( Q( D  b2 s
  44. #ifdef EDMA3_DEBUG
    3 e# a) n9 ]( l! ~# a
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" N3 o7 v2 {8 J9 _# o
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    + H1 }. c3 z" C( D  R
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) s1 B' A, r( B0 ^0 u  k9 i5 I
  48. #else
    ' q8 v/ B/ L, N# t0 [- N2 Y
  49. #define DMA_PRINTK( x... )
    8 a  t6 u1 I) M! Q
  50. #define DMA_FN_IN1 G) K7 _. W& V6 Q' B. e& @* i
  51. #define DMA_FN_OUT
    . d3 t% `. x) z3 Q7 i# n
  52. #endif8 j2 A/ u2 H- m( a, r# b
  53. 9 ^* j; \4 Q  }8 l( y6 I& y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)5 `& f% O, W& k- i1 s$ p  r
  55. #define STATIC_SHIFT                3
    % I8 K: [/ ~0 y- S+ L- {
  56. #define TCINTEN_SHIFT               20  m$ B* r, ]2 a. A
  57. #define ITCINTEN_SHIFT              21
    ( Y" {& f4 w5 K" u6 h
  58. #define TCCHEN_SHIFT                221 \1 a! J) A* r' I
  59. #define ITCCHEN_SHIFT               235 W9 g4 `3 m* q

  60. + N0 l* Q# C5 @/ Q" F0 l
  61. static volatile int irqraised1 = 0;
    8 U* V7 |" |" y: c& u
  62. static volatile int irqraised2 = 0;
    ) E3 j- H5 t6 d. `, k

  63. ) e1 [; y# L* T. M
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 n8 B. S4 \: \0 I
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - b9 i4 w5 l( _: w3 k6 F
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 z; n* @) M/ I8 B! p5 j) x. E

  67. % t( a) i3 S' U/ }
  68. dma_addr_t dmaphyssrc1 = 0;' g; b/ m( K- ^0 y4 m- g
  69. dma_addr_t dmaphyssrc2 = 0;
    - x5 n9 Y& t/ {" ?* l
  70. dma_addr_t dmaphysdest1 = 0;
    - T- {7 Q2 d2 u- Y& P; P! k% X
  71. dma_addr_t dmaphysdest2 = 0;
    , t6 Z/ [* U2 h& g* S
  72. 1 a' y: s1 d1 h# k5 i6 r: p
  73. char *dmabufsrc1 = NULL;7 B8 C7 O9 F, x
  74. char *dmabufsrc2 = NULL;$ q& n" y5 H. F) G6 m3 k% }
  75. char *dmabufdest1 = NULL;: H) v, @* @4 v* ~! d- x3 V4 P! K9 q) u
  76. char *dmabufdest2 = NULL;: Y5 m- }( C+ |7 g; H& P- j
  77. ( g6 a2 s# {  u& s; {* u
  78. static int acnt = 512;* |+ g' k+ y4 n% `
  79. static int bcnt = 8;1 l" _6 y- ^( R6 C/ s
  80. static int ccnt = 8;
    4 ~& e$ ?  S+ S/ {" `4 U; R2 t

  81. 4 \2 S' }1 Q9 }/ G
  82. module_param(acnt, int, S_IRUGO);
    - F6 u4 }' y5 i9 f* W4 N& `
  83. module_param(bcnt, int, S_IRUGO);- ?& q1 Z( \8 @- l& j' l  d
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: `& s$ R) W/ x2 J. y1 L
4 m: _# `: N3 P! k4 `      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( y1 V* M9 Y; c- J5 Q- Zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! _* D5 t+ ]# L% s3 d2 u     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 ^  w, {  P- @5 A( }/ |1 E
3 [! c1 B7 h1 u) G: Z9 S% [; k

1 b: m% N5 T! G% b% L6 d! s
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-11 20:12 , Processed in 0.038107 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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