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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 X4 i# f6 ?' n% n$ L2 w" a
  1. [code]EDMA sample test application4 {: F; X& e( V! L1 L- W0 I( t
  2. /*
    % h, @" E  E1 Q2 @5 Q
  3. * edma_test.c, z9 m* J8 D6 j$ B( z0 v
  4. *
    ! I+ K' u6 A& C8 y
  5. * brief  EDMA3 Test Application5 Z6 z  i6 H0 Z/ j! r- S
  6. *
    & K! o8 U- r/ q' ]3 ]$ Y" D' {
  7. *   This file contains EDMA3 Test code.
    2 n5 d- L+ h/ K, `# q4 \& u
  8. *
    & |6 j! _# }+ i9 A4 b$ G- X- j( S
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ l+ M/ d( \7 O9 b: D, B6 t3 Z# [
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 z4 a9 @" M* \- O
  11. *         TO CHANGE.
    ! `2 y9 R7 O$ t/ [* v5 w, m) d
  12. *
    * `+ [! }( S* K% J1 C- }
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 x' X* D4 _1 p# e+ f3 [: N
  14. *8 g$ p& e7 i2 H  ]: V% Z6 g
  15. * This program is free software; you can redistribute it and/or
    # b3 W$ {/ a% U( a9 l0 l2 F
  16. * modify it under the terms of the GNU General Public License as
    / w' {: O) b* g% @2 y
  17. * published by the Free Software Foundation version 2., C% f$ O, |" _# I
  18. *
    0 d. }" v, O  t% Q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    5 r+ s, [/ F. ]4 W7 a0 Y
  20. * kind, whether express or implied; without even the implied warranty" _! s7 }- H* v0 q  m
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the( V; I4 U( ^' h
  22. * GNU General Public License for more details.
    + D6 V  \/ z( R( ]2 J0 K, d
  23. */; U$ m& X0 j0 ~1 B8 I  ^6 J, N  _/ ^
  24. 1 b; A7 g6 a  I8 P$ L" A  n
  25. #include <linux/module.h>
    5 _* m# y3 P! D  B, ]
  26. #include <linux/init.h>
    + T0 F: e) s/ }' a
  27. #include <linux/errno.h>
    6 G7 w6 m& r/ n5 n! v- c" J
  28. #include <linux/types.h>
    ! Z- P# Q9 e& T$ b
  29. #include <linux/interrupt.h>
    / ]) V* @, x2 y1 a" @0 R
  30. #include <asm/io.h>% [2 C0 K* Q9 k
  31. #include <linux/moduleparam.h>
    + `; r5 n% ^8 U2 c& [
  32. #include <linux/sysctl.h>
    6 e, [. [* g$ A; G0 q
  33. #include <linux/mm.h>
    2 r* X% ^, J8 D0 [, @9 g2 K
  34. #include <linux/dma-mapping.h>
    # B$ t" B# R1 U) W& L7 L# V/ D2 X

  35. ; U$ D' b$ Q+ K! t* p. O) T% z
  36. #include <mach/memory.h>
    & U- y. d( A+ }" Q: e9 W" U$ V7 s
  37. #include <mach/hardware.h>' b2 v8 a. J0 q4 B# f; h
  38. #include <mach/irqs.h>
    , N  c+ Y, R* u  I/ Z
  39. #include <asm/hardware/edma.h>
    # p  b" h/ X6 K9 B; k" Y
  40. 2 i2 P8 ~1 B- k7 ?0 @
  41. #undef EDMA3_DEBUG$ }. e9 T# [8 t7 d7 c1 D4 |
  42. /*#define EDMA3_DEBUG*/5 B# W# K/ C4 {; S$ c
  43. , M- @, U. {4 f5 _
  44. #ifdef EDMA3_DEBUG
    % B& v5 T* \( m% T; B5 f1 y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 x$ L1 e6 I0 q! s: L* ^/ T
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 v/ T0 f1 V+ T) m! K# r
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) g+ Z  y, d# J" \" ?. R8 w
  48. #else( O! C( k. y6 X+ X
  49. #define DMA_PRINTK( x... )2 U$ T- b' ?3 I' O
  50. #define DMA_FN_IN( N7 S3 E5 q4 k
  51. #define DMA_FN_OUT& ~7 ~$ k' x& }* T5 S1 y: T) A
  52. #endif
    / t1 I% N7 C! B, C  ~! p4 T1 J

  53. ( k1 G3 J' T4 `5 S) J: R, W
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
      j$ z' {5 z. D2 q
  55. #define STATIC_SHIFT                3
    2 \2 b  H6 m, x/ ^0 T/ Y+ J9 ^) A
  56. #define TCINTEN_SHIFT               20
    9 i5 k+ [3 \2 j5 B* r
  57. #define ITCINTEN_SHIFT              21- b/ i) o) W2 s/ ~: U
  58. #define TCCHEN_SHIFT                22
    . U. h- P1 {- C2 t3 I
  59. #define ITCCHEN_SHIFT               23
    . f: z' @3 Q" f" x7 y* Z* t
  60. / i# @+ U2 G8 Q" O- w$ n
  61. static volatile int irqraised1 = 0;6 I" k( c3 B' D/ u' P1 r' _
  62. static volatile int irqraised2 = 0;
    7 h$ Y4 r) @- p: E8 u5 Q  f
  63. % o9 ]  a% m; P
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% |  ~9 b4 _% d
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* I8 {" n& B! R6 ?! {& S9 S
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ _, S* v: r0 ^& X

  67. ! Z* v0 w+ G( s0 \
  68. dma_addr_t dmaphyssrc1 = 0;
    $ f  H( k( d; M3 i
  69. dma_addr_t dmaphyssrc2 = 0;
    5 p. X- c& i. |: n
  70. dma_addr_t dmaphysdest1 = 0;
    ! N7 K( L; h8 a4 I4 c6 @, t6 _. x
  71. dma_addr_t dmaphysdest2 = 0;
    8 M7 C. F$ S3 x3 U0 T: N
  72. / z) s. O! @& ?& s
  73. char *dmabufsrc1 = NULL;
    0 K# e% `3 Z( P  f, z) Y, P
  74. char *dmabufsrc2 = NULL;# C4 Z, l0 u* ^8 \
  75. char *dmabufdest1 = NULL;
    7 H! u. H% F7 B& f* R$ {5 E' _4 _
  76. char *dmabufdest2 = NULL;6 i- v  K& x; {$ z$ j- [- ]" A

  77. ' ~/ ?% T$ o' m1 p; E( T
  78. static int acnt = 512;; x" z) O- T8 \
  79. static int bcnt = 8;: H! a5 y& |% u% y3 z
  80. static int ccnt = 8;
      [: a" B. m9 x  O) N

  81.   Z- X! K+ v8 A$ V1 u
  82. module_param(acnt, int, S_IRUGO);
    3 Q, \% u( R( |+ F
  83. module_param(bcnt, int, S_IRUGO);4 g  W' S3 Q' w, B* e
  84. module_param(ccnt, int, S_IRUGO);
复制代码
8 C9 o* }: m0 N- ]
. F5 R+ N0 M( g  o
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 i) R$ r2 y5 f/ Z5 D" Y1 P, O/ d
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 g6 Q9 [" `4 l% v1 d- a: E: q* W2 ]2 M
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。  R+ }& I" E! ~) x0 ^* E
, k5 v  _! z  x

: J1 R- h7 d; y8 a
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-26 13:46 , Processed in 0.038296 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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