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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; c) ]0 A5 |9 {6 _
  1. [code]EDMA sample test application
    : @: w% s5 a+ \/ P
  2. /*
    - |. O/ x/ ~4 H- C( G
  3. * edma_test.c9 h6 X$ x6 t- p
  4. *
    0 I+ }. v8 C1 O# o
  5. * brief  EDMA3 Test Application
    6 c7 Q! A1 z5 G( Z! p3 z* l" N
  6. *
    . ~: @6 P6 Z2 |
  7. *   This file contains EDMA3 Test code.
    ! `& r* ?/ X5 [7 R
  8. *# R' u1 G4 a% [& S: Q: A1 x& D5 y! q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      q& U: t6 l$ v% E6 ~6 z3 Q, J
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    8 {& @% t& R. u' }, {4 g- K  J
  11. *         TO CHANGE.
    7 {) I) h8 c- U! v5 J  @
  12. *( W9 b$ |& v! G0 {6 Q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. B' I* i. V8 M+ M3 q1 b+ @
  14. *
    $ r2 P, f- X8 k' B6 N' W/ v' r
  15. * This program is free software; you can redistribute it and/or
    * H/ T7 S7 s& X( l6 \8 m- g
  16. * modify it under the terms of the GNU General Public License as
    ! ^2 E6 J, G$ Y# t/ e& C
  17. * published by the Free Software Foundation version 2.4 l: ]7 e3 B+ p; s  {. z
  18. *: f5 d7 V8 x3 D# S1 d/ a
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    * b. o8 N. @! g: s, O* q7 U6 g
  20. * kind, whether express or implied; without even the implied warranty
    " h# m/ Z1 |* N  ~6 _9 m9 U
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7 w+ X8 Q0 e1 F$ `* C: k0 y& h
  22. * GNU General Public License for more details.
    # ^& E; y0 x# [/ Y# V* V8 N
  23. */0 `5 s- ]" ]5 g4 u) P' O  W
  24. 9 l* G  e& k! k
  25. #include <linux/module.h>
    8 Q  h3 a9 r9 H: h. D
  26. #include <linux/init.h>
    $ V# |# f5 \4 q( \. o( V# {* c
  27. #include <linux/errno.h>
    + D; M4 J+ V9 ]+ S2 w
  28. #include <linux/types.h>2 k4 G9 {' h  Q1 S2 T5 T; q1 y
  29. #include <linux/interrupt.h>
    ! T- s& d3 ]$ t" ^. }) O  }
  30. #include <asm/io.h>
    # i! }3 ~& _) m& q% F. y0 F# t
  31. #include <linux/moduleparam.h>
    ' x& F) p  c4 }/ {5 h, v
  32. #include <linux/sysctl.h>9 E7 e- l$ R8 m8 M8 G$ G1 d( D8 r
  33. #include <linux/mm.h>8 D' V2 \. v( n0 w# E1 D2 F; v
  34. #include <linux/dma-mapping.h>
    # L, ?1 f, a) h2 G
  35. + y5 I! n4 ^6 Z
  36. #include <mach/memory.h>3 F* M/ M' d: v  Q7 G& q
  37. #include <mach/hardware.h>5 d  L5 w5 ~7 H& Q7 C
  38. #include <mach/irqs.h>
    + ^9 R. N/ D2 ^
  39. #include <asm/hardware/edma.h>3 y; |. F! z8 _6 U. o
  40. 5 j2 a! v6 @- s, @8 E& P; p
  41. #undef EDMA3_DEBUG
    % {, ]. O3 o$ u# f
  42. /*#define EDMA3_DEBUG*/8 ^. @/ B( K9 F6 K; ]8 }& W

  43. 7 V! G* o$ K% d$ l4 Q6 ?
  44. #ifdef EDMA3_DEBUG# T  P% h6 r/ r
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ e: n& ?, B  {+ L5 \! }0 f
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 P' ~/ H: T6 g! ~
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). s, `0 F! ^$ J8 o2 x" X
  48. #else, B* @' H$ p6 J3 U* ^
  49. #define DMA_PRINTK( x... )3 _  h- Y3 u4 P) Z# C
  50. #define DMA_FN_IN( ~8 U  S3 L: ~/ ^
  51. #define DMA_FN_OUT# n9 E" k4 R. E# e/ ]
  52. #endif
    9 o" ]8 Z3 d* @( A2 G! s0 g; Q

  53. ! q4 P7 y7 m& ?
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
      {; o; f: _6 F9 Y) a6 U
  55. #define STATIC_SHIFT                3
    $ L9 K& K: H1 ]
  56. #define TCINTEN_SHIFT               20+ P( g" n1 c% K
  57. #define ITCINTEN_SHIFT              21
    4 p! `$ _( O) E; e
  58. #define TCCHEN_SHIFT                22, ?8 n$ @& M$ u, f2 ]# N% H( e
  59. #define ITCCHEN_SHIFT               23
    - C7 P4 f/ u' D8 Q0 J( ~0 ?

  60. 0 h# X  w- E* @' |$ D. b
  61. static volatile int irqraised1 = 0;! P# l; P% `9 F9 }
  62. static volatile int irqraised2 = 0;0 g% ~1 z( k* b% J
  63.   Z8 M% P8 i4 g# r/ p- P* a" ^9 l6 T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " V+ w, \, W5 j  A3 b( X# Q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 M- X; u, I  Z& e! e- y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' [( q; }5 ~* F2 j
  67. , w( f, |5 s! m" a& A
  68. dma_addr_t dmaphyssrc1 = 0;" H, m8 l. [0 O% a0 b" y
  69. dma_addr_t dmaphyssrc2 = 0;
    $ m) L$ S- _0 d. z
  70. dma_addr_t dmaphysdest1 = 0;) R0 E5 u4 Q5 J8 E  ^# @
  71. dma_addr_t dmaphysdest2 = 0;
    : H( x! o2 A1 R: u. y0 s; d- i
  72. 6 I; }, G5 \  n( }. t% |; T
  73. char *dmabufsrc1 = NULL;
    % }3 b6 ?  d2 L% ]$ s7 B6 F$ x
  74. char *dmabufsrc2 = NULL;
    ' J; p7 S& e6 A6 \# T- I
  75. char *dmabufdest1 = NULL;
    # m4 F8 J4 I1 s& O
  76. char *dmabufdest2 = NULL;
    ! W. a  Q2 L# l8 ~8 Q3 n

  77.   e1 r# Z( `& v! l9 a' r; |9 A# u
  78. static int acnt = 512;' C8 I& P0 g* o, n( ?
  79. static int bcnt = 8;4 v$ u7 k% O% P; P9 y
  80. static int ccnt = 8;
    1 L3 X- n% G3 E7 P

  81. - u' d7 O7 d( |3 T0 s
  82. module_param(acnt, int, S_IRUGO);' E4 ]8 r/ m8 i  d1 z! L1 m
  83. module_param(bcnt, int, S_IRUGO);
    5 S$ z+ r' W& Z; d7 A6 k1 d
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 }/ G' d. \: |# {

2 a7 b- z. s8 c. `      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' @9 ^2 l4 T" n: A0 e/ B$ a0 j
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 g* v: ]! t7 v% v% R     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 ]- Q' M+ }0 b+ [4 o

( r1 z, W, T0 C
* ^( |+ `3 X# r  V
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-4 17:20 , Processed in 0.040394 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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