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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ G; y4 S7 v3 C3 J! r) A
  1. [code]EDMA sample test application- x* n* x: ?) b3 U2 ~2 w# f9 v
  2. /*) t6 }4 c% X+ U5 j+ p
  3. * edma_test.c
    # V" o% j6 v" V, M# @& g
  4. *
    - ~% Z0 i  F/ C; i9 X$ O2 z
  5. * brief  EDMA3 Test Application
    / Z3 M! Y7 U2 o$ d+ O% `
  6. *
    ( s/ W9 A+ h. z% x4 B
  7. *   This file contains EDMA3 Test code.& s" P; p, y' h! ]* \
  8. *& H# {: t, C) Y5 p
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 r( M0 B, G2 d: X
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 D- C+ ^; Y$ Z0 B
  11. *         TO CHANGE.  f% W9 F  `2 z! L; m' _4 P# n
  12. *6 K3 A7 L7 X4 Q# u; ~3 E8 I. `
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! f" E( c. a9 W' w% }( s% u
  14. *2 z% E2 l) `# y+ d
  15. * This program is free software; you can redistribute it and/or9 S6 f% d& [& d7 }6 z8 R
  16. * modify it under the terms of the GNU General Public License as
    - Y: Z: s; o9 B+ Q  T; n
  17. * published by the Free Software Foundation version 2.
      W4 S& a1 p+ S) `8 d
  18. *, r( t* T& I3 @8 A; Q; T+ n5 G
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ Z7 G; q8 N: B
  20. * kind, whether express or implied; without even the implied warranty8 s" ]) C% W! m) o" C' d% r, G9 v0 w+ G
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 N, M$ i9 ]* R
  22. * GNU General Public License for more details.
    9 y) j- A* H/ X( k& b6 z  R2 ?
  23. */2 F! T5 h" Z' r
  24. 1 i$ |6 u' G5 i/ {, w4 F
  25. #include <linux/module.h>
    3 @: s8 @6 |& E  I. l9 q
  26. #include <linux/init.h>
    ; u. _- F4 ~# U8 B  W
  27. #include <linux/errno.h>. V" d$ x, {) |/ t) v6 l
  28. #include <linux/types.h>
    , p& s  @; F9 C) r
  29. #include <linux/interrupt.h>% w6 u, R% {/ _. r7 U4 N" {
  30. #include <asm/io.h>% ]: Z+ O* C/ D+ \' \6 E
  31. #include <linux/moduleparam.h>- [8 S6 T  p( y2 z( c' z6 G" F
  32. #include <linux/sysctl.h>& J/ V. k6 F1 {% [8 n. I
  33. #include <linux/mm.h>
    - w3 C* |2 J1 P# ?: z$ V& ?
  34. #include <linux/dma-mapping.h>
    ( K- g) I& I+ z+ K! g( d

  35. $ Q( f/ r0 z2 x( O) Y
  36. #include <mach/memory.h>
    ! U0 f. i6 D0 w' k
  37. #include <mach/hardware.h>
    8 p+ K/ [# x* I
  38. #include <mach/irqs.h>, S: D, y6 O: y% ?
  39. #include <asm/hardware/edma.h>) ^" b2 i! W- L* q+ |" u6 k: @' ?0 n/ a
  40. # L* m9 t% m3 i5 z) I
  41. #undef EDMA3_DEBUG
    $ w- ?. [0 {( B( p1 j1 b
  42. /*#define EDMA3_DEBUG*/
    1 z- d" I. a" d7 r

  43. 8 A8 U3 }3 b2 A2 T- P# k9 B( d
  44. #ifdef EDMA3_DEBUG
    ) z& t) ^5 u7 ~8 }; i: i
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    5 ~$ M7 H' n( G6 z2 S
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    . A+ d7 w1 u4 v7 t! y. R* q; H
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 C) \2 w) e: p' }3 o' _
  48. #else
    + g; ^" G5 ~, i+ Z4 r# G
  49. #define DMA_PRINTK( x... )
    3 C& F' a2 I$ z! b  v' i6 t; t
  50. #define DMA_FN_IN
    6 [* B! X* {: r. a- G
  51. #define DMA_FN_OUT8 ?, @  d5 @6 p% D0 T# b) L
  52. #endif
    4 ?6 E) r5 e3 {. D: i
  53. 1 N6 W& A4 V% B' G0 Q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): k) g2 P% P7 I3 y5 r
  55. #define STATIC_SHIFT                3
    2 O3 _5 B; k' l  |. ^9 q- V
  56. #define TCINTEN_SHIFT               206 Q& n' d' y2 E) A. v
  57. #define ITCINTEN_SHIFT              21  Z; i8 w( Q# E9 ?3 [! Z
  58. #define TCCHEN_SHIFT                22
    9 x. H( [4 Q3 ?7 ]
  59. #define ITCCHEN_SHIFT               230 M# J  n7 @9 `1 D

  60. $ c, s; g' O* J0 P* }; R- N% O
  61. static volatile int irqraised1 = 0;* z$ N, M( J7 f- p
  62. static volatile int irqraised2 = 0;) n  x5 k6 b& v

  63. ' {) c; y7 j' J# c
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 H9 ~4 a5 ~. r$ Z- x- s2 v
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 W" S. o, A2 A! A& E3 h0 e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 I* m  T9 ]' q4 ~- P6 ^" j1 ]
  67. * r$ H* C2 j. r) O& P; S8 [5 v
  68. dma_addr_t dmaphyssrc1 = 0;
    . z) W! w6 ?- v, A! W% v2 @# K3 S
  69. dma_addr_t dmaphyssrc2 = 0;5 [& W% G3 y1 w6 a
  70. dma_addr_t dmaphysdest1 = 0;: a4 T* y5 v- O# |2 P. m5 O0 n, O
  71. dma_addr_t dmaphysdest2 = 0;1 \- K7 K+ Z  q1 i5 M3 h2 c: F; R
  72. 7 H  T& P" M& `1 x! }( }
  73. char *dmabufsrc1 = NULL;
    & J6 X! z7 y+ n$ f
  74. char *dmabufsrc2 = NULL;7 A" _/ X8 G% E+ J: N) L
  75. char *dmabufdest1 = NULL;# P- s7 O0 Q2 s7 e
  76. char *dmabufdest2 = NULL;
    . r- _  ]  w9 M- r# B; }

  77.   M, r+ r7 w: O: }# I
  78. static int acnt = 512;3 Z! Q) t9 ^! R) Q7 `3 V0 x6 A" W( |
  79. static int bcnt = 8;
    ( H9 c; |! B( d: O$ j# l7 ]! h" B
  80. static int ccnt = 8;8 y3 h1 A6 b* k

  81. $ e! ~7 R" P4 e  D- P6 {
  82. module_param(acnt, int, S_IRUGO);
    , ~6 m( N4 {' P" O# j* _1 g
  83. module_param(bcnt, int, S_IRUGO);) N7 [$ L0 u2 L8 l) f, @
  84. module_param(ccnt, int, S_IRUGO);
复制代码
' R7 A" |2 c  d# r- d% O
- G4 n' h5 L. M5 k  O
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 J4 P% L3 J( M0 h1 {0 q1 p0 iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 y: A/ D& s5 N# C# ]     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' t9 [: P/ s  h3 r& w

( G* t) q0 b2 f  J% ]6 e( d
& c+ \/ L* P: X
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-2 10:30 , Processed in 0.053682 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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