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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 J" b' x8 ^9 I5 z) Y/ h
  1. [code]EDMA sample test application2 a# w1 ?+ q& i( I$ r! G
  2. /*
    ' o, M8 }1 o9 v8 ?
  3. * edma_test.c
    % l: T8 R) `) P7 }
  4. *
    0 ]6 z& W9 z0 a; J6 z1 D
  5. * brief  EDMA3 Test Application
    6 L. Z* T2 u8 B
  6. *
    # X+ m1 b: H6 m
  7. *   This file contains EDMA3 Test code.8 r; W4 M; t# f2 S& ~3 P' Q
  8. *
    8 }) c+ q( U  ?+ o( F2 y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    : m( b& s% R& u/ t5 a
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ J6 ~! r0 R! n# R+ Q5 a; q1 r* q# U
  11. *         TO CHANGE.! i0 B9 g- B, h# G
  12. *7 i/ d, T$ O' B8 Z8 g' Z( T
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " t7 g+ G4 {7 E0 f6 h( h! e9 u
  14. *
      e' Z: G, u* o" R
  15. * This program is free software; you can redistribute it and/or5 H6 P: e7 ~- t4 F4 Z0 ^8 t) n" z
  16. * modify it under the terms of the GNU General Public License as
    6 i8 n- V$ q5 f: S$ x: X; t
  17. * published by the Free Software Foundation version 2.
    9 S( I! y4 G9 R7 O0 u) v6 D5 O
  18. *
    9 \8 w! ]/ L8 C, e, w* e. `0 \
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ' F1 L$ [2 O- {9 `- s
  20. * kind, whether express or implied; without even the implied warranty. w9 a  O+ U5 g& I( T6 y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5 o0 V, Y0 o& o8 g' g9 L( V
  22. * GNU General Public License for more details.' f& z; y6 P, K0 h
  23. */% z% r( X$ u! L
  24. # R* z& n+ H4 f6 W  v! j
  25. #include <linux/module.h>
    5 w6 i9 }6 o9 K6 w
  26. #include <linux/init.h>3 H$ [# p+ ]3 t1 N, V* \
  27. #include <linux/errno.h>
    . l0 ?% Z5 j2 u3 T4 i  m% S
  28. #include <linux/types.h>
    0 I* P5 A$ w, I7 T$ w% ?3 h
  29. #include <linux/interrupt.h>
    ; f% t  F5 G  S1 Y2 t7 w( ]; B' x% C
  30. #include <asm/io.h>5 R2 ?: A* K' }# e9 f  ^
  31. #include <linux/moduleparam.h>0 P! f3 a, `6 k' _6 t* Z
  32. #include <linux/sysctl.h>
    : a( r, o' z) I
  33. #include <linux/mm.h>
    , }  x: @4 y' J+ V
  34. #include <linux/dma-mapping.h>3 \$ p7 t5 Z" W) v$ V+ P: h* h1 q) ^

  35. 2 S% I' q5 \* `+ O/ e6 D
  36. #include <mach/memory.h>, F- W- u" F: P; v9 p
  37. #include <mach/hardware.h>
    : p9 H, I. Q/ j9 ^( e; r
  38. #include <mach/irqs.h>* ]* a/ r2 i' H3 U. u
  39. #include <asm/hardware/edma.h>; o/ y2 `. p, i$ h7 ~

  40. . K2 l9 @, f% O
  41. #undef EDMA3_DEBUG/ K! q# \' s* Q' m8 c- V& K
  42. /*#define EDMA3_DEBUG*/
    ' g: t+ Z5 v+ `2 G; C
  43. " `; a* z3 y- m) R) p' t! S
  44. #ifdef EDMA3_DEBUG9 Z3 w1 d5 b4 f) Z' O
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! t/ l5 ]6 X: a0 T. l
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ) E4 G1 z* @( w7 P
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - [# k! e" U# T! g3 j% m
  48. #else
    9 w2 {: d" Y/ i% P6 [3 O4 A! b
  49. #define DMA_PRINTK( x... )+ ?6 @2 ?' A* Y' z  V4 v1 F
  50. #define DMA_FN_IN% E4 z& a8 M( M- N4 K
  51. #define DMA_FN_OUT
    4 {# M3 A0 L8 G' C, h, X1 z
  52. #endif
    ; N% d* P  P1 _
  53. : D7 A" m' y2 f2 f* F& \% `
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    3 |, b( n2 W" h
  55. #define STATIC_SHIFT                3, C+ @: w/ d1 P2 E
  56. #define TCINTEN_SHIFT               20! K, _2 K  D6 Z4 p8 m& X' Y
  57. #define ITCINTEN_SHIFT              219 {' [  G9 b$ p1 M* l
  58. #define TCCHEN_SHIFT                22  m. d% Z; O) B5 Q' D
  59. #define ITCCHEN_SHIFT               23
    , F! k) [1 g; w" C+ j  ^
  60. 9 L/ a/ B+ T4 [$ Y
  61. static volatile int irqraised1 = 0;9 Q1 \1 I, u* s8 ?7 S
  62. static volatile int irqraised2 = 0;
      m7 A2 x# H% F, x. ?: T8 ^
  63. 8 t: ]2 T  e1 D0 ]# b% R
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& c6 n/ d8 O' x$ p1 L
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- r% M. |$ c. [; I! r$ k; o. g2 r
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# |8 L( f( ~  d

  67. ' C, Z0 D3 b: b+ k4 M1 K4 e+ ]/ q
  68. dma_addr_t dmaphyssrc1 = 0;
    & F' i. y0 }/ c+ `: t+ t8 Y
  69. dma_addr_t dmaphyssrc2 = 0;
    2 h$ D/ ]/ g7 y5 B. |) W# O- i% S
  70. dma_addr_t dmaphysdest1 = 0;( D7 E6 F- `% J0 M( A. B+ n2 X
  71. dma_addr_t dmaphysdest2 = 0;
    , G/ J* _$ J" g5 @- d/ Q
  72. 1 ~2 b2 v  c+ t4 \& f1 s  }
  73. char *dmabufsrc1 = NULL;
    - A! K& S2 D! S' a+ U* B
  74. char *dmabufsrc2 = NULL;
    6 K+ E! |% M: d& o* u, ?* G
  75. char *dmabufdest1 = NULL;- \. J7 F0 Y  Z" I! J8 s
  76. char *dmabufdest2 = NULL;
    + }2 D+ @& C3 L

  77. " r& B8 k- U1 j: m4 X
  78. static int acnt = 512;
    # K1 j8 C2 B( A3 G# W
  79. static int bcnt = 8;
    5 x3 z( O* s4 l- G( S
  80. static int ccnt = 8;
    ( |6 Q( g( z4 m' ]( o
  81. 9 R8 r5 V; ]& f
  82. module_param(acnt, int, S_IRUGO);
    & K$ u) c; K8 M, ~9 X' v  r$ b
  83. module_param(bcnt, int, S_IRUGO);/ A' g" S3 @. J" C: V; Z% ~
  84. module_param(ccnt, int, S_IRUGO);
复制代码
" T6 c% f/ V4 ]* ?) D1 c* i- o

; C/ b+ P- Y) d* }0 ~- H2 ]0 H      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 R1 u8 u9 {, W7 \: l) Z  q5 [; x' R0 a
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 R6 n$ u, y6 S0 X1 _! v$ G     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ q, I1 m& S8 G! S' I- ^
- F) e* L: [4 u) D8 x5 J4 w9 @
( x2 Z- {5 m  t- l+ m
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-17 13:12 , Processed in 0.039733 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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