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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * k4 v3 m( B8 R7 D, T! U
  1. [code]EDMA sample test application
    7 B2 z7 u! L: v/ d  B. P
  2. /*
    % m; e$ |6 b  Y, F. Y! p
  3. * edma_test.c, ?6 ?4 Z6 {/ `0 k
  4. *& j; a: |% a% w, c
  5. * brief  EDMA3 Test Application& b4 ]! w) P8 J" T- ?
  6. *
    ( r8 B' y8 [9 V6 E  J5 z, Z/ I
  7. *   This file contains EDMA3 Test code.
      l( Q5 A. D6 E' b# \
  8. *2 ~  [4 U8 u! ~$ A/ u. `3 }
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    3 y8 p! A$ [8 l% z* E) l: U
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 S" B1 E0 S3 g5 M5 n8 S
  11. *         TO CHANGE.* z& O4 c/ c* x+ _  ^7 Y
  12. *
    & M9 J6 j3 U" G8 L6 n+ s
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    9 g7 p# z3 U- j; w* @( ?
  14. *
    $ ]; x8 @0 y6 g! D& s
  15. * This program is free software; you can redistribute it and/or: c, F# e) F& u  ]" d3 p9 o% I! [
  16. * modify it under the terms of the GNU General Public License as2 M& T; e2 M$ ~1 z
  17. * published by the Free Software Foundation version 2.
    0 Z9 M% j: R' k5 M9 Y
  18. *! A# h( [$ m0 ~4 o/ H# e
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    % t6 l0 \- E4 ?- ^3 f
  20. * kind, whether express or implied; without even the implied warranty
    # P* ?/ Q5 ~: X" L6 Z; I/ W* x9 M- K
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) {  m1 ~/ U# `7 ^3 ]
  22. * GNU General Public License for more details.
    ( i: g) N! b4 a& D4 q- M
  23. */
    % _( j* V: x) Z* y6 |: j

  24. 8 x5 O0 I- o' L' ]4 Z
  25. #include <linux/module.h>3 \  h9 c4 t! @$ L; `/ f& D1 s
  26. #include <linux/init.h>1 D( O2 u5 [- N# |4 j
  27. #include <linux/errno.h>/ y- L+ L7 ]2 f% y
  28. #include <linux/types.h>
    ) @1 `$ I8 o" b$ m
  29. #include <linux/interrupt.h>
    - L( o, M+ h" f/ I& j) s
  30. #include <asm/io.h>) Y5 A% r. t/ Z
  31. #include <linux/moduleparam.h>  }- s2 f9 {0 q0 M6 U
  32. #include <linux/sysctl.h>9 E8 b# i/ y" J7 ?' d
  33. #include <linux/mm.h>
    1 D$ w' N7 b' ]+ B8 |* E+ i
  34. #include <linux/dma-mapping.h>
    9 L* |3 s2 o- B( \! e

  35. & n* u- u( K" l: L: v5 t$ E
  36. #include <mach/memory.h>: [" @" f3 @( E
  37. #include <mach/hardware.h>+ j; N8 ]& e7 `& p- x7 `
  38. #include <mach/irqs.h>
    9 c% m  M& f8 u
  39. #include <asm/hardware/edma.h>
    * G, O. L. v' L, Z: W" Y: q
  40. 4 k$ ]' o- r% w/ D( E
  41. #undef EDMA3_DEBUG
    4 _# J* b8 \0 {" B% ]. M
  42. /*#define EDMA3_DEBUG*/& ^1 d# Q# ^# x! e! W
  43. , l6 {/ q: F# e% m8 |) j2 v
  44. #ifdef EDMA3_DEBUG
    3 |: o: ~9 E2 F+ A
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 o7 N" Y9 O6 v8 E4 h9 d8 e
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), C! r: T2 \, W* D' E; u* M
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# s4 b/ e) O# @( g; c9 w
  48. #else
      [$ Q( M4 u" @# U, }7 r4 }0 x$ c2 v
  49. #define DMA_PRINTK( x... )
    ; U- z9 E1 u( l- Q& E( u8 M8 B
  50. #define DMA_FN_IN
    8 T7 C& R5 O3 j# B
  51. #define DMA_FN_OUT" g2 `1 r0 ~' o' Q4 B+ W$ c% ^$ K
  52. #endif3 q6 [! A( U. A- I; I
  53. # g( R- m: {( C* Z- S
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    * ~% @( b; N6 S, H/ G4 W: I
  55. #define STATIC_SHIFT                3. K# a/ @4 v  @4 N1 [! b
  56. #define TCINTEN_SHIFT               207 j+ c: o; |8 V7 @
  57. #define ITCINTEN_SHIFT              217 @+ x) I& t: f7 U* ^/ ?
  58. #define TCCHEN_SHIFT                225 ]# I8 p1 }) V. ?
  59. #define ITCCHEN_SHIFT               231 U7 O0 x$ i4 x6 v0 |7 v% [7 _* u; K* t5 y

  60. 6 B) c* }! f* |1 M# g" w
  61. static volatile int irqraised1 = 0;. g5 G1 n2 [) J9 G
  62. static volatile int irqraised2 = 0;
    4 i2 S1 l" b4 D4 }" R: }  {1 P

  63. + X! m0 e1 |& N7 Q% f6 [* `* s1 N
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 J4 s$ `. D1 O- w0 h5 ~
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 T$ {/ Z! e( s/ w! X
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& `% [* H! {+ ^0 H3 g
  67. 4 s$ h& U5 O0 f% N+ s2 c
  68. dma_addr_t dmaphyssrc1 = 0;0 ?1 E0 d0 p$ S- Q0 h9 [
  69. dma_addr_t dmaphyssrc2 = 0;
    " m6 Z+ o8 G- k0 C6 l
  70. dma_addr_t dmaphysdest1 = 0;
    4 T# U8 v1 h" `. {
  71. dma_addr_t dmaphysdest2 = 0;2 u, p2 n6 T" ]$ w+ y9 V

  72. ( ]1 L4 S1 y! \- c4 ^$ f: Z9 i+ `
  73. char *dmabufsrc1 = NULL;* L8 h& n2 O1 Q- p
  74. char *dmabufsrc2 = NULL;7 Y0 K$ m& ^& D$ \
  75. char *dmabufdest1 = NULL;) C% `7 T1 O7 L9 n+ D7 a" ~
  76. char *dmabufdest2 = NULL;
    . L+ w; Q8 Z  I
  77. % e- U7 x6 u2 {& {2 V- H
  78. static int acnt = 512;1 k. `. T+ q! z+ z) ^
  79. static int bcnt = 8;
    4 G& a  @. |# i2 E
  80. static int ccnt = 8;3 k; j) A+ x, z7 G7 t1 V
  81. + E3 h' v: L7 q$ J4 x1 T# ?
  82. module_param(acnt, int, S_IRUGO);
    & C" I7 c9 n6 S1 q
  83. module_param(bcnt, int, S_IRUGO);1 x- o) o# b* V# t7 ?% ?3 m
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 Q! }( |6 d6 n2 d2 H5 _/ v% S; o! I/ D
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! ^4 G& ~5 a. t* Karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 l6 T' j' ?0 M. p# T1 m     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% E# ^; u/ k& U, Q: H% t
- e3 C% L% P+ [4 I5 ?8 }
. V3 }, G2 y! ?! r6 N
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-30 02:31 , Processed in 0.039496 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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