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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ A. F& _6 w* s% b0 g8 F
  1. [code]EDMA sample test application. }. B* h3 c, X+ ]8 z
  2. /*
    ( g1 ~; J+ }& m% r
  3. * edma_test.c+ x' q0 j. _: b3 g
  4. *6 R8 e! O5 A4 }2 o8 F/ C
  5. * brief  EDMA3 Test Application; q3 |' {9 }' A
  6. *
    4 g  ^4 A, _" F" |! f2 I& `- B, [+ t
  7. *   This file contains EDMA3 Test code.: k! q2 j; v4 }
  8. *( I1 F' u  i$ G/ u0 x
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    % o6 d6 Q; r$ ~2 a
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    * I9 w; z- D2 f% }  D$ z- H, X4 y
  11. *         TO CHANGE.
    5 y2 I+ _7 i) ?4 u
  12. *
    4 b- p- ?9 ^5 r% N7 H
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    1 J0 ~; Z6 [# l" i/ ~2 g6 n6 i  D+ i
  14. *
    6 |/ k! Q" Q& B( C" [2 N# {
  15. * This program is free software; you can redistribute it and/or
    / p  P' C) c+ x: t) W3 r, i. S) R& J
  16. * modify it under the terms of the GNU General Public License as
    ) n0 h/ b8 i& E: E2 r- M' {2 H
  17. * published by the Free Software Foundation version 2.
    6 ]; ^: Z- m" U! B
  18. *' ^4 l4 p0 A7 H/ X2 g& M4 I
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
      O8 z6 W) f5 w9 O( o
  20. * kind, whether express or implied; without even the implied warranty
    3 F! m! \" y* D+ V" ?
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ; |$ [9 r4 B9 c0 v8 j9 h
  22. * GNU General Public License for more details.
    - ^3 L! J6 `7 E$ Z  c0 q
  23. */
    4 Z. y8 F' r5 `; J9 R

  24. + ^+ g7 K$ @* X6 m4 h
  25. #include <linux/module.h>0 A3 g2 [4 r0 n% e7 r) n
  26. #include <linux/init.h>$ ~! @# V3 r3 f9 b) \" E/ T1 C
  27. #include <linux/errno.h>
    $ F+ }5 W& ]% V' h3 T7 @
  28. #include <linux/types.h>
    0 {% z/ _( @, W; k* _* f0 v- x' `
  29. #include <linux/interrupt.h>
    ' p. b* \% j4 e8 R  B- ]0 W$ P6 ?0 o
  30. #include <asm/io.h>  c& a1 x8 R# b2 B5 w9 |& i
  31. #include <linux/moduleparam.h>% L$ b  U4 N! A; e
  32. #include <linux/sysctl.h>
    8 `2 n6 B* T- |' f% s$ i
  33. #include <linux/mm.h>2 N/ g4 g8 G8 u; B5 d7 Q$ {
  34. #include <linux/dma-mapping.h>
    3 c/ `4 |. B; M

  35. ! c# U! m5 b  F/ n
  36. #include <mach/memory.h>8 a, L" N4 F% _4 z6 q7 }3 r
  37. #include <mach/hardware.h>( g$ ?: H; n6 r2 _' Z6 |
  38. #include <mach/irqs.h>  G2 z! M" R  Q2 s7 z# n
  39. #include <asm/hardware/edma.h>  z9 e( ~# P' b7 p+ {
  40. " _8 i6 g! s8 O
  41. #undef EDMA3_DEBUG
    8 m8 B* n- N3 _/ [! L& t% z" y
  42. /*#define EDMA3_DEBUG*/
    0 F0 a# q8 W4 g' }% b
  43. 7 U3 q# d+ w3 i
  44. #ifdef EDMA3_DEBUG# y/ `- G" ]. R" P
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    % o/ m. ^' U+ o! y& N- s
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    1 L, u) R3 [( u# q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* F, g  q; m, \3 E, {' Y
  48. #else1 f  I  \: j7 b; l% g: g
  49. #define DMA_PRINTK( x... )
    7 s+ q) N: C/ D3 x
  50. #define DMA_FN_IN
    & x8 u7 w1 g" p! v! `& C) r
  51. #define DMA_FN_OUT
    8 ~; e7 e( ~6 h
  52. #endif; {; j% c4 Q) K

  53. 9 D) a7 |& U( @  j
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    4 q, {# k' x5 W- a
  55. #define STATIC_SHIFT                3
    2 p0 D9 k; g+ p; c3 c9 {( f3 d+ X
  56. #define TCINTEN_SHIFT               20
    7 r2 J& v+ m# H+ @8 D# \
  57. #define ITCINTEN_SHIFT              21
    $ U, ~7 O9 n6 |0 g! }, H; h
  58. #define TCCHEN_SHIFT                22
    ) Y5 u8 u$ }7 \8 i. t' {
  59. #define ITCCHEN_SHIFT               23
    : D9 d8 X* c; m- R3 b- A  D  K
  60. ) z5 P6 S+ o0 p9 \- R7 U4 |8 C
  61. static volatile int irqraised1 = 0;- M) b, l3 o% A& S
  62. static volatile int irqraised2 = 0;
    - P* }' `8 K% v7 w/ G# S# K* R( _

  63. 7 G4 M5 p' ]% o, Y1 m) e+ q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 {1 q  L1 v5 C4 y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 x5 r: N( S' j' Z2 U$ \
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# B9 d, K- ~' M4 F9 x- B+ W( P" W

  67. 1 [; _) I+ N2 Z3 s. B1 _/ q3 L4 Z
  68. dma_addr_t dmaphyssrc1 = 0;1 k1 [* [- y8 G9 _! e9 ?5 L
  69. dma_addr_t dmaphyssrc2 = 0;& h/ g" |& Z( h  O
  70. dma_addr_t dmaphysdest1 = 0;: U. g# c# v3 v: @
  71. dma_addr_t dmaphysdest2 = 0;
    * f% q* K! C& \8 l. X. F4 G8 P
  72. : N* {9 Y, G1 p. S$ n5 p
  73. char *dmabufsrc1 = NULL;6 A+ q- }$ r9 O  T! E2 X! ]
  74. char *dmabufsrc2 = NULL;
    4 p" T# _$ x# N
  75. char *dmabufdest1 = NULL;* ?& C: \5 t! d" E& I) T9 m/ y
  76. char *dmabufdest2 = NULL;7 J9 q% {( T$ y* q- N" _+ T; L* Y

  77.   Y8 s1 v+ p4 M  L
  78. static int acnt = 512;
    5 S; n) t7 ^% C9 A. N& E- }
  79. static int bcnt = 8;7 h) t7 @8 Z3 e$ O
  80. static int ccnt = 8;
    + E! K/ Z# d, s( C7 m) c

  81. 6 u0 V# X" a% N1 \$ P
  82. module_param(acnt, int, S_IRUGO);# r8 U8 N* W9 L+ q/ }
  83. module_param(bcnt, int, S_IRUGO);
    4 y1 S6 I& ]- ]$ j9 H4 o1 [
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ H5 u% k' Z4 P. z# Z+ v! P, Y, \2 D# ?
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( M& P. p. k1 T: E! v2 H9 m  W, 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ O0 H) n: k6 Q4 L6 G$ V     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, p, f. W+ p/ s  Q; Y' V! ]& ?% V: e, `+ }, {7 m- c
% ~2 Y% K1 }8 W- G# `8 y5 E6 z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-21 17:43 , Processed in 0.041294 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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