OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" m  a6 p0 k* |- c; v& a+ S; ?
  1. [code]EDMA sample test application
    ! o) E) O' n. \* d" J
  2. /*
    + s3 f" z; G/ z, E
  3. * edma_test.c5 r# L- H9 S8 M- k
  4. *
    8 e- U* \, J$ e: ]) J2 [5 _
  5. * brief  EDMA3 Test Application# A7 j" p) @4 J7 T6 c8 j& g
  6. *. J0 v. A" ], t  P* h* `
  7. *   This file contains EDMA3 Test code.
    ; c$ V# J( E% h: A, e
  8. *
    / C- c# M! e* I3 b' ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / K+ _0 v7 R7 s
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    * b; x6 S$ P9 d; _
  11. *         TO CHANGE.* M  p* M- P, [
  12. *
    7 m8 |, s+ d% J) k) Z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 B, w, v6 t2 I6 a- X1 T; a
  14. *" S8 i1 \( {8 t& [' _6 j
  15. * This program is free software; you can redistribute it and/or4 _4 Y- L3 B0 z, B! p5 h5 N$ R0 b
  16. * modify it under the terms of the GNU General Public License as
    ; j' s3 {+ o) Q! ]7 b# Z3 v
  17. * published by the Free Software Foundation version 2.8 R6 H: g% ~0 z& e8 J5 Z
  18. ** b& f- r' ]% J' z* s
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ R6 a" i) d1 @, [) I
  20. * kind, whether express or implied; without even the implied warranty( f: i1 H7 R8 i/ s* Y8 X9 Q0 _, B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the( k% c% I% }& f0 X
  22. * GNU General Public License for more details.
    6 X$ h1 ]: p+ t' y2 j; u; {
  23. *// {- @1 p  d  Z' b; r& C7 I9 \' A! \

  24. - n' h! _! L* D5 o
  25. #include <linux/module.h>
    ( s* ~+ }5 W9 Y0 V9 E+ F
  26. #include <linux/init.h>
    0 p4 h' a+ ~. _& q! _% l/ V
  27. #include <linux/errno.h>
    3 n. _* ^5 e+ k) K1 k. }) f
  28. #include <linux/types.h>
    / \" [6 K$ q9 J5 Y" x* f" c: |4 j
  29. #include <linux/interrupt.h>
    , _) q7 S3 Z. w8 M/ ^1 I0 ^8 |  K
  30. #include <asm/io.h>! X1 }9 ^* n7 }* |1 a" D
  31. #include <linux/moduleparam.h>
    8 g0 I4 G, \! J
  32. #include <linux/sysctl.h>
    1 L$ Z3 s& Y) h
  33. #include <linux/mm.h>2 A7 k: D% D. s- j- v( `6 U$ w
  34. #include <linux/dma-mapping.h>
    ( d% {, N' {, E9 x" A" G- Y

  35. 3 T, w- p( \/ ?  ~. `
  36. #include <mach/memory.h>, G& K* E' u; D2 S* l0 ~
  37. #include <mach/hardware.h>) m3 ^3 J9 L7 `+ d
  38. #include <mach/irqs.h>4 `  z1 x$ \1 X) e! q5 ^! q
  39. #include <asm/hardware/edma.h>. M$ s2 g, j1 b* e1 X
  40. ' I7 H+ }4 ^; \& L3 b" S
  41. #undef EDMA3_DEBUG, g, A0 r/ q7 ]* Z
  42. /*#define EDMA3_DEBUG*/9 g5 K9 d$ q! {
  43. # ^, N! Q) q7 o. F9 l7 d
  44. #ifdef EDMA3_DEBUG
    + ~9 \- r3 n9 D5 X' n
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 `, {& X; }, E, ~8 w  o& p7 O
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# D+ q9 j2 i% t3 |0 m2 U7 z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    : h* i0 ]9 n8 s, j1 z) o
  48. #else" @' K! W7 V7 R: v. Z/ K
  49. #define DMA_PRINTK( x... )
    * y0 I+ v. ?0 U  M
  50. #define DMA_FN_IN
    ; }6 b# G2 n. X' Q; w$ P, N7 |/ G: l) z9 O- Z
  51. #define DMA_FN_OUT7 J; [& I- S' k" x
  52. #endif
    : `; R" h0 _! a
  53. ( a+ S5 x' H. h% n( Q- R: [* @
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): {$ G# K5 P3 f1 {4 |9 w7 x
  55. #define STATIC_SHIFT                31 A& U2 Q0 D8 H' h: K) t' R
  56. #define TCINTEN_SHIFT               204 ]) ^  n. V% I+ T
  57. #define ITCINTEN_SHIFT              21
    # v6 E; R# S( `7 B$ z) Q
  58. #define TCCHEN_SHIFT                22+ ^1 @4 t5 L+ C  X$ ~) B1 W! s; C2 `
  59. #define ITCCHEN_SHIFT               233 E) v1 ^) }6 T- W% ?$ ?
  60. ' X7 d9 x* {% T$ U* t1 B  ?) S
  61. static volatile int irqraised1 = 0;
    . k  H2 ^0 n( M" S
  62. static volatile int irqraised2 = 0;$ o  a! Y- Z) r" S
  63. 7 G- ^; B5 ?1 C- ?, n1 g4 V' d
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # g# b9 ~% i: w0 R/ v" M: h
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 H+ ?6 B3 |% D' N* T, O3 e: O# ~
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 O% p3 ]# R2 W  K
  67. 0 e. x5 y! X  y$ [* l
  68. dma_addr_t dmaphyssrc1 = 0;8 P6 S+ I5 B9 d) D+ \
  69. dma_addr_t dmaphyssrc2 = 0;
    % Y/ a- D2 ^8 [+ X, ~( ]
  70. dma_addr_t dmaphysdest1 = 0;
    ! Z$ @7 ^$ G* e! [
  71. dma_addr_t dmaphysdest2 = 0;7 Q% R. h8 y+ C, B" }, u
  72. ; C- s; r4 C- W+ g9 {1 j  o
  73. char *dmabufsrc1 = NULL;
    : s: z& U; L3 M( L; [% l
  74. char *dmabufsrc2 = NULL;$ b7 V+ Y/ F$ J! j! {8 b! \
  75. char *dmabufdest1 = NULL;
    5 I. N) f6 p' g
  76. char *dmabufdest2 = NULL;
    6 n( _( j$ K4 C  s) B/ P

  77. . W$ {# T) M- {+ Z. B
  78. static int acnt = 512;
    ; R/ @  {( k+ ~8 Z% a+ w
  79. static int bcnt = 8;
    2 A9 I/ l& X; h, u# _% q
  80. static int ccnt = 8;( D" n5 W& s: i" v& ^

  81. 3 Z2 {: _6 _4 ?2 f3 G$ w2 p4 [
  82. module_param(acnt, int, S_IRUGO);
    % c  l2 D; m' [* k
  83. module_param(bcnt, int, S_IRUGO);
    5 S+ T  I9 o; t2 y9 d8 Z6 C
  84. module_param(ccnt, int, S_IRUGO);
复制代码
' f* H2 H/ z& F$ `: a! G

& l& q$ e( s  B. @1 B/ u. g      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* K% W( v: W- H. Q% 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' d! A; g: O) c  p! f+ t4 W
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 H7 [2 R; ?8 A3 a/ d1 p
# p4 b# G# w# [1 R# \( f2 b: p3 Y. @/ N+ d2 @$ n
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-15 21:24 , Processed in 0.036818 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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