OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ L' }6 b0 T: F8 H* l
  1. [code]EDMA sample test application# t1 `6 e& a8 T% f" u
  2. /*
    ) X' N7 x2 \# ?( k
  3. * edma_test.c; L' M) b4 A5 d* m: @' s% O
  4. *
    ; ~' ?; F' J7 Q. J/ w4 _" M7 @
  5. * brief  EDMA3 Test Application# Z, A4 i. b; Y9 N. z$ }" U- J- W
  6. *
    * V. g  B. o7 u+ s: C/ `# C9 j1 G
  7. *   This file contains EDMA3 Test code.
    % l2 k% b, j* Y# g. p  J% q
  8. *
    : i9 s0 L- E/ W7 U- `/ S+ E% h
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ; k0 ~# D: g! ]& V- q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
      I( O! S2 B( V; {$ x% W9 M4 s0 O- P
  11. *         TO CHANGE., i6 k* \2 K4 L8 p2 p9 q4 X7 E
  12. *5 b! f% m* M4 f. B0 R) \
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      }" H6 z; k1 U! [7 Y7 }" t
  14. *5 R& }# _4 t" J
  15. * This program is free software; you can redistribute it and/or: }9 n/ w3 H. l$ y: n5 h' S
  16. * modify it under the terms of the GNU General Public License as( u1 {: y0 k! T6 J/ R
  17. * published by the Free Software Foundation version 2.  A' D) l* h# }( g9 v0 W. M
  18. *+ Z  Y/ o( i+ A! [4 r. g/ I6 n$ _
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    * P! }( P9 U3 Q. v! F" I
  20. * kind, whether express or implied; without even the implied warranty3 Y1 ~) Q3 c! L" B' s
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the; u  v4 j' C2 d# _
  22. * GNU General Public License for more details.2 r1 f8 H6 G, @, k# w  J' S/ P
  23. */: @+ e/ c( f( n6 e4 l1 s

  24. & L& @, M- X; e$ k6 Y" j* L2 h: N
  25. #include <linux/module.h>5 u! v+ `' P4 f
  26. #include <linux/init.h>& a0 @( U3 r) c1 C/ \3 @
  27. #include <linux/errno.h>4 F  ~: d9 n" Y" q8 t& {0 C
  28. #include <linux/types.h>5 R3 }# f' Q( g) W( w
  29. #include <linux/interrupt.h>' w) W4 ~- C+ A7 {; ?# |( p
  30. #include <asm/io.h>
    4 r$ U1 h: M5 [+ }
  31. #include <linux/moduleparam.h>+ ]( @. R8 ]# ^# s4 v, L. t( |
  32. #include <linux/sysctl.h>
    - ]8 _- m2 g1 A
  33. #include <linux/mm.h>* t, L; d, z/ [
  34. #include <linux/dma-mapping.h>- n5 M  j6 t$ m3 Z7 o  g4 e

  35. # \7 H8 ~1 C% R6 R: s
  36. #include <mach/memory.h>) J" e8 |1 J3 l
  37. #include <mach/hardware.h>
      y) _' Z' A% L- W& `
  38. #include <mach/irqs.h>( K9 ]6 ?( o, K* t, O6 U
  39. #include <asm/hardware/edma.h>
    3 ]# ~7 B! {* p! W3 P/ I

  40. $ F* H) q; L! r+ L2 o/ D1 g
  41. #undef EDMA3_DEBUG
    ! x9 |& N! [: Z. z4 |
  42. /*#define EDMA3_DEBUG*/9 @1 h+ y! F  a6 Y  [
  43. 5 g& a, n6 E9 E
  44. #ifdef EDMA3_DEBUG- a1 F" n9 H- ]% b; n
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    * S& B- B# N9 r+ E* f: ]) `
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 q5 ]+ f) [5 `$ U! V
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    . @% J9 V! {5 O: A* Y; m! \
  48. #else
    5 {; N" N$ r  b" a1 k3 R. P
  49. #define DMA_PRINTK( x... )6 \7 E, m% @( L/ L
  50. #define DMA_FN_IN' U" F* A% S$ K; r
  51. #define DMA_FN_OUT9 g* t& X5 z; K" @( R
  52. #endif
    $ I2 Z, d: F+ w
  53. : B+ m( f! o+ o- r
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)' ^6 _! v. x* Y' n/ e* a5 A
  55. #define STATIC_SHIFT                3* [! s  ~; I* T5 ~
  56. #define TCINTEN_SHIFT               209 v2 r. i% [& A0 E% j
  57. #define ITCINTEN_SHIFT              21
    2 [( {; L* G1 m- l1 {
  58. #define TCCHEN_SHIFT                229 h# j% C- F6 F& }) l& F
  59. #define ITCCHEN_SHIFT               23$ f' _! i- g$ g
  60. ; ?: w' f; j, A/ [9 o
  61. static volatile int irqraised1 = 0;
    1 }7 S& Q' A' e. Q. T$ g
  62. static volatile int irqraised2 = 0;" o/ R$ \" j: b( H7 S" B  R

  63. / v+ m) `% d5 J& t. Y' I, `- Y3 C& ?
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; A8 [5 N- ]. y: G! v" m- S5 c
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % ]+ @1 a& j7 N/ Z5 J- W7 B
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 W2 L5 ?; L) s% X
  67. 2 q+ R& e9 B$ q6 B* y+ T* I
  68. dma_addr_t dmaphyssrc1 = 0;
    % j3 ^. _1 ~/ B7 N- |
  69. dma_addr_t dmaphyssrc2 = 0;
    - |  H, v  J6 _1 N5 ^& W) t
  70. dma_addr_t dmaphysdest1 = 0;
    1 {1 Y7 D/ L- g# ?! U
  71. dma_addr_t dmaphysdest2 = 0;* p6 k0 a' }) g0 N6 Z( n
  72. " S! Z( r0 I2 K
  73. char *dmabufsrc1 = NULL;
    + [1 J5 C, e9 U: c
  74. char *dmabufsrc2 = NULL;3 ?# P" s# P7 F  f
  75. char *dmabufdest1 = NULL;
    - l4 u6 |* Y" w! }8 _) `
  76. char *dmabufdest2 = NULL;! g' n  z+ R2 C# C& ?
  77. 6 j/ ^' j$ H8 ?& V2 J( w: o6 q
  78. static int acnt = 512;  S& q9 K" n0 E) N$ @
  79. static int bcnt = 8;
      O  R' p1 k; y* s7 e% B
  80. static int ccnt = 8;9 E/ d6 C, e* i) v) M9 Q3 I6 H
  81. $ Y, `7 b5 D3 r% M" ?4 \$ n/ q# r
  82. module_param(acnt, int, S_IRUGO);
    6 ~# h3 w6 |0 p5 V1 i5 Q! z
  83. module_param(bcnt, int, S_IRUGO);
    $ a4 G, V# y/ C: ?$ m" i9 Z  D
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 z( g0 Z3 {& U7 W2 C( m; U3 q# c3 t! m8 b) o
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; d* |4 f& |; D" H$ s0 F& I! darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- I7 _' z8 R% x: n     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 S# T5 l- {8 t% `% `9 q- b
( H. p6 V0 N7 G- Z5 o! ], U% L+ n9 T" Z/ d/ ~/ K% S
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-28 01:44 , Processed in 0.039171 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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