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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* _" Z) O0 J0 J& p' d
  1. [code]EDMA sample test application
    ) M  e* f" E" S0 l. U2 {
  2. /*% y; m. V! p3 L) P
  3. * edma_test.c
    * t) N! ]' B; N
  4. *
    % j) c( i! O" _6 [7 I
  5. * brief  EDMA3 Test Application
    ; q# C, m7 u9 Y; M
  6. *
    7 f; k9 o* H7 J- \
  7. *   This file contains EDMA3 Test code.. U: U6 j4 r% }/ q
  8. *
    2 f1 [6 h- I. V+ ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ u3 R  M& v# a# a
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# B" O; q; b5 j7 I  {, _6 d
  11. *         TO CHANGE.
    : r% E4 o# O- l& P3 e
  12. *
    8 t$ h$ X9 V1 n: N3 J8 q$ v' X
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 @) o2 _& C3 \' X/ V! h
  14. *
    7 g; e) |9 o4 c. K* K  z5 x# M" N
  15. * This program is free software; you can redistribute it and/or; A0 H; p5 C2 [! K% d* e' E7 P7 M/ ]
  16. * modify it under the terms of the GNU General Public License as
    3 c+ ^. E8 x- P* }
  17. * published by the Free Software Foundation version 2.
    / [! t/ {' {# V! `7 y9 |
  18. *
    # q+ L( n4 H. F# S' ^, @7 E9 z' |
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any" _/ E1 V, Q9 A( o" q  o% b
  20. * kind, whether express or implied; without even the implied warranty3 l3 m5 Y" _+ D: K6 O! O1 q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ( {& P7 f0 p/ S6 M. e' n
  22. * GNU General Public License for more details.
    6 X% v0 @$ X' X) h) o' o
  23. */# R8 O. c& T* T# ^" |5 X

  24. . R. E3 n3 k* a* A0 ~+ F9 U# `3 i
  25. #include <linux/module.h>
    4 x3 r1 [9 W- L
  26. #include <linux/init.h>1 ^% R* e% y2 v
  27. #include <linux/errno.h>
    2 c0 ~: \; J( p0 n0 I+ N9 _
  28. #include <linux/types.h>! ^& X4 y2 ^6 l# y) i' E" c$ w7 P
  29. #include <linux/interrupt.h>
    . l' q2 c3 ^& ]
  30. #include <asm/io.h>
    $ P8 V. L3 |6 S3 U2 t
  31. #include <linux/moduleparam.h>
    $ m% L2 N; ?3 U& C2 [" `2 `8 ]
  32. #include <linux/sysctl.h>
    $ T7 @$ M9 `2 k
  33. #include <linux/mm.h>
    $ T4 M1 z+ Y, D! c% @, P
  34. #include <linux/dma-mapping.h>  k3 h+ M( @  m) G. K; i  P

  35. 4 b, W3 v8 i! W5 B
  36. #include <mach/memory.h>- Z) r0 \3 \) t: E
  37. #include <mach/hardware.h>
    3 u: p$ ~! f9 e2 A
  38. #include <mach/irqs.h>: [/ c1 Q$ S  M- V1 z
  39. #include <asm/hardware/edma.h># Z$ [# I+ y9 R! m
  40. + Q1 y7 M. A. P* {% M1 l- f: i& \/ ^
  41. #undef EDMA3_DEBUG
    ( q0 D# }0 s) j& A3 n+ I
  42. /*#define EDMA3_DEBUG*/# A( y* U& `% ^& B- j( k
  43. 0 _5 {5 m  _9 K) `$ e2 A- W
  44. #ifdef EDMA3_DEBUG' K: |5 E* u% [2 i+ {; }( C. E3 o
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ p- \, V4 n( T$ o% E. \4 S
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & e" z# C9 x- w6 F
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ a1 {8 r9 u( ?! v) i' q
  48. #else
    $ ?$ h0 \' o% }/ h& K$ H
  49. #define DMA_PRINTK( x... )
    ( h; l* k6 T) H% B% M( h0 _
  50. #define DMA_FN_IN  X8 ~+ e* J2 U3 ]% K
  51. #define DMA_FN_OUT: M% ~3 X* O! s$ q4 Q
  52. #endif
    8 M9 C! T6 m& ]" _( K+ [* P
  53. : T3 l: D% ]2 K  |
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 b5 v' A. f" B4 I
  55. #define STATIC_SHIFT                31 d, ^* q5 W# x) ~# k- I
  56. #define TCINTEN_SHIFT               20
    8 M3 {5 A8 f& U$ |
  57. #define ITCINTEN_SHIFT              21% M) w# B: W2 o) o
  58. #define TCCHEN_SHIFT                22
    # S" l5 o9 u2 H( B4 @0 V6 Y
  59. #define ITCCHEN_SHIFT               237 H4 ^: w$ t+ m3 h6 H( m
  60. 3 F) }# R+ l' |, q0 n+ G" a( \
  61. static volatile int irqraised1 = 0;5 R6 s0 O" @: x5 g# f: P/ t* s3 u8 h
  62. static volatile int irqraised2 = 0;' e- s# q3 F. X  x0 f

  63. 1 z" A0 P- _& t7 P. d
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + p: o7 Y% Z- V% Z  _! X2 A3 f* h
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" R4 |% j5 f0 k& ^% l. A1 }# A' D
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! A( }) G. T2 Z: Q- w  P- X8 r

  67. : D& w! _$ D( I9 k. _( w- r
  68. dma_addr_t dmaphyssrc1 = 0;  Y- \  ]; ~! f3 D5 R) D
  69. dma_addr_t dmaphyssrc2 = 0;6 r* V0 x: L0 a% T
  70. dma_addr_t dmaphysdest1 = 0;
    * l, |2 d: L4 d7 L' T; j+ d
  71. dma_addr_t dmaphysdest2 = 0;
    ( y& f( D, _; s
  72. % f* b8 Q2 z: w4 [% b; `: C
  73. char *dmabufsrc1 = NULL;
    ! J; h" E4 g) y8 h
  74. char *dmabufsrc2 = NULL;
    0 C7 x5 w! r% c2 j. i0 r, R
  75. char *dmabufdest1 = NULL;
    ) ^+ L. i- ~" ]$ B
  76. char *dmabufdest2 = NULL;# x9 C; k) a( N, A
  77. , k- e' E( C4 ?7 K
  78. static int acnt = 512;4 I/ S- n  p+ c1 C' G
  79. static int bcnt = 8;
    ; o/ J  [" u4 U$ V4 G' D
  80. static int ccnt = 8;/ Y% _5 I' T2 c( _5 F
  81. 5 f5 V0 k# ^( E, C( s( f
  82. module_param(acnt, int, S_IRUGO);1 ^7 K. {% ?0 J5 F7 z5 }5 V( Z) j
  83. module_param(bcnt, int, S_IRUGO);
    7 T' K  I( Q3 `
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; X- U' ^0 ?" S' Y* W7 E7 D% ~

( V( l: I  G8 V- G; U  k" z  n      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. T/ U9 O! I; t% s6 ^+ w  s5 v
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& o( P6 S. i2 o, q5 E; K     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ k6 m* U. p3 F
9 Y3 B- F" l; m, |+ G( Y7 s

! i7 j2 M+ X( ]+ V0 G
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-5 21:45 , Processed in 0.038969 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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