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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % o; E  h' w6 F" ^% w
  1. [code]EDMA sample test application7 t5 u; T/ B. C0 |4 z* h6 ~- Q+ F
  2. /*
    : }, A- r$ o: M( j4 p3 @5 J( }! U
  3. * edma_test.c
    ' }' j6 d+ e; Q# z; ?  [
  4. *
    : U. s' u% h0 L0 m' z2 n1 l
  5. * brief  EDMA3 Test Application
    2 _; a! S$ ]0 t  S
  6. *
    8 B. |. ?2 P: _9 N  u# c
  7. *   This file contains EDMA3 Test code.
    * Z8 ~& B" A* o, i8 ]$ t
  8. *7 q' T0 G3 ?$ M1 d. A( v
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- c1 P; _  ^! r2 ?  K/ e
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( \3 D; O& j* l+ ]+ d; G
  11. *         TO CHANGE.
    4 l) S0 ]$ \# z" D" _! ^+ @7 w
  12. *8 g; `3 K" B6 Y$ o$ a% w1 @
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    & a! w# e1 i( T) C! c
  14. *
    1 W  M, p+ T: |9 R4 }. D7 }9 [
  15. * This program is free software; you can redistribute it and/or) D8 A: f0 P5 g) d, i( C0 r
  16. * modify it under the terms of the GNU General Public License as
    4 m# J/ o; x  ^( q  E9 r5 b& O+ S
  17. * published by the Free Software Foundation version 2./ S3 u" b. R% q/ D$ m5 M# H' ~
  18. *+ c  Q  X9 S: N4 f/ k* \2 ^8 F; `
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
      L- ^9 C. r5 t+ ^7 _2 G" ~
  20. * kind, whether express or implied; without even the implied warranty9 _) q8 j1 C9 ^6 ?$ ?: m9 m# }. H6 z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the0 g& _) `# ?2 p% {$ _3 a* _, r
  22. * GNU General Public License for more details.
    - _/ H7 C- ]+ U  O* h
  23. */5 J5 y, A' p7 _* e7 R4 n5 v- W

  24. 9 Y0 A( _# w- [9 |- c- j3 z' ~
  25. #include <linux/module.h>/ h" O3 ?) |+ S9 W1 b6 b
  26. #include <linux/init.h>
    7 E# }6 A2 D& m9 i/ m2 Q1 l5 a
  27. #include <linux/errno.h>
    $ T" x# @* t7 L* \! Z) a! D( L
  28. #include <linux/types.h>
    ' G: P. R+ T# V$ @
  29. #include <linux/interrupt.h>
    2 M; Q$ w4 r7 Y8 |3 x  S
  30. #include <asm/io.h>* s" M, }) j- m, ?
  31. #include <linux/moduleparam.h>, s7 ]/ G# d% s+ t* p9 o/ B
  32. #include <linux/sysctl.h>
    $ D0 Q; \& a) _1 v$ C
  33. #include <linux/mm.h>8 j: a! q. A8 C
  34. #include <linux/dma-mapping.h>% [- ^" j2 z% y! s3 g0 |- J2 _
  35. 0 G9 g, `, l! T3 P1 F8 r
  36. #include <mach/memory.h>& z% F. ^# h! i( v5 E, i: Z2 `
  37. #include <mach/hardware.h>
    ( |, t7 g- d  K' X4 q, ~* w1 i
  38. #include <mach/irqs.h>
      J) p4 _* n, T5 x
  39. #include <asm/hardware/edma.h>: {7 `# C+ e0 i" L$ P
  40. + H8 m8 A; C6 Z5 @
  41. #undef EDMA3_DEBUG
    2 C8 {, |) |3 x0 g
  42. /*#define EDMA3_DEBUG*/
    : H& q0 p* _. C7 u# g

  43. # B8 J, [  m& Q, S8 P/ {5 y7 o
  44. #ifdef EDMA3_DEBUG" B( D- q! j( g! @" G8 u+ y. V- F, v- ^
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    : ?, H7 v5 H3 C; x: M6 X% G/ a) T
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- U, t- u6 c6 F9 t5 r* z+ g
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    2 t  C: d# ]3 ?/ U; ^
  48. #else) x/ s% h- c! V: z
  49. #define DMA_PRINTK( x... )
    2 B7 k8 `1 V4 s: N/ W, z
  50. #define DMA_FN_IN
    6 ^: d3 B' ?$ @/ H0 A" O: S" T
  51. #define DMA_FN_OUT
    ( _* y! r& P2 J& i( C5 N: x: @
  52. #endif3 m2 \; s, J8 z: ~

  53. # g* s, @$ x: s& c
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    1 C  y* G' m1 n8 i6 T1 q, i
  55. #define STATIC_SHIFT                33 l1 y5 w& d9 a  g; _: J* i
  56. #define TCINTEN_SHIFT               20
    * ]8 ?1 C( i* n$ R' e; A: I* m6 j/ o
  57. #define ITCINTEN_SHIFT              21
    + a( F! ?8 z0 N# N
  58. #define TCCHEN_SHIFT                222 X0 k: z4 k4 ^2 S4 h( o% ?0 m
  59. #define ITCCHEN_SHIFT               23
    0 ?, z/ J2 j) X; L6 V

  60. $ j, f( S7 L; M# H2 G- E) L
  61. static volatile int irqraised1 = 0;
    4 E2 G, v. `3 {; F
  62. static volatile int irqraised2 = 0;
    1 m; a  i2 K) {; C9 q- w! e

  63. ' W( g, ]/ L2 y$ d5 v3 L, s
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      ]- ?6 W% z$ S$ W/ F: X" [
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ a9 A: m$ c% ]. a. a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& ^9 {! ]& G+ c  i; ?# c" H3 u

  67. 4 F3 X, x$ R1 w  p3 l/ U$ v
  68. dma_addr_t dmaphyssrc1 = 0;* r) ?- P( L) O# @
  69. dma_addr_t dmaphyssrc2 = 0;
    - m. h" U% C9 W
  70. dma_addr_t dmaphysdest1 = 0;
    : Z" M7 f- b6 B+ `: c1 {; M6 B
  71. dma_addr_t dmaphysdest2 = 0;
    / B0 V4 v. m9 Z: A* N3 h3 S
  72. 6 w6 _4 p# B& q
  73. char *dmabufsrc1 = NULL;
    ; z( ^, \+ o* ^
  74. char *dmabufsrc2 = NULL;7 C2 D1 x! p' u# Z8 S
  75. char *dmabufdest1 = NULL;
    7 d7 _; E( e$ [! w/ ~: y( ^# k
  76. char *dmabufdest2 = NULL;. L$ x; V4 m4 y6 [4 {1 j3 M
  77. 8 h. J6 |9 k/ y+ F/ w
  78. static int acnt = 512;
    + Z& {2 N& G" O3 A4 P! {7 Q" l
  79. static int bcnt = 8;) T# r+ t# w4 Q5 M. q
  80. static int ccnt = 8;& n9 j5 d  }- a. M% {

  81. , D/ n. V0 b: Z- ^  I  i8 O8 A
  82. module_param(acnt, int, S_IRUGO);4 q- X9 h( T9 v$ Y* ~
  83. module_param(bcnt, int, S_IRUGO);3 z  Z: t) H- I. J1 e6 h
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 _! ?" R$ q( y4 X  v7 {9 t

2 W2 s' u% d' e7 p( P3 D0 L1 F; M. H      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( J8 G: l" |* T4 p- O+ N
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 Y' c" v  c" r3 q6 e% F$ O     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 S& e; @0 F% D! y0 p, _. z3 p  a4 f
: w9 D. n* r# N0 v9 ~, _
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-4 03:55 , Processed in 0.039296 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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